Merge branch 'master' of git.evergreen-ils.org:Evergreen into social
[evergreen-equinox.git] / Open-ILS / src / perlmods / lib / OpenILS / Application / Storage / Publisher / actor.pm
index cd3d4b5..75152ce 100644 (file)
@@ -197,8 +197,10 @@ sub calc_proximity {
                                actor.org_unit r;
        SQL
 
+       $self->method_lookup('open-ils.storage.transaction.begin')->run;
        actor::org_unit_proximity->db_Main->do($delete_sql);
        actor::org_unit_proximity->db_Main->do($insert_sql);
+       $self->method_lookup('open-ils.storage.transaction.commit')->run;
 
        return 1;
 }
@@ -680,7 +682,11 @@ sub patron_search {
        my @phonev;
        if ($pv) {
                for my $p ( qw/day_phone evening_phone other_phone/ ) {
-                       push @ps, "evergreen.lowercase($p) ~ ?";
+                       if ($pv =~ /^\d+$/) {
+                               push @ps, "evergreen.lowercase(REGEXP_REPLACE($p, '[^0-9]', '', 'g')) ~ ?";
+                       } else {
+                               push @ps, "evergreen.lowercase($p) ~ ?";
+                       }
                        push @phonev, "^$pv";
                }
                $phone = '(' . join(' OR ', @ps) . ')';