Bugzilla – Attachment 98499 Details for
Bug 24526
Add verbose and test modes to the `automatic_renewals.pl` cronjob
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24526: Use sprintf for readability
Bug-24526-Use-sprintf-for-readability.patch (text/plain), 2.59 KB, created by
Jonathan Druart
on 2020-02-05 15:05:53 UTC
(
hide
)
Description:
Bug 24526: Use sprintf for readability
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-02-05 15:05:53 UTC
Size:
2.59 KB
patch
obsolete
>From 6f8a1d407da4966a6f75b1ef7dc6ae76e6590632 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 5 Feb 2020 16:02:25 +0100 >Subject: [PATCH] Bug 24526: Use sprintf for readability > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > misc/cronjobs/automatic_renewals.pl | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > >diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl >index a5667e5f39..76f43d882a 100755 >--- a/misc/cronjobs/automatic_renewals.pl >+++ b/misc/cronjobs/automatic_renewals.pl >@@ -89,14 +89,14 @@ while ( my $auto_renew = $auto_renews->next ) { > # CanBookBeRenewed returns 'auto_renew' when the renewal should be done by this script > my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber ); > if ( $error eq 'auto_renew' ) { >+ if ($verbose) { >+ say sprintf "Issue id: %s for borrower: %s and item: %s ". ( $commit ? 'will' : 'would') . " be renewed.", >+ $auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber; >+ } > if ($commit){ > my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode ); > $auto_renew->auto_renew_error(undef)->store; > } >- if ( $verbose ){ >- print "Issue id: " . $auto_renew->issue_id . " for borrower: " . $auto_renew->borrowernumber . " and item: " . $auto_renew->itemnumber; >- $commit ? print " will be renewed.\n" : print " would be renewed.\n"; >- } > push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew; > } elsif ( $error eq 'too_many' > or $error eq 'on_reserve' >@@ -108,9 +108,8 @@ while ( my $auto_renew = $auto_renews->next ) { > or $error eq 'auto_too_soon' > or $error eq 'item_denied_renewal' ) { > if ( $verbose ) { >- print "Issue id: " . $auto_renew->issue_id . " for borrower: " . $auto_renew->borrowernumber . " and item: " . $auto_renew->itemnumber; >- $commit ? print " will not be renewed " : print " would not be renewed "; >- print "($error)\n"; >+ say sprintf "Issue id: %s for borrower: %s and item: %s ". ( $commit ? 'will' : 'would') . " not be renewed. (%s)", >+ $auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber, $error; > } > if ( not $auto_renew->auto_renew_error or $error ne $auto_renew->auto_renew_error ) { > $auto_renew->auto_renew_error($error)->store if $commit; >-- >2.11.0
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 24526
:
98037
|
98059
|
98081
|
98082
|
98083
|
98497
|
98498
| 98499 |
98500
|
98501
|
98520