Bugzilla – Attachment 57594 Details for
Bug 17649
Create only one message per borrower and overdue level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17649 - Only one message per borrower and overdue level
0001-Bug-17649-Only-one-message-per-borrower-and-overdue-.patch (text/plain), 4.41 KB, created by
Koha Team University Lyon 3
on 2016-11-17 11:08:21 UTC
(
hide
)
Description:
Bug 17649 - Only one message per borrower and overdue level
Filename:
MIME Type:
Creator:
Koha Team University Lyon 3
Created:
2016-11-17 11:08:21 UTC
Size:
4.41 KB
patch
obsolete
>From 09938f21f6905e2ce5713d08d4fbd19043a2dac0 Mon Sep 17 00:00:00 2001 >From: Olivier Crouzet <kohateam@univ-lyon3.fr> >Date: Thu, 17 Nov 2016 12:05:50 +0100 >Subject: [PATCH] Bug 17649 Only one message per borrower and overdue level > >The added option (-a|--all_in_one) allows to create only one message per borrower and delay level >including overdues from whatever branches. >A branchcode value (branches.branchcode) has to be given to choose which sender address will be set. >--- > misc/cronjobs/overdue_notices.pl | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 7504c7a..31cfbf8 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -73,7 +73,7 @@ overdue_notices.pl > -list-all list all overdues > -date <yyyy-mm-dd> emulate overdues run for this date > -email <email_type> type of email that will be used. Can be 'email', 'emailpro' or 'B_email'. Repeatable. >- >+ -a <branchcode> Create only one message per borrower and delay level including overdues from all branches. > =head1 OPTIONS > > =over 8 >@@ -181,6 +181,13 @@ use it in order to send overdues on a specific date and not Now. Format: YYYY-MM > > Allows to specify which type of email will be used. Can be email, emailpro or B_email. Repeatable. > >+=item B<-a> | B<--all_in_one> >+ >+Create only one message per borrower and for each delay level including overdues from all branches. >+Branchcode value (branches.branchcode) has to be given to choose which sender address will be set. >+It's recommended to use this option only with default notice(s) defined for 'All branches' >+in Notices & Slips and no specific ones. >+ > =back > > =head1 DESCRIPTION >@@ -302,6 +309,7 @@ my $itemscontent = join( ',', qw( date_due title barcode author itemnumber ) ); > my @myborcat; > my @myborcatout; > my ( $date_input, $today ); >+my $all_in_one; > > GetOptions( > 'help|?' => \$help, >@@ -321,6 +329,7 @@ GetOptions( > 'borcat=s' => \@myborcat, > 'borcatout=s' => \@myborcatout, > 'email=s' => \@emails, >+ 'a|all_in_one=s' => \$all_in_one, > ) or pod2usage(2); > pod2usage(1) if $help; > pod2usage( -verbose => 2 ) if $man; >@@ -442,6 +451,8 @@ elsif ( defined $text_filename ) { > } > } > >+my %already_queued; >+my %seen = map { $_ => 1 } @branches; > foreach my $branchcode (@branches) { > if ( C4::Context->preference('OverdueNoticeCalendar') ) { > my $calendar = Koha::Calendar->new( branchcode => $branchcode ); >@@ -450,7 +461,7 @@ foreach my $branchcode (@branches) { > } > } > >- my $library = Koha::Libraries->find($branchcode); >+ my $library = $all_in_one ? Koha::Libraries->find($all_in_one) : Koha::Libraries->find($branchcode); > my $admin_email_address = $library->branchemail > || C4::Context->preference('KohaAdminEmailAddress'); > my @output_chunks; # may be sent to mail or stdout or csv file. >@@ -468,6 +479,7 @@ SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, branchname > AND TO_DAYS($date)-TO_DAYS(issues.date_due) >= 0 > END_SQL > >+ > my $query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = ? "; > $query .= " AND categorycode IN (".join( ',' , ('?') x @myborcat ).") " if (@myborcat); > $query .= " AND categorycode NOT IN (".join( ',' , ('?') x @myborcatout ).") " if (@myborcatout); >@@ -570,6 +582,7 @@ END_SQL > next; > } > $borrowernumber = $data->{'borrowernumber'}; >+ next if ($all_in_one && $already_queued{"$borrowernumber$i"}); > my $borr = > $data->{'firstname'} . ', ' > . $data->{'surname'} . ' (' >@@ -661,6 +674,7 @@ END_SQL > $exceededPrintNoticesMaxLines = 1; > last; > } >+ next if $all_in_one and ! grep {$seen{$item_info->{branchcode}}} @branches; > $j++; > my @item_info = map { $_ =~ /^date|date$/ ? > eval { output_pref( { dt => dt_from_string( $item_info->{$_} ), dateonly => 1 } ); } >@@ -774,6 +788,7 @@ END_SQL > } > } > } >+ $already_queued{"$borrowernumber$i"} = 1; > } > $sth->finish; > } >-- >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 17649
:
57594
|
58398
|
80925
|
125298
|
145695
|
148927