From: Bill Erickson Date: Mon, 30 Jul 2018 21:23:49 +0000 (-0400) Subject: LP#1724083 Webstaff approve pending patron address X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e763bd684550bf44093734f14fb93ce05cddd458;p=working%2FEvergreen.git LP#1724083 Webstaff approve pending patron address Add support for approving pending patron addresses in the webstaff patron edit interface. To test: [1] Enable the pending address org unit setting. [2] Log into the catalog and "edit" an address. [3] Edit same user in staff client and use the Approve action. Signed-off-by: Bill Erickson Signed-off-by: Garry Collum Signed-off-by: Galen Charlton --- 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 87a15228d5..3a502a74d8 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 @@ -825,6 +825,35 @@ within the "form" by name for validation. +
+
+
+
+ [% l('This is a pending address') %] +
+
+ +
+
+
+
+ [% | l( + '{{addr._replaces.street1}}', + '{{addr._replaces.street2}}', + '
' + '{{addr._replaces.city}}', + '{{addr._replaces.state}}', + '{{addr._replaces.post_code}}') %] + Replaces: [_1] [_2] [_3] [_4], [_5] [_6] + [% END %] +
+
+
+ +
+
+
[% draw_field_label('aua', 'address_type') %] diff --git a/Open-ILS/src/templates/staff/css/circ.css.tt2 b/Open-ILS/src/templates/staff/css/circ.css.tt2 index cbbf509133..798117ebad 100644 --- a/Open-ILS/src/templates/staff/css/circ.css.tt2 +++ b/Open-ILS/src/templates/staff/css/circ.css.tt2 @@ -189,6 +189,13 @@ but the ones I'm finding aren't quite cutting it..*/ background-color: rgb(215, 215, 215); } +.patron-reg-pending-address { + border:2px dashed #d9e8f9; + -moz-border-radius: 10px; + padding: 10px; + margin-bottom: 5px; +} + /* -- end patron registration -- */ [%# 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 30f2a63d60..75990209d8 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 @@ -720,6 +720,7 @@ angular.module('egCoreMod') addr.id == patron.mailing_address.id); addr._is_billing = (patron.billing_address && addr.id == patron.billing_address.id); + addr.pending = addr.pending === 't'; } /* @@ -761,6 +762,14 @@ angular.module('egCoreMod') angular.forEach(patron.addresses, function(addr) { service.ingest_address(patron, addr) }); + // Link replaced address to its pending address. + angular.forEach(patron.addresses, function(addr) { + if (addr.replaces) { + addr._replaces = patron.addresses.filter( + function(a) {return a.id == addr.replaces})[0]; + } + }); + service.get_linked_addr_users(patron.addresses); // Remove stat cat entries that link to out-of-scope stat @@ -1071,6 +1080,7 @@ angular.module('egCoreMod') patron.addresses().push(addr); addr.valid(addr.valid() ? 't' : 'f'); addr.within_city_limits(addr.within_city_limits() ? 't' : 'f'); + addr.pending(addr.pending() ? 't' : 'f'); if (addr_hash._is_mailing) patron.mailing_address(addr); if (addr_hash._is_billing) patron.billing_address(addr); }); @@ -1563,6 +1573,37 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , $scope.patron.addresses = addresses; } + $scope.approve_pending_address = function(addr) { + + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.user.pending_address.approve', + egCore.auth.token(), addr.id + ).then(function(replaced_id) { + var evt = egCore.evt.parse(replaced_id); + if (evt) { alert(evt); return; } + + // Remove the pending address and the replaced address + // from the local list of patron addresses. + var addresses = []; + angular.forEach($scope.patron.addresses, function(a) { + if (a.id != addr.id && a.id != replaced_id) { + addresses.push(a); + } + }); + $scope.patron.addresses = addresses; + + // Fetch a fresh copy of the modified address from the server. + // and add it back to the list. + egCore.pcrud.retrieve('aua', replaced_id, {}, {authoritative: true}) + .then(null, null, function(new_addr) { + new_addr = egCore.idl.toHash(new_addr); + patronRegSvc.ingest_address($scope.patron, new_addr); + $scope.patron.addresses.push(new_addr); + }); + }); + } + $scope.post_code_changed = function(addr) { egCore.net.request( 'open-ils.search', 'open-ils.search.zip', addr.post_code)