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

Evergreen Git git at git.evergreen-ils.org
Fri Jan 20 11:43:29 EST 2012


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  c5716450f3fd01f13ccd68006fdd577df4e7d709 (commit)
       via  ad99ea9259b3d160c1dbc59695c0affee9e48d44 (commit)
       via  7f0b1d720344bc417e24613650592dd7e262c8f8 (commit)
      from  90d0cc43bd65a7841d47feadfd78b3dc5dc4f889 (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 c5716450f3fd01f13ccd68006fdd577df4e7d709
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Tue Jan 10 22:15:31 2012 -0500

    Make Delete User failure overridable
    
    Make mrpeter's new ACTOR_USER_DELETE_OPEN_XACTS event overridable to preserve
    existing functionality (the delete user code will wipe out all transactions if
    allowed to, and will leave copy statuses as "Checked Out" if needed, which is
    okay in EG even if there aren't corresponding circ records--some libraries
    migrate data like this if the information available is sparse).
    
    So if you want to be able to do this without a super user, you'll need to create
    an ACTOR_USER_DELETE_OPEN_XACTS.override perm and assign it to perm groups
    and/or users.
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
index d2d60b2..42ff3bf 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
@@ -3580,6 +3580,12 @@ sub update_events {
 
 __PACKAGE__->register_method (
 	method		=> 'really_delete_user',
+	api_name    => 'open-ils.actor.user.delete.override',
+    signature   => q/@see open-ils.actor.user.delete/
+);
+
+__PACKAGE__->register_method (
+	method		=> 'really_delete_user',
 	api_name    => 'open-ils.actor.user.delete',
     signature   => q/
         It anonymizes all personally identifiable information in actor.usr. By calling actor.usr_purge_data() 
@@ -3606,8 +3612,12 @@ sub really_delete_user {
 
     my $user = $e->retrieve_actor_user($user_id) or return $e->die_event;
 
-    # No deleting patrons with open billings or checked out copies
-    return $e->die_event(OpenILS::Event->new('ACTOR_USER_DELETE_OPEN_XACTS')) if @$open_bills;
+    # No deleting patrons with open billings or checked out copies, unless perm-enabled override
+    if (@$open_bills) {
+        return $e->die_event(OpenILS::Event->new('ACTOR_USER_DELETE_OPEN_XACTS'))
+        unless $self->api_name =~ /override/o
+        && $e->allowed('ACTOR_USER_DELETE_OPEN_XACTS.override', $user->home_ou);
+    }
     # No deleting yourself - UI is supposed to stop you first, though.
     return $e->die_event unless $e->requestor->id != $user->id;
     return $e->die_event unless $e->allowed('DELETE_USER', $user->home_ou);
diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
index 3bd00ce..bd55f59 100644
--- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
+++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
@@ -94,7 +94,7 @@ staff.patron.display.cmd_patron_delete.dest_user.default_value=
 staff.patron.display.cmd_patron_delete.dest_user.title=Destination User
 staff.patron.display.cmd_patron_delete.dest_user.failure=Failed to retrieve destination user.  User deletion aborted.
 staff.patron.display.cmd_patron_delete.dest_user.self_reference_failure=Cannot specify the deleted user as the destination user.  User deletion aborted.
-staff.patron.display.cmd_patron_delete.open_xact=The user you have attempted to delete cannot be deleted because it has open circulations and/or unpaid bills.
+staff.patron.display.cmd_patron_delete.override_prompt=Override patron deletion failure?
 staff.patron.display.spawn_editor.editing_related_patron=Editing Related Patron
 staff.patron.display.init.retrieving_patron=Retrieving Patron...
 staff.patron.display.init.retrieving=Retrieving...
diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js
index f4da6f2..97f23c0 100644
--- a/Open-ILS/xul/staff_client/server/patron/display.js
+++ b/Open-ILS/xul/staff_client/server/patron/display.js
@@ -123,12 +123,21 @@ patron.display.prototype = {
                                         }
                                         params.push( dest_usr.id() );
                                     }
-                                    var robj = obj.network.simple_request( 'FM_AU_DELETE', params );
-                                    alert(js2JSON(robj));
+                                    var robj = obj.network.simple_request(
+                                        'FM_AU_DELETE',
+                                        params,
+                                        null,
+                                        {
+                                            'title' : document.getElementById('patronStrings').getString('staff.patron.display.cmd_patron_delete.override_prompt'),
+                                            'overridable_events' : [
+                                                2004 /* ACTOR_USER_DELETE_OPEN_XACTS */
+                                            ]
+                                        }
+                                    );
                                     if (typeof robj.ilsevent != 'undefined') {
                                         switch(Number(robj.ilsevent)) {
+                                            /* already informed via override prompt */
                                             case 2004 /* ACTOR_USER_DELETE_OPEN_XACTS */ :
-                                                alert(document.getElementById('patronStrings').getString('staff.patron.display.cmd_patron_delete.open_xact'));
                                                 return;
                                             break;
                                         }

commit ad99ea9259b3d160c1dbc59695c0affee9e48d44
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Tue Jan 10 21:54:37 2012 -0500

    whitespace
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js
index 3eba4f4..f4da6f2 100644
--- a/Open-ILS/xul/staff_client/server/patron/display.js
+++ b/Open-ILS/xul/staff_client/server/patron/display.js
@@ -123,16 +123,16 @@ patron.display.prototype = {
                                         }
                                         params.push( dest_usr.id() );
                                     }
-	                            var robj = obj.network.simple_request( 'FM_AU_DELETE', params );
-				    alert(js2JSON(robj));
-				    if (typeof robj.ilsevent != 'undefined') {
-					switch(Number(robj.ilsevent)) {
-					    case 2004 /* ACTOR_USER_DELETE_OPEN_XACTS */ :
-						alert(document.getElementById('patronStrings').getString('staff.patron.display.cmd_patron_delete.open_xact'));
-						return;
-						break;
-					}
-				    }
+                                    var robj = obj.network.simple_request( 'FM_AU_DELETE', params );
+                                    alert(js2JSON(robj));
+                                    if (typeof robj.ilsevent != 'undefined') {
+                                        switch(Number(robj.ilsevent)) {
+                                            case 2004 /* ACTOR_USER_DELETE_OPEN_XACTS */ :
+                                                alert(document.getElementById('patronStrings').getString('staff.patron.display.cmd_patron_delete.open_xact'));
+                                                return;
+                                            break;
+                                        }
+                                    }
                                     obj.refresh_all();
                                 }
                             } catch(E) {

commit 7f0b1d720344bc417e24613650592dd7e262c8f8
Author: Michael Peters <mrpeters at library.in.gov>
Date:   Wed Oct 12 11:46:12 2011 -0400

    LP872862, delete user function and open xacts
    
    Prevent deletion of a user with open circulations or unpaid bills
    Link up an error message on attempt to delete a patron with open xacts
    
    Signed-off-by: Michael Peters <mrpeters at library.in.gov>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/extras/ils_events.xml b/Open-ILS/src/extras/ils_events.xml
index 0a8b7a8..59ff421 100644
--- a/Open-ILS/src/extras/ils_events.xml
+++ b/Open-ILS/src/extras/ils_events.xml
@@ -760,6 +760,9 @@
 	<event code='2003' textcode='INTERNAL_SERVER_ERROR'>
 		<desc xml:lang="en-US">There was an internal server error</desc>
 	</event>
+        <event code='2004' textcode='ACTOR_USER_DELETE_OPEN_XACTS'>
+                <desc xml:lang="en-US">The user you have attempted to delete cannot be deleted because it has open circulations and/or unpaid bills.</desc>
+        </event>
 
     <!-- CREDIT EVENTS -->
 	<event code='4001' textcode='CREDIT_PROCESSOR_NOT_ENABLED'>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
index b1ec6d8..d2d60b2 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
@@ -3593,7 +3593,21 @@ sub really_delete_user {
     my($self, $conn, $auth, $user_id, $dest_user_id) = @_;
     my $e = new_editor(authtoken => $auth, xact => 1);
     return $e->die_event unless $e->checkauth;
+
+    # Find all unclosed billings for for user $user_id, thereby, also checking for open circs
+    my $open_bills = $e->json_query({
+        select => { mbts => ['id'] },
+        from => 'mbts',
+        where => {
+            xact_finish => { '=' => undef },
+            usr => { '=' => $user_id },
+        }
+    }) or return $e->die_event;
+
     my $user = $e->retrieve_actor_user($user_id) or return $e->die_event;
+
+    # No deleting patrons with open billings or checked out copies
+    return $e->die_event(OpenILS::Event->new('ACTOR_USER_DELETE_OPEN_XACTS')) if @$open_bills;
     # No deleting yourself - UI is supposed to stop you first, though.
     return $e->die_event unless $e->requestor->id != $user->id;
     return $e->die_event unless $e->allowed('DELETE_USER', $user->home_ou);
@@ -3602,14 +3616,13 @@ sub really_delete_user {
     my $evt = group_perm_failed($session, $e->requestor, $user);
     return $e->die_event($evt) if $evt;
     my $stat = $e->json_query(
-        {from => ['actor.usr_delete', $user_id, $dest_user_id]})->[0] 
+        {from => ['actor.usr_delete', $user_id, $dest_user_id]})->[0]
         or return $e->die_event;
     $e->commit;
     return 1;
 }
 
 
-
 __PACKAGE__->register_method (
 	method		=> 'user_payments',
 	api_name    => 'open-ils.actor.user.payments.retrieve',
diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
index f910d37..3bd00ce 100644
--- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
+++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
@@ -94,6 +94,7 @@ staff.patron.display.cmd_patron_delete.dest_user.default_value=
 staff.patron.display.cmd_patron_delete.dest_user.title=Destination User
 staff.patron.display.cmd_patron_delete.dest_user.failure=Failed to retrieve destination user.  User deletion aborted.
 staff.patron.display.cmd_patron_delete.dest_user.self_reference_failure=Cannot specify the deleted user as the destination user.  User deletion aborted.
+staff.patron.display.cmd_patron_delete.open_xact=The user you have attempted to delete cannot be deleted because it has open circulations and/or unpaid bills.
 staff.patron.display.spawn_editor.editing_related_patron=Editing Related Patron
 staff.patron.display.init.retrieving_patron=Retrieving Patron...
 staff.patron.display.init.retrieving=Retrieving...
diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js
index 2e17b8b..3eba4f4 100644
--- a/Open-ILS/xul/staff_client/server/patron/display.js
+++ b/Open-ILS/xul/staff_client/server/patron/display.js
@@ -123,7 +123,16 @@ patron.display.prototype = {
                                         }
                                         params.push( dest_usr.id() );
                                     }
-                                    obj.network.simple_request( 'FM_AU_DELETE', params );
+	                            var robj = obj.network.simple_request( 'FM_AU_DELETE', params );
+				    alert(js2JSON(robj));
+				    if (typeof robj.ilsevent != 'undefined') {
+					switch(Number(robj.ilsevent)) {
+					    case 2004 /* ACTOR_USER_DELETE_OPEN_XACTS */ :
+						alert(document.getElementById('patronStrings').getString('staff.patron.display.cmd_patron_delete.open_xact'));
+						return;
+						break;
+					}
+				    }
                                     obj.refresh_all();
                                 }
                             } catch(E) {

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

Summary of changes:
 Open-ILS/src/extras/ils_events.xml                 |    3 ++
 .../src/perlmods/lib/OpenILS/Application/Actor.pm  |   27 ++++++++++++++++++-
 .../server/locale/en-US/patron.properties          |    1 +
 Open-ILS/xul/staff_client/server/patron/display.js |   20 ++++++++++++++-
 4 files changed, 48 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list