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

(-)a/C4/Templates.pm (-1 / +1 lines)
Lines 325-331 sub getlanguage { Link Here
325
    my $lang;
325
    my $lang;
326
326
327
    # cookie
327
    # cookie
328
    if ( $query->cookie('KohaOpacLanguage') ) {
328
    if ( defined $query and $query->cookie('KohaOpacLanguage') ) {
329
        $lang = $query->cookie('KohaOpacLanguage');
329
        $lang = $query->cookie('KohaOpacLanguage');
330
        $lang =~ s/[^a-zA-Z_-]*//; # sanitize cookie
330
        $lang =~ s/[^a-zA-Z_-]*//; # sanitize cookie
331
    }
331
    }
(-)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 (-17 / +46 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 389-395 foreach my $branchcode (@branches) { Link Here
389
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address;
405
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address;
390
406
391
    my $sth2 = $dbh->prepare( <<"END_SQL" );
407
    my $sth2 = $dbh->prepare( <<"END_SQL" );
392
SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue
408
SELECT biblio.title as "biblio.title", biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue
393
  FROM issues,items,biblio, biblioitems
409
  FROM issues,items,biblio, biblioitems
394
  WHERE items.itemnumber=issues.itemnumber
410
  WHERE items.itemnumber=issues.itemnumber
395
    AND biblio.biblionumber   = items.biblionumber
411
    AND biblio.biblionumber   = items.biblionumber
Lines 486-495 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;
509
                if ($htmlfilename) {
510
                    $titles = "<table id='itemscontent$borrowernumber'>";
511
                    $titles .= "<thead><tr><th>" . join( "</th><th>", @$columns_def_hashref{@item_content_fields} );
512
                    $titles .= "</th></tr></thead><tbody>";
513
                }
493
                my @items = ();
514
                my @items = ();
494
                
515
                
495
                my $j = 0;
516
                my $j = 0;
Lines 501-510 END_SQL Link Here
501
                    }
522
                    }
502
                    $j++;
523
                    $j++;
503
                    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;
504
                    $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
                    }
505
                    $itemcount++;
530
                    $itemcount++;
506
                    push @items, $item_info;
531
                    push @items, $item_info;
507
                }
532
                }
533
                $titles .= "</tbody></table>" if ($htmlfilename);
534
                $debug && warn $titles;
508
                $sth2->finish;
535
                $sth2->finish;
509
536
510
                my $letter = parse_letter(
537
                my $letter = parse_letter(
Lines 528-544 END_SQL Link Here
528
                    next PERIOD;
555
                    next PERIOD;
529
                }
556
                }
530
                
557
                
531
                if ( $exceededPrintNoticesMaxLines ) {
558
                $letter->{'content-type'}="text/".($htmlfilename?"html":"plain")."; charset=UTF8";
532
                  $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
559
560
                if ($exceededPrintNoticesMaxLines) {
561
                    $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
533
                }
562
                }
534
563
535
                my @misses = grep { /./ } map { /^([^>]*)[>]+/; ( $1 || '' ); } split /\</, $letter->{'content'};
564
                my @misses = grep { /./ } map { /^([^>]*)[>]{2,}/; ( $1 || '' ); } split /\<\</, $letter->{'content'};
536
                if (@misses) {
565
                if (@misses) {
537
                    $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;
538
                }
567
                }
539
                $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.
540
                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # 2nd pass for the double nesting.
541
    
569
    
570
                #                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # 2nd pass for the double nesting.
542
                if ($nomail) {
571
                if ($nomail) {
543
    
572
    
544
                    push @output_chunks,
573
                    push @output_chunks,
Lines 554-560 END_SQL Link Here
554
                            email          => $email,
583
                            email          => $email,
555
                            itemcount      => $itemcount,
584
                            itemcount      => $itemcount,
556
                            titles         => $titles,
585
                            titles         => $titles,
557
                            outputformat   => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
586
                            outputformat   => $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
558
                        }
587
                        }
559
                      );
588
                      );
560
                } else {
589
                } else {
Lines 582-588 END_SQL Link Here
582
                                email          => $email,
611
                                email          => $email,
583
                                itemcount      => $itemcount,
612
                                itemcount      => $itemcount,
584
                                titles         => $titles,
613
                                titles         => $titles,
585
                                outputformat   => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
614
                                outputformat   => $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
586
                            }
615
                            }
587
                          );
616
                          );
588
                    }
617
                    }
Lines 593-599 END_SQL Link Here
593
    }
622
    }
594
623
595
    if (@output_chunks) {
624
    if (@output_chunks) {
596
        if ( defined $csvfilename ) {
625
        if ( $csvfilename ) {
597
            print $csv_fh @output_chunks;        
626
            print $csv_fh @output_chunks;        
598
        }
627
        }
599
        elsif ( defined $htmlfilename ) {
628
        elsif ( defined $htmlfilename ) {
Lines 753-758 sub prepare_letter_for_printing { Link Here
753
        }
782
        }
754
    } elsif ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'html' ) {
783
    } elsif ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'html' ) {
755
      $return = "<pre>\n";
784
      $return = "<pre>\n";
785
        $params->{'letter'}->{'content'} =~ s#
#<br/>#g;
756
      $return .= "$params->{'letter'}->{'content'}\n";
786
      $return .= "$params->{'letter'}->{'content'}\n";
757
      $return .= "\n</pre>\n";
787
      $return .= "\n</pre>\n";
758
    } else {
788
    } else {
759
- 

Return to bug 6030