@@ -, +, @@ exists end for example. the checkout when you choose to 'Transform to checkout' from bookings list view. --- C4/Circulation.pm | 9 +++++++++ circ/circulation.pl | 1 + ...ug_37201_allow-expired-booking-to-checkout.pl | 16 ++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../modules/admin/preferences/circulation.pref | 6 ++++++ .../prog/en/modules/circ/circulation.tt | 5 +++++ 6 files changed, 38 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/Bug_37201_allow-expired-booking-to-checkout.pl --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -781,6 +781,7 @@ sub CanBookBeIssued { my $onsite_checkout = $params->{onsite_checkout} || 0; my $override_high_holds = $params->{override_high_holds} || 0; + my $booking_id = $params->{booking_id}; my $item_object = $params->{item} // Koha::Items->find( { barcode => $barcode } ); @@ -1265,6 +1266,14 @@ sub CanBookBeIssued { } } + if ( $booking_id && !(C4::Context->preference('AllowExpiredBookingTransformation')) ) { + my $booking = Koha::Bookings->find( { booking_id => $booking_id } ); + my $booking_end = dt_from_string( $booking->end_date ); + if ( $booking->patron_id == $patron->borrowernumber && $now > $booking_end ) { + $needsconfirmation{'BOOKED_TOO_LATE'} = $booking; + } + } + ## CHECK AGE RESTRICTION my $agerestriction = $biblioitem->agerestriction; my ( $restriction_age, $daysToAgeRestriction ) = --- a/circ/circulation.pl +++ a/circ/circulation.pl @@ -341,6 +341,7 @@ if (@$barcodes && $op eq 'cud-checkout') { { onsite_checkout => $onsite_checkout, override_high_holds => $override_high_holds || $override_high_holds_tmp || 0, + booking_id => $booking_id, } ); } catch { --- a/installer/data/mysql/atomicupdate/Bug_37201_allow-expired-booking-to-checkout.pl +++ a/installer/data/mysql/atomicupdate/Bug_37201_allow-expired-booking-to-checkout.pl @@ -0,0 +1,16 @@ +use Modern::Perl; + +return { + bug_number => "37201", + description => "Add syspref AllowExpiredBookingTransformation", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('AllowExpiredBookingTransformation', 1, '', 'Prevent transform into checkout a past booking', 'YesNo'); + }); + + say $out "Added new system preference 'AllowExpiredBookingTransformation'"; + }, +}; --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -28,6 +28,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AllFinesNeedOverride','1','0','If on, staff will be asked to override every fine, even if it is below noissuescharge.','YesNo'), ('AllowAllMessageDeletion','0','','Allow any Library to delete any message','YesNo'), ('AllowCheckoutNotes', '0', NULL, 'Allow patrons to submit notes about checked out items.','YesNo'), +('AllowExpiredBookingTransformation','1','','Prevent transform into checkout a past booking','YesNo'), ('AllowFineOverride','0','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','YesNo'), ('AllowHoldDateInFuture','0','','If set a date field is displayed on the Hold screen of the Staff Interface, allowing the hold date to be set in the future.','YesNo'), ('AllowHoldItemTypeSelection','0','','If enabled, patrons and staff will be able to select the itemtype when placing a hold','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -615,6 +615,12 @@ Circulation: open: "extend the loan period and set the checkout to be due at the library's open time." close: "shorten the loan period and set the checkout to be due at the library's close time." ignore: "do not consider the library's opening hours." + - + - pref: AllowExpiredBookingTransformation + choices: + 1: Allow + 0: "Don't allow" + - patrons to transform a past booking into checkout. Checkin policy: - - pref: TrapHoldsOnOrder --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -275,6 +275,11 @@ Patron has this item booked for checkout on [% BOOKED_EARLY.start_date | $KohaDates %] [% END %] + [% IF ( BOOKED_TOO_LATE ) %] +
  • + Booking ended on [% BOOKED_TOO_LATE.end_date | $KohaDates %] would you force the checkout ? +
  • + [% END %] [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %] --