aboutsummaryrefslogtreecommitdiffstats
path: root/bin/send-reports
diff options
context:
space:
mode:
Diffstat (limited to 'bin/send-reports')
-rwxr-xr-xbin/send-reports15
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/send-reports b/bin/send-reports
index eb881d169..17fe225a4 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -38,6 +38,10 @@ use constant SEND_FAIL_RETRIES_CUTOFF => 3;
use constant COUNCIL_ID_BARNET => 2489;
use constant COUNCIL_ID_EAST_HANTS => 2330;
+# FMB aka FixMyBarangay numbers
+use constant FMB_ID_LUZ => 1; # barangay Luz
+use constant FMB_ID_BSN => 2; # barangay Basak San Nicolas
+
use constant MAX_LINE_LENGTH => 132;
# send_method config values found in by-area config data, for selecting to appropriate method
@@ -250,7 +254,7 @@ while (my $row = $unsent->next) {
if (mySociety::Config::get('STAGING_SITE')) {
# on a staging server send emails to ourselves rather than the councils
# ...webservice calls will only go through if explictly allowed here:
- my @testing_councils = (COUNCIL_ID_BARNET);
+ my @testing_councils = (COUNCIL_ID_BARNET, FMB_ID_LUZ, FMB_ID_BSN);
unless (grep {$row->council eq $_} @testing_councils) {
@recips = ( mySociety::Config::get('CONTACT_EMAIL') );
$send_method = 0;
@@ -338,6 +342,11 @@ while (my $row = $unsent->next) {
$row->user->name( $row->user->id . ' ' . $row->user->name );
}
+ if ($cobrand eq 'fixmybarangay') {
+ # FixMyBarangay endpoints expect external_id as an attribute
+ $row->extra( [ { 'name' => 'external_id', 'value' => $row->id } ] );
+ }
+
my $resp = $open311->send_service_request( $row, \%h, $contact->email );
# make sure we don't save user changes from above
@@ -345,6 +354,10 @@ while (my $row = $unsent->next) {
$row->discard_changes();
}
+ if ($cobrand eq 'fixmybarangay') {
+ $row->discard_changes();
+ }
+
if ( $resp ) {
$row->external_id( $resp );
$result *= 0;