diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Borsetshire.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 16 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Factories.pm | 8 |
4 files changed, 30 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index a1258ccaa..ec8df4450 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -399,10 +399,13 @@ sub _geocode : Private { sub lookup_by_ref : Private { my ( $self, $c, $ref ) = @_; - my $problems = $c->cobrand->problems->search([ - id => $ref, - external_id => $ref - ]); + my $criteria = $c->cobrand->call_hook("lookup_by_ref", $ref) || + [ + id => $ref, + external_id => $ref + ]; + + my $problems = $c->cobrand->problems->search( $criteria ); my $count = try { $problems->count; diff --git a/perllib/FixMyStreet/Cobrand/Borsetshire.pm b/perllib/FixMyStreet/Cobrand/Borsetshire.pm index d9b018d69..44a4a9162 100644 --- a/perllib/FixMyStreet/Cobrand/Borsetshire.pm +++ b/perllib/FixMyStreet/Cobrand/Borsetshire.pm @@ -31,4 +31,6 @@ sub send_questionnaires { sub bypass_password_checks { 1 } +sub enable_category_groups { 1 } + 1; diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index dafd6e069..4d627c756 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -53,6 +53,22 @@ sub users_can_hide { return 1; } sub default_show_name { 0 } +sub lookup_by_ref_regex { + return qr/^\s*((?:ENQ)?\d+)\s*$/; +} + +sub lookup_by_ref { + my ($self, $ref) = @_; + + if ( $ref =~ /^ENQ/ ) { + my $len = length($ref); + my $filter = "%T18:customer_reference,T$len:$ref,%"; + return { 'extra' => { -like => $filter } }; + } + + return 0; +} + =head2 problem_response_days Returns the number of working days that are expected to elapse diff --git a/perllib/FixMyStreet/DB/Factories.pm b/perllib/FixMyStreet/DB/Factories.pm index db80773e7..b66b27c5d 100644 --- a/perllib/FixMyStreet/DB/Factories.pm +++ b/perllib/FixMyStreet/DB/Factories.pm @@ -212,7 +212,7 @@ sub key_field { 'id' } package FixMyStreet::DB::Factory::Contact; -use parent "DBIx::Class::Factory"; +use parent -norequire, "FixMyStreet::DB::Factory::Base"; __PACKAGE__->resultset(FixMyStreet::DB->resultset("Contact")); @@ -224,8 +224,8 @@ __PACKAGE__->fields({ category => 'Other', email => __PACKAGE__->callback(sub { my $category = shift->get('category'); - (my $email = lc $_) =~ s/ /-/g; - lc $category . '@example.org'; + (my $email = lc $category) =~ s/ /-/g; + $email . '@example.org'; }), state => 'confirmed', editor => 'Factory', @@ -233,6 +233,8 @@ __PACKAGE__->fields({ note => 'Created by factory', }); +sub key_field { 'id' } + ####################### package FixMyStreet::DB::Factory::ResponseTemplate; |