Bugzilla – Attachment 168159 Details for
Bug 37201
Add a syspref to allow or not a checkout if a expired booking exists for the same patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37201: Allow or not a checkout if a expired booking exists
Bug-37201-Allow-or-not-a-checkout-if-a-expired-boo.patch (text/plain), 7.08 KB, created by
Thibaud Guillot (thibaud_g)
on 2024-06-26 15:13:26 UTC
(
hide
)
Description:
Bug 37201: Allow or not a checkout if a expired booking exists
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2024-06-26 15:13:26 UTC
Size:
7.08 KB
patch
obsolete
>From 178cf6df3df1dbbdb94e8a7efa9d77babda593d8 Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Wed, 26 Jun 2024 17:07:00 +0200 >Subject: [PATCH] Bug 37201: Allow or not a checkout if a expired booking > exists >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Test plan: > >1) Apply this patch and run updatedatabase >2) Set a booking on a specific item >3) In database you can update the value to set a past date for booking > end for example. >4) Go system preferences and search 'AllowExpiredBookingTransformation' >5) When you "Don\'t allow" normally you will find a pop up to confirm > the checkout when you choose to 'Transform to checkout' from bookings > list view. > >Sponsored by: Association de Gestion des Ã…uvres Sociales d'Inria (AGOS) >--- > 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 > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index ebdc4334d70..607864a3ee5 100644 >--- a/C4/Circulation.pm >+++ b/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 ) = >diff --git a/circ/circulation.pl b/circ/circulation.pl >index c67569f647d..1ba9b45716b 100755 >--- a/circ/circulation.pl >+++ b/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 { >diff --git a/installer/data/mysql/atomicupdate/Bug_37201_allow-expired-booking-to-checkout.pl b/installer/data/mysql/atomicupdate/Bug_37201_allow-expired-booking-to-checkout.pl >new file mode 100755 >index 00000000000..ca287a79d03 >--- /dev/null >+++ b/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'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index dffaaadd49a..7f098e19669 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/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'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index e0e0ead4892..143d9a20ae6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/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 >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 4689f6cdd1a..b1d92959ced 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/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 %] > </li> > [% END %] >+ [% IF ( BOOKED_TOO_LATE ) %] >+ <li class="needsconfirm booked_too_late"> >+ Booking ended on [% BOOKED_TOO_LATE.end_date | $KohaDates %] would you force the checkout ? >+ </li> >+ [% END %] > </ul> > > [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %] >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37201
:
168159
|
168227
|
170192