[open-ils-commits] r7549 - in trunk/Open-ILS/src: extras perlmods/OpenILS/Application

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jul 13 17:41:47 EDT 2007


Author: erickson
Date: 2007-07-13 17:36:45 -0400 (Fri, 13 Jul 2007)
New Revision: 7549

Modified:
   trunk/Open-ILS/src/extras/ils_events.xml
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Log:
forward-porting record delete method and event

Modified: trunk/Open-ILS/src/extras/ils_events.xml
===================================================================
--- trunk/Open-ILS/src/extras/ils_events.xml	2007-07-13 21:29:27 UTC (rev 7548)
+++ trunk/Open-ILS/src/extras/ils_events.xml	2007-07-13 21:36:45 UTC (rev 7549)
@@ -150,6 +150,9 @@
 		<desc xml:lang="en-US">The saved item has been edited by another user</desc>
 	</event>
 
+	<event code='1231' textcode='RECORD_NOT_EMPTY'>
+		<desc xml:lang="en-US">The selected bib record has volumes attached</desc>
+	</event>
 
 
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm	2007-07-13 21:29:27 UTC (rev 7548)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm	2007-07-13 21:36:45 UTC (rev 7549)
@@ -1054,6 +1054,25 @@
 	return undef;
 }
 
+
+__PACKAGE__->register_method (
+	method => 'delete_bib_record',
+	api_name => 'open-ils.cat.biblio.record_entry.delete');
+
+sub delete_bib_record {
+    my($self, $conn, $auth, $rec_id) = @_;
+    my $e = new_editor(xact=>1, authtoken=>$auth);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('DELETE_RECORD');
+    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 $evt = delete_rec($e, $rec_id);
+    if($evt) { $e->rollback; return $evt; }   
+    $e->commit;
+    return 1;
+}
+
+
 # marks a record as deleted
 sub delete_rec {
    my( $editor, $rec_id ) = @_;



More information about the open-ils-commits mailing list