prompt for destination user (for transfer of misc staff junk) if deleting a staff...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 30 Sep 2009 18:40:03 +0000 (18:40 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 30 Sep 2009 18:40:03 +0000 (18:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14229 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
Open-ILS/xul/staff_client/server/patron/display.js

index 7967cba..6c16da6 100644 (file)
@@ -70,6 +70,11 @@ staff.patron.display.cmd_patron_delete.dialog.cancel=Cancel Deletion
 staff.patron.display.cmd_patron_delete.dialog.okay=Delete Account
 staff.patron.display.cmd_patron_delete.deny_deletion_of_super_user=You may not delete a super user through this interface.
 staff.patron.display.cmd_patron_delete.deny_deletion_of_self=You may not delete your own account.
+staff.patron.display.cmd_patron_delete.dest_user.prompt=The user you're attempting to delete has STAFF_LOGIN priviledges.  Please enter the barcode for a destination user to receive the deleted user's miscellaneous staff artifacts (reports, etc.):
+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.spawn_editor.editing_related_patron=Editing Related Patron
 staff.patron.display.init.retrieving_patron=Retrieving Patron...
 staff.patron.display.init.retrieving=Retrieving...
index 8113bca..b2f1d2e 100644 (file)
@@ -142,12 +142,30 @@ patron.display.prototype = {
                                 );
                                 //alert('rv = ' + rv + ' (' + typeof rv + ')');
                                 if (rv == 0) {
-                                    obj.network.simple_request(
-                                        'FM_AU_DELETE',
-                                        [ ses(), obj.patron.id() ]
-                                    );
+                                    var params = [ ses(), obj.patron.id() ];
+                                    var staff_check = obj.network.simple_request('PERM_RETRIEVE_WORK_OU',[ ses(), 'STAFF_LOGIN', obj.patron.id() ]);
+                                    if (staff_check.length > 0) {
+                                        var dest_barcode = window.prompt(
+                                            $("patronStrings").getString('staff.patron.display.cmd_patron_delete.dest_user.prompt'),
+                                            $("patronStrings").getString('staff.patron.display.cmd_patron_delete.dest_user.default_value'),
+                                            $("patronStrings").getString('staff.patron.display.cmd_patron_delete.dest_user.title')
+                                        );
+                                        if (!dest_barcode) return;
+                                        JSAN.use('patron.util');
+                                        var dest_usr = patron.util.retrieve_fleshed_au_via_barcode( ses(), dest_barcode );
+                                        if (typeof dest_usr.ilsevent != 'undefined') {
+                                            alert( $("patronStrings").getString('staff.patron.display.cmd_patron_delete.dest_user.failure') );
+                                            return;
+                                        }
+                                        if (dest_usr.id() == obj.patron.id()) {
+                                            alert( $("patronStrings").getString('staff.patron.display.cmd_patron_delete.dest_user.self_reference_failure') );
+                                            return;
+                                        }
+                                        params.push( dest_usr.id() );
+                                    }
+                                    obj.network.simple_request( 'FM_AU_DELETE', params );
+                                    obj.refresh_all();
                                 }
-                                obj.refresh_all();
                             } catch(E) {
                                 obj.error.standard_unexpected_error_alert('Error in server/patron/display.js -> cmd_patron_delete: ',E);
                             }