[open-ils-commits] [GIT] Evergreen ILS branch master updated. baf337b63d09b24a516881a91366da714e472c92

Evergreen Git git at git.evergreen-ils.org
Thu Aug 31 17:19:21 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  baf337b63d09b24a516881a91366da714e472c92 (commit)
      from  edc503b788fd587b014932b0b2fbaf44b295d170 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit baf337b63d09b24a516881a91366da714e472c92
Author: blake <blake at mobiusconsortium.org>
Date:   Thu Aug 31 20:33:17 2017 +0000

    LP1655158 Patron Search by Date of Birth
    
    Adds three UI boxes to the WBSC "Show Extra" patron search. One for the year, month and day.
    The javascript on the page is altered to deliver group "4" to the backend. Local javascript
    strips out non-numeric user entered data. The backend is updated to handle the new group.
    SQL is genereated using the DATE_PART postgres function.
    
    1. Open the web based staff client and browse to the patron search UI.
    2. Click the show more down arrow button. Notice the lack of birth date field.
    3. Apply the patch, repeat step one. Notice the addition of birth date boxes.
    4. Type 1975 into the birth year box and press enter. Notice search results.
    5. Try searching for partial names and partial birthdates.
    6. Try entering non-numeric data into the birth date boxes.
    7. Try searching for patrons without including the dob. Try with only the dob. Try a mix.
    
    Signed-off-by: blake <blake at mobiusconsortium.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
index bcf4508..a1e634d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
@@ -676,6 +676,7 @@ sub patron_search {
     # group 1 = address
     # group 2 = phone, ident
     # group 3 = barcode
+    # group 4 = dob
 
     # Treatment of name fields depends on whether the org has 
     # diacritic_insensitivity turned on or off.
@@ -685,6 +686,8 @@ sub patron_search {
     $diacritic_insensitive = ($diacritic_insensitive) ? $JSON->JSON2perl($diacritic_insensitive) : 0;
     my $usr;
     my @usrv;
+    my $dob;
+    my @dobv;
 
     if ($diacritic_insensitive) {
        $usr = join ' AND ', map { "evergreen.unaccent_and_squash(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
@@ -695,6 +698,23 @@ sub patron_search {
        @usrv = map { "^" . _clean_regex_chars($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
     }
 
+    while (($key, $value) = each (%$search)) {
+        if($$search{$key}{group} eq '4') {
+            my $tval = $key;
+            $tval =~ s/dob_//g;
+            my $right = "RIGHT('0'|| ";
+            my $end = ", 2)";
+            $end = $right = '' if lc $tval eq 'year';
+            $dob .= $right."CAST(DATE_PART('$tval', dob) AS text)$end ~ ? AND ";
+        }
+    }
+    # Trim the last " AND "
+    $dob = substr($dob,0,-4);
+    @dobv = map { _clean_regex_chars($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '4' } keys %$search;
+    $usr .= ' AND ' if ( $usr && $dob );
+    $usr .= $dob if $dob; # $dob not in-line above in case $usr doesn't have any search vals (only searched for dob)
+    push(@usrv, @dobv) if @dobv;
+
     my $addr = join ' AND ', map { "evergreen.lowercase(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
     my @addrv = map { "^" . _clean_regex_chars($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
 
diff --git a/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2 b/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
index 49152d3..816076c 100644
--- a/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
+++ b/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
@@ -145,6 +145,20 @@
           </div>
         </div>
       </div>
+      <div class="form-group" ng-show="showExtras">
+        <div class="col-md-2">
+            <input type="text" class="form-control" ng-model="searchArgs.dob_year"
+            placeholder="[% l('DOB Year') %]" title="[% l('DOB Year') %]"/>
+        </div>
+        <div class="col-md-2">
+            <input type="text" class="form-control" ng-model="searchArgs.dob_month"
+            placeholder="[% l('DOB Month') %]" title="[% l('DOB Month') %]"/>
+        </div>
+        <div class="col-md-2">
+            <input type="text" class="form-control" ng-model="searchArgs.dob_day"
+            placeholder="[% l('DOB Day') %]" title="[% l('DOB Day') %]"/>
+        </div>
+      </div>
     </form>
   </div>
 </div>
diff --git a/Open-ILS/web/js/ui/default/staff/services/patron_search.js b/Open-ILS/web/js/ui/default/staff/services/patron_search.js
index 97c9152..21e477d 100644
--- a/Open-ILS/web/js/ui/default/staff/services/patron_search.js
+++ b/Open-ILS/web/js/ui/default/staff/services/patron_search.js
@@ -760,6 +760,18 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
                     search[key].group = 1;
                 } else if (key == 'card') {
                     search[key].group = 3
+                } else if (key.match(/dob_/)) {
+                    // DOB should always be numeric
+                    search[key].value = search[key].value.replace(/\D/g,'');
+                    if (search[key].value.length == 0) {
+                        delete search[key];
+                    }
+                    else {
+                        if (!key.match(/year/)) {
+                            search[key].value = ('0'+search[key].value).slice(-2);
+                        }
+                        search[key].group = 4;
+                    }
                 }
             }
         });
diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/lp1655158_search_by_dob_NOTES.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/lp1655158_search_by_dob_NOTES.adoc
new file mode 100755
index 0000000..a014859
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Circulation/lp1655158_search_by_dob_NOTES.adoc
@@ -0,0 +1,8 @@
+Patron Search by Birth Date
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+* Now you can include the patron birth year and/or birth month and/or
+  birth day when searching for patrons using the web based staff client.
+* Day and month values are exact matches.  E.g. month "1" (or "01")
+  matches January, "12" matches December.
+* Year searches are "contains" searches.  E.g. year "15" matches 2015,
+  1915, 1599, etc.  For exact matches use the full 4-digit year.
\ No newline at end of file

-----------------------------------------------------------------------

Summary of changes:
 .../OpenILS/Application/Storage/Publisher/actor.pm |   20 ++++++++++++++++++++
 .../templates/staff/share/t_patron_search_form.tt2 |   14 ++++++++++++++
 .../js/ui/default/staff/services/patron_search.js  |   12 ++++++++++++
 .../Circulation/lp1655158_search_by_dob_NOTES.adoc |    8 ++++++++
 4 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100755 docs/RELEASE_NOTES_NEXT/Circulation/lp1655158_search_by_dob_NOTES.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list