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

Evergreen Git git at git.evergreen-ils.org
Thu Aug 1 07:35:01 EDT 2019


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  18277d2154ada19acddfd8ef294f41084a8b87f2 (commit)
      from  08ac09848368388b2f4265c9580183bf9c4c200e (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 18277d2154ada19acddfd8ef294f41084a8b87f2
Author: Rogan Hamby <rogan.hamby at gmail.com>
Date:   Fri Apr 19 15:39:57 2019 -0400

    LP#1634244 - prevent bibs from being deleted when they have on-order, pending-order or new line items attached to them
    
    Signed-off-by: Rogan Hamby <rogan.hamby at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/src/extras/ils_events.xml b/Open-ILS/src/extras/ils_events.xml
index 362fff563d..2163696968 100644
--- a/Open-ILS/src/extras/ils_events.xml
+++ b/Open-ILS/src/extras/ils_events.xml
@@ -704,7 +704,9 @@
 	<event code='1881' textcode='PERMISSION_GRP_PENALTY_THRESHOLD_NOT_FOUND'>
 		<desc xml:lang='en-US'>The requested permission_grp_penalty_threshold was not found</desc>
 	</event>
-
+    <event code='1882' textcode='RECORD_REFERENCED_BY_LINEITEM'>
+        <desc xml:lang="en-US">The selected bib record has an open lineitem order referencing it.</desc>
+    </event>
 
 	<event code='1700' textcode='NON_CAT_TYPE_EXISTS'>
 		<desc xml:lang="en-US"> The non-cataloged type object already exists </desc>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
index 831633717d..4c4d977cca 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm
@@ -1296,6 +1296,17 @@ sub delete_bib_record {
     return $e->die_event unless $e->allowed('DELETE_RECORD', $e->requestor->ws_ou);
     my $vols = $e->search_asset_call_number({record=>$rec_id, deleted=>'f'});
     return OpenILS::Event->new('RECORD_NOT_EMPTY', payload=>$rec_id) if @$vols;
+    my $acq_li_count = $e->json_query({
+        select => {jub => [{column => 'id', transform => 'count'}]},
+    from => 'jub',
+    where => {
+        '+jub' => {
+                 eg_bib_id => $rec_id,
+                 state => ['new','pending-order','on-order']
+            }
+        }
+    })->[0];
+    return OpenILS::Event->new('RECORD_REFERENCED_BY_LINEITEM', payload => $rec_id) if ($acq_li_count->{id} > 0);
     my $evt = OpenILS::Application::Cat::BibCommon->delete_rec($e, $rec_id);
     if($evt) { $e->rollback; return $evt; }   
     $e->commit;

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

Summary of changes:
 Open-ILS/src/extras/ils_events.xml                   |  4 +++-
 Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm | 11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list