From: senator Date: Wed, 14 Apr 2010 18:54:15 +0000 (+0000) Subject: Booking workflow fix for reservation op-capture X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ac23c9773b0bccc08e4a8b2603dcf33d33cc3031;p=working%2FEvergreen.git 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. git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@16238 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm b/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm index 91f5ddba76..65e5e43a7e 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Booking.pm @@ -778,22 +778,37 @@ sub could_capture { 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;