Bugzilla – Attachment 125796 Details for
Bug 15261
Verify if checkout or hold request periods overlap with existing holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15261: Always check preference PreventCheckoutOnSameReservePeriod first
Bug-15261-Always-check-preference-PreventCheckoutO.patch (text/plain), 5.61 KB, created by
Alex Arnaud
on 2021-10-06 12:32:53 UTC
(
hide
)
Description:
Bug 15261: Always check preference PreventCheckoutOnSameReservePeriod first
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2021-10-06 12:32:53 UTC
Size:
5.61 KB
patch
obsolete
>From f49f789512d681e44e370a67d12a9094df1e2104 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Mon, 2 Aug 2021 19:19:12 -1000 >Subject: [PATCH] Bug 15261: Always check preference > PreventCheckoutOnSameReservePeriod first > >--- > C4/Circulation.pm | 67 ++++++++++++++++++++++++++-------------------------- > opac/opac-reserve.pl | 5 ++-- > 2 files changed, 35 insertions(+), 37 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 97145b1..4c679e6 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1149,23 +1149,23 @@ sub CanBookBeIssued { > } > } > >- my $now = dt_from_string(); >- my $preventCheckoutOnSameReservePeriod = >- C4::Context->preference("PreventCheckoutOnSameReservePeriod"); >- my $reserves_on_same_period = >- ReservesOnSamePeriod($item_object->biblionumber, $item_object->itemnumber, $now->ymd, $duedate->ymd); >- if ($preventCheckoutOnSameReservePeriod && $reserves_on_same_period) { >- my $reserve = $reserves_on_same_period->[0]; >- if ($reserve->{borrowernumber} ne $patron->borrowernumber) { >- my $patron = Koha::Patrons->find( $reserve->{borrowernumber} ); >- $needsconfirmation{RESERVED} = 1; >- $needsconfirmation{resfirstname} = $patron->firstname; >- $needsconfirmation{ressurname} = $patron->surname; >- $needsconfirmation{rescardnumber} = $patron->cardnumber; >- $needsconfirmation{resborrowernumber} = $patron->borrowernumber; >- $needsconfirmation{resbranchcode} = $patron->branchcode; >- $needsconfirmation{resreservedate} = $reserve->{reservedate}; >- $needsconfirmation{reserve_id} = $reserve->{reserve_id}; >+ if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) { >+ my $now = dt_from_string(); >+ my $reserves_on_same_period = >+ ReservesOnSamePeriod($item_object->biblionumber, $item_object->itemnumber, $now->ymd, $duedate->ymd); >+ if ($reserves_on_same_period) { >+ my $reserve = $reserves_on_same_period->[0]; >+ if ($reserve->{borrowernumber} ne $patron->borrowernumber) { >+ my $patron = Koha::Patrons->find( $reserve->{borrowernumber} ); >+ $needsconfirmation{RESERVED} = 1; >+ $needsconfirmation{resfirstname} = $patron->firstname; >+ $needsconfirmation{ressurname} = $patron->surname; >+ $needsconfirmation{rescardnumber} = $patron->cardnumber; >+ $needsconfirmation{resborrowernumber} = $patron->borrowernumber; >+ $needsconfirmation{resbranchcode} = $patron->branchcode; >+ $needsconfirmation{resreservedate} = $reserve->{reservedate}; >+ $needsconfirmation{reserve_id} = $reserve->{reserve_id}; >+ } > } > } > >@@ -2942,23 +2942,22 @@ sub CanBookBeRenewed { > } > } > >- unless ($date_due) { >- my $itemtype = $item->effective_itemtype; >- my $patron_unblessed = $patron->unblessed; >- $date_due = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? >- dt_from_string( $issue->date_due, 'sql' ) : >- dt_from_string(); >- $date_due = CalcDateDue($date_due, $itemtype, _GetCircControlBranch($item->unblessed(), $patron_unblessed), $patron_unblessed, 'is a renewal'); >- } >- >- my $now = dt_from_string(); >- my $biblionumber = $item->biblionumber; >- my $preventCheckoutOnSameReservePeriod = >- C4::Context->preference("PreventCheckoutOnSameReservePeriod"); >- my $reserves_on_same_period = >- ReservesOnSamePeriod($biblionumber, $itemnumber, $now->ymd, $date_due->ymd); >- if ($preventCheckoutOnSameReservePeriod && $reserves_on_same_period) { >- $resfound = 1; >+ if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) { >+ unless ($date_due) { >+ my $itemtype = $item->effective_itemtype; >+ my $patron_unblessed = $patron->unblessed; >+ $date_due = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? >+ dt_from_string( $issue->date_due, 'sql' ) : >+ dt_from_string(); >+ $date_due = CalcDateDue($date_due, $itemtype, _GetCircControlBranch($item->unblessed(), $patron_unblessed), $patron_unblessed, 'is a renewal'); >+ } >+ my $now = dt_from_string(); >+ my $biblionumber = $item->biblionumber; >+ my $reserves_on_same_period = >+ ReservesOnSamePeriod($biblionumber, $itemnumber, $now->ymd, $date_due->ymd); >+ if ($reserves_on_same_period) { >+ $resfound = 1; >+ } > } > > if( $cron ) { #The cron wants to return 'too_soon' over 'on_reserve' >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 697ec83..9f094fd 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -286,9 +286,8 @@ if ( $query->param('place_reserve') ) { > $itemNum = undef; > } > >- if ($canreserve) { >- if (C4::Context->preference("PreventReservesOnSamePeriod") && >- ReservesOnSamePeriod($biblioNum, $itemNum, $startdate, $expiration_date)) { >+ if ( $canreserve && C4::Context->preference("PreventReservesOnSamePeriod") ) { >+ if ( ReservesOnSamePeriod($biblioNum, $itemNum, $startdate, $expiration_date) ) { > $canreserve = 0; > $failed_holds++; > } >-- >2.7.4
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 15261
:
45216
|
45833
|
45841
|
46432
|
46433
|
46441
|
46442
|
49001
|
49002
|
49003
|
52704
|
59643
|
61534
|
61539
|
61544
|
67088
|
67094
|
67143
|
68660
|
68661
|
68662
|
68663
|
68664
|
68852
|
68853
|
72956
|
72957
|
76221
|
76222
|
88292
|
88293
|
88297
|
88298
|
92376
|
92377
|
92584
|
92585
|
92664
|
93136
|
94871
|
98383
|
98424
|
98672
|
106944
|
106949
|
120822
|
123405
|
125793
|
125794
|
125795
|
125796
|
131569
|
131570
|
131571
|
131572
|
131573