Summary: | Can't upload and import zipped file of patron images | ||
---|---|---|---|
Product: | Koha | Reporter: | Owen Leonard <oleonard> |
Component: | Patrons | Assignee: | Ivan Brown <I.Brown> |
Status: | CLOSED FIXED | QA Contact: | Mason James <mtj> |
Severity: | normal | ||
Priority: | P5 - low | CC: | ago, ata.rehman, chris, cnighswonger, gmcharlt, I.Brown, kaust, kyle, mtj, paul.poulain, wizzyrea |
Version: | 3.8 | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
proposed patch
[SIGNED-OFF] Bug 7643 - Can't upload and import zipped file of patron images |
Description
Owen Leonard
2012-03-05 15:35:50 UTC
I confirm this bug - a slight variation, I had a single image, single patron in similar format to Owen's. Mine came back Unpacking completed 4 directorie(s) scanned. 4 directorie(s) processed. Now, I didn't have 4 directories in my zip file, very odd. Dear All I'm also getting the same error in Koha 3.6.4 Ata ur Rehman LISolutions For 3.6 I found that unzip hadn't been installed on a site. Once I installed that I got errors. I installed an earlier version of picture-upload.pl and that resolved the problem. http://git.koha-community.org/gitweb/?p=koha.git;a=blob_plain;f=tools/picture-upload.pl;hb=44201a54e15f06d13c2f40d93bd5a76f6493d7d2 I'm seeing a similar problem on 3.8, and am going to test that now. Hi, same problem with 3.8 missing unzip fixed with : sudo apt-get install unzip current 3.8 picture-upload.pl gives this error: Patron image failed to upload Unpacking completed 1 directories scanned. 1 directories processed. - Cardnumber: WARNING: This image not imported because the cardnumber and filename is missing. installed the older picture-upload.pl and it now works fine. Here's the diff of the two: (picture-upload.pl.orig = 3.8 version) kohaclone/tools$ diff picture-upload.pl picture-upload.pl.orig 61c61 < picture-upload.p. - Script for handling uploading of both single and bulk patronimages and importing them into the database. --- > picture-upload.pl - Script for handling uploading of both single and bulk patronimages and importing them into the database. 81c81,84 < my $filesuffix = $1 if $uploadfilename =~ m/(\..+)$/i; --- > my $filesuffix; > if ( $uploadfilename =~ m/(\..+)$/i ) { > my $filesuffix = $1; > } 98c101 < unless (system("unzip $tempfile -d $dirname") == 0) { --- > unless (system("unzip", $tempfile, '-d', $dirname) == 0) { 257,258c260,264 < my $dberror = PutPatronImage($cardnumber,$mimetype, $imgfile) if $mimetype; < 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 --- > my $dberror; > if ($mimetype) { > $dberror = PutPatronImage( $cardnumber, $mimetype, $imgfile ); > } > 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 298,299d303 < < =back I think I have managed to fix this. In the new code: my $filesuffix; if ( $uploadfilename =~ m/(\..+)$/i ) { my $filesuffix = $1; } $filesuffix is being declared as local (with my) twice. If the second my is deleted, the upload works. (In reply to comment #5) > I think I have managed to fix this. > > In the new code: > > my $filesuffix; > if ( $uploadfilename =~ m/(\..+)$/i ) { > my $filesuffix = $1; > } > > $filesuffix is being declared as local (with my) twice. > > If the second my is deleted, the upload works. Good catch indeed! And here is the commit which broke it: http://git.koha-community.org/gitweb/?p=koha.git;a=commit;h=b5b71339f3e3dfd639609ecc4b6912435d29704b Maybe you would consider submitting a patch to fix this bug? In return, you'll get your name added to the list of those who make Koha what it is. Created attachment 12503 [details] [review] proposed patch Updating status Created attachment 12577 [details] [review] [SIGNED-OFF] Bug 7643 - Can't upload and import zipped file of patron images Fixed problem with re-declaration of $filesuffix Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> (In reply to comment #9) > Created attachment 12577 [details] [review] > [SIGNED-OFF] Bug 7643 - Can't upload and import zipped file of patron images > > Fixed problem with re-declaration of $filesuffix > > Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> patch looks good, passing QA... thanks for the patch Ivan! :p $ koha-qa.pl -c 1 testing 1 commit(s) (applied to commit 0c75d66) * 7ab41ad Bug 7643 - Can't upload and import zipped file of patron images tools/picture-upload.pl * tools/picture-upload.pl OK Patch pushed to master Pushed to 3.8.x will be in 3.8.6. Thanks Ivan and welcome to the Koha contributors family! |