Bugzilla – Attachment 63142 Details for
Bug 15705
Notify the user on auto renewing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15705: Add --send-notices to the cronjob script
Bug-15705-Add---send-notices-to-the-cronjob-script.patch (text/plain), 3.94 KB, created by
Nick Clemens (kidclamp)
on 2017-05-04 17:30:58 UTC
(
hide
)
Description:
Bug 15705: Add --send-notices to the cronjob script
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-05-04 17:30:58 UTC
Size:
3.94 KB
patch
obsolete
>From acdcd0c77643a66463cabb7f2c424589f385f9ab Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 3 May 2017 04:17:30 -0300 >Subject: [PATCH] Bug 15705: Add --send-notices to the cronjob script > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > misc/cronjobs/automatic_renewals.pl | 76 +++++++++++++++++++++++-------------- > 1 file changed, 48 insertions(+), 28 deletions(-) > >diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl >index 8e6cdfa..e0b4447 100755 >--- a/misc/cronjobs/automatic_renewals.pl >+++ b/misc/cronjobs/automatic_renewals.pl >@@ -23,7 +23,7 @@ automatic_renewals.pl - cron script to renew loans > > =head1 SYNOPSIS > >-./automatic_renewals.pl >+./automatic_renewals.pl [--send-notices] > > or, in crontab: > 0 3 * * * automatic_renewals.pl >@@ -36,11 +36,21 @@ and the renewal isn't premature (No Renewal before) the issue is renewed. > > =head1 OPTIONS > >-No options. >+=over >+ >+=item B<--send-notices> >+ >+Send AUTO_RENEWALS notices to patrons if the auto renewal has been done. >+ >+Note that this option does not support digest yet. >+ >+=back > > =cut > > use Modern::Perl; >+use Pod::Usage; >+use Getopt::Long; > > use C4::Circulation; > use C4::Context; >@@ -50,6 +60,14 @@ use Koha::Checkouts; > use Koha::Libraries; > use Koha::Patrons; > >+my ( $help, $send_notices ); >+GetOptions( >+ 'h|help' => \$help, >+ 'send-notices' => \$send_notices, >+) || pod2usage(1); >+ >+pod2usage(0) if $help; >+ > cronlogaction(); > > my $auto_renews = Koha::Checkouts->search({ auto_renew => 1 }); >@@ -78,31 +96,33 @@ while ( my $auto_renew = $auto_renews->next ) { > } > } > >-for my $borrowernumber ( keys %report ) { >- my $patron = Koha::Patrons->find($borrowernumber); >- my @issues; >- for my $issue ( @{ $report{$borrowernumber} } ) { >- my $item = Koha::Items->find( $issue->itemnumber ); >- my $letter = C4::Letters::GetPreparedLetter( >- module => 'circulation', >- letter_code => 'AUTO_RENEWALS', >- tables => { >- borrowers => $patron->borrowernumber, >- issues => $issue->itemnumber, >- items => $issue->itemnumber, >- biblio => $item->biblionumber, >- }, >- ); >- >- my $library = Koha::Libraries->find( $patron->branchcode ); >- my $admin_email_address = $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'); >- >- C4::Letters::EnqueueLetter( >- { letter => $letter, >- borrowernumber => $borrowernumber, >- message_transport_type => 'email', >- from_address => $admin_email_address, >- } >- ); >+if ( $send_notices ) { >+ for my $borrowernumber ( keys %report ) { >+ my $patron = Koha::Patrons->find($borrowernumber); >+ my @issues; >+ for my $issue ( @{ $report{$borrowernumber} } ) { >+ my $item = Koha::Items->find( $issue->itemnumber ); >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'circulation', >+ letter_code => 'AUTO_RENEWALS', >+ tables => { >+ borrowers => $patron->borrowernumber, >+ issues => $issue->itemnumber, >+ items => $issue->itemnumber, >+ biblio => $item->biblionumber, >+ }, >+ ); >+ >+ my $library = Koha::Libraries->find( $patron->branchcode ); >+ my $admin_email_address = $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'); >+ >+ C4::Letters::EnqueueLetter( >+ { letter => $letter, >+ borrowernumber => $borrowernumber, >+ message_transport_type => 'email', >+ from_address => $admin_email_address, >+ } >+ ); >+ } > } > } >-- >2.1.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 15705
:
47470
|
47471
|
47472
|
50336
|
50337
|
50338
|
50341
|
50342
|
50344
|
50345
|
50346
|
50680
|
50681
|
50682
|
50683
|
50732
|
50733
|
56756
|
56757
|
56758
|
56759
|
56760
|
56798
|
56799
|
56981
|
56983
|
57741
|
57742
|
57743
|
57744
|
57745
|
57746
|
57747
|
61080
|
61081
|
61082
|
61083
|
61084
|
61085
|
61086
|
61495
|
61496
|
61497
|
61498
|
61499
|
61500
|
61501
|
61739
|
62072
|
63036
|
63037
|
63138
|
63139
|
63140
|
63141
| 63142 |
63143
|
63144