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

(-)a/koha-tmpl/intranet-tmpl/prog/en/columns.def (+2 lines)
Lines 49-54 borrowers.sort2 Sorting Column 2 Link Here
49
borrowers.cellph	Cellphone number
49
borrowers.cellph	Cellphone number
50
borrowers.borlog
50
borrowers.borlog
51
borrowers.checkhist
51
borrowers.checkhist
52
issues.date_due	Due date
52
items.itemnumber	Item Number (koha internal)
53
items.itemnumber	Item Number (koha internal)
53
items.biblionumber	Biblio Number (koha internal)
54
items.biblionumber	Biblio Number (koha internal)
54
items.multivolumepart	Item one part of a Multi volume set
55
items.multivolumepart	Item one part of a Multi volume set
Lines 96-101 statistics.itemnumber Item Number Link Here
96
statistics.itemtype	Item Type
97
statistics.itemtype	Item Type
97
statistics.borrowernumber	Borrower Number
98
statistics.borrowernumber	Borrower Number
98
biblio.frameworkcode	Framework Code
99
biblio.frameworkcode	Framework Code
100
biblio.title	Title
99
biblio.author	Author
101
biblio.author	Author
100
biblio.datecreated	Creation Date
102
biblio.datecreated	Creation Date
101
biblio.timestamp	Modification Date
103
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 252-258 my $verbose = 0; Link Here
252
my $nomail  = 0;
254
my $nomail  = 0;
253
my $MAX     = 90;
255
my $MAX     = 90;
254
my @branchcodes; # Branch(es) passed as parameter
256
my @branchcodes; # Branch(es) passed as parameter
255
my $csvfilename;
257
my $csvfilename = '';
256
my $htmlfilename;
258
my $htmlfilename;
257
my $triggered = 0;
259
my $triggered = 0;
258
my $listall = 0;
260
my $listall = 0;
Lines 278-284 GetOptions( Link Here
278
pod2usage(1) if $help;
280
pod2usage(1) if $help;
279
pod2usage( -verbose => 2 ) if $man;
281
pod2usage( -verbose => 2 ) if $man;
280
282
281
if ( defined $csvfilename && $csvfilename =~ /^-/ ) {
283
my $columns_def_hashref = C4::Reports::Guided::_get_column_defs();
284
285
# get column header definitions
286
foreach my $key ( keys %$columns_def_hashref ) {
287
    my $initkey = $key;
288
    $key =~ s/[^\.]*\.//;
289
    #warn "KEY : $initkey = ".$columns_def_hashref->{$initkey};
290
    if ($columns_def_hashref->{$initkey}) {
291
        $columns_def_hashref->{$initkey}=NormalizeString($columns_def_hashref->{$initkey});
292
        $columns_def_hashref->{$initkey}=~s# #<br/>#;
293
    }
294
    $columns_def_hashref->{$key} = $columns_def_hashref->{$initkey};
295
}
296
297
if ( $csvfilename =~ /^-/ ) {
282
    warn qq(using "$csvfilename" as filename, that seems odd);
298
    warn qq(using "$csvfilename" as filename, that seems odd);
283
}
299
}
284
300
Lines 328-334 binmode( STDOUT, ":utf8" ); Link Here
328
344
329
our $csv;       # the Text::CSV_XS object
345
our $csv;       # the Text::CSV_XS object
330
our $csv_fh;    # the filehandle to the CSV file.
346
our $csv_fh;    # the filehandle to the CSV file.
331
if ( defined $csvfilename ) {
347
if ( $csvfilename ) {
332
    my $sep_char = C4::Context->preference('delimiter') || ',';
348
    my $sep_char = C4::Context->preference('delimiter') || ',';
333
    $csv = Text::CSV_XS->new( { binary => 1 , sep_char => $sep_char } );
349
    $csv = Text::CSV_XS->new( { binary => 1 , sep_char => $sep_char } );
334
    if ( $csvfilename eq '' ) {
350
    if ( $csvfilename eq '' ) {
Lines 336-342 if ( defined $csvfilename ) { Link Here
336
    } else {
352
    } else {
337
        open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!";
353
        open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!";
338
    }
354
    }
339
    if ( $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) {
355
    if ( $csvfilename && $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) {
340
        print $csv_fh $csv->string, "\n";
356
        print $csv_fh $csv->string, "\n";
341
    } else {
357
    } else {
342
        $verbose and warn 'combine failed on argument: ' . $csv->error_input;
358
        $verbose and warn 'combine failed on argument: ' . $csv->error_input;
Lines 477-484 END_SQL Link Here
477
                    $verbose and warn "debarring $borrowernumber $firstname $lastname\n";
493
                    $verbose and warn "debarring $borrowernumber $firstname $lastname\n";
478
                }
494
                }
479
                my @params = ($listall ? ( $borrowernumber , 1 , $MAX ) : ( $borrowernumber, $mindays, $maxdays ));
495
                my @params = ($listall ? ( $borrowernumber , 1 , $MAX ) : ( $borrowernumber, $mindays, $maxdays ));
480
                $verbose and warn "STH2 PARAMS: borrowernumber = $borrowernumber, mindays = $mindays, maxdays = $maxdays";
481
                $sth2->execute(@params);
496
                $sth2->execute(@params);
497
                $verbose and warn "STH2 PARAMS: borrowernumber = $borrowernumber, mindays = $mindays, maxdays = $maxdays returns ".$sth2->rows." rows";
482
                my $itemcount = 0;
498
                my $itemcount = 0;
483
                my $titles;
499
                my $titles;
484
                if ($htmlfilename) {
500
                if ($htmlfilename) {
Lines 497-506 END_SQL Link Here
497
                    }
513
                    }
498
                    $i++;
514
                    $i++;
499
                    my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || '' } @item_content_fields;
515
                    my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || '' } @item_content_fields;
500
                    $titles .= join("\t", @item_info) . "\n";
516
                    if ($htmlfilename) {
517
                        $titles .= "<tr><td>" . join( "</td><td>", @item_info ) . "</td></tr>";
518
                    } else {
519
                        $titles .= join("\t", @item_info) . "\n";
520
                    }
501
                    $itemcount++;
521
                    $itemcount++;
502
                    push @items, { itemnumber => $item_info->{'itemnumber'}, biblionumber => $item_info->{'biblionumber'} };
522
                    push @items, { itemnumber => $item_info->{'itemnumber'}, biblionumber => $item_info->{'biblionumber'} };
503
                }
523
                }
524
                $titles .= "</tbody></table>" if ($htmlfilename);
525
                $debug && warn $titles;
504
                $sth2->finish;
526
                $sth2->finish;
505
                $letter = parse_letter(
527
                $letter = parse_letter(
506
                    {   letter          => $letter,
528
                    {   letter          => $letter,
Lines 513-531 END_SQL Link Here
513
                                           }
535
                                           }
514
                    }
536
                    }
515
                );
537
                );
516
                $letter->{'content-type'}="text/".($htmlfilename?"html":"plain");
538
                $letter->{'content-type'}="text/".($htmlfilename?"html":"plain")."; charset=UTF8";
517
539
518
                if ($exceededPrintNoticesMaxLines) {
540
                if ($exceededPrintNoticesMaxLines) {
519
                    $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
541
                    $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
520
                }
542
                }
521
543
522
                my @misses = grep { /./ } map { /^([^>]*)[>]+/; ( $1 || '' ); } split /\</, $letter->{'content'};
544
                my @misses = grep { /./ } map { /^([^>]*)[>]{2,}/; ( $1 || '' ); } split /\<\</, $letter->{'content'};
523
                if (@misses) {
545
                if (@misses) {
524
                    $verbose and warn "The following terms were not matched and replaced: \n\t" . join "\n\t", @misses;
546
                    $verbose and warn "The following terms were not matched and replaced: \n\t" . join "\n\t", @misses;
525
                }
547
                }
526
                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # Now that we've warned about them, remove them.
548
                $letter->{'content'} =~ s/\<\<[^<>]*?\>\>//g;    # Now that we've warned about them, remove them.
527
                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # 2nd pass for the double nesting.
528
    
549
    
550
                #                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # 2nd pass for the double nesting.
529
                if ($nomail) {
551
                if ($nomail) {
530
    
552
    
531
                    push @output_chunks,
553
                    push @output_chunks,
Lines 541-547 END_SQL Link Here
541
                            email          => $email,
563
                            email          => $email,
542
                            itemcount      => $itemcount,
564
                            itemcount      => $itemcount,
543
                            titles         => $titles,
565
                            titles         => $titles,
544
                            outputformat   => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
566
                            outputformat   => $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
545
                        }
567
                        }
546
                      );
568
                      );
547
                } else {
569
                } else {
Lines 569-575 END_SQL Link Here
569
                                email          => $email,
591
                                email          => $email,
570
                                itemcount      => $itemcount,
592
                                itemcount      => $itemcount,
571
                                titles         => $titles,
593
                                titles         => $titles,
572
                                outputformat   => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
594
                                outputformat   => $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
573
                            }
595
                            }
574
                          );
596
                          );
575
                    }
597
                    }
Lines 580-586 END_SQL Link Here
580
    }
602
    }
581
603
582
    if (@output_chunks) {
604
    if (@output_chunks) {
583
        if ( defined $csvfilename ) {
605
        if ( $csvfilename ) {
584
            print $csv_fh @output_chunks;        
606
            print $csv_fh @output_chunks;        
585
        }
607
        }
586
        elsif ( defined $htmlfilename ) {
608
        elsif ( defined $htmlfilename ) {
Lines 735-740 sub prepare_letter_for_printing { Link Here
735
        }
757
        }
736
    } elsif ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'html' ) {
758
    } elsif ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'html' ) {
737
      $return = "<pre>\n";
759
      $return = "<pre>\n";
760
        $params->{'letter'}->{'content'} =~ s#
#<br/>#g;
738
      $return .= "$params->{'letter'}->{'content'}\n";
761
      $return .= "$params->{'letter'}->{'content'}\n";
739
      $return .= "\n</pre>\n";
762
      $return .= "\n</pre>\n";
740
    } else {
763
    } else {
741
- 

Return to bug 6030