Bug 37365: (QA follow-up) Add error checking around AddFile call
Test plan: Add a return; in AddFile to simulate a failing db insert. Verify that an alert pops up. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> (cherry picked from commit35d90969f1) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commitc8cab29919) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
8768a3f701
commit
78c719ea95
|
|
@ -47,6 +47,7 @@
|
|||
<div class="dialog alert">
|
||||
[% IF errors.empty_upload %]The file you are attempting to upload has no contents.[% END %]
|
||||
[% IF errors.no_file %]You did not select a file to upload.[% END %]
|
||||
[% IF errors.upload_failed %]The upload failed. More information may be in the system logs.[% END %]
|
||||
</div>
|
||||
[% END %]
|
||||
|
||||
|
|
|
|||
|
|
@ -87,12 +87,13 @@ else {
|
|||
$file_content .= $_;
|
||||
}
|
||||
|
||||
$bf->AddFile(
|
||||
my $rv = $bf->AddFile(
|
||||
name => $filename,
|
||||
type => $mimetype,
|
||||
content => $file_content,
|
||||
description => scalar $cgi->param('description'),
|
||||
);
|
||||
$errors{upload_failed} = 1 unless $rv;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -103,9 +104,7 @@ else {
|
|||
}
|
||||
|
||||
$template->param(
|
||||
files => Koha::Patron::Files->new( borrowernumber => $borrowernumber )
|
||||
->GetFilesInfo(),
|
||||
|
||||
files => Koha::Patron::Files->new( borrowernumber => $borrowernumber )->GetFilesInfo(),
|
||||
errors => \%errors,
|
||||
);
|
||||
output_html_with_http_headers $cgi, $cookie, $template->output;
|
||||
|
|
|
|||
Loading…
Reference in New Issue