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

(-)a/misc/cronjobs/overdue_notices.pl (-7 / +13 lines)
Lines 378-384 if ( defined $csvfilename ) { Link Here
378
    } else {
378
    } else {
379
        open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!";
379
        open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!";
380
    }
380
    }
381
    if ( $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) {
381
    if ( $csv->combine(qw(name surname address1 address2 zipcode city country email phone cardnumber itemcount itemsinfo branchname letternumber)) ) {
382
        print $csv_fh $csv->string, "\n";
382
        print $csv_fh $csv->string, "\n";
383
    } else {
383
    } else {
384
        $verbose and warn 'combine failed on argument: ' . $csv->error_input;
384
        $verbose and warn 'combine failed on argument: ' . $csv->error_input;
Lines 392-402 if ( defined $htmlfilename ) { Link Here
392
    $fh = *STDOUT;
392
    $fh = *STDOUT;
393
  } else {
393
  } else {
394
    my $today = DateTime->now(time_zone => C4::Context->tz );
394
    my $today = DateTime->now(time_zone => C4::Context->tz );
395
    open $fh, ">",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html");
395
    open $fh, ">:encoding(UTF-8)",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html");
396
  }
396
  }
397
  
397
  
398
  print $fh "<html>\n";
398
  print $fh "<html>\n";
399
  print $fh "<head>\n";
399
  print $fh "<head>\n";
400
  print $fh "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
400
  print $fh "<style type='text/css'>\n";
401
  print $fh "<style type='text/css'>\n";
401
  print $fh "pre {page-break-after: always;}\n";
402
  print $fh "pre {page-break-after: always;}\n";
402
  print $fh "pre {white-space: pre-wrap;}\n";
403
  print $fh "pre {white-space: pre-wrap;}\n";
Lines 425-434 foreach my $branchcode (@branches) { Link Here
425
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address;
426
    $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address;
426
427
427
    my $sth2 = $dbh->prepare( <<"END_SQL" );
428
    my $sth2 = $dbh->prepare( <<"END_SQL" );
428
SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue
429
SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue, branchname
429
  FROM issues,items,biblio, biblioitems
430
  FROM issues,items,biblio, biblioitems, branches b
430
  WHERE items.itemnumber=issues.itemnumber
431
  WHERE items.itemnumber=issues.itemnumber
431
    AND biblio.biblionumber   = items.biblionumber
432
    AND biblio.biblionumber   = items.biblionumber
433
    AND b.branchcode = items.homebranch
432
    AND biblio.biblionumber   = biblioitems.biblionumber
434
    AND biblio.biblionumber   = biblioitems.biblionumber
433
    AND issues.borrowernumber = ?
435
    AND issues.borrowernumber = ?
434
    AND TO_DAYS($date)-TO_DAYS(date_due) BETWEEN ? and ?
436
    AND TO_DAYS($date)-TO_DAYS(date_due) BETWEEN ? and ?
Lines 474-480 END_SQL Link Here
474
            # <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country>
476
            # <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country>
475
477
476
            my $borrower_sql = <<'END_SQL';
478
            my $borrower_sql = <<'END_SQL';
477
SELECT distinct(issues.borrowernumber), firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber
479
SELECT distinct(issues.borrowernumber), firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber
478
FROM   issues,borrowers,categories
480
FROM   issues,borrowers,categories
479
WHERE  issues.borrowernumber=borrowers.borrowernumber
481
WHERE  issues.borrowernumber=borrowers.borrowernumber
480
AND    borrowers.categorycode=categories.categorycode
482
AND    borrowers.categorycode=categories.categorycode
Lines 616-621 END_SQL Link Here
616
                              address1       => $data->{'address'},
618
                              address1       => $data->{'address'},
617
                              address2       => $data->{'address2'},
619
                              address2       => $data->{'address2'},
618
                              city           => $data->{'city'},
620
                              city           => $data->{'city'},
621
                              phone          => $data->{'phone'},
622
                              cardnumber     => $data->{'cardnumber'},
623
                              branchname     => $branch_details->{'branchname'},
624
                              letternumber   => $i,
619
                              postcode       => $data->{'zipcode'},
625
                              postcode       => $data->{'zipcode'},
620
                              country        => $data->{'country'},
626
                              country        => $data->{'country'},
621
                              email          => $notice_email,
627
                              email          => $notice_email,
Lines 813-819 sub prepare_letter_for_printing { Link Here
813
    if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) {
819
    if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) {
814
        if ($csv->combine(
820
        if ($csv->combine(
815
                $params->{'firstname'}, $params->{'lastname'}, $params->{'address1'},  $params->{'address2'}, $params->{'postcode'},
821
                $params->{'firstname'}, $params->{'lastname'}, $params->{'address1'},  $params->{'address2'}, $params->{'postcode'},
816
                $params->{'city'}, $params->{'country'}, $params->{'email'}, $params->{'itemcount'}, $params->{'titles'}
822
                $params->{'city'}, $params->{'country'}, $params->{'email'}, $params->{'phone'}, $params->{'cardnumber'},
823
                $params->{'itemcount'}, $params->{'titles'}, $params->{'branchname'}, $params->{'letternumber'}
817
            )
824
            )
818
          ) {
825
          ) {
819
            return $csv->string, "\n";
826
            return $csv->string, "\n";
820
- 

Return to bug 8687