LP#1452950 patron reg additions (phone pw, hiding stuff)
authorBill Erickson <berickxx@gmail.com>
Sun, 25 Oct 2015 15:42:11 +0000 (11:42 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 25 Feb 2016 22:31:57 +0000 (17:31 -0500)
1. Generate password from last 4 digits of phone number if library
setting is present (patron.password.use_phone).

2. Only show "replace barcode" and invlidate buttons when editing an
existing patron.

3. Address no longer defaults to within_city_limits, consistent with
dojo version.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js

index 2d8e8c3..e6ffef4 100644 (file)
         focus-me="focus_usrname"
         ng-blur="usrname_changed(patron.usrname)"
         class="form-control" ng-model="[% model %]"/>
+    [% ELSIF field == 'day_phone' %]
+      <input type="text" 
+        ng-blur="day_phone_changed(patron.day_phone)"
+        class="form-control" ng-model="[% model %]"/>
     [% ELSE %]
       <input type="[% input_type %]" 
         class="form-control" ng-model="[% model %]"/>
@@ -88,7 +92,7 @@
 
     [% IF field == 'barcode' %]
 
-      <button class="btn btn-default"
+      <button class="btn btn-default" ng-show="!patron.isnew"
         ng-click="replace_card()">[% l('Replace Barcode') %]</button>
       <button class="btn btn-default" 
         ng-click="cards_dialog()">[% l('See All') %]</button>
       <!-- invalidate buttons -->
 
       [% IF field.match('phone') OR field.match('email') %]
-        <button ng-show="patron.[% field %]" class="btn btn-default"
+        <button ng-show="patron.[% field %] && !patron.isnew" class="btn btn-default"
           ng-click="">[% l('Invalidate') %]</button>
       [% END %]
 
index 40809e5..52dd1f8 100644 (file)
@@ -320,7 +320,7 @@ angular.module('egCoreMod')
             address_type : egCore.strings.REG_ADDR_TYPE,
             _is_mailing : true,
             _is_billing : true,
-            within_city_limits : true
+            within_city_limits : false
         };
 
         var card = {
@@ -659,6 +659,12 @@ function PatronRegCtrl($scope, $routeParams,
         $scope.patron.cards.push(new_card);
     }
 
+    $scope.day_phone_changed = function(phone) {
+        if (phone && $scope.org_settings['patron.password.use_phone']) {
+           $scope.patron.passwd = phone.substr(-4);
+        }
+    }
+
     $scope.barcode_changed = function(bc) {
         if (!bc) return;
         egCore.net.request(