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

(-)a/misc/cronjobs/overdue_notices.pl (-7 / +9 lines)
Lines 350-356 if ( defined $csvfilename ) { Link Here
350
    } else {
350
    } else {
351
        open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!";
351
        open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!";
352
    }
352
    }
353
    if ( $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) {
353
    if ( $csv->combine(qw(name surname address1 address2 zipcode city country email phone cardnumber itemcount itemsinfo)) ) {
354
        print $csv_fh $csv->string, "\n";
354
        print $csv_fh $csv->string, "\n";
355
    } else {
355
    } else {
356
        $verbose and warn 'combine failed on argument: ' . $csv->error_input;
356
        $verbose and warn 'combine failed on argument: ' . $csv->error_input;
Lines 364-374 if ( defined $htmlfilename ) { Link Here
364
    $html_fh = *STDOUT;
364
    $html_fh = *STDOUT;
365
  } else {
365
  } else {
366
    my $today = DateTime->now(time_zone => C4::Context->tz );
366
    my $today = DateTime->now(time_zone => C4::Context->tz );
367
    open $html_fh, ">",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html");
367
    open $html_fh, ">:utf8",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html");
368
  }
368
  }
369
  
369
  
370
  print $html_fh "<html>\n";
370
  print $html_fh "<html>\n";
371
  print $html_fh "<head>\n";
371
  print $html_fh "<head>\n";
372
  print $html_fh "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
372
  print $html_fh "<style type='text/css'>\n";
373
  print $html_fh "<style type='text/css'>\n";
373
  print $html_fh "pre {page-break-after: always;}\n";
374
  print $html_fh "pre {page-break-after: always;}\n";
374
  print $html_fh "pre {white-space: pre-wrap;}\n";
375
  print $html_fh "pre {white-space: pre-wrap;}\n";
Lines 439-445 END_SQL Link Here
439
            # <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode>
440
            # <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode>
440
441
441
            my $borrower_sql = <<'END_SQL';
442
            my $borrower_sql = <<'END_SQL';
442
SELECT distinct(issues.borrowernumber), firstname, surname, address, address2, city, zipcode, country, email
443
SELECT distinct(issues.borrowernumber), firstname, surname, address, address2, city, zipcode, country, email, phone, cardnumber
443
FROM   issues,borrowers,categories
444
FROM   issues,borrowers,categories
444
WHERE  issues.borrowernumber=borrowers.borrowernumber
445
WHERE  issues.borrowernumber=borrowers.borrowernumber
445
AND    borrowers.categorycode=categories.categorycode
446
AND    borrowers.categorycode=categories.categorycode
Lines 468-475 END_SQL Link Here
468
            $verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays)\nreturns " . $sth->rows . " rows";
469
            $verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays)\nreturns " . $sth->rows . " rows";
469
470
470
            while ( my ( $borrowernumber, $firstname, $lastname,
471
            while ( my ( $borrowernumber, $firstname, $lastname,
471
                    $address1, $address2, $city, $postcode, $country, $email
472
                    $address1, $address2, $city, $postcode, $country, $email,
472
                    ) = $sth->fetchrow )
473
                    $phone, $cardnumber) = $sth->fetchrow )
473
            {
474
            {
474
                $verbose and warn "borrower $firstname, $lastname ($borrowernumber) has items triggering level $i.";
475
                $verbose and warn "borrower $firstname, $lastname ($borrowernumber) has items triggering level $i.";
475
    
476
    
Lines 546-551 END_SQL Link Here
546
                            postcode       => $postcode,
547
                            postcode       => $postcode,
547
                            email          => $email,
548
                            email          => $email,
548
                            itemcount      => $itemcount,
549
                            itemcount      => $itemcount,
550
                            phone          => $phone,
551
                            cardnumber     => $cardnumber,
549
                            titles         => $titles,
552
                            titles         => $titles,
550
                            outputformat   => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
553
                            outputformat   => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '',
551
                        }
554
                        }
Lines 735-741 sub prepare_letter_for_printing { Link Here
735
    if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) {
738
    if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) {
736
        if ($csv->combine(
739
        if ($csv->combine(
737
                $params->{'firstname'}, $params->{'lastname'}, $params->{'address1'},  $params->{'address2'}, $params->{'postcode'},
740
                $params->{'firstname'}, $params->{'lastname'}, $params->{'address1'},  $params->{'address2'}, $params->{'postcode'},
738
                $params->{'city'},      $params->{'email'},    $params->{'itemcount'}, $params->{'titles'}
741
                $params->{'city'},      $params->{'email'},    $params->{'phone'},     $params->{'cardnumber'}, $params->{'itemcount'}, $params->{'titles'}
739
            )
742
            )
740
          ) {
743
          ) {
741
            return $csv->string, "\n";
744
            return $csv->string, "\n";
742
- 

Return to bug 8687