[open-ils-commits] r19417 - branches/rel_1_6_2/Open-ILS/src/perlmods/OpenILS/Application (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Feb 9 13:27:37 EST 2011
Author: erickson
Date: 2011-02-09 13:27:33 -0500 (Wed, 09 Feb 2011)
New Revision: 19417
Modified:
branches/rel_1_6_2/Open-ILS/src/perlmods/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: branches/rel_1_6_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- branches/rel_1_6_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2011-02-09 18:26:06 UTC (rev 19416)
+++ branches/rel_1_6_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2011-02-09 18:27:33 UTC (rev 19417)
@@ -973,9 +973,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;
@@ -985,9 +982,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;
@@ -1008,6 +1002,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');
@@ -1025,6 +1021,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