Bugzilla – Attachment 163205 Details for
Bug 35944
Bookings is not taken into account in CanBookBeRenewed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35944: (QA follow-up) Check if there are bookings before other calculations
Bug-35944-QA-follow-up-Check-if-there-are-bookings.patch (text/plain), 2.79 KB, created by
Nick Clemens (kidclamp)
on 2024-03-15 11:40:35 UTC
(
hide
)
Description:
Bug 35944: (QA follow-up) Check if there are bookings before other calculations
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-03-15 11:40:35 UTC
Size:
2.79 KB
patch
obsolete
>From 7c5933c129a98c1eec851646c99d438bff755b7c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 15 Mar 2024 11:35:38 +0000 >Subject: [PATCH] Bug 35944: (QA follow-up) Check if there are bookings before > other calculations > >--- > C4/Circulation.pm | 42 ++++++++++++++++++++++-------------------- > 1 file changed, 22 insertions(+), 20 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index e57e634d3c9..5b90cf0eccd 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3121,29 +3121,31 @@ sub CanBookBeRenewed { > } > > # CHECK FOR BOOKINGS >- my $startdate = >- ( C4::Context->preference('RenewalPeriodBase') eq 'date_due' ) >- ? dt_from_string( $issue->date_due, 'sql' ) >- : dt_from_string(); >- my $datedue = CalcDateDue( $startdate, $item->effective_itemtype, $branchcode, $patron, 'is a renewal' ); >- if ( >- my $booking = $item->find_booking( >- { checkout_date => $startdate, due_date => $datedue, patron_id => $patron->borrowernumber } >- ) >- ) >- { >- return ( 0, 'booked' ) unless ( $booking->patron_id == $patron->borrowernumber ); >- } >+ if( $item->bookings->count ){ >+ my $startdate = >+ ( C4::Context->preference('RenewalPeriodBase') eq 'date_due' ) >+ ? dt_from_string( $issue->date_due, 'sql' ) >+ : dt_from_string(); >+ my $datedue = CalcDateDue( $startdate, $item->effective_itemtype, $branchcode, $patron, 'is a renewal' ); >+ if ( >+ my $booking = $item->find_booking( >+ { checkout_date => $startdate, due_date => $datedue, patron_id => $patron->borrowernumber } >+ ) >+ ) >+ { >+ return ( 0, 'booked' ) unless ( $booking->patron_id == $patron->borrowernumber ); >+ } > >- if ( $auto_renew eq 'auto_too_soon' ) { >+ if ( $auto_renew eq 'auto_too_soon' ) { > >- # If its cron, tell it it's too soon for a an auto renewal >- return ( 0, $auto_renew, { soonest_renew_date => $soonest } ) if $cron; >+ # If its cron, tell it it's too soon for a an auto renewal >+ return ( 0, $auto_renew, { soonest_renew_date => $soonest } ) if $cron; > >- # Check if it's too soon for a manual renewal >- my $soonestManual = GetSoonestRenewDate( $patron, $issue ); >- if ( $soonestManual > dt_from_string() ) { >- return ( 0, "too_soon", { soonest_renew_date => $soonestManual } ) unless $override_limit; >+ # Check if it's too soon for a manual renewal >+ my $soonestManual = GetSoonestRenewDate( $patron, $issue ); >+ if ( $soonestManual > dt_from_string() ) { >+ return ( 0, "too_soon", { soonest_renew_date => $soonestManual } ) unless $override_limit; >+ } > } > } > >-- >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 35944
:
162407
|
162408
|
162417
|
162418
|
162423
|
162424
|
163201
|
163202
|
163203
|
163204
|
163205
|
163206
|
163208
|
163209
|
163210
|
163211
|
163212
|
163213