Bugzilla – Attachment 58922 Details for
Bug 17181
Patron card creator replaces existing image when uploading image with same name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17181: Simplify code
Bug-17181-Simplify-code.patch (text/plain), 1.95 KB, created by
Jonathan Druart
on 2017-01-13 09:24:45 UTC
(
hide
)
Description:
Bug 17181: Simplify code
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-13 09:24:45 UTC
Size:
1.95 KB
patch
obsolete
>From aaada84e4a217961a570510a0e7d287a9e8d4b0b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 11 Jan 2017 22:37:33 +0100 >Subject: [PATCH] Bug 17181: Simplify code > >- do not prepare statement when used only once >- remove use of Data::Dumper >- remove $duplicate, not needed > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > patroncards/image-manage.pl | 14 +++----------- > 1 file changed, 3 insertions(+), 11 deletions(-) > >diff --git a/patroncards/image-manage.pl b/patroncards/image-manage.pl >index eb5639c..fafd7b0 100755 >--- a/patroncards/image-manage.pl >+++ b/patroncards/image-manage.pl >@@ -6,7 +6,6 @@ use strict; > use CGI qw ( -utf8 ); > use Graphics::Magick; > use POSIX qw(ceil); >-use autouse 'Data::Dumper' => qw(Dumper); > > use C4::Context; > use C4::Auth; >@@ -14,7 +13,6 @@ use C4::Output; > use C4::Debug; > use C4::Creators; > use C4::Patroncards; >-use Data::Dumper; > > my $cgi = CGI->new; > >@@ -49,15 +47,10 @@ my $errstr = ''; # NOTE: For error codes see error-messages.inc > > if ($op eq 'upload') { > # Checking for duplicate image name >- my $duplicate; > my $dbh = C4::Context->dbh; > my $query = "SELECT COUNT(*) FROM creator_images WHERE image_name=?"; >- my $sth = $dbh->prepare($query); >- $sth->execute($image_name); >- my $count = $sth->fetchrow_arrayref; >- if ( $count->[0] > 0 ) { >- $duplicate = 1; >- warn sprintf('Image name already exists.'); >+ my ( $exists ) = $dbh->selectrow_array( $query, undef, $image_name ); >+ if ( $exists ) { > $errstr = 304; > $template->param( > IMPORT_SUCCESSFUL => 0, >@@ -66,8 +59,7 @@ if ($op eq 'upload') { > TABLE => $table, > error => $errstr, > ); >- } >- unless ($duplicate) { >+ } else { > if (!$upload_file) { > warn sprintf('An error occurred while attempting to upload file %s.', $source_file); > $errstr = 301; >-- >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 17181
:
58789
|
58808
|
58888
|
58917
|
58921
| 58922