Bug 9104: country in CSV in overdue_notices.pl

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Output of of the overdues script with -csv now contains country
from the first address in the patron account.

I checked output for 2 patrons, one with and one without country
in the patron's address.

All tests pass. Perlcritic fails before and after:
"require" statement with library name as string at line 29, column 12.
Use a bareword instead.  (Severity: 5)
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Fridolyn SOMERS 2012-12-03 10:12:42 +01:00 committed by Jared Camins-Esakov
parent 570372b24e
commit c0d2db7781

View file

@ -442,7 +442,7 @@ END_SQL
# this text contains fields that are replaced by their value. Those fields must be written between brackets
# The following fields are available :
# itemcount is interpreted here as the number of items in the overdue range defined by the current notice or all overdues < max if(-list-all).
# <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode>
# <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country>
my $borrower_sql = <<'END_SQL';
SELECT distinct(issues.borrowernumber), firstname, surname, address, address2, city, zipcode, country, email
@ -551,6 +551,7 @@ END_SQL
address2 => $address2,
city => $city,
postcode => $postcode,
country => $country,
email => $email,
itemcount => $itemcount,
titles => $titles,
@ -579,6 +580,7 @@ END_SQL
address2 => $address2,
city => $city,
postcode => $postcode,
country => $country,
email => $email,
itemcount => $itemcount,
titles => $titles,
@ -604,7 +606,7 @@ END_SQL
print @output_chunks;
}
# Generate the content of the csv with headers
my $content = join(";", qw(title name surname address1 address2 zipcode city email itemcount itemsinfo due_date issue_date)) . "\n";
my $content = join(";", qw(title name surname address1 address2 zipcode city country email itemcount itemsinfo due_date issue_date)) . "\n";
$content .= join( "\n", @output_chunks );
my $attachment = {
@ -744,7 +746,7 @@ sub prepare_letter_for_printing {
if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) {
if ($csv->combine(
$params->{'firstname'}, $params->{'lastname'}, $params->{'address1'}, $params->{'address2'}, $params->{'postcode'},
$params->{'city'}, $params->{'email'}, $params->{'itemcount'}, $params->{'titles'}
$params->{'city'}, $params->{'country'}, $params->{'email'}, $params->{'itemcount'}, $params->{'titles'}
)
) {
return $csv->string, "\n";