Make it so that COPY_DELETE_WARNING cannot be overridden.
authorJason Stephenson <jstephenson@mvlc.org>
Tue, 22 Nov 2011 14:19:05 +0000 (09:19 -0500)
committerJason Stephenson <jstephenson@mvlc.org>
Tue, 22 Nov 2011 14:27:54 +0000 (09:27 -0500)
Also, base the throwing of COPY_DELETE_WARNING on the true or false
value of copy_status.resctrict_copy_delete.

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm
Open-ILS/xul/staff_client/server/cat/util.js
Open-ILS/xul/staff_client/server/circ/copy_status.js
Open-ILS/xul/staff_client/server/serial/manage_items.js

index 71a2020..595c638 100644 (file)
@@ -322,15 +322,10 @@ sub delete_copy {
    return $editor->event unless 
       $editor->allowed('DELETE_COPY', $class->copy_perm_org($vol, $copy));
 
-       my $stat = $U->copy_status($copy->status)->id;
-
-       unless($override) {
-               return OpenILS::Event->new('COPY_DELETE_WARNING', payload => $copy->id )
-                       if $stat == OILS_COPY_STATUS_CHECKED_OUT or
-                               $stat == OILS_COPY_STATUS_IN_TRANSIT or
-                               $stat == OILS_COPY_STATUS_ON_HOLDS_SHELF or
-                               $stat == OILS_COPY_STATUS_ILL;
-       }
+       my $stat = $U->copy_status($copy->status);
+
+        return OpenILS::Event->new('COPY_DELETE_WARNING', payload => $copy->id )
+            if $U->is_true($stat->restrict_copy_delete);
 
        $logger->info("vol-update: deleting copy ".$copy->id);
        $copy->deleted('t');
index 5719987..88df975 100644 (file)
@@ -203,7 +203,6 @@ cat.util.transfer_copies = function(params) {
                 'title' : $("catStrings").getString('staff.cat.util.transfer_copies.override_transfer_failure'),
                 'overridable_events' : [
                     1208 /* TITLE_LAST_COPY */,
-                    1227 /* COPY_DELETE_WARNING */,
                 ]
             }
         );
index 89e6287..e3bba6a 100644 (file)
@@ -618,7 +618,6 @@ circ.copy_status.prototype = {
                                         'title' : document.getElementById('circStrings').getString('staff.circ.copy_status.del_items.title'),
                                         'overridable_events' : [
                                             1208 /* TITLE_LAST_COPY */,
-                                            1227 /* COPY_DELETE_WARNING */
                                         ]
                                     }
                                 );
@@ -626,7 +625,6 @@ circ.copy_status.prototype = {
                                 if (typeof robj.ilsevent != 'undefined') {
                                     switch(Number(robj.ilsevent)) {
                                         case 1208 /* TITLE_LAST_COPY */:
-                                        case 1227 /* COPY_DELETE_WARNING */:
                                         break;
                                         default:
                                             obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.copy_status.del_items.success.error'), robj);
index 5e734ff..640ac4e 100644 (file)
@@ -283,13 +283,12 @@ serial.manage_items.prototype = {
                                             'title' : document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_items.override'),
                                             'overridable_events' : [ // FIXME: replace or delete these events
                                                 1208 /* TITLE_LAST_COPY */,
-                                                1227 /* COPY_DELETE_WARNING */,
                                             ]
                                         }
                                     );
                                     if (robj == null) throw(robj);
                                     if (typeof robj.ilsevent != 'undefined') {
-                                        if ( (robj.ilsevent != 0) && (robj.ilsevent != 1227 /* COPY_DELETE_WARNING */) && (robj.ilsevent != 1208 /* TITLE_LAST_COPY */) ) throw(robj);
+                                        if ( (robj.ilsevent != 0) && (robj.ilsevent != 1208 /* TITLE_LAST_COPY */) ) throw(robj);
                                     }
                                     obj.refresh_list(obj.selected_list);
                                 }