Bugzilla – Attachment 67685 Details for
Bug 19420
Improve display of errors from failure of uploading file during stage import
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19420: Improve display of errors from failure of uploading file during stage import
Bug-19420-Improve-display-of-errors-from-failure-o.patch (text/plain), 3.78 KB, created by
Nick Clemens (kidclamp)
on 2017-10-06 10:06:24 UTC
(
hide
)
Description:
Bug 19420: Improve display of errors from failure of uploading file during stage import
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-10-06 10:06:24 UTC
Size:
3.78 KB
patch
obsolete
>From b31d92c3c25c20f105279f2f9e75494ef725c963 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 6 Oct 2017 10:00:53 +0000 >Subject: [PATCH] Bug 19420: Improve display of errors from failure of > uploading file during stage import > >To test: >1 - sudo chown www-data:www-data /tmp/koha_kohadev_upload/ (or your > relevant dir and user) >2 - Attempt to stage a file >3 - Error message is: Upload status: Failed >4 - Apply patch >5 - Repeat upload >6 - Error is now: Failed - Directory is not writeable: >/tmp/koha_kohadev_upload >7 - Trigger the other errors if you can and note better responses >--- > Koha/Uploader.pm | 8 +++++++- > .../intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt | 5 +++-- > 2 files changed, 10 insertions(+), 3 deletions(-) > >diff --git a/Koha/Uploader.pm b/Koha/Uploader.pm >index 844c166..5bc8d03 100644 >--- a/Koha/Uploader.pm >+++ b/Koha/Uploader.pm >@@ -153,7 +153,9 @@ sub err { > my $err; > foreach my $f ( keys %{ $self->{files} } ) { > my $e = $self->{files}->{$f}->{errcode}; >- $err->{ $f } = $e if $e; >+ my $etext = $self->{files}->{$f}->{errtext}; >+ $err->{ $f }->{code} = $e if $e; >+ $err->{ $f }->{text} = $etext; > } > return $err; > } >@@ -221,8 +223,10 @@ sub _create_file { > #skip > } elsif( !$self->{temporary} && !$self->{rootdir} ) { > $self->{files}->{$filename}->{errcode} = 3; #no rootdir >+ $self->{files}->{$filename}->{errtext} = "Root directory for uploads not defined"; #no rootdir > } elsif( $self->{temporary} && !$self->{tmpdir} ) { > $self->{files}->{$filename}->{errcode} = 4; #no tempdir >+ $self->{files}->{$filename}->{errtext} = "Temporary directory for uploads not defined"; #no tempdir > } else { > my $dir = $self->_dir; > my $hashval = $self->{files}->{$filename}->{hash}; >@@ -236,6 +240,7 @@ sub _create_file { > uploadcategorycode => $self->{category}, > })->count ) { > $self->{files}->{$filename}->{errcode} = 1; #already exists >+ $self->{files}->{$filename}->{errtext} = "File already exists: $dir/$fn"; #already exists > return; > } > >@@ -245,6 +250,7 @@ sub _create_file { > $self->{files}->{$filename}->{fh}= $fh; > } else { > $self->{files}->{$filename}->{errcode} = 2; #not writable >+ $self->{files}->{$filename}->{errtext} = "Directory is not writeable: $dir"; #not writable > } > } > return $fh; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt >index 233b527..3de2d58 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt >@@ -61,7 +61,7 @@ function CancelUpload() { > $("#fileuploadfailed").show(); > $("#fileuploadfailed").text( _("Upload status: Cancelled ") ); > } >-function cbUpload( status, fileid ) { >+function cbUpload( status, fileid, errors ) { > if( status=='done' ) { > $("#uploadedfileid").val( fileid ); > $('#fileToUpload').prop('disabled',true); >@@ -74,12 +74,13 @@ function cbUpload( status, fileid ) { > } > $("#processfile").show(); > } else { >+ var errText = errors[$('#fileToUpload').prop('files')[0].name].text ; > $('#fileuploadbutton').show(); > $("#fileuploadcancel").hide(); > $("#fileuploadstatus").hide(); > $("#fileuploadfailed").show(); > $("#fileuploadfailed").text( _("Upload status: ") + >- ( status=='failed'? _("Failed"): >+ ( status=='failed'? _("Failed") + " - " + errText: > ( status=='denied'? _("Denied"): status )) > ); > } >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19420
:
67685
|
68292
|
68365
|
68909
|
68910
|
68941
|
68960
|
68961
|
68962
|
68963