|
Lines 6-12
use strict;
Link Here
|
| 6 |
use CGI qw ( -utf8 ); |
6 |
use CGI qw ( -utf8 ); |
| 7 |
use Graphics::Magick; |
7 |
use Graphics::Magick; |
| 8 |
use POSIX qw(ceil); |
8 |
use POSIX qw(ceil); |
| 9 |
use autouse 'Data::Dumper' => qw(Dumper); |
|
|
| 10 |
|
9 |
|
| 11 |
use C4::Context; |
10 |
use C4::Context; |
| 12 |
use C4::Auth; |
11 |
use C4::Auth; |
|
Lines 14-20
use C4::Output;
Link Here
|
| 14 |
use C4::Debug; |
13 |
use C4::Debug; |
| 15 |
use C4::Creators; |
14 |
use C4::Creators; |
| 16 |
use C4::Patroncards; |
15 |
use C4::Patroncards; |
| 17 |
use Data::Dumper; |
|
|
| 18 |
|
16 |
|
| 19 |
my $cgi = CGI->new; |
17 |
my $cgi = CGI->new; |
| 20 |
|
18 |
|
|
Lines 49-63
my $errstr = ''; # NOTE: For error codes see error-messages.inc
Link Here
|
| 49 |
|
47 |
|
| 50 |
if ($op eq 'upload') { |
48 |
if ($op eq 'upload') { |
| 51 |
# Checking for duplicate image name |
49 |
# Checking for duplicate image name |
| 52 |
my $duplicate; |
|
|
| 53 |
my $dbh = C4::Context->dbh; |
50 |
my $dbh = C4::Context->dbh; |
| 54 |
my $query = "SELECT COUNT(*) FROM creator_images WHERE image_name=?"; |
51 |
my $query = "SELECT COUNT(*) FROM creator_images WHERE image_name=?"; |
| 55 |
my $sth = $dbh->prepare($query); |
52 |
my ( $exists ) = $dbh->selectrow_array( $query, undef, $image_name ); |
| 56 |
$sth->execute($image_name); |
53 |
if ( $exists ) { |
| 57 |
my $count = $sth->fetchrow_arrayref; |
|
|
| 58 |
if ( $count->[0] > 0 ) { |
| 59 |
$duplicate = 1; |
| 60 |
warn sprintf('Image name already exists.'); |
| 61 |
$errstr = 304; |
54 |
$errstr = 304; |
| 62 |
$template->param( |
55 |
$template->param( |
| 63 |
IMPORT_SUCCESSFUL => 0, |
56 |
IMPORT_SUCCESSFUL => 0, |
|
Lines 66-73
if ($op eq 'upload') {
Link Here
|
| 66 |
TABLE => $table, |
59 |
TABLE => $table, |
| 67 |
error => $errstr, |
60 |
error => $errstr, |
| 68 |
); |
61 |
); |
| 69 |
} |
62 |
} else { |
| 70 |
unless ($duplicate) { |
|
|
| 71 |
if (!$upload_file) { |
63 |
if (!$upload_file) { |
| 72 |
warn sprintf('An error occurred while attempting to upload file %s.', $source_file); |
64 |
warn sprintf('An error occurred while attempting to upload file %s.', $source_file); |
| 73 |
$errstr = 301; |
65 |
$errstr = 301; |
| 74 |
- |
|
|