[open-ils-commits] r7548 - in branches/rel_1_2/Open-ILS/src: extras
perlmods/OpenILS/Application
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jul 13 17:34:28 EDT 2007
Author: erickson
Date: 2007-07-13 17:29:27 -0400 (Fri, 13 Jul 2007)
New Revision: 7548
Modified:
branches/rel_1_2/Open-ILS/src/extras/ils_events.xml
branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Log:
added bib delete method and new event for attempts to delete non-empty records
Modified: branches/rel_1_2/Open-ILS/src/extras/ils_events.xml
===================================================================
--- branches/rel_1_2/Open-ILS/src/extras/ils_events.xml 2007-07-13 15:55:39 UTC (rev 7547)
+++ branches/rel_1_2/Open-ILS/src/extras/ils_events.xml 2007-07-13 21:29:27 UTC (rev 7548)
@@ -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: branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
===================================================================
--- branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2007-07-13 15:55:39 UTC (rev 7547)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2007-07-13 21:29:27 UTC (rev 7548)
@@ -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