[open-ils-commits] r18503 - branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ (senator)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Oct 27 15:09:19 EDT 2010
Author: senator
Date: 2010-10-27 15:09:14 -0400 (Wed, 27 Oct 2010)
New Revision: 18503
Modified:
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
Backport r18502 from trunk: make booking avoidable in circ service (speedup!)
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-10-27 19:06:08 UTC (rev 18502)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2010-10-27 19:09:14 UTC (rev 18503)
@@ -13,7 +13,22 @@
my %scripts;
my $script_libs;
my $legacy_script_support = 0;
+my $booking_status;
+sub determine_booking_status {
+ unless (defined $booking_status) {
+ my $ses = create OpenSRF::AppSession("router");
+ $booking_status = grep {$_ eq "open-ils.booking"} @{
+ $ses->request("opensrf.router.info.class.list")->gather(1)
+ };
+ $ses->disconnect;
+ $logger->info("booking status: " . ($booking_status ? "on" : "off"));
+ }
+
+ return $booking_status;
+}
+
+
my $MK_ENV_FLESH = {
flesh => 2,
flesh_fields => {acp => ['call_number'], acn => ['record']}
@@ -65,7 +80,6 @@
);
}
-
__PACKAGE__->register_method(
method => "run_method",
api_name => "open-ils.circ.checkout.permit",
@@ -181,12 +195,14 @@
return circ_events($circulator) if $circulator->bail_out;
+ $circulator->use_booking(determine_booking_status());
+
# --------------------------------------------------------------------------
# First, check for a booking transit, as the barcode may not be a copy
# barcode, but a resource barcode, and nothing else in here will work
# --------------------------------------------------------------------------
- if ((my $bc = $circulator->copy_barcode) && $api !~ /checkout|inspect/) { # do we have a barcode?
+ if ($circulator->use_booking && (my $bc = $circulator->copy_barcode) && $api !~ /checkout|inspect/) { # do we have a barcode?
my $resources = $circulator->editor->search_booking_resource( { barcode => $bc } ); # any resources by this barcode?
if (@$resources) { # yes!
@@ -239,19 +255,15 @@
# of the objects we need
# --------------------------------------------------------------------------
- # XXX I wanted to make this better so it might support blocking renewals
- # if a reservation has been placed on an item, but that will need more
- # design, as institutions will differ in their policy on that. In the
- # meantime making sure we're trying some kind of checkin will at least
- # keep OPAC renewals from breaking since patrons don't have VIEW_USER...
+ if ($circulator->use_booking) {
+ $circulator->is_res_checkin($circulator->is_checkin(1))
+ if $api =~ /reservation.return/ or (
+ $api =~ /checkin/ and $circulator->seems_like_reservation()
+ );
- $circulator->is_res_checkin($circulator->is_checkin(1))
- if $api =~ /reservation.return/ or (
- $api =~ /checkin/ and $circulator->seems_like_reservation()
- );
+ $circulator->is_res_checkout(1) if $api =~ /reservation.pickup/;
+ }
- $circulator->is_res_checkout(1) if $api =~ /reservation.pickup/;
-
$circulator->is_renewal(1) if $api =~ /renew/;
$circulator->is_checkin(1) if $api =~ /checkin/;
@@ -504,6 +516,7 @@
skip_permit_key
skip_deposit_fee
skip_rental_fee
+ use_booking
/;
@@ -1926,6 +1939,7 @@
my $circ = $self->circ;
my $copy = $self->copy;
+ return undef unless $self->use_booking;
my $changed;
@@ -2301,7 +2315,7 @@
if (!$self->remote_hold) {
my $potential_hold = $self->hold_capture_is_possible;
- my $potential_reservation = $self->reservation_capture_is_possible;
+ my $potential_reservation = $self->use_booking && $self->reservation_capture_is_possible;
if ($potential_hold and $potential_reservation) {
$logger->info("circulator: item could fulfill either hold or reservation");
More information about the open-ils-commits
mailing list