Bugzilla – Attachment 153732 Details for
Bug 31427
Automatic renewal errors should come before many other renewal errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31427: Get auto renewal errors before other renewal errors
Bug-31427-Get-auto-renewal-errors-before-other-ren.patch (text/plain), 3.89 KB, created by
Sam Lau
on 2023-07-20 15:39:45 UTC
(
hide
)
Description:
Bug 31427: Get auto renewal errors before other renewal errors
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2023-07-20 15:39:45 UTC
Size:
3.89 KB
patch
obsolete
>From 86d0a13cb243b8c881b1b241ce7ac1dc3bcc66b7 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 20 Jul 2023 03:22:22 +0000 >Subject: [PATCH] Bug 31427: Get auto renewal errors before other renewal > errors > >This patch changes CanBookBeRenewed so that automatic renewal >errors pop up before other renewal errors. This means that a book >will be considered "auto_too_soon" before things like "too_many" or >"restricted". (Otherwise, you'll get an email saying you can't renew >a book the day after using your last auto renewal, even though the >earliest renewal isn't available until later.) > >Test plan: >0. Apply patch >1. prove t/db_dependent/Circulation.t >2. prove t/db_dependent/Holds.t >3. prove t/db_dependent/Koha/Account/Line.t >4. prove t/db_dependent/Koha/Account.t > >Additional tests: >5. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RestrictionBlockRenewing >6. Change to "block" >7. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=AutoRenewalNotices >8. Change to "according to patron messaging preferences" >9. Go to http://localhost:8081/cgi-bin/koha/admin/smart-rules.pl >10. Set "Automatic renewal" to "Yes" and "No renewal before" to 4 >11. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51 >12. Checkout 39999000001310 with a due date 4 days in the future >13. Add a manual restriction >14. Run `perl ./misc/cronjobs/automatic_renewals.pl` >15. Note that it says something like the following: >Issue id: 1237 for borrower: 51 and item: 73 would not be renewed. (auto_too_soon) > >Instead of something like the following: >Issue id: 1237 for borrower: 51 and item: 73 would not be renewed. (restriction) > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > C4/Circulation.pm | 26 ++++++++++++++------------ > 1 file changed, 14 insertions(+), 12 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 5a6e036685..14918de09d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2965,6 +2965,20 @@ sub CanBookBeRenewed { > # override_limit will override anything else except on_reserve > unless ( $override_limit ){ > my $branchcode = _GetCircControlBranch( $item->unblessed, $patron->unblessed ); >+ >+ ( $auto_renew, $soonest ) = _CanBookBeAutoRenewed({ >+ patron => $patron, >+ item => $item, >+ branchcode => $branchcode, >+ issue => $issue >+ }); >+ return ( 0, $auto_renew, { soonest_renew_date => $soonest } ) if $auto_renew =~ 'auto_too_soon' && $cron; >+ # cron wants 'too_soon' over 'on_reserve' for performance and to avoid >+ # extra notices being sent. Cron also implies no override >+ return ( 0, $auto_renew ) if $auto_renew =~ 'auto_account_expired'; >+ return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_late'; >+ return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_much_oweing'; >+ > my $issuing_rule = Koha::CirculationRules->get_effective_rules( > { > categorycode => $patron->categorycode, >@@ -2997,18 +3011,6 @@ sub CanBookBeRenewed { > return ( 0, 'overdue'); > } > >- ( $auto_renew, $soonest ) = _CanBookBeAutoRenewed({ >- patron => $patron, >- item => $item, >- branchcode => $branchcode, >- issue => $issue >- }); >- return ( 0, $auto_renew, { soonest_renew_date => $soonest } ) if $auto_renew =~ 'auto_too_soon' && $cron; >- # cron wants 'too_soon' over 'on_reserve' for performance and to avoid >- # extra notices being sent. Cron also implies no override >- return ( 0, $auto_renew ) if $auto_renew =~ 'auto_account_expired'; >- return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_late'; >- return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_much_oweing'; > } > > if ( C4::Context->preference('UseRecalls') ) { >-- >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 31427
:
153696
|
153732
|
156232
|
157894
|
162239
|
162240
|
162656
|
162657
|
162658