[open-ils-commits] r17460 - in branches/rel_2_0/Open-ILS/src/perlmods/OpenILS: Application/Circ SIP/Transaction (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Sep 2 17:11:32 EDT 2010
Author: erickson
Date: 2010-09-02 17:11:26 -0400 (Thu, 02 Sep 2010)
New Revision: 17460
Modified:
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm
Log:
back-porting: 17400 17401 => support for overridable physical location in checkin and honoring current_location in SIP checkin code
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2010-09-02 21:10:04 UTC (rev 17459)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2010-09-02 21:11:26 UTC (rev 17460)
@@ -998,7 +998,7 @@
# ahead and renew the item instead of warning about open circulations.
my $auto_renew_intvl = $U->ou_ancestor_setting_value(
- $self->editor->requestor->ws_ou,
+ $self->circ_lib,
'circ.checkout_auto_renew_age',
$self->editor
);
@@ -1121,7 +1121,7 @@
my $results = $self->editor->json_query(
{ from => [
$dbfunc,
- $self->editor->requestor->ws_ou,
+ $self->circ_lib,
($self->is_noncat or ($self->is_precat and !$self->override and !$self->is_renewal)) ? undef : $self->copy->id,
$self->patron->id,
]
@@ -1351,7 +1351,7 @@
$CR->checkin_time('now');
$CR->checkin_scan_time('now');
- $CR->checkin_lib($self->editor->requestor->ws_ou);
+ $CR->checkin_lib($self->circ_lib);
$CR->checkin_workstation($self->editor->requestor->wsid);
$CR->checkin_staff($self->editor->requestor->id);
@@ -1613,7 +1613,7 @@
$hold->capture_time('now') unless $hold->capture_time;
$hold->fulfillment_time('now');
$hold->fulfillment_staff($e->requestor->id);
- $hold->fulfillment_lib($e->requestor->ws_ou);
+ $hold->fulfillment_lib($self->circ_lib);
return $self->bail_on_events($e->event)
unless $e->update_action_hold_request($hold);
@@ -1636,7 +1636,7 @@
return undef if $self->volume->id == OILS_PRECAT_CALL_NUMBER;
return undef unless $U->ou_ancestor_setting_value(
- $e->requestor->ws_ou, 'circ.checkout_fills_related_hold', $e);
+ $self->circ_lib, 'circ.checkout_fills_related_hold', $e);
# find the oldest unfulfilled hold that has not yet hit the holds shelf.
my $args = {
@@ -1989,7 +1989,7 @@
# due-date overlap should be determined by the location the item
# is checked out from, not the owning or circ lib of the item
- my $org = $self->editor->requestor->ws_ou;
+ my $org = $self->circ_lib;
$logger->info("circulator: circ searching for closed date overlap on lib $org".
" with an item due date of ".$circ->due_date );
@@ -2104,7 +2104,7 @@
my $circ;
my $evt;
- my $lib = $self->noncat_circ_lib || $self->editor->requestor->ws_ou;
+ my $lib = $self->noncat_circ_lib || $self->circ_lib;
my $count = $self->noncat_count || 1;
my $cotime = cleanse_ISO8601($self->checkout_time) || "";
@@ -2292,9 +2292,9 @@
" is on a remote hold's shelf, sending to $circ_lib");
}
- $logger->debug("circulator: circlib=$circ_lib, workstation=".$self->editor->requestor->ws_ou);
+ $logger->debug("circulator: circlib=$circ_lib, workstation=".$self->circ_lib);
- if( $circ_lib == $self->editor->requestor->ws_ou ) {
+ if( $circ_lib == $self->circ_lib) {
# copy is where it needs to be, either for hold or reshelving
$self->checkin_handle_precat();
@@ -2305,7 +2305,7 @@
if ($U->is_true( $self->copy->floating ) && !$self->remote_hold) { # copy is floating, stick here
$self->checkin_changed(1);
- $self->copy->circ_lib( $self->editor->requestor->ws_ou );
+ $self->copy->circ_lib( $self->circ_lib );
$self->update_copy;
} else {
my $bc = $self->copy->barcode;
@@ -2319,7 +2319,7 @@
} else { # no-op checkin
if ($U->is_true( $self->copy->floating )) { # XXX floating items still stick where they are even with no-op checkin?
$self->checkin_changed(1);
- $self->copy->circ_lib( $self->editor->requestor->ws_ou );
+ $self->copy->circ_lib( $self->circ_lib );
$self->update_copy;
}
}
@@ -2426,7 +2426,7 @@
$logger->info("circulator: we found a captured, un-fulfilled hold [".
$hold->id. "] for copy ".$self->copy->barcode);
- if( $hold->pickup_lib == $self->editor->requestor->ws_ou ) {
+ if( $hold->pickup_lib == $self->circ_lib ) {
$logger->info("circulator: hold is for here .. we're done: ".$self->copy->barcode);
return 1;
}
@@ -2459,7 +2459,7 @@
#$dest ||= (ref($copy->circ_lib)) ? $copy->circ_lib->id : $copy->circ_lib;
$logger->info("circulator: transiting copy to $dest");
- $transit->source($self->editor->requestor->ws_ou);
+ $transit->source($self->circ_lib);
$transit->dest($dest);
$transit->target_copy($copy->id);
$transit->source_send_time('now');
@@ -2548,7 +2548,7 @@
$hold->current_copy($copy->id);
$hold->capture_time('now');
$self->put_hold_on_shelf($hold)
- if $hold->pickup_lib == $self->editor->requestor->ws_ou;
+ if $hold->pickup_lib == $self->circ_lib;
# prevent DB errors caused by fetching
# holds from storage, and updating through cstore
@@ -2566,7 +2566,7 @@
return 0 if $self->bail_out;
- if( $hold->pickup_lib == $self->editor->requestor->ws_ou ) {
+ if( $hold->pickup_lib == $self->circ_lib ) {
# This hold was captured in the correct location
$copy->status(OILS_COPY_STATUS_ON_HOLDS_SHELF);
@@ -2708,7 +2708,7 @@
$logger->debug("circulator: building hold transit for ".$copy->barcode);
$trans->hold($hold->id);
- $trans->source($self->editor->requestor->ws_ou);
+ $trans->source($self->circ_lib);
$trans->dest($hold->pickup_lib);
$trans->source_send_time("now");
$trans->target_copy($copy->id);
@@ -2734,11 +2734,11 @@
my $transit = $self->transit;
- if( $transit->dest != $self->editor->requestor->ws_ou ) {
+ if( $transit->dest != $self->circ_lib ) {
# - this item is in-transit to a different location
my $tid = $transit->id;
- my $loc = $self->editor->requestor->ws_ou;
+ my $loc = $self->circ_lib;
my $dest = $transit->dest;
$logger->info("circulator: Fowarding transit on copy which is destined ".
@@ -2873,7 +2873,7 @@
$circ->checkin_scan_time('now');
$circ->checkin_staff($self->editor->requestor->id);
- $circ->checkin_lib($self->editor->requestor->ws_ou);
+ $circ->checkin_lib($self->circ_lib);
$circ->checkin_workstation($self->editor->requestor->wsid);
my $circ_lib = (ref $self->copy->circ_lib) ?
@@ -2885,7 +2885,7 @@
$circ_lib, OILS_SETTING_LOST_IMMEDIATELY_AVAILABLE, $self->editor) || 0;
- if ( (!$lost_immediately_available) && ($circ_lib != $self->editor->requestor->ws_ou) ) {
+ if ( (!$lost_immediately_available) && ($circ_lib != $self->circ_lib) ) {
if( ($stat == OILS_COPY_STATUS_LOST or $stat == OILS_COPY_STATUS_MISSING) ) {
$logger->info("circulator: not updating copy status on checkin because copy is lost/missing");
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm 2010-09-02 21:10:04 UTC (rev 17459)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkin.pm 2010-09-02 21:11:26 UTC (rev 17460)
@@ -53,6 +53,7 @@
return !$self->{item}->magnetic;
}
+my %org_sn_cache;
sub do_checkin {
my $self = shift;
my ($inst_id, $trans_date, $return_date, $current_loc, $item_props) = @_; # most unused
@@ -64,11 +65,19 @@
$inst_id ||= '';
+ my $args = {barcode => $self->{item}->id};
+ if($current_loc) {
+ my $org_id = (defined $org_sn_cache{$current_loc}) ?
+ $org_sn_cache{$current_loc} :
+ OpenILS::SIP->editor()->search_actor_org_unit({shortname => $current_loc}, {idlist => 1})->[0];
+ $org_sn_cache{$current_loc} = $org_id;
+ $args->{circ_lib} = $org_id if defined $org_id;
+ }
+
my $resp = $U->simplereq(
'open-ils.circ',
'open-ils.circ.checkin',
- $self->{authtoken},
- { barcode => $self->{item}->id }
+ $self->{authtoken}, $args
);
if ($debug) {
More information about the open-ils-commits
mailing list