From c273f651551d5b84a3efebb7978601295e2bec84 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 16 Sep 2015 21:42:16 -0400 Subject: [PATCH] LP#1452950 patron reg replace barcode Replace patron barcode. Includes duplicate barcode detection, but no styling/warning is produced when a dupe is found, since the structure for handling invalid form fields in patron reg does not yet exist. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- .../src/templates/staff/circ/patron/t_edit.tt2 | 6 ++++- .../web/js/ui/default/staff/circ/patron/regctl.js | 30 +++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 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 f9abc182d4..d70c60ffbb 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 @@ -64,6 +64,9 @@ [% ELSIF field == 'post_code' %] + [% ELSIF field == 'barcode' %] + [% ELSE %] @@ -77,7 +80,8 @@ [% IF field == 'barcode' %] - + 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 c88dbee6e8..d9cd490f50 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 @@ -404,7 +404,6 @@ angular.module('egCoreMod') function PatronRegCtrl($scope, $routeParams, $q, $modal, egCore, patronSvc, patronRegSvc) { - $scope.clone_id = $routeParams.clone_id; $scope.stage_username = $routeParams.stage_username; $scope.patron_id = @@ -580,6 +579,35 @@ function PatronRegCtrl($scope, $routeParams, }); } + var new_card_id = -1; + $scope.replace_card = function() { + $scope.patron.card.active = false; + $scope.patron.card.ischanged = true; + var new_card = egCore.idl.toHash(new egCore.idl.ac()); + new_card.id = new_card_id--; + new_card.isnew = true; + new_card.active = true; + new_card._primary = true; + $scope.patron.card = new_card; + $scope.patron.cards.push(new_card); + } + + $scope.barcode_changed = function(bc) { + if (!bc) return; + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.barcode.exists', + egCore.auth.token(), bc + ).then(function(resp) { + if (resp == '1') { + console.log('duplicate barcode detected: ' + bc); + // DUPLICATE CARD + } else { + // No dupe -- A-OK + } + }); + } + $scope.cards_dialog = function() { $modal.open({ templateUrl: './circ/patron/t_patron_cards_dialog', -- 2.11.0