[open-ils-commits] r10815 - in trunk/Open-ILS/src: extras
perlmods/OpenILS/Application/Circ
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Oct 10 12:36:48 EDT 2008
Author: erickson
Date: 2008-10-10 12:36:44 -0400 (Fri, 10 Oct 2008)
New Revision: 10815
Modified:
trunk/Open-ILS/src/extras/ils_events.xml
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
added verify hold capture (and event) and no-op checkin flags
Modified: trunk/Open-ILS/src/extras/ils_events.xml
===================================================================
--- trunk/Open-ILS/src/extras/ils_events.xml 2008-10-10 13:25:25 UTC (rev 10814)
+++ trunk/Open-ILS/src/extras/ils_events.xml 2008-10-10 16:36:44 UTC (rev 10815)
@@ -713,11 +713,12 @@
should be specified within the event with a 'location' key
</desc>
</event>
-
-
<event code='7018' textcode='COPY_MARKED_LOST'>
<desc xml:lang="en-US">The requested item is already marked as lost</desc>
</event>
+ <event code='7019' textcode='HOLD_CAPTURE_DELAYED'>
+ <desc xml:lang="en-US">Hold capture was delayed for this item</desc>
+ </event>
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2008-10-10 13:25:25 UTC (rev 10814)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2008-10-10 16:36:44 UTC (rev 10815)
@@ -391,6 +391,8 @@
is_rental
deposit_billing
rental_billing
+ capture
+ noop
/;
@@ -444,6 +446,8 @@
$self->desk_renewal(1) unless
$self->opac_renewal or $self->phone_renewal;
+ $self->capture('') unless $self->capture;
+
return $self;
}
@@ -1691,37 +1695,39 @@
# this copy can fulfill a hold or needs to be routed to a different location
# ------------------------------------------------------------------------------
- if( !$self->remote_hold and $self->attempt_checkin_hold_capture() ) {
+ unless($self->noop) { # no-op checkins to not capture holds or put items into transit
+
+ my $needed_for_hold = (!$self->remote_hold and $self->attempt_checkin_hold_capture());
return if $self->bail_out;
-
- } else { # not needed for a hold
-
- my $circ_lib = (ref $self->copy->circ_lib) ?
- $self->copy->circ_lib->id : $self->copy->circ_lib;
-
- if( $self->remote_hold ) {
- $circ_lib = $self->remote_hold->pickup_lib;
- $logger->warn("circulator: Copy ".$self->copy->barcode.
- " is on a remote hold's shelf, sending to $circ_lib");
+
+ unless($needed_for_hold) {
+ my $circ_lib = (ref $self->copy->circ_lib) ?
+ $self->copy->circ_lib->id : $self->copy->circ_lib;
+
+ if( $self->remote_hold ) {
+ $circ_lib = $self->remote_hold->pickup_lib;
+ $logger->warn("circulator: Copy ".$self->copy->barcode.
+ " is on a remote hold's shelf, sending to $circ_lib");
+ }
+
+ $logger->debug("circulator: circlib=$circ_lib, workstation=".$self->editor->requestor->ws_ou);
+
+ if( $circ_lib == $self->editor->requestor->ws_ou ) {
+
+ $self->checkin_handle_precat();
+ return if $self->bail_out;
+
+ } else {
+
+ my $bc = $self->copy->barcode;
+ $logger->info("circulator: copy $bc at the wrong location, sending to $circ_lib");
+ $self->checkin_build_copy_transit($circ_lib);
+ return if $self->bail_out;
+ $self->push_events(OpenILS::Event->new('ROUTE_ITEM', org => $circ_lib));
+ }
}
+ }
- $logger->debug("circulator: circlib=$circ_lib, workstation=".$self->editor->requestor->ws_ou);
-
- if( $circ_lib == $self->editor->requestor->ws_ou ) {
-
- $self->checkin_handle_precat();
- return if $self->bail_out;
-
- } else {
-
- my $bc = $self->copy->barcode;
- $logger->info("circulator: copy $bc at the wrong location, sending to $circ_lib");
- $self->checkin_build_copy_transit($circ_lib);
- return if $self->bail_out;
- $self->push_events(OpenILS::Event->new('ROUTE_ITEM', org => $circ_lib));
- }
- }
-
$self->reshelve_copy;
return if $self->bail_out;
@@ -1869,10 +1875,15 @@
}
+# returns true if the item was used (or may potentially be used
+# in subsequent calls) to capture a hold.
sub attempt_checkin_hold_capture {
my $self = shift;
my $copy = $self->copy;
+ # we've been explicitly told not to capture any holds
+ return 0 if $self->capture eq 'nocapture';
+
# See if this copy can fulfill any holds
my ($hold, undef, $retarget) = $holdcode->find_nearest_permitted_hold(
$self->editor, $copy, $self->editor->requestor );
@@ -1880,9 +1891,18 @@
if(!$hold) {
$logger->debug("circulator: no potential permitted".
"holds found for copy ".$copy->barcode);
- return undef;
+ return 0;
}
+ if($self->capture ne 'capture') {
+ # see if this item is in a hold-capture-delay location
+ my $location = $self->editor->retrieve_asset_copy_location($self->copy->location);
+ if($U->is_true($location->hold_verify)) {
+ $self->bail_on_events(OpenILS::Event->new('HOLD_CAPTURE_DELAYED'));
+ return 1;
+ }
+ }
+
$self->retarget($retarget);
$logger->info("circulator: found permitted hold ".
@@ -1905,12 +1925,12 @@
$self->hold($hold);
$self->checkin_changed(1);
- return 1 if $self->bail_out;
+ return 0 if $self->bail_out;
if( $hold->pickup_lib == $self->editor->requestor->ws_ou ) {
# This hold was captured in the correct location
- $copy->status(OILS_COPY_STATUS_ON_HOLDS_SHELF);
+ $copy->status(OILS_COPY_STATUS_ON_HOLDS_SHELF);
$self->push_events(OpenILS::Event->new('SUCCESS'));
#$self->do_hold_notify($hold->id);
@@ -1921,10 +1941,9 @@
# Hold needs to be picked up elsewhere. Build a hold
# transit and route the item.
$self->checkin_build_hold_transit();
- $copy->status(OILS_COPY_STATUS_IN_TRANSIT);
- return 1 if $self->bail_out;
- $self->push_events(
- OpenILS::Event->new('ROUTE_ITEM', org => $hold->pickup_lib));
+ $copy->status(OILS_COPY_STATUS_IN_TRANSIT);
+ return 0 if $self->bail_out;
+ $self->push_events(OpenILS::Event->new('ROUTE_ITEM', org => $hold->pickup_lib));
}
# make sure we save the copy status
More information about the open-ils-commits
mailing list