Lines 66-72
my $columnkeystpl = [ map { {'key' => $_} } grep {$_ ne 'borrowernumber' && $_
Link Here
|
66 |
|
66 |
|
67 |
my $input = CGI->new(); |
67 |
my $input = CGI->new(); |
68 |
our $csv = Text::CSV->new({binary => 1}); # binary needed for non-ASCII Unicode |
68 |
our $csv = Text::CSV->new({binary => 1}); # binary needed for non-ASCII Unicode |
69 |
# push @feedback, {feedback=>1, name=>'backend', value=>$csv->backend, backend=>$csv->backend}; |
69 |
#push @feedback, {feedback=>1, name=>'backend', value=>$csv->backend, backend=>$csv->backend}; #XXX |
70 |
|
70 |
|
71 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ |
71 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ |
72 |
template_name => "tools/import_borrowers.tmpl", |
72 |
template_name => "tools/import_borrowers.tmpl", |
Lines 193-198
if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
Link Here
|
193 |
} |
193 |
} |
194 |
if ($extended) { |
194 |
if ($extended) { |
195 |
my $attr_str = $borrower{patron_attributes}; |
195 |
my $attr_str = $borrower{patron_attributes}; |
|
|
196 |
$attr_str =~ s/\xe2\x80\x9c/"/g; # fixup double quotes in case we are passed smart quotes |
197 |
$attr_str =~ s/\xe2\x80\x9d/"/g; |
198 |
push @feedback, {feedback=>1, name=>'attribute string', value=>$attr_str, filename=>$uploadborrowers}; |
196 |
delete $borrower{patron_attributes}; # not really a field in borrowers, so we don't want to pass it to ModMember. |
199 |
delete $borrower{patron_attributes}; # not really a field in borrowers, so we don't want to pass it to ModMember. |
197 |
$patron_attributes = extended_attributes_code_value_arrayref($attr_str); |
200 |
$patron_attributes = extended_attributes_code_value_arrayref($attr_str); |
198 |
} |
201 |
} |
Lines 246-251
if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
Link Here
|
246 |
} |
249 |
} |
247 |
unless (ModMember(%borrower)) { |
250 |
unless (ModMember(%borrower)) { |
248 |
$invalid++; |
251 |
$invalid++; |
|
|
252 |
# untill we have better error trapping, we have no way of knowing why ModMember errored out... |
253 |
push @errors, {unknown_error => 1}; |
249 |
$template->param('lastinvalid'=>$borrower{'surname'}.' / '.$borrowernumber); |
254 |
$template->param('lastinvalid'=>$borrower{'surname'}.' / '.$borrowernumber); |
250 |
next LINE; |
255 |
next LINE; |
251 |
} |
256 |
} |
Lines 254-260
if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
Link Here
|
254 |
my $old_attributes = GetBorrowerAttributes($borrowernumber); |
259 |
my $old_attributes = GetBorrowerAttributes($borrowernumber); |
255 |
$patron_attributes = extended_attributes_merge($old_attributes, $patron_attributes); #TODO: expose repeatable options in template |
260 |
$patron_attributes = extended_attributes_merge($old_attributes, $patron_attributes); #TODO: expose repeatable options in template |
256 |
} |
261 |
} |
257 |
SetBorrowerAttributes($borrower{'borrowernumber'}, $patron_attributes); |
262 |
push @errors, {unknown_error => 1} unless SetBorrowerAttributes($borrower{'borrowernumber'}, $patron_attributes); |
258 |
} |
263 |
} |
259 |
$overwritten++; |
264 |
$overwritten++; |
260 |
$template->param('lastoverwritten'=>$borrower{'surname'}.' / '.$borrowernumber); |
265 |
$template->param('lastoverwritten'=>$borrower{'surname'}.' / '.$borrowernumber); |
Lines 276-281
if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
Link Here
|
276 |
$template->param('lastimported'=>$borrower{'surname'}.' / '.$borrowernumber); |
281 |
$template->param('lastimported'=>$borrower{'surname'}.' / '.$borrowernumber); |
277 |
} else { |
282 |
} else { |
278 |
$invalid++; |
283 |
$invalid++; |
|
|
284 |
push @errors, {unknown_error => 1}; |
279 |
$template->param('lastinvalid'=>$borrower{'surname'}.' / AddMember'); |
285 |
$template->param('lastinvalid'=>$borrower{'surname'}.' / AddMember'); |
280 |
} |
286 |
} |
281 |
} |
287 |
} |
282 |
- |
|
|