Bug 5484 - Handling bad borrower categories in serial routing lists more gracefully

Signed-off-by: Colin Campbell <colin.campbell@ptfs-europe.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Chris Cormack 2010-12-13 11:44:35 +00:00
parent 2b25835464
commit 96330a7b07
1 changed files with 15 additions and 11 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/perl
# Parts copyright Catalyst IT 2010
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
@ -110,18 +112,20 @@ my @resultsdata;
$to=($count>$to?$to:$count);
my $index=$from;
foreach my $borrower(@$results[$from..$to-1]){
#find out stats
$$borrower{'dateexpiry'}= C4::Dates->new($$borrower{'dateexpiry'},'iso')->output('syspref');
my %row = (
count => $index++,
%$borrower,
%{$categories_dislay{$$borrower{categorycode}}},
);
push(@resultsdata, \%row);
# find out stats
$borrower->{'dateexpiry'}= C4::Dates->new($borrower->{'dateexpiry'},'iso')->output('syspref');
if ($categories_dislay{$borrower->{'categorycode'}}){
my %row = (
count => $index++,
%$borrower,
%{$categories_dislay{$$borrower{categorycode}}},
);
push(@resultsdata, \%row);
}
else {
warn $borrower->{'cardnumber'} ." has a bad category code of " . $borrower->{'categorycode'} ."\n";
}
}
if ($$patron{branchcode}){
foreach my $branch (grep{$_->{value} eq $$patron{branchcode}}@$branches){
$$branch{selected}=1;