[open-ils-commits] r19414 - trunk/Open-ILS/src/perlmods/lib/OpenILS/Application (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Feb 9 13:22:18 EST 2011
Author: erickson
Date: 2011-02-09 13:22:14 -0500 (Wed, 09 Feb 2011)
New Revision: 19414
Modified:
trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
Log:
allow item status update if either status-specific perm is allowed or UPDATE_COPY is allowed. fire off related A/T events after the initial transaction has been committed
Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm 2011-02-09 05:34:29 UTC (rev 19413)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm 2011-02-09 18:22:14 UTC (rev 19414)
@@ -1138,9 +1138,6 @@
($copy->call_number->id == OILS_PRECAT_CALL_NUMBER) ?
$copy->circ_lib : $copy->call_number->owning_lib;
- return $e->die_event unless $e->allowed('UPDATE_COPY', $owning_lib);
-
-
my $perm = 'MARK_ITEM_MISSING';
my $stat = OILS_COPY_STATUS_MISSING;
@@ -1150,9 +1147,6 @@
my $evt = handle_mark_damaged($e, $copy, $owning_lib, $args);
return $evt if $evt;
- my $ses = OpenSRF::AppSession->create('open-ils.trigger');
- $ses->request('open-ils.trigger.event.autocreate', 'damaged', $copy, $owning_lib);
-
} elsif ( $self->api_name =~ /bindery/ ) {
$perm = 'MARK_ITEM_BINDERY';
$stat = OILS_COPY_STATUS_BINDERY;
@@ -1173,6 +1167,8 @@
$stat = OILS_COPY_STATUS_DISCARD;
}
+ # caller may proceed if either perm is allowed
+ return $e->die_event unless $e->allowed([$perm, 'UPDATE_COPY'], $owning_lib);
$copy->status($stat);
$copy->edit_date('now');
@@ -1190,6 +1186,12 @@
$e->commit;
+ if( $self->api_name =~ /damaged/ ) {
+ # now that we've committed the changes, create related A/T events
+ my $ses = OpenSRF::AppSession->create('open-ils.trigger');
+ $ses->request('open-ils.trigger.event.autocreate', 'damaged', $copy, $owning_lib);
+ }
+
$logger->debug("resetting holds that target the marked copy");
OpenILS::Application::Circ::Holds->_reset_hold($e->requestor, $_) for @$holds;
More information about the open-ils-commits
mailing list