From 25a682e7995143d6c76e14cab5a9edad45319d38 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 28 Mar 2016 15:30:37 -0400 Subject: [PATCH] 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 Signed-off-by: Kathy Lussier Signed-off-by: Galen Charlton --- Open-ILS/src/templates/staff/circ/patron/register.tt2 | 2 ++ Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/Open-ILS/src/templates/staff/circ/patron/register.tt2 b/Open-ILS/src/templates/staff/circ/patron/register.tt2 index 3eac3ef7fe..0df6f9e5fa 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.') %]" }]); 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 534bda5f2d..37e331aa9b 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) { -- 2.11.0