@@ -, +, @@ 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 @@ -616,6 +616,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PreservationNotForLoanDefaultTrainIn', '', '', 'Not for loan to apply to items removed from the preservation waiting list', 'TextArea'), ('PreservationNotForLoanWaitingListIn', '', '', 'Not for loan to apply to items added to the preservation waiting list', 'TextArea'), ('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'), +('AllowExpiredBookingTransformation','1','','Prevent transform into checkout a past booking','YesNo'), ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), ('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'), ('PrivacyPolicyConsent','','Enforced|Permissive|Disabled','Data privacy policy consent in the OPAC', 'Choice'), --- 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 %] --