[open-ils-commits] [GIT] Evergreen ILS branch master updated. e3470259fc793f008e24019692924ce4ca8b9416

Evergreen Git git at git.evergreen-ils.org
Fri Jun 30 11:27:19 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  e3470259fc793f008e24019692924ce4ca8b9416 (commit)
       via  4bc2104dd27a02bb27f35dd2363277ced845159e (commit)
      from  b653ed1a1cb6c6e253de98d0fadcb97e85d6feca (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e3470259fc793f008e24019692924ce4ca8b9416
Author: Jason Etheridge <jason at equinoxinitiative.org>
Date:   Thu Jun 15 12:58:19 2017 -0400

    lp1517595 webstaff: purge patron account action
    
    TODO: disable the menu entry based on permissions
    
    Signed-off-by: Jason Etheridge <jason at equinoxinitiative.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/templates/staff/circ/patron/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/index.tt2
index 88c5dca..b9d19c8 100644
--- a/Open-ILS/src/templates/staff/circ/patron/index.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2
@@ -53,6 +53,12 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
   s.PAYMENT_OVER_MAX = "[% l('Payments over $[_1] are denied by policy.', '{{max_amount}}') %]";
   s.PATRON_NOTE_DELETE_CONFIRM_TITLE = "[% l('Delete Note?') %]";
   s.PATRON_NOTE_DELETE_CONFIRM = "[% l('Delete the note titled \"[_1]\" created on [_2]?', '{{note_title}}', '{{create_date | date}}') %]";
+  s.PATRON_PURGE_CONFIRM_TITLE = "[% l('Completely Purge Patron Account?') %]";
+  s.PATRON_PURGE_CONFIRM = "[% l('Completely OBLITERATE this patron account, including bills, payments, bookbags, etc? This is IRREVERSIBLE.') %]";
+  s.PATRON_PURGE_LAST_CHANCE = "[% l('Last chance, are you sure you want to completely delete this account?') %]";
+  s.PATRON_PURGE_STAFF_PROMPT = "[% l('The account you are attempting to delete has STAFF_LOGIN privileges. Please enter the barcode for a destination account to receive miscellaneous staff artifacts (reports, etc.) from the account to be deleted.') %]";
+  s.PATRON_PURGE_STAFF_BAD_BARCODE = "[% l('Could not retrieve a destination account with the barcode provided. Aborting the purge...') %]";
+  s.PATRON_PURGE_OVERRIDE_PROMPT = "[% l('The account has open transactions (circulations and/or unpaid bills). Purge anyway?') %]";
   s.OPT_IN_DIALOG_TITLE = "[% l('Verify Permission to Share Personal Information') %]";
   s.OPT_IN_DIALOG = "[% l('Does patron [_1], [_2] from [_3] ([_4]) consent to having their personal information shared with your library?', '{{family_name}}', '{{first_given_name}}', '{{org_name}}', '{{org_shortname}}') %]";
 }]);
@@ -198,6 +204,11 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
               [% l('Booking: Return Reservations') %]
             </a>
           </li>
+          <li>
+            <a href ng-click="purge_account()" a-disabled="patron().super_user() == 't' || patron().id() == auth_user_id">
+              [% l('Completely Purge Account') %]
+            </a>
+          </li>
        </ul>
       </li>
       <li ng-class="{active : tab == 'search'}" class="pull-right">
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js
index fe126d4..1452ce5 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js
@@ -589,8 +589,8 @@ function($q , $timeout , $location , egCore,  egUser , $locale) {
  *
  * */
 .controller('PatronCtrl',
-       ['$scope','$q','$location','$filter','egCore','egUser','patronSvc',
-function($scope,  $q,  $location , $filter,  egCore,  egUser,  patronSvc) {
+       ['$scope','$q','$location','$filter','egCore','egNet','egUser','egAlertDialog','egConfirmDialog','egPromptDialog','patronSvc',
+function($scope,  $q , $location , $filter , egCore , egNet , egUser , egAlertDialog , egConfirmDialog , egPromptDialog , patronSvc) {
 
     $scope.is_patron_edit = function() {
         return Boolean($location.path().match(/patron\/\d+\/edit$/));
@@ -645,6 +645,7 @@ function($scope,  $q,  $location , $filter,  egCore,  egUser,  patronSvc) {
         console.log('init tab ' + tab);
         $scope.tab = tab;
         $scope.aous = egCore.env.aous;
+        $scope.auth_user_id = egCore.auth.user().id();
 
         if (patron_id) {
             $scope.patron_id = patron_id;
@@ -705,6 +706,71 @@ function($scope,  $q,  $location , $filter,  egCore,  egUser,  patronSvc) {
         return $scope.tab != 'search' && $scope.collapsePatronSummary;
     }
 
+    function _purge_account(dest_usr,override) {
+        egNet.request(
+            'open-ils.actor',
+            'open-ils.actor.user.delete' + (override ? '.override' : ''),
+            egCore.auth.token(),
+            $scope.patron().id(),
+            dest_usr
+        ).then(function(resp){
+            if (evt = egCore.evt.parse(resp)) {
+                if (evt.code == '2004' /* ACTOR_USER_DELETE_OPEN_XACTS */) {
+                    egConfirmDialog.open(
+                        egCore.strings.PATRON_PURGE_CONFIRM_TITLE, egCore.strings.PATRON_PURGE_OVERRIDE_PROMPT,
+                        {ok : function() {
+                            _purge_account(dest_usr,true);
+                        }}
+                    );
+                } else {
+                    alert(js2JSON(evt));
+                }
+            } else {
+                location.href = egCore.env.basePath + '/circ/patron/search';
+            }
+        });
+    }
+
+    function _purge_account_with_destination(dest_barcode) {
+        egCore.pcrud.search('ac', {barcode : dest_barcode})
+        .then(function(card) {
+            if (!card) {
+                egAlertDialog.open(egCore.strings.PATRON_PURGE_STAFF_BAD_BARCODE);
+            } else {
+                _purge_account(card.usr());
+            }
+        });
+    }
+
+    $scope.purge_account = function() {
+        egConfirmDialog.open(
+            egCore.strings.PATRON_PURGE_CONFIRM_TITLE, egCore.strings.PATRON_PURGE_CONFIRM,
+            {ok : function() {
+                egConfirmDialog.open(
+                    egCore.strings.PATRON_PURGE_CONFIRM_TITLE, egCore.strings.PATRON_PURGE_LAST_CHANCE,
+                    {ok : function() {
+                        egNet.request(
+                            'open-ils.actor',
+                            'open-ils.actor.user.has_work_perm_at',
+                            egCore.auth.token(), 'STAFF_LOGIN', $scope.patron().id()
+                        ).then(function(resp) {
+                            var is_staff = resp.length > 0;
+                            if (is_staff) {
+                                egPromptDialog.open(
+                                    egCore.strings.PATRON_PURGE_STAFF_PROMPT,
+                                    null, // TODO: this would be cool if it worked: egCore.auth.user().card().barcode(),
+                                    {ok : function(barcode) {_purge_account_with_destination(barcode)}}
+                                );
+                            } else {
+                                _purge_account();
+                            }
+                        });
+                    }
+                });
+            }
+        });
+    }
+
     egCore.hatch.getItem('eg.circ.patron.summary.collapse')
     .then(function(val) {$scope.collapsePatronSummary = Boolean(val)});
 }])

commit 4bc2104dd27a02bb27f35dd2363277ced845159e
Author: Jason Etheridge <jason at equinoxinitiative.org>
Date:   Thu Jun 15 11:29:59 2017 -0400

    webstaff: CSS for disabled anchor <a> elements
    
    Don't let bootstrap override the grey color (for example, when using dropdown-menu)
    
    Signed-off-by: Jason Etheridge <jason at equinoxinitiative.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/templates/staff/css/style.css.tt2 b/Open-ILS/src/templates/staff/css/style.css.tt2
index bfde500..9aa3eda 100644
--- a/Open-ILS/src/templates/staff/css/style.css.tt2
+++ b/Open-ILS/src/templates/staff/css/style.css.tt2
@@ -94,7 +94,7 @@
 a.disabled {
   pointer-events: none;
   cursor: default;
-  color: #888;
+  color: #888 !important;
 }
 
 #splash-nav .panel-body div {

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/templates/staff/circ/patron/index.tt2 |   11 +++
 Open-ILS/src/templates/staff/css/style.css.tt2     |    2 +-
 .../web/js/ui/default/staff/circ/patron/app.js     |   70 +++++++++++++++++++-
 3 files changed, 80 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list