[open-ils-commits] r18874 - in branches/rel_1_6_1/Open-ILS: src/perlmods/OpenILS/Application src/perlmods/OpenILS/Application/Circ src/perlmods/OpenILS/Application/Storage/Publisher web/templates/default/conify/global/booking (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Nov 30 10:53:21 EST 2010


Author: senator
Date: 2010-11-30 10:53:18 -0500 (Tue, 30 Nov 2010)
New Revision: 18874

Modified:
   branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm
   branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
   branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/money.pm
   branches/rel_1_6_1/Open-ILS/web/templates/default/conify/global/booking/resource_type.tt2
Log:
Backport some booking related commits from trunk.

r17563: Booking: stop the "new resource type" dialog from executing a naughty
query

The dialog will no longer offer a field for selecting a bibliographic record,
but then again you wouldn't need it.  Bibliographically-based resource types
can be set up through a context menu option in the staff OPAC browser, whereas
this interface is only suited to non-bib-based resource types, like meeting
rooms, laptops, etc.
--
r17980: more transaction cleanups
--
r18502: Booking: make the circ module avoid booking code if the booking service
isn't up

Previously, it was not possible to turn the booking service off and have
working circ.  Now you should be able to turn it off if you don't need it.
--
r18514: If we already know we're not using booking, skip a redundant and
expensive test for the possibility of capturing a hold. We're just going to
try actually doing it a little farther down.
--
r18580: Patch from Steve Callender to address a booking-related collection
agency reporting problem


Modified: branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm
===================================================================
--- branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm	2010-11-30 15:47:40 UTC (rev 18873)
+++ branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm	2010-11-30 15:53:18 UTC (rev 18874)
@@ -1291,12 +1291,13 @@
     }) or return $e->die_event;
 
     if (@$rows < 1) {
+        $e->rollback;
         return $rows;
     } else {
         # More than one result might be possible, but we don't want to return
         # more than one at this time.
         my $id = $rows->[0]->{"id"};
-        return $e->retrieve_booking_reservation([
+        my $resp =$e->retrieve_booking_reservation([
             $id, {
                 "flesh" => 2,
                 "flesh_fields" => {
@@ -1305,6 +1306,8 @@
                 }
             }
         ]) or $e->die_event;
+        $e->rollback;
+        return $resp;
     }
 }
 

Modified: branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2010-11-30 15:47:40 UTC (rev 18873)
+++ branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2010-11-30 15:53:18 UTC (rev 18874)
@@ -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",
@@ -180,12 +194,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!
 
@@ -238,19 +254,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/;
 
@@ -490,6 +502,7 @@
     rental_billing
     capture
     noop
+    use_booking
 /;
 
 
@@ -1748,6 +1761,7 @@
     my $circ = $self->circ;
     my $copy = $self->copy;
 
+    return undef unless $self->use_booking;
 
     my $changed;
 
@@ -2087,23 +2101,27 @@
 
         my $needed_for_something = 0; # formerly "needed_for_hold"
         if (!$self->remote_hold) {
-            my $potential_hold = $self->hold_capture_is_possible;
-            my $potential_reservation = $self->reservation_capture_is_possible;
+            if ($self->use_booking) {
+                my $potential_hold = $self->hold_capture_is_possible;
+                my $potential_reservation = $self->reservation_capture_is_possible;
 
-            if ($potential_hold and $potential_reservation) {
-                $logger->info("circulator: item could fulfill either hold or reservation");
-                $self->push_events(new OpenILS::Event(
-                    "HOLD_RESERVATION_CONFLICT",
-                    "hold" => $potential_hold,
-                    "reservation" => $potential_reservation
-                ));
-                return if $self->bail_out;
-            } elsif ($potential_hold) {
-                $needed_for_something =
-                    $self->attempt_checkin_hold_capture;
-            } elsif ($potential_reservation) {
-                $needed_for_something =
-                    $self->attempt_checkin_reservation_capture;
+                if ($potential_hold and $potential_reservation) {
+                    $logger->info("circulator: item could fulfill either hold or reservation");
+                    $self->push_events(new OpenILS::Event(
+                        "HOLD_RESERVATION_CONFLICT",
+                        "hold" => $potential_hold,
+                        "reservation" => $potential_reservation
+                    ));
+                    return if $self->bail_out;
+                } elsif ($potential_hold) {
+                    $needed_for_something =
+                        $self->attempt_checkin_hold_capture;
+                } elsif ($potential_reservation) {
+                    $needed_for_something =
+                        $self->attempt_checkin_reservation_capture;
+                }
+            } else {
+                $needed_for_something = $self->attempt_checkin_hold_capture;
             }
         }
         return if $self->bail_out;

Modified: branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/money.pm
===================================================================
--- branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/money.pm	2010-11-30 15:47:40 UTC (rev 18873)
+++ branches/rel_1_6_1/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/money.pm	2010-11-30 15:53:18 UTC (rev 18874)
@@ -199,7 +199,7 @@
 		(my $real_sql = $SQL) =~ s/XX/$o_txt/gsm;
 
 		my $sth = money::collections_tracker->db_Main->prepare($real_sql);
-		$sth->execute( $org->id, $age, $org->id, $age, $amount );
+		$sth->execute( $org->id, $age, $org->id, $age, $org->id, $age, $amount );
 
 		while (my $row = $sth->fetchrow_hashref) {
 			#$row->{usr} = actor::user->retrieve($row->{usr})->to_fieldmapper;

Modified: branches/rel_1_6_1/Open-ILS/web/templates/default/conify/global/booking/resource_type.tt2
===================================================================
--- branches/rel_1_6_1/Open-ILS/web/templates/default/conify/global/booking/resource_type.tt2	2010-11-30 15:47:40 UTC (rev 18873)
+++ branches/rel_1_6_1/Open-ILS/web/templates/default/conify/global/booking/resource_type.tt2	2010-11-30 15:53:18 UTC (rev 18874)
@@ -23,6 +23,7 @@
             fieldOrder="['name', 'fine_interval', 'fine_amount',
                 'owner', 'catalog_item', 'transferable']"
             suppressFields="['record']"
+            suppressEditFields="['record']"
             query="{id: '*'}"
             fmClass='brt'
             showPaginator='true'



More information about the open-ils-commits mailing list