Bugzilla – Attachment 37812 Details for
Bug 11603
Gather print notices: add csv and ods export
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11603 Add --send|--nosend, fix stuf
Bug-11603-Add---send--nosend-fix-stuf.patch (text/plain), 3.46 KB, created by
Frédéric Demians
on 2015-04-14 11:23:18 UTC
(
hide
)
Description:
Bug 11603 Add --send|--nosend, fix stuf
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2015-04-14 11:23:18 UTC
Size:
3.46 KB
patch
obsolete
>From c8f5c8397ecbe0ed303342458c806cfa7ed64055 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Tue, 14 Apr 2015 13:13:18 +0200 >Subject: [PATCH] Bug 11603 Add --send|--nosend, fix stuf > >Fix --html without --letter_code >Fix --ods which was producing a 2 lines ods file >--- > misc/cronjobs/gather_print_notices.pl | 44 +++++++++++++++++++++++++---------- > 1 file changed, 32 insertions(+), 12 deletions(-) > >diff --git a/misc/cronjobs/gather_print_notices.pl b/misc/cronjobs/gather_print_notices.pl >index b852680..30aec0c 100755 >--- a/misc/cronjobs/gather_print_notices.pl >+++ b/misc/cronjobs/gather_print_notices.pl >@@ -21,8 +21,19 @@ use Getopt::Long; > use File::Basename qw( dirname ); > use Koha::DateUtils; > >-my ( $stylesheet, $help, $split, $html, $csv, $ods, $delimiter, @letter_codes ); >- >+my ( >+ $stylesheet, >+ $help, >+ $split, >+ $html, >+ $csv, >+ $ods, >+ $delimiter, >+ @letter_codes, >+ $send, >+); >+ >+$send = 1; > GetOptions( > 'h|help' => \$help, > 's|split' => \$split, >@@ -31,6 +42,7 @@ GetOptions( > 'ods' => \$ods, > 'd|delimiter:s' => \$delimiter, > 'letter_code:s' => \@letter_codes, >+ 'send!' => \$send, > ) || pod2usage(1); > > pod2usage(0) if $help; >@@ -72,7 +84,7 @@ my @all_messages = @{ GetPrintMessages() }; > ( > grep { /^$letter_code$/ } @letter_codes > ) ? $_ : () >-} @all_messages; >+} @all_messages if @letter_codes; > exit unless @all_messages; > > my ( $html_filenames, $csv_filenames, $ods_filenames ); >@@ -151,13 +163,15 @@ sub print_notices { > }); > } > >- foreach my $message ( @$branch_messages ) { >- C4::Letters::_set_message_status( >- { >- message_id => $message->{'message_id'}, >- status => 'sent' >- } >- ); >+ if ( $send ) { >+ foreach my $message ( @$branch_messages ) { >+ C4::Letters::_set_message_status( >+ { >+ message_id => $message->{'message_id'}, >+ status => 'sent' >+ } >+ ); >+ } > } > push @filenames, $filename; > } >@@ -227,7 +241,7 @@ sub generate_ods { > my $table = $doc->getTable(0); > > my @headers; >- my ( $nb_rows, $nb_cols ) = ( scalar(@$messages), 0 ); >+ my ( $nb_rows, $nb_cols, $i ) = ( scalar(@$messages), 0, 0 ); > foreach my $message ( @$messages ) { > my @lines = split /\n/, $message->{content}; > chomp for @lines; >@@ -244,10 +258,10 @@ sub generate_ods { > $doc->cellValue( $row, $j, Encode::encode( 'UTF8', $header ) ); > $j++; > } >+ $i = 1; > } > > shift @lines; # remove headers >- my $i = 1; > for my $line ( @lines ) { > my @row_data = split $delimiter, $line; > my $row = $doc->getRow( $table, $i ); >@@ -282,6 +296,12 @@ The generated filename will be holdnotices-TODAY.[csv|html|ods] or holdnotices-T > > Define the output directory where the files will be generated. > >+=item B<--send|--nosend> >+ >+After files have been generated, messages status is changed from 'pending' to >+'sent'. This is the default action, without this parameter or with --send. >+Using --nosend, mesages status aren't changed. >+ > =item B<-s|--split> > > Split messages into separate file by borrower home library to OUTPUT_DIRECTORY/notices-CURRENT_DATE-BRANCHCODE.[csv|html|ods] >-- >2.3.5
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 11603
:
25021
|
25022
|
25023
|
25024
|
25640
|
25642
|
30980
|
30981
|
30982
|
30983
|
37799
|
37812
|
37813
|
37814
|
37815
|
37816
|
37817
|
37829
|
37830
|
37831
|
37832
|
37833
|
37834
|
37837
|
38381
|
38385
|
38386
|
38387
|
38388
|
38389
|
38390
|
38391
|
38392
|
38403
|
38411
|
38412
|
38413
|
38414
|
38415
|
38416
|
38417
|
38418
|
38419
|
39033
|
39034
|
39035
|
39036
|
39037
|
39038
|
39039
|
39040
|
39041