From a5d5d19bd7dac767fc37f272858c286f6acf37a8 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 8 Dec 2015 09:39:43 -0500 Subject: [PATCH] LP#1452950 patron reg invalidate fields Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- .../src/templates/staff/circ/patron/t_edit.tt2 | 7 ++++-- .../web/js/ui/default/staff/circ/patron/regctl.js | 25 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) 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 c8bfb8c22e..980ec0c470 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 @@ -107,8 +107,11 @@ [% IF field.match('phone') OR field.match('email') %] - + [% END %] 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 8514b09227..44f936ca03 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 @@ -355,6 +355,24 @@ angular.module('egCoreMod') }); } + service.invalidate_field = function(patron, field) { + console.log('Invalidating patron field ' + field); + + return egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.invalidate.' + field, + egCore.auth.token(), patron.id, null, patron.home_ou.id() + + ).then(function(res) { + // clear the invalid value from the form + patron[field] = ''; + + // update last_xact_id so future save operations + // on this patron will be allowed + patron.last_xact_id = res.payload.last_xact_id[patron.id]; + }); + } + service.init_patron = function(current) { if (!current) @@ -387,7 +405,8 @@ angular.module('egCoreMod') patron.home_ou = egCore.org.get(patron.home_ou.id); patron.expire_date = new Date(Date.parse(patron.expire_date)); - patron.dob = new Date(Date.parse(patron.dob)); + patron.dob = patron.dob ? + new Date(Date.parse(patron.dob)) : null; patron.profile = current.profile(); // pre-hash version patron.net_access_level = current.net_access_level(); patron.ident_type = current.ident_type(); @@ -1014,6 +1033,10 @@ function PatronRegCtrl($scope, $routeParams, $scope.hold_notify_sms = Boolean(notify.match(/sms/)); } + $scope.invalidate_field = function(field) { + patronRegSvc.invalidate_field($scope.patron, field); + } + $scope.edit_passthru.save = function() { // toss the deleted addresses back into the patron's list of -- 2.11.0