[open-ils-commits] [GIT] Evergreen ILS branch rel_2_10 updated. 736aa4d9261f717fc7a9b37219ab1c7e1a044c45

Evergreen Git git at git.evergreen-ils.org
Mon Apr 4 16:56:59 EDT 2016


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, rel_2_10 has been updated
       via  736aa4d9261f717fc7a9b37219ab1c7e1a044c45 (commit)
       via  f25e0567bda92cc0e635cd427bd27ceb4328c957 (commit)
       via  d2dcd6ba6fe6ddfd086e6e8f05e95544c7a05c9f (commit)
       via  1464aa082ea93da70a7809a42f44d2bf0f9a028f (commit)
       via  13b61f30ec24a660b1d638da1d37ddd2973a923e (commit)
       via  140be17c673bec818e37363959a90ad247b0404e (commit)
       via  6ec8bd4c16eb2bed8a4c59856f5ee17137ce853f (commit)
       via  50153a8d3392eb75304fed54323f3664040e5c8f (commit)
       via  68eacf38e0bb967e2683146b3b314e39f87ccd0a (commit)
       via  a802095aff2b6c300045fb7a6ef181bcb5f15903 (commit)
      from  fba80e28dc490157cf2d06aa4cdfe6787064ef3e (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 736aa4d9261f717fc7a9b37219ab1c7e1a044c45
Author: Bill Erickson <berickxx at gmail.com>
Date:   Sat Apr 2 18:11:12 2016 -0400

    LP#1564685 Prevent linked address edit on reload
    
    Prevent editing of linked addresses when a user is loaded after the
    clone operation.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
index 437c401..69577d3 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
@@ -67,6 +67,23 @@ angular.module('egCoreMod')
         });
     }
 
+    // When editing a user with addresses linked to other users, fetch
+    // the linked user(s) so we can display their names and edit links.
+    service.get_linked_addr_users = function(addrs) {
+        angular.forEach(addrs, function(addr) {
+            if (addr.usr == service.existing_patron.id()) return;
+            egCore.pcrud.retrieve('au', addr.usr)
+            .then(function(usr) {
+                addr._linked_owner_id = usr.id();
+                addr._linked_owner = service.format_name(
+                    usr.family_name(),
+                    usr.first_given_name(),
+                    usr.second_given_name()
+                );
+            })
+        });
+    }
+
     service.apply_secondary_groups = function(user_id, group_ids) {
         return egCore.net.request(
             'open-ils.actor',
@@ -611,6 +628,8 @@ angular.module('egCoreMod')
         angular.forEach(patron.addresses, 
             function(addr) { service.ingest_address(patron, addr) });
 
+        service.get_linked_addr_users(patron.addresses);
+
         // Remove stat cat entries that link to out-of-scope stat
         // cats.  With this, we avoid unnecessarily updating (or worse,
         // modifying) stat cat values that are not ours to modify.

commit f25e0567bda92cc0e635cd427bd27ceb4328c957
Author: Bill Erickson <berickxx at gmail.com>
Date:   Thu Mar 31 20:35:00 2016 -0400

    LP#1564685 Avoid referencing out-of-scope stat cats
    
    Fixes a bug in the patron editor where out-of-scope stat cats would be
    incorrectly bundled in the patron save operation, resulting in a
    server-side error on save.  In short, ignore out-of-scope stat cat
    entries for patrons in the editor.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
index 106bdb0..437c401 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
@@ -611,6 +611,19 @@ angular.module('egCoreMod')
         angular.forEach(patron.addresses, 
             function(addr) { service.ingest_address(patron, addr) });
 
+        // Remove stat cat entries that link to out-of-scope stat
+        // cats.  With this, we avoid unnecessarily updating (or worse,
+        // modifying) stat cat values that are not ours to modify.
+        patron.stat_cat_entries = patron.stat_cat_entries.filter(
+            function(map) {
+                return Boolean(
+                    // service.stat_cats only contains in-scope stat cats.
+                    service.stat_cats.filter(function(cat) { 
+                        return (cat.id() == map.stat_cat.id) })[0]
+                );
+            }
+        );
+
         // toss entries for existing stat cat maps into our living 
         // stat cat entry map, which is modified within the template.
         angular.forEach(patron.stat_cat_entries, function(map) {

commit d2dcd6ba6fe6ddfd086e6e8f05e95544c7a05c9f
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Mar 28 16:10:10 2016 -0400

    LP#1564685 Prevent edit of linked addresses
    
    Do not allow a cloned user to modify a linked address.  Only the address
    owner should be able to do that.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
index 92c5e11..a98d7fe 100644
--- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
@@ -703,7 +703,8 @@ within the "form" by name for validation.
   <!-- ADDRESS_TYPE -->
   <div class="row reg-field-row" ng-show="show_field('aua.address_type')">
     [% draw_field_label('aua', 'address_type') %]
-    [% draw_form_input('aua', 'address_type', 'addresses[$index]') %]
+    [% draw_form_input('aua', 
+      'address_type', 'addresses[$index]', '', 'addr._linked_owner') %]
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'address_type') %]
     </div>
@@ -713,7 +714,8 @@ within the "form" by name for validation.
 
   <div class="row reg-field-row" ng-show="show_field('aua.post_code')">
     [% draw_field_label('aua', 'post_code') %]
-    [% draw_form_input('aua', 'post_code', 'addresses[$index]') %]
+    [% draw_form_input('aua', 
+      'post_code', 'addresses[$index]', '', 'addr._linked_owner') %]
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'post_code') %]
     </div>
@@ -723,7 +725,8 @@ within the "form" by name for validation.
 
   <div class="row reg-field-row" ng-show="show_field('aua.street1')">
     [% draw_field_label('aua', 'street1') %]
-    [% draw_form_input('aua', 'street1', 'addresses[$index]') %]
+    [% draw_form_input('aua', 
+      'street1', 'addresses[$index]', '', 'addr._linked_owner') %]
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'street1') %]
     </div>
@@ -733,7 +736,8 @@ within the "form" by name for validation.
 
   <div class="row reg-field-row" ng-show="show_field('aua.street2')">
     [% draw_field_label('aua', 'street2') %]
-    [% draw_form_input('aua', 'street2', 'addresses[$index]') %]
+    [% draw_form_input('aua', 
+      'street2', 'addresses[$index]', '', 'addr._linked_owner') %]
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'street2') %]
     </div>
@@ -743,7 +747,8 @@ within the "form" by name for validation.
 
   <div class="row reg-field-row" ng-show="show_field('aua.city')">
     [% draw_field_label('aua', 'city') %]
-    [% draw_form_input('aua', 'city', 'addresses[$index]') %]
+    [% draw_form_input('aua', 
+      'city', 'addresses[$index]', '', 'addr._linked_owner') %]
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'city') %]
     </div>
@@ -753,7 +758,8 @@ within the "form" by name for validation.
 
   <div class="row reg-field-row" ng-show="show_field('aua.county')">
     [% draw_field_label('aua', 'county') %]
-    [% draw_form_input('aua', 'county', 'addresses[$index]') %]
+    [% draw_form_input('aua', 
+      'county', 'addresses[$index]', '', 'addr._linked_owner') %]
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'county') %]
     </div>
@@ -763,7 +769,8 @@ within the "form" by name for validation.
 
   <div class="row reg-field-row" ng-show="show_field('aua.state')">
     [% draw_field_label('aua', 'state') %]
-    [% draw_form_input('aua', 'state', 'addresses[$index]') %]
+    [% draw_form_input('aua', 
+      'state', 'addresses[$index]', '', 'addr._linked_owner') %]
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'state') %]
     </div>
@@ -773,7 +780,8 @@ within the "form" by name for validation.
 
   <div class="row reg-field-row" ng-show="show_field('aua.country')">
     [% draw_field_label('aua', 'country') %]
-    [% draw_form_input('aua', 'country', 'addresses[$index]') %]
+    [% draw_form_input('aua', 
+      'country', 'addresses[$index]', '', 'addr._linked_owner') %]
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'country') %]
     </div>
@@ -788,6 +796,7 @@ within the "form" by name for validation.
         <input 
           type='checkbox' 
           ng-change="field_modified()" 
+          ng-disabled='addr._linked_owner'
           ng-blur="handle_field_changed(patron.addresses[$index], 'valid')"
           ng-model="patron.addresses[$index].valid"/>
       </div>
@@ -806,6 +815,7 @@ within the "form" by name for validation.
         <input 
           type='checkbox' 
           ng-change="field_modified()" 
+          ng-disabled='addr._linked_owner'
           ng-blur="handle_field_changed(patron.addresses[$index], 'within_city_limits')"
           ng-model="patron.addresses[$index].within_city_limits"/>
       </div>

commit 1464aa082ea93da70a7809a42f44d2bf0f9a028f
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Mar 28 16:00:18 2016 -0400

    LP#1564685 New Address button is always accessible
    
    The New Address button in the patron editor is now always accessible,
    regardless of the existence of any addresses.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
index d4d750e..92c5e11 100644
--- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
@@ -815,15 +815,15 @@ within the "form" by name for validation.
     </div>
   </div>
 
-  <div class="row" ng-if="$last">
-    <button type="button" ng-click="new_address()" 
-      class="btn btn-success">[% l('New Address') %]</button>
-  </div>
-
   <!-- pending address -->
 
 </div> <!-- addresses -->
 
+<div class="row">
+  <button type="button" ng-click="new_address()" 
+    class="btn btn-success">[% l('New Address') %]</button>
+</div>
+
 <div class="alert alert-success row" role="alert" 
     ng-show="show_field('stat_cats')" ng-if="stat_cats.length > 0">
     <div class="col-md-6">[% l('Statistical Categories') %]</div>

commit 13b61f30ec24a660b1d638da1d37ddd2973a923e
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Mar 28 15:57:26 2016 -0400

    LP#1564685 Repair patron editor checkboxes sizing
    
    Fix the checkbox HTML markup to prevent huge checkboxes in the patron
    editor.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
index 6a5fcc2..d4d750e 100644
--- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
@@ -276,7 +276,14 @@ within the "form" by name for validation.
 
 <div class="row reg-field-row" ng-show="show_field('au.juvenile')">
   [% draw_field_label('au', 'juvenile') %]
-  [% draw_form_input('au', 'juvenile', '', 'checkbox'); %]
+  <div class="col-md-3 reg-field-input">
+    <div class='checkbox'>
+      <input 
+        ng-change="field_modified()" 
+        ng-blur="handle_field_changed(patron, 'juvenile')"
+        type='checkbox' ng-model="patron.juvenile"/>
+    </div>
+  </div>
 </div>
 
 <!-- ident_type -->
@@ -457,21 +464,42 @@ within the "form" by name for validation.
 
 <div class="row reg-field-row" ng-show="show_field('au.active')">
   [% draw_field_label('au', 'active') %]
-  [% draw_form_input('au', 'active', '', 'checkbox') %]
+  <div class="col-md-3 reg-field-input">
+    <div class='checkbox'>
+      <input 
+        ng-change="field_modified()" 
+        ng-blur="handle_field_changed(patron, 'active')"
+        type='checkbox' ng-model="patron.active"/>
+    </div>
+  </div>
 </div>
 
 <!-- BARRED -->
 
 <div class="row reg-field-row" ng-show="show_field('au.barred')">
   [% draw_field_label('au', 'barred') %]
-  [% draw_form_input('au', 'barred', '', 'checkbox') %]
+  <div class="col-md-3 reg-field-input">
+    <div class='checkbox'>
+      <input 
+        ng-change="field_modified()" 
+        ng-blur="handle_field_changed(patron, 'barred')"
+        type='checkbox' ng-model="patron.barred"/>
+    </div>
+  </div>
 </div>
 
 <!-- MASTER_ACCOUNT -->
 
 <div class="row reg-field-row" ng-show="show_field('au.master_account')">
   [% draw_field_label('au', 'master_account') %]
-  [% draw_form_input('au', 'master_account', '', 'checkbox') %]
+  <div class="col-md-3 reg-field-input">
+    <div class='checkbox'>
+      <input 
+        ng-change="field_modified()" 
+        ng-blur="handle_field_changed(patron, 'master_account')"
+        type='checkbox' ng-model="patron.master_account"/>
+    </div>
+  </div>
 </div>
 
 <!-- CLAIMS_RETURNED_COUNT -->
@@ -755,7 +783,15 @@ within the "form" by name for validation.
 
   <div class="row reg-field-row" ng-show="show_field('aua.valid')">
     [% draw_field_label('aua', 'valid') %]
-    [% draw_form_input('aua', 'valid', 'addresses[$index]', 'checkbox') %]
+    <div class="col-md-3 reg-field-input">
+      <div class='checkbox'>
+        <input 
+          type='checkbox' 
+          ng-change="field_modified()" 
+          ng-blur="handle_field_changed(patron.addresses[$index], 'valid')"
+          ng-model="patron.addresses[$index].valid"/>
+      </div>
+    </div>
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'valid') %]
     </div>
@@ -765,7 +801,15 @@ within the "form" by name for validation.
 
   <div class="row reg-field-row" ng-show="show_field('aua.within_city_limits')">
     [% draw_field_label('aua', 'within_city_limits') %]
-    [% draw_form_input('aua', 'within_city_limits', 'addresses[$index]', 'checkbox') %]
+    <div class="col-md-3 reg-field-input">
+      <div class='checkbox'>
+        <input 
+          type='checkbox' 
+          ng-change="field_modified()" 
+          ng-blur="handle_field_changed(patron.addresses[$index], 'within_city_limits')"
+          ng-model="patron.addresses[$index].within_city_limits"/>
+      </div>
+    </div>
     <div class="col-md-6 patron-reg-example">
       [% draw_example_text('aua', 'within_city_limits') %]
     </div>

commit 140be17c673bec818e37363959a90ad247b0404e
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Mar 28 15:48:29 2016 -0400

    LP#1564685 Required-field org settings overlay defaults
    
    An org setting requiring a value for a field in the patron editor means
    the field is required, even if it's not required by default.  IOW, fix
    the code that was supposed to do that already.
    
    Of note, county and state can now both be marked as required by org
    settings in the patron editor.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
index 37e331a..106bdb0 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
@@ -1199,7 +1199,8 @@ function PatronRegCtrl($scope, $routeParams, $q, $modal, $window, egCore,
     // 3 == value universally required
     // 2 == field is visible by default
     // 1 == field is suggested by default
-    var field_visibility = {
+    var field_visibility = {};
+    var default_field_visibility = {
         'ac.barcode' : 3,
         'au.usrname' : 3,
         'au.passwd' :  3,
@@ -1224,31 +1225,40 @@ function PatronRegCtrl($scope, $routeParams, $q, $modal, $window, egCore,
         'surveys' : 1
     }; 
 
-    // returns true if the selected field should be visible
+    // Returns true if the selected field should be visible
     // given the current required/suggested/all setting.
+    // The visibility flag applied to each field as a result of calling
+    // this function also sets (via the same flag) the requiredness state.
     $scope.show_field = function(field_key) {
+        // org settings have not been received yet.
+        if (!$scope.org_settings) return false;
 
         if (field_visibility[field_key] == undefined) {
             // compile and cache the visibility for the selected field
 
-            // org settings have not been received yet.
-            if (!$scope.org_settings) return false;
-
             var req_set = 'ui.patron.edit.' + field_key + '.require';
             var sho_set = 'ui.patron.edit.' + field_key + '.show';
             var sug_set = 'ui.patron.edit.' + field_key + '.suggest';
 
             if ($scope.org_settings[req_set]) {
                 field_visibility[field_key] = 3;
+
             } else if ($scope.org_settings[sho_set]) {
                 field_visibility[field_key] = 2;
+
             } else if ($scope.org_settings[sug_set]) {
                 field_visibility[field_key] = 1;
-            } else {
-                field_visibility[field_key] = 0;
             }
         }
 
+        if (field_visibility[field_key] == undefined) {
+            // No org settings were applied above.  Use the default
+            // settings if present or assume the field has no
+            // visibility flags applied.
+            field_visibility[field_key] = 
+                default_field_visibility[field_key] || 0;
+        }
+
         return field_visibility[field_key] >= $scope.edit_passthru.vis_level;
     }
 

commit 6ec8bd4c16eb2bed8a4c59856f5ee17137ce853f
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Mar 28 15:30:37 2016 -0400

    LP#1564685 Allow delete of all patron addresses
    
    If the org setting ui.patron.registration.require_address is not true,
    allow all addresses to be removed from a patron's account.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/templates/staff/circ/patron/register.tt2 b/Open-ILS/src/templates/staff/circ/patron/register.tt2
index 3eac3ef..0df6f9e 100644
--- a/Open-ILS/src/templates/staff/circ/patron/register.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/register.tt2
@@ -14,6 +14,8 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
   s.REG_ADDR_TYPE = "[% l('Mailing') %]";
   s.REG_INVALID_FIELDS = 
     "[% l('Please enter valid values for all required fields.') %]"
+  s.REG_ADDR_REQUIRED = 
+    "[% l('An address is required during registration.') %]"
 }]);
 </script>
 <link rel="stylesheet" href="[% ctx.base_path %]/staff/css/circ.css" />
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
index 534bda5..37e331a 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
@@ -1309,6 +1309,14 @@ function PatronRegCtrl($scope, $routeParams, $q, $modal, $window, egCore,
     // when the patron is updated.
     deleted_addresses = [];
     $scope.delete_address = function(id) {
+
+        if ($scope.patron.isnew &&
+            $scope.patron.addresses.length == 1 &&
+            $scope.org_settings['ui.patron.registration.require_address']) {
+            egAlertDialog.open(egCore.strings.REG_ADDR_REQUIRED);
+            return;
+        }
+
         var addresses = [];
         angular.forEach($scope.patron.addresses, function(addr) {
             if (addr.id == id) {

commit 50153a8d3392eb75304fed54323f3664040e5c8f
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Mar 28 15:22:52 2016 -0400

    LP#1564685 Alert and stop on invalid fields
    
    Display an alert message and prevent save or save+clone when invalid
    values exist in the patron edit form.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/templates/staff/circ/patron/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/index.tt2
index df0cea5..85b8866 100644
--- a/Open-ILS/src/templates/staff/circ/patron/index.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2
@@ -44,6 +44,8 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
   s.RENEW_ITEMS = "[% l('Renew Items?') %]";
   s.RENEW_ALL_ITEMS = "[% l('Renew All Items?') %]";
   s.CHECK_IN_CONFIRM = "[% l('Check In Items?') %]";
+  s.REG_INVALID_FIELDS = 
+    "[% l('Please enter valid values for all required fields.') %]"
 }]);
 </script>
 
diff --git a/Open-ILS/src/templates/staff/circ/patron/register.tt2 b/Open-ILS/src/templates/staff/circ/patron/register.tt2
index 81b4279..3eac3ef 100644
--- a/Open-ILS/src/templates/staff/circ/patron/register.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/register.tt2
@@ -12,6 +12,8 @@
 <script>
 angular.module('egCoreMod').run(['egStrings', function(s) {
   s.REG_ADDR_TYPE = "[% l('Mailing') %]";
+  s.REG_INVALID_FIELDS = 
+    "[% l('Please enter valid values for all required fields.') %]"
 }]);
 </script>
 <link rel="stylesheet" href="[% ctx.base_path %]/staff/css/circ.css" />
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
index da7cfed..534bda5 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
@@ -1047,8 +1047,8 @@ angular.module('egCoreMod')
 }]);
 
 
-function PatronRegCtrl($scope, $routeParams, 
-    $q, $modal, $window, egCore, patronSvc, patronRegSvc, egUnloadPrompt) {
+function PatronRegCtrl($scope, $routeParams, $q, $modal, $window, egCore, 
+    patronSvc, patronRegSvc, egUnloadPrompt, egAlertDialog) {
 
     $scope.page_data_loaded = false;
     $scope.clone_id = patronRegSvc.clone_id = $routeParams.clone_id;
@@ -1669,27 +1669,36 @@ function PatronRegCtrl($scope, $routeParams,
         );
     }
 
+    // Returns true if the Save and Save & Clone buttons should be disabled.
+    $scope.edit_passthru.hide_save_actions = function() {
+        return $scope.patron.isnew ?
+            !$scope.perms.CREATE_USER : 
+            !$scope.perms.UPDATE_USER;
+    }
+
     // Returns true if any input elements are tagged as invalid
-    $scope.edit_passthru.has_invalid_fields = function() {
+    // via Angular patterns or required attributes.
+    function form_has_invalid_fields() {
         return $('#patron-reg-container .ng-invalid').length > 0;
     }
 
-    // Returns true if the Save and Save & Clone buttons should be disabled.
-    $scope.edit_passthru.hide_save_actions = function() {
-        var can_save = $scope.patron.isnew ?
-            $scope.perms.CREATE_USER : $scope.perms.UPDATE_USER;
-
+    function form_is_incomplete() {
         return (
-            !can_save ||
             $scope.dupe_username ||
             $scope.dupe_barcode ||
-            $scope.edit_passthru.has_invalid_fields()
+            form_has_invalid_fields()
         );
+
     }
 
     $scope.edit_passthru.save = function(save_args) {
         if (!save_args) save_args = {};
 
+        if (form_is_incomplete()) {
+            // User has not provided valid values for all required fields.
+            return egAlertDialog.open(egCore.strings.REG_INVALID_FIELDS);
+        }
+
         // remove page unload warning prompt
         egUnloadPrompt.clear();
 
@@ -1758,5 +1767,5 @@ function PatronRegCtrl($scope, $routeParams,
 // This controller may be loaded from different modules (patron edit vs.
 // register new patron), so we have to inject the controller params manually.
 PatronRegCtrl.$inject = ['$scope', '$routeParams', '$q', '$modal', 
-    '$window', 'egCore', 'patronSvc', 'patronRegSvc', 'egUnloadPrompt'];
+    '$window', 'egCore', 'patronSvc', 'patronRegSvc', 'egUnloadPrompt', 'egAlertDialog'];
 

commit 68eacf38e0bb967e2683146b3b314e39f87ccd0a
Author: Bill Erickson <berickxx at gmail.com>
Date:   Wed Mar 23 22:13:44 2016 -0400

    LP#1564685 Allow barcode as username despite regex
    
    Allow a patron's barcode to be considered a valid username in the patron
    editor even in the presence of an 'opac.username_regex' org setting
    value that does not match the barcode.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
index c68a20d..da7cfed 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
@@ -1172,8 +1172,10 @@ function PatronRegCtrl($scope, $routeParams,
         $scope.page_data_loaded = true;
 
         prs.set_field_patterns(field_patterns);
+        apply_username_regex();
     });
 
+
     // update the currently displayed field documentation
     $scope.set_selected_field_doc = function(cls, field) {
         $scope.selected_field_doc = $scope.field_doc[cls][field];
@@ -1362,10 +1364,9 @@ function PatronRegCtrl($scope, $routeParams,
             'open-ils.actor.barcode.exists',
             egCore.auth.token(), bc
         ).then(function(resp) {
-            if (resp == '1') {
+            if (resp == '1') { // duplicate card
                 $scope.dupe_barcode = true;
                 console.log('duplicate barcode detected: ' + bc);
-                // DUPLICATE CARD
             } else {
                 if (!$scope.patron.usrname)
                     $scope.patron.usrname = bc;
@@ -1555,6 +1556,27 @@ function PatronRegCtrl($scope, $routeParams,
         egUnloadPrompt.attach($scope);
     }
 
+    // username regex (if present) must be removed any time
+    // the username matches the barcode to avoid firing the
+    // invalid field handlers.
+    function apply_username_regex() {
+        var regex = $scope.org_settings['opac.username_regex'];
+        if (regex) {
+            if ($scope.patron.card.barcode) {
+                // username must match the regex or the barcode
+                field_patterns.au.usrname = 
+                    new RegExp(
+                        regex + '|^' + $scope.patron.card.barcode + '$');
+            } else {
+                // username must match the regex
+                field_patterns.au.usrname = new RegExp(regex);
+            }
+        } else {
+            // username can be any format.
+            field_patterns.au.usrname = new RegExp('.*');
+        }
+    }
+
     // obj could be the patron, an address, etc.
     // This is called any time a form field achieves then loses focus.
     // It does not necessarily mean the field has changed.
@@ -1611,6 +1633,7 @@ function PatronRegCtrl($scope, $routeParams,
             case 'barcode':
                 // TODO: finish barcode_changed handler.
                 $scope.barcode_changed(value);
+                apply_username_regex();
                 break;
 
             case 'dob':

commit a802095aff2b6c300045fb7a6ef181bcb5f15903
Author: Bill Erickson <berickxx at gmail.com>
Date:   Wed Mar 23 21:21:12 2016 -0400

    LP#1564685 Avoid dupe usrname warning on matching patron
    
    Do not treat usernames as duplicates when they belong to the patron
    being edited.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
index ae7838e..c68a20d 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
@@ -125,6 +125,16 @@ angular.module('egCoreMod')
     }
 
     service.check_dupe_username = function(usrname) {
+
+        // empty usernames can't be dupes
+        if (!usrname) return $q.when(false);
+
+        // avoid dupe check if username matches the originally loaded usrname
+        if (service.existing_patron) {
+            if (usrname == service.existing_patron.usrname())
+                return $q.when(false);
+        }
+
         return egCore.net.request(
             'open-ils.actor',
             'open-ils.actor.username.exists',
@@ -573,6 +583,8 @@ angular.module('egCoreMod')
      */
     service.init_existing_patron = function(current) {
 
+        service.existing_patron = current;
+
         var patron = egCore.idl.toHash(current);
 
         patron.home_ou = egCore.org.get(patron.home_ou.id);

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

Summary of changes:
 Open-ILS/src/templates/staff/circ/patron/index.tt2 |    2 +
 .../src/templates/staff/circ/patron/register.tt2   |    4 +
 .../src/templates/staff/circ/patron/t_edit.tt2     |   92 +++++++++++---
 .../web/js/ui/default/staff/circ/patron/regctl.js  |  134 +++++++++++++++++---
 4 files changed, 193 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list