From 92a1a41127d513658b69d5f6bf85c095ca4ff8a8 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Fri, 22 Nov 2019 15:18:57 -0500 Subject: [PATCH] LP#1849334 - Protect precat volumes from accidental staff edits 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 --- Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm index 36376a0948..260f8a094a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm @@ -1188,7 +1188,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 @@ -1207,7 +1207,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: -- 2.11.0