[open-ils-commits] r9795 -
trunk/Open-ILS/src/perlmods/OpenILS/Application
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jun 9 15:39:53 EDT 2008
Author: erickson
Date: 2008-06-09 15:39:50 -0400 (Mon, 09 Jun 2008)
New Revision: 9795
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Log:
added support for setting an org unit setting to disable auto-record deletion when the last copy for the record is deleted. also support for enabling an event to be returned when the last copy for a record is deleted
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2008-06-09 19:39:10 UTC (rev 9794)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm 2008-06-09 19:39:50 UTC (rev 9795)
@@ -1053,26 +1053,30 @@
sub remove_empty_objects {
my( $editor, $override, $vol ) = @_;
+
+ my $koe = $U->ou_ancestor_setting_value(
+ $editor->requestor->ws_ou, 'cat.bib.keep_on_empty', $editor);
+ my $aoe = $U->ou_ancestor_setting_value(
+ $editor->requestor->ws_ou, 'cat.bib.alert_on_empty', $editor);
+
if( title_is_empty($editor, $vol->record) ) {
- # disable the TITLE_LAST_COPY event for now
- # if( $override ) {
- if( 1 ) {
+ # delete this volume if it's not already marked as deleted
+ unless( $U->is_true($vol->deleted) || $vol->isdeleted ) {
+ $vol->deleted('t');
+ $vol->editor($editor->requestor->id);
+ $vol->edit_date('now');
+ $editor->update_asset_call_number($vol) or return $editor->event;
+ }
- # delete this volume if it's not already marked as deleted
- unless( $U->is_true($vol->deleted) || $vol->isdeleted ) {
- $vol->deleted('t');
- $vol->editor($editor->requestor->id);
- $vol->edit_date('now');
- $editor->update_asset_call_number($vol) or return $editor->event;
- }
+ unless($koe) {
+ # delete the bib record if the keep-on-empty setting is not set
+ my $evt = delete_rec($editor, $vol->record);
+ return $evt if $evt;
+ }
- my $evt = delete_rec($editor, $vol->record);
- return $evt if $evt;
-
- } else {
- return OpenILS::Event->new('TITLE_LAST_COPY', payload => $vol->record );
- }
+ # return the empty alert if the alert-on-empty setting is set
+ return OpenILS::Event->new('TITLE_LAST_COPY', payload => $vol->record ) if $aoe;
}
return undef;
More information about the open-ils-commits
mailing list