Bugzilla – Attachment 26046 Details for
Bug 11917
upload patron image can raise a software error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11917: upload image - catch error if cardnumber does not exist.
Bug-11917-upload-image---catch-error-if-cardnumber.patch (text/plain), 1.52 KB, created by
Jonathan Druart
on 2014-03-11 08:13:36 UTC
(
hide
)
Description:
Bug 11917: upload image - catch error if cardnumber does not exist.
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-03-11 08:13:36 UTC
Size:
1.52 KB
patch
obsolete
>From 8c8fd95a410997dedbc6e0b7392b722f7ee6c795 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 10 Mar 2014 14:20:45 +0100 >Subject: [PATCH] Bug 11917: upload image - catch error if cardnumber does not > exist. > >On uploading a patron image, if the given cardnumber does not exist, >a software error is raised > >DBD::mysql::st execute failed: Column 'borrowernumber' cannot be null at /home/koha/src/C4/Members.pm line 1916. > >Test plan: >SET DEBUG=1 in your apache configuration >go on tools/picture-upload.pl, choose an image and put a cardnumber which does not exist in DB. >With the patch, you should get a friendly error message. >--- > tools/picture-upload.pl | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl >index b2aa18a..ab2692a 100755 >--- a/tools/picture-upload.pl >+++ b/tools/picture-upload.pl >@@ -258,7 +258,10 @@ sub handle_file { > $debug and warn "Image is of mimetype $mimetype"; > my $dberror; > if ($mimetype) { >- $dberror = PutPatronImage( $cardnumber, $mimetype, $imgfile ); >+ $dberror = eval { >+ PutPatronImage( $cardnumber, $mimetype, $imgfile ); >+ }; >+ $dberror = $@ if $@; > } > if ( !$dberror && $mimetype ) { # Errors from here on are fatal only to the import of a particular image, so don't bail, just note the error and keep going > $count{count}++; >-- >1.7.10.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 11917
:
26005
|
26046
|
26117