Bug 19420: (QA Follow-up) Change in error reporting affects upload.pl
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 6 Nov 2017 10:28:46 +0000 (11:28 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 8 Nov 2017 16:31:37 +0000 (13:31 -0300)
The change from the first patch requires a similar change in upload.pl
when a few error codes are passed to the template.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested by deleting a temporary file manually and downloading or deleting
the file from the upload search results.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

tools/upload.pl

index fd70b13..dafb8dd 100755 (executable)
@@ -83,9 +83,9 @@ if ( $op eq 'new' ) {
     my $delete = $rec ? $rec->delete : undef;
     #TODO Improve error handling
     my $msg = $delete
-        ? JSON::to_json({ $fn => 6 })
+        ? JSON::to_json({ $fn => { code => 6 }})
         : $id
-        ? JSON::to_json({ $fn || $id, 7 })
+        ? JSON::to_json({ $fn || $id, { code => 7 }})
         : '';
     $template->param(
         mode             => 'deleted',
@@ -100,7 +100,7 @@ if ( $op eq 'new' ) {
     if ( !$rec || !$fh ) {
         $template->param(
             mode             => 'new',
-            msg              => JSON::to_json( { $id => 5 } ),
+            msg              => JSON::to_json({ $id => { code => 5 }}),
         );
         output_html_with_http_headers $input, $cookie, $template->output;
     } else {