View | Details | Raw Unified | Return to bug 6030
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/columns.def (+6 lines)
Lines 66-71 borrowers.privacy Privacy settings Link Here
66
items.itemnumber	Item number (internal)
66
items.itemnumber	Item number (internal)
67
items.biblionumber	Biblio number (internal)
67
items.biblionumber	Biblio number (internal)
68
items.biblioitemnumber	Biblioitem number (internal)
68
items.biblioitemnumber	Biblioitem number (internal)
69
issues.date_due	Due date
70
items.itemnumber	Item Number (koha internal)
71
items.biblionumber	Biblio Number (koha internal)
72
items.multivolumepart	Item one part of a Multi volume set
73
items.biblioitemnumber	Biblioitem Number (koha internal)
69
items.barcode	Barcode
74
items.barcode	Barcode
70
items.dateaccessioned	Date acquired
75
items.dateaccessioned	Date acquired
71
items.booksellerid	Source of acquisition
76
items.booksellerid	Source of acquisition
Lines 112-117 statistics.itemnumber Item number Link Here
112
statistics.itemtype	Itemtype
117
statistics.itemtype	Itemtype
113
statistics.borrowernumber	Borrower number
118
statistics.borrowernumber	Borrower number
114
biblio.frameworkcode	Framework code
119
biblio.frameworkcode	Framework code
120
biblio.title	Title
115
biblio.author	Author
121
biblio.author	Author
116
biblio.datecreated	Creation date
122
biblio.datecreated	Creation date
117
biblio.timestamp	Modification date
123
biblio.timestamp	Modification date
(-)a/misc/cronjobs/overdue_notices.pl (-14 / +36 lines)
Lines 38-45 use Encode; Link Here
38
use C4::Context;
38
use C4::Context;
39
use C4::Dates qw/format_date/;
39
use C4::Dates qw/format_date/;
40
use C4::Debug;
40
use C4::Debug;
41
use C4::Charset;
41
use C4::Letters;
42
use C4::Letters;
42
use C4::Overdues qw(GetFine);
43
use C4::Overdues qw(GetFine);
44
use C4::Reports::Guided;
43
45
44
=head1 NAME
46
=head1 NAME
45
47
Lines 256-262 my $verbose = 0; Link Here
256
my $nomail  = 0;
258
my $nomail  = 0;
257
my $MAX     = 90;
259
my $MAX     = 90;
258
my @branchcodes; # Branch(es) passed as parameter
260
my @branchcodes; # Branch(es) passed as parameter
259
my $csvfilename;
261
my $csvfilename = '';
260
my $htmlfilename;
262
my $htmlfilename;
261
my $triggered = 0;
263
my $triggered = 0;
262
my $listall = 0;
264
my $listall = 0;
Lines 284-290 GetOptions( Link Here
284
pod2usage(1) if $help;
286
pod2usage(1) if $help;
285
pod2usage( -verbose => 2 ) if $man;
287
pod2usage( -verbose => 2 ) if $man;
286
288
287
if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
289
my $columns_def_hashref = C4::Reports::Guided::_get_column_defs();
290
291
# get column header definitions
292
foreach my $key ( keys %$columns_def_hashref ) {
293
    my $initkey = $key;
294
    $key =~ s/[^\.]*\.//;
295
    #warn "KEY : $initkey = ".$columns_def_hashref->{$initkey};
296
    if ($columns_def_hashref->{$initkey}) {
297
        $columns_def_hashref->{$initkey}=NormalizeString($columns_def_hashref->{$initkey});
298
        $columns_def_hashref->{$initkey}=~s# #<br/>#;
299
    }
300
    $columns_def_hashref->{$key} = $columns_def_hashref->{$initkey};
301
}
302
303
if ( $csvfilename =~ /^-/ ) {
288
    warn qq(using "$csvfilename" as filename, that seems odd);
304
    warn qq(using "$csvfilename" as filename, that seems odd);
289
}
305
}
290
306
Lines 341-347 binmode( STDOUT, ':encoding(UTF-8)' ); Link Here
341
357
342
our $csv;       # the Text::CSV_XS object
358
our $csv;       # the Text::CSV_XS object
343
our $csv_fh;    # the filehandle to the CSV file.
359
our $csv_fh;    # the filehandle to the CSV file.
344
if ( defined $csvfilename ) {
360
if ( $csvfilename ) {
345
    my $sep_char = C4::Context->preference('delimiter') || ',';
361
    my $sep_char = C4::Context->preference('delimiter') || ',';
346
    $sep_char = "\t" if ($sep_char eq 'tabulation');
362
    $sep_char = "\t" if ($sep_char eq 'tabulation');
347
    $csv = Text::CSV_XS->new( { binary => 1 , sep_char => $sep_char } );
363
    $csv = Text::CSV_XS->new( { binary => 1 , sep_char => $sep_char } );
Lines 350-356 if ( defined $csvfilename ) { Link Here
350
    } else {
366
    } else {
351
        open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!";
367
        open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!";
352
    }
368
    }
353
    if ( $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) {
369
    if ( $csvfilename && $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) {
354
        print $csv_fh $csv->string, "\n";
370
        print $csv_fh $csv->string, "\n";
355
    } else {
371
    } else {
356
        $verbose and warn 'combine failed on argument: ' . $csv->error_input;
372
        $verbose and warn 'combine failed on argument: ' . $csv->error_input;
Lines 486-493 END_SQL Link Here
486
                    $verbose and warn "debarring $borrowernumber $firstname $lastname\n";
502
                    $verbose and warn "debarring $borrowernumber $firstname $lastname\n";
487
                }
503
                }
488
                my @params = ($listall ? ( $borrowernumber , 1 , $MAX ) : ( $borrowernumber, $mindays, $maxdays ));
504
                my @params = ($listall ? ( $borrowernumber , 1 , $MAX ) : ( $borrowernumber, $mindays, $maxdays ));
489
                $verbose and warn "STH2 PARAMS: borrowernumber = $borrowernumber, mindays = $mindays, maxdays = $maxdays";
490
                $sth2->execute(@params);
505
                $sth2->execute(@params);
506
                $verbose and warn "STH2 PARAMS: borrowernumber = $borrowernumber, mindays = $mindays, maxdays = $maxdays returns ".$sth2->rows." rows";
491
                my $itemcount = 0;
507
                my $itemcount = 0;
492
                my $titles;
508
                my $titles;
493
                if ($htmlfilename) {
509
                if ($htmlfilename) {
Lines 506-515 END_SQL Link Here
506
                    }
522
                    }
507
                    $j++;
523
                    $j++;
508
                    my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || '' } @item_content_fields;
524
                    my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || '' } @item_content_fields;
509
                    $titles .= join("\t", @item_info) . "\n";
525
                    if ($htmlfilename) {
526
                        $titles .= "<tr><td>" . join( "</td><td>", @item_info ) . "</td></tr>";
527
                    } else {
528
                        $titles .= join("\t", @item_info) . "\n";
529
                    }
510
                    $itemcount++;
530
                    $itemcount++;
511
                    push @items, $item_info;
531
                    push @items, $item_info;
512
                }
532
                }
533
                $titles .= "</tbody></table>" if ($htmlfilename);
534
                $debug && warn $titles;
513
                $sth2->finish;
535
                $sth2->finish;
514
536
515
                my $letter = parse_letter(
537
                my $letter = parse_letter(
Lines 533-551 END_SQL Link Here
533
                    next PERIOD;
555
                    next PERIOD;
534
                }
556
                }
535
                
557
                
536
                $letter->{'content-type'}="text/".($htmlfilename?"html":"plain");
558
                $letter->{'content-type'}="text/".($htmlfilename?"html":"plain")."; charset=UTF8";
537
559
538
                if ($exceededPrintNoticesMaxLines) {
560
                if ($exceededPrintNoticesMaxLines) {
539
                    $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
561
                    $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
540
                }
562
                }
541
563
542
                my @misses = grep { /./ } map { /^([^>]*)[>]+/; ( $1 || '' ); } split /\</, $letter->{'content'};
564
                my @misses = grep { /./ } map { /^([^>]*)[>]{2,}/; ( $1 || '' ); } split /\<\</, $letter->{'content'};
543
                if (@misses) {
565
                if (@misses) {
544
                    $verbose and warn "The following terms were not matched and replaced: \n\t" . join "\n\t", @misses;
566
                    $verbose and warn "The following terms were not matched and replaced: \n\t" . join "\n\t", @misses;
545
                }
567
                }
546
                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # Now that we've warned about them, remove them.
568
                $letter->{'content'} =~ s/\<\<[^<>]*?\>\>//g;    # Now that we've warned about them, remove them.
547
                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # 2nd pass for the double nesting.
548
    
569
    
570
                #                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # 2nd pass for the double nesting.
549
                if ($nomail) {
571
                if ($nomail) {
550
    
572
    
551
                    push @output_chunks,
573
                    push @output_chunks,
Lines 561-567 END_SQL Link Here
561
                            email          => $email,
583
                            email          => $email,
562
                            itemcount      => $itemcount,
584
                            itemcount      => $itemcount,
563
                            titles         => $titles,
585
                            titles         => $titles,
564
                            outputformat   => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
586
                            outputformat   => $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
565
                        }
587
                        }
566
                      );
588
                      );
567
                } else {
589
                } else {
Lines 589-595 END_SQL Link Here
589
                                email          => $email,
611
                                email          => $email,
590
                                itemcount      => $itemcount,
612
                                itemcount      => $itemcount,
591
                                titles         => $titles,
613
                                titles         => $titles,
592
                                outputformat   => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
614
                                outputformat   => $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
593
                            }
615
                            }
594
                          );
616
                          );
595
                    }
617
                    }
Lines 600-606 END_SQL Link Here
600
    }
622
    }
601
623
602
    if (@output_chunks) {
624
    if (@output_chunks) {
603
        if ( defined $csvfilename ) {
625
        if ( $csvfilename ) {
604
            print $csv_fh @output_chunks;        
626
            print $csv_fh @output_chunks;        
605
        }
627
        }
606
        elsif ( defined $htmlfilename ) {
628
        elsif ( defined $htmlfilename ) {
Lines 760-765 sub prepare_letter_for_printing { Link Here
760
        }
782
        }
761
    } elsif ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'html' ) {
783
    } elsif ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'html' ) {
762
      $return = "<pre>\n";
784
      $return = "<pre>\n";
785
        $params->{'letter'}->{'content'} =~ s#
#<br/>#g;
763
      $return .= "$params->{'letter'}->{'content'}\n";
786
      $return .= "$params->{'letter'}->{'content'}\n";
764
      $return .= "\n</pre>\n";
787
      $return .= "\n</pre>\n";
765
    } else {
788
    } else {
766
- 

Return to bug 6030