LP#1849334 - Protect precat volumes from accidental staff edits
authorChris Sharp <csharp@georgialibraries.org>
Fri, 22 Nov 2019 20:18:57 +0000 (15:18 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Sun, 7 Nov 2021 16:48:32 +0000 (11:48 -0500)
It is possible to edit the precat volume (id = -1) in a batch
volume/copy edit in the webclient.  We assume that valid changeable
volumes have an id > 0, then allow changes.

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm

index deb7ad4..9b25b33 100644 (file)
@@ -1217,7 +1217,7 @@ sub fleshed_volume_update {
         $vol->editor($editor->requestor->id);
         $vol->edit_date('now');
 
-        if( $vol->isdeleted ) {
+        if( $vol->isdeleted && $vol->id > 0 ) {
 
             $logger->info("vol-update: deleting volume");
             return $editor->die_event unless
@@ -1236,7 +1236,7 @@ sub fleshed_volume_update {
             ($vol,$evt) = $assetcom->create_volume( $auto_merge_vols ? { all => 1} : $oargs, $editor, $vol );
             return $evt if $evt;
 
-        } elsif( $vol->ischanged ) {
+        } elsif( $vol->ischanged && $vol->id > 0 ) {
             $logger->info("vol-update: update volume");
 
             # Three cases here: