diff options
Diffstat (limited to 'perllib/FixMyStreet')
22 files changed, 181 insertions, 87 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index acdaf7c04..198acade6 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -483,6 +483,10 @@ sub search_reports : Path('search_reports') { $query = [ 'me.id' => int($1), ]; + } elsif ($search =~ /^area:(\d+)$/) { + $query = [ + 'me.areas' => { like => "%,$1,%" } + ]; } else { $query = [ 'me.id' => $search_n, @@ -523,6 +527,8 @@ sub search_reports : Path('search_reports') { 'problem.id' => int($1), %{ $site_restriction }, ]; + } elsif ($search =~ /^area:(\d+)$/) { + $query = []; } else { $query = [ 'me.id' => $search_n, @@ -534,18 +540,20 @@ sub search_reports : Path('search_reports') { %{ $site_restriction }, ]; } - my $updates = $c->model('DB::Comment')->search( - { - -or => $query, - }, - { - -select => [ 'me.*', qw/problem.council problem.state/ ], - prefetch => [qw/user problem/], - order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created'] - } - ); - $c->stash->{updates} = [ $updates->all ]; + if (@$query) { + my $updates = $c->model('DB::Comment')->search( + { + -or => $query, + }, + { + -select => [ 'me.*', qw/problem.council problem.state/ ], + prefetch => [qw/user problem/], + order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created'] + } + ); + $c->stash->{updates} = [ $updates->all ]; + } # Switch quoting back off. See above for explanation of this. $c->model('DB')->schema->storage->sql_maker->quote_char( '' ); diff --git a/perllib/FixMyStreet/App/Controller/Photo.pm b/perllib/FixMyStreet/App/Controller/Photo.pm index c54bad238..5d5832b08 100644 --- a/perllib/FixMyStreet/App/Controller/Photo.pm +++ b/perllib/FixMyStreet/App/Controller/Photo.pm @@ -114,6 +114,7 @@ sub _shrink { $image->BlobToImage($photo); my $err = $image->Scale(geometry => "$size>"); throw Error::Simple("resize failed: $err") if "$err"; + $image->Strip(); my @blobs = $image->ImageToBlob(); undef $image; return $blobs[0]; @@ -129,6 +130,7 @@ sub _crop { throw Error::Simple("resize failed: $err") if "$err"; $err = $image->Extent( geometry => '90x60', gravity => 'Center' ); throw Error::Simple("resize failed: $err") if "$err"; + $image->Strip(); my @blobs = $image->ImageToBlob(); undef $image; return $blobs[0]; diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index af4cdd5aa..6d22a0556 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -78,6 +78,8 @@ partial =cut +use constant COUNCIL_ID_BARNET => 2489; + sub report_new : Path : Args(0) { my ( $self, $c ) = @_; @@ -545,9 +547,15 @@ sub setup_categories_and_councils : Private { } elsif ($first_council->{type} eq 'LBO') { $area_ids_to_list{ $first_council->{id} } = 1; + my @local_categories; + if ($first_council->{id} == COUNCIL_ID_BARNET) { + @local_categories = sort(keys %{ Utils::barnet_categories() }); # removed 'Other' option + } else { + @local_categories = sort keys %{ Utils::london_categories() } + } @category_options = ( _('-- Pick a category --'), - sort keys %{ Utils::london_categories() } + @local_categories ); $category_label = _('Category:'); @@ -733,8 +741,15 @@ sub process_report : Private { $councils = join( ',', @{ $c->stash->{area_ids_to_list} } ) || -1; $report->council( $councils ); - } elsif ( $first_council->{type} eq 'LBO') { + } elsif ( $first_council->{id} == COUNCIL_ID_BARNET ) { + unless ( exists Utils::barnet_categories()->{ $report->category } or $report->category eq 'Other') { + $c->stash->{field_errors}->{category} = _('Please choose a category'); + } + $report->council( $first_council->{id} ); + + } elsif ( $first_council->{type} eq 'LBO') { + unless ( Utils::london_categories()->{ $report->category } ) { $c->stash->{field_errors}->{category} = _('Please choose a category'); } diff --git a/perllib/FixMyStreet/DB.pm b/perllib/FixMyStreet/DB.pm index 18c8cc2ca..a1767abe9 100644 --- a/perllib/FixMyStreet/DB.pm +++ b/perllib/FixMyStreet/DB.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB; # Created by DBIx::Class::Schema::Loader @@ -10,8 +11,9 @@ use base 'DBIx::Class::Schema'; __PACKAGE__->load_namespaces; -# Created by DBIx::Class::Schema::Loader v0.07009 @ 2011-03-01 15:43:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tJZ+CpaAfZVPrctDXTZTuQ + +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CjFpUvon7KggFM7OF7VK/w # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/perllib/FixMyStreet/DB/Result/Abuse.pm b/perllib/FixMyStreet/DB/Result/Abuse.pm index b1cf9c1ed..e8e554afa 100644 --- a/perllib/FixMyStreet/DB/Result/Abuse.pm +++ b/perllib/FixMyStreet/DB/Result/Abuse.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Abuse; # Created by DBIx::Class::Schema::Loader @@ -7,15 +8,14 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("abuse"); __PACKAGE__->add_columns("email", { data_type => "text", is_nullable => 0 }); __PACKAGE__->set_primary_key("email"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IuTLiJSDZGLF/WX8q3iKIQ +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PnQhGMx+ktK++3gWOMJBpQ # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/perllib/FixMyStreet/DB/Result/AdminLog.pm b/perllib/FixMyStreet/DB/Result/AdminLog.pm index da97950a0..ede786871 100644 --- a/perllib/FixMyStreet/DB/Result/AdminLog.pm +++ b/perllib/FixMyStreet/DB/Result/AdminLog.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::AdminLog; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("admin_log"); __PACKAGE__->add_columns( @@ -36,8 +36,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7427CuN3/6IL2GxiQDoWUA +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+NlSH8U+beRjBZl8CpqK9A # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Alert.pm b/perllib/FixMyStreet/DB/Result/Alert.pm index eddd98f37..ca9ad45c2 100644 --- a/perllib/FixMyStreet/DB/Result/Alert.pm +++ b/perllib/FixMyStreet/DB/Result/Alert.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Alert; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("alert"); __PACKAGE__->add_columns( @@ -24,6 +24,8 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 1 }, "parameter2", { data_type => "text", is_nullable => 1 }, + "user_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "confirmed", { data_type => "integer", default_value => 0, is_nullable => 0 }, "lang", @@ -40,8 +42,6 @@ __PACKAGE__->add_columns( }, "whendisabled", { data_type => "timestamp", is_nullable => 1 }, - "user_id", - { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to( @@ -50,22 +50,22 @@ __PACKAGE__->belongs_to( { ref => "alert_type" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); +__PACKAGE__->has_many( + "alerts_sent", + "FixMyStreet::DB::Result::AlertSent", + { "foreign.alert_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); __PACKAGE__->belongs_to( "user", "FixMyStreet::DB::Result::User", { id => "user_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); -__PACKAGE__->has_many( - "alert_sents", - "FixMyStreet::DB::Result::AlertSent", - { "foreign.alert_id" => "self.id" }, - { cascade_copy => 0, cascade_delete => 0 }, -); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:d2TrE9UIZdXu3eXYJH0Zmw +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vump36YxUO4FQi5Do6DwvA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/AlertSent.pm b/perllib/FixMyStreet/DB/Result/AlertSent.pm index a901c2fde..a537c95cd 100644 --- a/perllib/FixMyStreet/DB/Result/AlertSent.pm +++ b/perllib/FixMyStreet/DB/Result/AlertSent.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::AlertSent; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("alert_sent"); __PACKAGE__->add_columns( @@ -30,8 +30,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fTiWIoriQUvHpWc9PpFLvA +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oN+36hDWJuc0hqkCW9BHOw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/AlertType.pm b/perllib/FixMyStreet/DB/Result/AlertType.pm index d23a2983d..3aa9677e0 100644 --- a/perllib/FixMyStreet/DB/Result/AlertType.pm +++ b/perllib/FixMyStreet/DB/Result/AlertType.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::AlertType; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("alert_type"); __PACKAGE__->add_columns( @@ -47,8 +47,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+PKqo7IZ4MlM9ur4V2P9tA +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KDBYzNEAM5lPvZjb9cv22g # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 195fe4019..5b45c63a8 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Comment; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("comment"); __PACKAGE__->add_columns( @@ -20,6 +20,10 @@ __PACKAGE__->add_columns( }, "problem_id", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "user_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "anonymous", + { data_type => "boolean", is_nullable => 0 }, "name", { data_type => "text", is_nullable => 1 }, "website", @@ -48,30 +52,26 @@ __PACKAGE__->add_columns( { data_type => "boolean", is_nullable => 0 }, "mark_open", { data_type => "boolean", default_value => \"false", is_nullable => 0 }, - "user_id", - { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, - "anonymous", - { data_type => "boolean", is_nullable => 0 }, "problem_state", { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to( - "user", - "FixMyStreet::DB::Result::User", - { id => "user_id" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); -__PACKAGE__->belongs_to( "problem", "FixMyStreet::DB::Result::Problem", { id => "problem_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); +__PACKAGE__->belongs_to( + "user", + "FixMyStreet::DB::Result::User", + { id => "user_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-27 10:07:32 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ilLn3dlagg5COdpZDmzrVQ +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:E+96vo/AB0zz1jAEPj/OKw use DateTime::TimeZone; use Image::Size; diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm index 941e4e1bb..c32b75d0c 100644 --- a/perllib/FixMyStreet/DB/Result/Contact.pm +++ b/perllib/FixMyStreet/DB/Result/Contact.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Contact; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("contacts"); __PACKAGE__->add_columns( @@ -40,8 +40,9 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); __PACKAGE__->add_unique_constraint("contacts_area_id_category_idx", ["area_id", "category"]); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-08-01 10:07:59 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4y6yRz4rMN66pBpkzfJJhg + +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hyvU0bMWSFxEPAJT7wqM/Q __PACKAGE__->filter_column( extra => { diff --git a/perllib/FixMyStreet/DB/Result/ContactsHistory.pm b/perllib/FixMyStreet/DB/Result/ContactsHistory.pm index 811a06b44..deb00fb95 100644 --- a/perllib/FixMyStreet/DB/Result/ContactsHistory.pm +++ b/perllib/FixMyStreet/DB/Result/ContactsHistory.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::ContactsHistory; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("contacts_history"); __PACKAGE__->add_columns( @@ -40,8 +40,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("contacts_history_id"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9APvBwAOebG5g4MGxJuVKQ +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dN2ueIDoP3d/+Mg1UDqsMw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Open311conf.pm b/perllib/FixMyStreet/DB/Result/Open311conf.pm index 0a5784560..742a12ebd 100644 --- a/perllib/FixMyStreet/DB/Result/Open311conf.pm +++ b/perllib/FixMyStreet/DB/Result/Open311conf.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Open311conf; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("open311conf"); __PACKAGE__->add_columns( @@ -26,13 +26,15 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 1 }, "api_key", { data_type => "text", is_nullable => 1 }, + "send_method", + { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->add_unique_constraint("open311conf_area_id_key", ["area_id"]); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-07-29 18:09:25 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ryqCpvwjNtQrZm4I3s0hxg +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ClYnPB2gsKapnfHuco5d/w # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index ce7488703..192e539bd 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Problem; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("problem"); __PACKAGE__->add_columns( @@ -84,6 +84,14 @@ __PACKAGE__->add_columns( { data_type => "boolean", default_value => \"false", is_nullable => 0 }, "geocode", { data_type => "bytea", is_nullable => 1 }, + "send_fail_count", + { data_type => "integer", default_value => 0, is_nullable => 0 }, + "send_fail_reason", + { data_type => "text", is_nullable => 1 }, + "send_fail_timestamp", + { data_type => "timestamp", is_nullable => 1 }, + "send_method_used", + { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->has_many( @@ -92,22 +100,22 @@ __PACKAGE__->has_many( { "foreign.problem_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); -__PACKAGE__->belongs_to( - "user", - "FixMyStreet::DB::Result::User", - { id => "user_id" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); __PACKAGE__->has_many( "questionnaires", "FixMyStreet::DB::Result::Questionnaire", { "foreign.problem_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); +__PACKAGE__->belongs_to( + "user", + "FixMyStreet::DB::Result::User", + { id => "user_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-09-19 14:38:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nq8Ufn/SEoDGSrrGlHIxag +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-05-03 16:05:20 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EvwI91Ot7SioQWqwnXRTBQ # Add fake relationship to stored procedure table __PACKAGE__->has_one( @@ -562,7 +570,50 @@ sub body { return $body; } +# returns true if the external id is the council's ref, i.e., useful to publish it +# (by way of an example, the barnet send method returns a useful reference when +# it succeeds, so that is the ref we should show on the problem report page). +# Future: this is installation-dependent so maybe should be using the contact +# data to determine if the external id is public on a council-by-council basis. +# Note: this only makes sense when called on a problem that has been sent! +sub can_display_external_id { + my $self = shift; + if ($self->external_id && $self->send_method_used eq 'barnet') { + return 1; + } + return 0; +} + # TODO Some/much of this could be moved to the template + +# either: +# "sent to council 3 mins later" +# "[Council name] ref: XYZ" +# or +# "sent to council 3 mins later, their ref: XYZ" +# +# Note: some silliness with pronouns and the adjacent comma mean this is +# being presented as a single string rather than two +sub processed_summary_string { + my ( $problem, $c ) = @_; + my ($duration_clause, $external_ref_clause); + if ($problem->whensent) { + $duration_clause = $problem->duration_string($c) + } + if ($problem->can_display_external_id) { + if ($duration_clause) { + $external_ref_clause = sprintf(_('their ref: %s'), $problem->external_id); + } else { + $external_ref_clause = sprintf(_('%s ref: %s'), $problem->external_body, $problem->external_id); + } + } + if ($duration_clause and $external_ref_clause) { + return "$duration_clause, $external_ref_clause" + } else { + return $duration_clause || $external_ref_clause + } +} + sub duration_string { my ( $problem, $c ) = @_; my $body = $problem->body( $c ); diff --git a/perllib/FixMyStreet/DB/Result/Questionnaire.pm b/perllib/FixMyStreet/DB/Result/Questionnaire.pm index cc4ec300b..b6791603a 100644 --- a/perllib/FixMyStreet/DB/Result/Questionnaire.pm +++ b/perllib/FixMyStreet/DB/Result/Questionnaire.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Questionnaire; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("questionnaire"); __PACKAGE__->add_columns( @@ -40,8 +40,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QNFqqCg6J4SFlg4zwm7TWw +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NGlSRjoBpDoIvK3EueqN6Q use DateTime::TimeZone; diff --git a/perllib/FixMyStreet/DB/Result/Secret.pm b/perllib/FixMyStreet/DB/Result/Secret.pm index 8a1fa671d..449dfec0e 100644 --- a/perllib/FixMyStreet/DB/Result/Secret.pm +++ b/perllib/FixMyStreet/DB/Result/Secret.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Secret; # Created by DBIx::Class::Schema::Loader @@ -7,14 +8,13 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("secret"); __PACKAGE__->add_columns("secret", { data_type => "text", is_nullable => 0 }); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MfqW1K0aFtwpa/1c/UwHjg +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9XiWSKJ1PD3LSYjrSA3drw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Session.pm b/perllib/FixMyStreet/DB/Result/Session.pm index 9d5d509dc..4713c99eb 100644 --- a/perllib/FixMyStreet/DB/Result/Session.pm +++ b/perllib/FixMyStreet/DB/Result/Session.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Session; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("sessions"); __PACKAGE__->add_columns( @@ -21,8 +21,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TagSQOXnDttkwfJ7oDH8Yw +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MVmCn4gLQWXTDIIaDHiVmA # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/perllib/FixMyStreet/DB/Result/Token.pm b/perllib/FixMyStreet/DB/Result/Token.pm index 3a900858d..b223ada3a 100644 --- a/perllib/FixMyStreet/DB/Result/Token.pm +++ b/perllib/FixMyStreet/DB/Result/Token.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Token; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("token"); __PACKAGE__->add_columns( @@ -27,8 +27,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("scope", "token"); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:frl+na3HrIzGw9D1t891nA +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+LLZ8P5GXqPetuGyrra2vw # Trying not to use this # use mySociety::DBHandle qw(dbh); diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index 56d726a8d..e13d88b88 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::User; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("users"); __PACKAGE__->add_columns( @@ -53,8 +53,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-27 10:25:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9IHuqRTcHZCqJeBAaiQxzw +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tM1LUGrqDeQnF4BDgnYXGQ __PACKAGE__->add_columns( "password" => { diff --git a/perllib/FixMyStreet/Geocode/Bing.pm b/perllib/FixMyStreet/Geocode/Bing.pm index 4ba00dbfe..a24f7c102 100644 --- a/perllib/FixMyStreet/Geocode/Bing.pm +++ b/perllib/FixMyStreet/Geocode/Bing.pm @@ -69,7 +69,14 @@ sub string { ); ( $latitude, $longitude ) = @{ $_->{point}->{coordinates} }; - push (@$error, { address => $address, latitude => $latitude, longitude => $longitude }); + # These co-ordinates are output as query parameters in a URL, make sure they have a "." + mySociety::Locale::in_gb_locale { + push (@$error, { + address => $address, + latitude => sprintf('%0.6f', $latitude), + longitude => sprintf('%0.6f', $longitude) + }); + }; push (@valid_locations, $_); } diff --git a/perllib/FixMyStreet/Geocode/Google.pm b/perllib/FixMyStreet/Geocode/Google.pm index 83b36dbcd..b62c89cda 100644 --- a/perllib/FixMyStreet/Geocode/Google.pm +++ b/perllib/FixMyStreet/Geocode/Google.pm @@ -75,7 +75,13 @@ sub string { my $address = $_->{address}; next unless $c->cobrand->geocoded_string_check( $address ); ( $longitude, $latitude ) = @{ $_->{Point}->{coordinates} }; - push (@$error, { address => $address, latitude => $latitude, longitude => $longitude }); + mySociety::Locale::in_gb_locale { + push (@$error, { + address => $address, + latitude => sprintf('%0.6f', $latitude), + longitude => sprintf('%0.6f', $longitude) + }); + }; push (@valid_locations, $_); } return { latitude => $latitude, longitude => $longitude } if scalar @valid_locations == 1; diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index a8cbc98f2..7daf01f56 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -151,7 +151,7 @@ sub delete_user { ok( $p->delete, "delete problem " . $p->title ); } for my $a ( $user->alerts ) { - $a->alert_sents->delete; + $a->alerts_sent->delete; ok( $a->delete, "delete alert " . $a->alert_type ); } ok( $_->delete, "delete comment " . $_->text ) for $user->comments; |