aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Oxfordshire.pm16
-rw-r--r--t/cobrand/oxfordshire.t14
2 files changed, 30 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm
index cac79a347..f03f1b605 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/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t
index 19a82742a..cec8f53b3 100644
--- a/t/cobrand/oxfordshire.t
+++ b/t/cobrand/oxfordshire.t
@@ -186,6 +186,20 @@ subtest 'Reports are marked as inspected correctly' => sub {
};
};
+subtest 'can use customer reference to search for reports' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'oxfordshire' ],
+ MAPIT_URL => 'http://mapit.uk/',
+ }, sub {
+ my $problem = $problems[0];
+ $problem->set_extra_metadata( customer_reference => 'ENQ12456' );
+ $problem->update;
+
+ $mech->get_ok('/around?pc=ENQ12456');
+ is $mech->uri->path, '/report/' . $problem->id, 'redirects to report';
+ };
+};
+
END {
done_testing();
}