[open-ils-commits] r16238 - branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Apr 14 14:54:20 EDT 2010


Author: senator
Date: 2010-04-14 14:54:15 -0400 (Wed, 14 Apr 2010)
New Revision: 16238

Modified:
   branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm
Log:
Booking workflow fix for reservation op-capture

Only capture items for reservation upon checkin if the reservation in question
is starting within the interval defined by the elbow room value.  Elbow room
value can be controller per booking resource type, or if none is set, an
org unit setting defines the elbow room interval.  This allows new
circulations to happen more easily between the time a reservation is made and
the time a reservation actually starts.


Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm	2010-04-14 18:48:15 UTC (rev 16237)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm	2010-04-14 18:54:15 UTC (rev 16238)
@@ -778,22 +778,37 @@
     return $e->die_event unless $e->checkauth;
     return $e->die_event unless $e->allowed("CAPTURE_RESERVATION");
 
+    my $dt_parser = new DateTime::Format::ISO8601;
+    my $now = now DateTime; # sic
     my $res = get_uncaptured_bresv_for_brsrc($e, {"barcode" => $barcode});
+
     if ($res and keys %$res) {
         my $id;
         while ((undef, $id) = each %$res) {
-            $client->respond(
-                $e->retrieve_booking_reservation([
-                    $id, {
-                        "flesh" => 1, "flesh_fields" => {
-                            "bresv" => [qw(
-                                usr target_resource_type
-                                target_resource current_resource
-                            )]
-                        }
+            my $bresv = $e->retrieve_booking_reservation([
+                $id, {
+                    "flesh" => 1, "flesh_fields" => {
+                        "bresv" => [qw(
+                            usr target_resource_type
+                            target_resource current_resource
+                        )]
                     }
-                ])
+                }
+            ]);
+            my $elbow_room = interval_to_seconds(
+                $bresv->target_resource_type->elbow_room ||
+                $U->ou_ancestor_setting_value(
+                    $bresv->pickup_lib,
+                    "circ.booking_reservation.default_elbow_room"
+                ) ||
+                "0 seconds"
             );
+            my $start_time = $dt_parser->parse_datetime(
+                clense_ISO8601($bresv->start_time)
+            );
+
+            $client->respond($bresv) if
+                $now >= $start_time->subtract("seconds" => $elbow_room);
         }
     }
     $e->disconnect;



More information about the open-ils-commits mailing list