From e8f87a10de300a40c4d0bc9cd7820f99b59c8c4b Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Thu, 6 Mar 2025 18:45:35 +0100 Subject: [PATCH] Bug 39267: Specified due date remains for checkouts even when removing unchecking remember for session To test: 1) Checkout an item for a patron, specify a due date and check remember for session. 2) Remove the due date, uncheck remember for session and checkout another item. 3) The previously specified due date is filled in again, while remember for session remains unchecked. 4) Apply patch 5) Repeat the steps above, in step 3) due date should now remain empty. Sponsored-by: Gothenburg University Libarary --- circ/circulation.pl | 51 ++++++++++--------- .../prog/en/modules/circ/circulation.tt | 2 +- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 968470e6f17..71f852f0184 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -177,12 +177,38 @@ for my $barcode (@$barcodes) { $barcode = barcodedecode($barcode) if $barcode; } +# Check if stickyduedate is turned off +if (@$barcodes) { + + # was stickyduedate loaded from session? + if ( $session->param('stickyduedate') && !$query->param("stickyduedate") ) { + $session->clear('stickyduedate'); + } + + $session->param( 'auto_renew', scalar $query->param('auto_renew') ); + +} else { + $session->clear('auto_renew'); +} + my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate'); my $duedatespec = $query->param('duedatespec') || $session->param('stickyduedate'); my $restoreduedatespec = $query->param('restoreduedatespec') || $duedatespec || $session->param('stickyduedate'); if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) { undef $restoreduedatespec; } + +# Restore date if changed by holds and/or save stickyduedate to session +if ( $restoreduedatespec || $stickyduedate ) { + $duedatespec = $restoreduedatespec || $duedatespec; + + if ($stickyduedate) { + $session->param( 'stickyduedate', $duedatespec ); + } +} elsif ( defined($duedatespec) && !defined($restoreduedatespec) ) { + undef $duedatespec; +} + my $issueconfirmed = $query->param('issueconfirmed'); my $cancelreserve = $query->param('cancelreserve'); my $cancel_recall = $query->param('cancel_recall'); @@ -190,20 +216,6 @@ my $recall_id = $query->param('recall_id'); my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice my $charges = $query->param('charges') || q{}; -# Check if stickyduedate is turned off -if (@$barcodes) { - - # was stickyduedate loaded from session? - if ( $stickyduedate && !$query->param("stickyduedate") ) { - $session->clear('stickyduedate'); - $stickyduedate = $query->param('stickyduedate'); - $duedatespec = $query->param('duedatespec'); - } - $session->param( 'auto_renew', scalar $query->param('auto_renew') ); -} else { - $session->clear('auto_renew'); -} - $template->param( auto_renew => $session->param('auto_renew') ); my ( $datedue, $invalidduedate ); @@ -733,17 +745,6 @@ if ($patron) { ); } -# Restore date if changed by holds and/or save stickyduedate to session -if ( $restoreduedatespec || $stickyduedate ) { - $duedatespec = $restoreduedatespec || $duedatespec; - - if ($stickyduedate) { - $session->param( 'stickyduedate', $duedatespec ); - } -} elsif ( defined($duedatespec) && !defined($restoreduedatespec) ) { - undef $duedatespec; -} - $template->param( borrowernumber => $borrowernumber, branch => $branch, 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 a3c9d73f1bb..2df6c586074 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -231,7 +231,7 @@ [% END %] [% IF HIGHHOLDS %] -
  • High demand item. Loan period shortened to [% HIGHHOLDS.duration | html %] days (due [% HIGHHOLDS.returndate | $KohaDates %]). Check out anyway?
  • +
  • High demand item. WHY THE FUCK IS THIS SHSHOW. Loan period shortened to [% HIGHHOLDS.duration | html %] days (due [% HIGHHOLDS.returndate | $KohaDates %]). Check out anyway?
  • [% END %] [% IF PREVISSUE %] -- 2.48.1