View | Details | Raw Unified | Return to bug 26145
Collapse All | Expand All

(-)a/C4/Images.pm (-10 / +39 lines)
Lines 18-29 package C4::Images; Link Here
18
# You should have received a copy of the GNU General Public License
18
# You should have received a copy of the GNU General Public License
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
20
21
use strict;
21
use Modern::Perl;
22
use warnings;
23
use 5.010;
24
22
25
use C4::Context;
23
use C4::Context;
26
use GD;
24
use GD;
25
use Koha::Exceptions;
27
26
28
use vars qw($debug $noimage @ISA @EXPORT);
27
use vars qw($debug $noimage @ISA @EXPORT);
29
28
Lines 47-64 BEGIN { Link Here
47
46
48
=head2 PutImage
47
=head2 PutImage
49
48
50
    PutImage($biblionumber, $srcimage, $replace);
49
    PutImage({ biblionumber => $biblionumber, itemnumber => $itemnumber, src_image => $srcimage, replace => $replace });
51
50
52
Stores binary image data and thumbnail in database, optionally replacing existing images for the given biblio.
51
Stores binary image data and thumbnail in database, optionally replacing existing images for the given biblio or item.
53
52
54
=cut
53
=cut
55
54
56
sub PutImage {
55
sub PutImage {
57
    my ( $biblionumber, $srcimage, $replace ) = @_;
56
    my ( $params ) = @_;
57
58
    my $biblionumber = $params->{biblionumber};
59
    my $itemnumber   = $params->{itemnumber};
60
    my $srcimage     = $params->{src_image};
61
    my $replace      = $params->{replace};
62
63
    Koha::Exceptions::WrongParameter->throw(
64
        'PutImage cannot be called with both biblionumber and itemnumber')
65
      if $biblionumber and $itemnumber;
66
67
    Koha::Exceptions::WrongParameter->throw(
68
        'PutImage must be called with "replace" if itemnumber is passed. Only 1 cover per item is allowed.')
69
      if $itemnumber and not $replace;
70
58
71
59
    return -1 unless defined($srcimage);
72
    return -1 unless defined($srcimage);
60
73
61
    if ($replace) {
74
    if ($biblionumber && $replace) {
62
        foreach ( ListImagesForBiblio($biblionumber) ) {
75
        foreach ( ListImagesForBiblio($biblionumber) ) {
63
            DelImage($_);
76
            DelImage($_);
64
        }
77
        }
Lines 66-72 sub PutImage { Link Here
66
79
67
    my $dbh = C4::Context->dbh;
80
    my $dbh = C4::Context->dbh;
68
    my $query =
81
    my $query =
69
"INSERT INTO biblioimages (biblionumber, mimetype, imagefile, thumbnail) VALUES (?,?,?,?);";
82
"INSERT INTO biblioimages (biblionumber, itemnumber, mimetype, imagefile, thumbnail) VALUES (?,?,?,?,?);";
70
    my $sth = $dbh->prepare($query);
83
    my $sth = $dbh->prepare($query);
71
84
72
    my $mimetype = 'image/png'
85
    my $mimetype = 'image/png'
Lines 79-88 sub PutImage { Link Here
79
      ;    # MAX pixel dims are 600 X 800 for full-size image...
92
      ;    # MAX pixel dims are 600 X 800 for full-size image...
80
    $debug and warn "thumbnail is " . length($thumbnail) . " bytes.";
93
    $debug and warn "thumbnail is " . length($thumbnail) . " bytes.";
81
94
82
    $sth->execute( $biblionumber, $mimetype, $fullsize->png(),
95
    $sth->execute( $biblionumber, $itemnumber, $mimetype, $fullsize->png(),
83
        $thumbnail->png() );
96
        $thumbnail->png() );
84
    my $dberror = $sth->errstr;
97
    my $dberror = $sth->errstr;
85
    warn "Error returned inserting $biblionumber.$mimetype." if $sth->errstr;
98
    warn sprintf("Error returned inserting %s.%s.", ($biblionumber || $itemnumber, $mimetype)) if $sth->errstr;
86
    undef $thumbnail;
99
    undef $thumbnail;
87
    undef $fullsize;
100
    undef $fullsize;
88
    return $dberror;
101
    return $dberror;
Lines 135-140 sub ListImagesForBiblio { Link Here
135
    return @imagenumbers;
148
    return @imagenumbers;
136
}
149
}
137
150
151
=head2 GetImageForItem
152
    my $image  = GetImageForItem($itemnumber);
153
154
Gets the image associated with a particular item.
155
156
=cut
157
158
sub GetImageForItem {
159
    my ($itemnumber) = @_;
160
161
    my $dbh   = C4::Context->dbh;
162
    return $dbh->selectrow_array(
163
        'SELECT imagenumber FROM biblioimages WHERE itemnumber = ?',
164
        undef, $itemnumber );
165
}
166
138
=head2 DelImage
167
=head2 DelImage
139
168
140
    my ($dberror) = DelImage($imagenumber);
169
    my ($dberror) = DelImage($imagenumber);
(-)a/catalogue/detail.pl (+14 lines)
Lines 322-327 if ($currentbranch and C4::Context->preference('SeparateHoldings')) { Link Here
322
    $template->param(SeparateHoldings => 1);
322
    $template->param(SeparateHoldings => 1);
323
}
323
}
324
my $separatebranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch';
324
my $separatebranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch';
325
my ( $itemloop_has_images, $otheritemloop_has_images );
325
foreach my $item (@items) {
326
foreach my $item (@items) {
326
    my $itembranchcode = $item->{$separatebranch};
327
    my $itembranchcode = $item->{$separatebranch};
327
328
Lines 406-422 foreach my $item (@items) { Link Here
406
        }
407
        }
407
    }
408
    }
408
409
410
    if ( C4::Context->preference("LocalCoverImages") == 1 ) {
411
        $item->{imagenumber} =
412
          C4::Images::GetImageForItem( $item->{itemnumber} );
413
    }
414
409
    if ($currentbranch and C4::Context->preference('SeparateHoldings')) {
415
    if ($currentbranch and C4::Context->preference('SeparateHoldings')) {
410
        if ($itembranchcode and $itembranchcode eq $currentbranch) {
416
        if ($itembranchcode and $itembranchcode eq $currentbranch) {
411
            push @itemloop, $item;
417
            push @itemloop, $item;
418
            $itemloop_has_images++ if $item->{imagenumber};
412
        } else {
419
        } else {
413
            push @otheritemloop, $item;
420
            push @otheritemloop, $item;
421
            $otheritemloop_has_images++ if $item->{imagenumber};
414
        }
422
        }
415
    } else {
423
    } else {
416
        push @itemloop, $item;
424
        push @itemloop, $item;
425
        $itemloop_has_images++ if $item->{imagenumber};
417
    }
426
    }
418
}
427
}
419
428
429
$template->param(
430
    itemloop_has_images      => $itemloop_has_images,
431
    otheritemloop_has_images => $otheritemloop_has_images,
432
);
433
420
# Display only one tab if one items list is empty
434
# Display only one tab if one items list is empty
421
if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) {
435
if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) {
422
    $template->param(SeparateHoldings => 0);
436
    $template->param(SeparateHoldings => 0);
(-)a/catalogue/imageviewer.pl (-5 / +19 lines)
Lines 28-33 use C4::Images; Link Here
28
use C4::Search;
28
use C4::Search;
29
29
30
use Koha::Biblios;
30
use Koha::Biblios;
31
use Koha::Items;
31
use Koha::Patrons;
32
use Koha::Patrons;
32
33
33
my $query = new CGI;
34
my $query = new CGI;
Lines 40-46 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
40
    }
41
    }
41
);
42
);
42
43
43
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
44
my $itemnumber  = $query->param('itemnumber');
45
my $biblionumber = $query->param('biblionumber') || $query->param('bib') || Koha::Items->find($itemnumber)->biblionumber;
44
my $imagenumber = $query->param('imagenumber');
46
my $imagenumber = $query->param('imagenumber');
45
my $biblio = Koha::Biblios->find( $biblionumber );
47
my $biblio = Koha::Biblios->find( $biblionumber );
46
my $itemcount = $biblio ? $biblio->items->count : 0;
48
my $itemcount = $biblio ? $biblio->items->count : 0;
Lines 65-74 if( $query->cookie("searchToOrder") ){ Link Here
65
}
67
}
66
68
67
if ( C4::Context->preference("LocalCoverImages") ) {
69
if ( C4::Context->preference("LocalCoverImages") ) {
68
    my @images = ListImagesForBiblio($biblionumber);
70
    if ( $itemnumber ) {
69
    $template->{VARS}->{'LocalCoverImages'} = 1;
71
        my $image = C4::Images::GetImageForItem($itemnumber);
70
    $template->{VARS}->{'images'}           = \@images;
72
        $template->param(
71
    $template->{VARS}->{'imagenumber'}      = $imagenumber || $images[0] || '';
73
            LocalCoverImages => 1,
74
            images           => [$image],
75
            imagenumber      => $imagenumber,
76
        );
77
78
    } else {
79
        my @images = ListImagesForBiblio($biblionumber);
80
        $template->param(
81
            LocalCoverImages => 1,
82
            images           => \@images,
83
            imagenumber      => $imagenumber || $images[0] || '',
84
        );
85
    }
72
}
86
}
73
$template->{VARS}->{'count'}        = $itemcount;
87
$template->{VARS}->{'count'}        = $itemcount;
74
$template->{VARS}->{'biblionumber'} = $biblionumber;
88
$template->{VARS}->{'biblionumber'} = $biblionumber;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +21 lines)
Lines 285-290 Link Here
285
        <thead>
285
        <thead>
286
            <tr>
286
            <tr>
287
                [% IF (StaffDetailItemSelection) %]<th id="[% tab | html %]_checkbox" data-colname="[% tab | html %]_checkbox" class="NoSort"></th>[% END %]
287
                [% IF (StaffDetailItemSelection) %]<th id="[% tab | html %]_checkbox" data-colname="[% tab | html %]_checkbox" class="NoSort"></th>[% END %]
288
                [% IF ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
289
                    <th id="[% tab | html %]_cover" data-colname="[% tab | html %]_cover">Cover image</th>
290
                [% END %]
288
                [% IF ( item_level_itypes ) %]<th id="[% tab | html %]_itype" data-colname="[% tab | html %]_itype">Item type</th>[% END %]
291
                [% IF ( item_level_itypes ) %]<th id="[% tab | html %]_itype" data-colname="[% tab | html %]_itype">Item type</th>[% END %]
289
                <th id="[% tab | html %]_holdingbranch" data-colname="[% tab | html %]_holdingbranch">Current library</th>
292
                <th id="[% tab | html %]_holdingbranch" data-colname="[% tab | html %]_holdingbranch">Current library</th>
290
                <th id="[% tab | html %]_homebranch" data-colname="[% tab | html %]_homebranch">Home library</th>
293
                <th id="[% tab | html %]_homebranch" data-colname="[% tab | html %]_homebranch">Home library</th>
Lines 323-328 Link Here
323
                        <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
326
                        <input type="checkbox" value="[% item.itemnumber | html %]" name="itemnumber" />
324
                    </td>
327
                    </td>
325
                [% END %]
328
                [% END %]
329
                    [% IF ( tab == 'holdings' && itemloop_has_images || tab == 'otherholdings' && otheritemloop_has_images ) %]
330
                        <td class="cover">
331
                            [% IF item.imagenumber %]
332
                                <a href="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% item.itemnumber | uri %]&amp;imagenumber=[% item.imagenumber | uri %]">
333
                                    <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1amp;imagenumber=[% item.imagenumber | uri %]" />
334
                                </a>
335
                            [% END %]
336
                        </td>
337
                    [% END %]
338
326
                    [% IF ( item_level_itypes ) %]
339
                    [% IF ( item_level_itypes ) %]
327
                        <td class="itype">
340
                        <td class="itype">
328
                            [% IF !noItemTypeImages && item.imageurl %]
341
                            [% IF !noItemTypeImages && item.imageurl %]
Lines 533-539 Note that permanent location is a code, and location may be an authval. Link Here
533
                [% IF CAN_user_editcatalogue_edit_items %]
546
                [% IF CAN_user_editcatalogue_edit_items %]
534
                    <td class="actions">
547
                    <td class="actions">
535
                        [% UNLESS item.cannot_be_edited %]
548
                        [% UNLESS item.cannot_be_edited %]
536
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]#edititem"><i class="fa fa-pencil"></i> Edit</a>
549
                            <div class="btn-group">
550
                                <a  class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]#edititem"><i class="fa fa-pencil"></i> Edit</a><a class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
551
                                <ul class="dropdown-menu pull-right">
552
                                    <li><a href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=[% item.itemnumber | uri %]&amp;filetype=image"><i class="fa fa-upload">Upload image</i></a></li>
553
                                </ul>
554
                            </div>
537
                        [% END %]
555
                        [% END %]
538
                    </td>
556
                    </td>
539
                [% END %]
557
                [% END %]
Lines 541-546 Note that permanent location is a code, and location may be an authval. Link Here
541
            [% END %]
559
            [% END %]
542
        </tbody>
560
        </tbody>
543
    </table>
561
    </table>
562
544
[% END %][%# end of block items_table %]
563
[% END %][%# end of block items_table %]
545
564
546
<div id="holdings">
565
<div id="holdings">
Lines 1054-1060 Note that permanent location is a code, and location may be an authval. Link Here
1054
            thumbnail.find("img").css("opacity", ".2");
1073
            thumbnail.find("img").css("opacity", ".2");
1055
            thumbnail.find("a.remove").html("<img style='display:inline-block' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' />");
1074
            thumbnail.find("a.remove").html("<img style='display:inline-block' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' />");
1056
            $.ajax({
1075
            $.ajax({
1057
                url: "/cgi-bin/koha/svc/cover_images?action=delete&biblionumber=" + biblionumber + "&imagenumber=" + imagenumber,
1076
                url: "/cgi-bin/koha/svc/cover_images?action=delete&imagenumber=" + imagenumber,
1058
                success: function(data) {
1077
                success: function(data) {
1059
                    $(data).each( function(i) {
1078
                    $(data).each( function(i) {
1060
                        if ( this.deleted == 1 ) {
1079
                        if ( this.deleted == 1 ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt (-1 / +1 lines)
Lines 133-139 Link Here
133
            thumbnail.find("a.remove").html("<img style='display:inline-block' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' />");
133
            thumbnail.find("a.remove").html("<img style='display:inline-block' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' />");
134
134
135
            $.ajax({
135
            $.ajax({
136
                url: "/cgi-bin/koha/svc/cover_images?action=delete&biblionumber=" + biblionumber + "&imagenumber=" + imagenumber,
136
                url: "/cgi-bin/koha/svc/cover_images?action=delete&imagenumber=" + imagenumber,
137
                success: function(data) {
137
                success: function(data) {
138
                    $(data).each( function() {
138
                    $(data).each( function() {
139
                        if ( this.deleted == 1 ) {
139
                        if ( this.deleted == 1 ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt (-12 / +22 lines)
Lines 77-100 Link Here
77
  <fieldset class="rows">
77
  <fieldset class="rows">
78
    <legend>File type</legend>
78
    <legend>File type</legend>
79
    <ol>
79
    <ol>
80
      <li class="radio">
80
      [% UNLESS itemnumber %]
81
        [% IF (filetype != 'image' ) %]<input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" />[% ELSE %]<input type="radio" id="zipfile" name="filetype" value="zip" />[% END %]
81
        <li class="radio">
82
        <label for="zipfile">ZIP file</label>
82
          [% IF (filetype != 'image' ) %]<input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" />[% ELSE %]<input type="radio" id="zipfile" name="filetype" value="zip" />[% END %]
83
      </li>
83
          <label for="zipfile">ZIP file</label>
84
      <li class="radio">
84
        </li>
85
        [% IF (filetype == 'image' ) %]<input type="radio" id="image" name="filetype" value="image" checked="checked" />[% ELSE %]<input type="radio" id="image" name="filetype" value="image" />[% END %]
85
        <li class="radio">
86
        <label for="image">Image file</label>
86
          [% IF (filetype == 'image' ) %]<input type="radio" id="image" name="filetype" value="image" checked="checked" />[% ELSE %]<input type="radio" id="image" name="filetype" value="image" />[% END %]
87
      </li>
87
          <label for="image">Image file</label>
88
      <li class="radio">
88
        </li>
89
        [% IF ( filetype == 'image' ) %]<span id="bibnum">[% ELSE %]<span id="bibnum" style="display: none">[% END %]<label for="biblionumber">Enter cover biblionumber: </label><input type="text" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" size="15" /></span>
89
        <li class="radio">
90
      </li>
90
          [% IF ( filetype == 'image' ) %]<span id="bibnum">[% ELSE %]<span id="bibnum" style="display: none">[% END %]<label for="biblionumber">Enter cover biblionumber: </label><input type="text" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" size="15" /></span>
91
        </li>
92
      [% ELSE %]
93
          <label for="itemnumber">Cover itemnumber: </label>
94
          <input type="text" id="itemnumber" name="itemnumber" value="[% itemnumber | html %]" size="15" readonly="readonly" />
95
          <input type="hidden" name="filetype" value="image" />
96
      [% END %]
91
    </ol>
97
    </ol>
92
  </fieldset>
98
  </fieldset>
93
  <fieldset class="rows">
99
  <fieldset class="rows">
94
    <legend>Options</legend>
100
    <legend>Options</legend>
95
    <ol>
101
    <ol>
96
      <li class="checkbox">
102
      <li class="checkbox">
97
        [% IF AllowMultipleCovers == 0 %]<input type="checkbox" id="replace" name="replace" checked="checked" disabled="disabled" value="1" />[% ELSE %]<input type="checkbox" id="replace" name="replace" value="1" />[% END %]
103
        [% IF AllowMultipleCovers == 0 OR itemnumber%]
104
            <input type="checkbox" id="replace" name="replace" checked="checked" disabled="disabled" value="1" />
105
        [% ELSE %]
106
            <input type="checkbox" id="replace" name="replace" value="1" />
107
        [% END %]
98
        <label for="replace">Replace existing covers</label>
108
        <label for="replace">Replace existing covers</label>
99
      </li>
109
      </li>
100
    </ol>
110
    </ol>
(-)a/svc/cover_images (-7 / +6 lines)
Lines 37-64 if ( $auth_status ne "ok" ) { Link Here
37
}
37
}
38
38
39
my $action       = $input->param('action');
39
my $action       = $input->param('action');
40
my $biblionumber = $input->param('biblionumber');
41
my @imagenumbers = $input->param('imagenumber');
40
my @imagenumbers = $input->param('imagenumber');
42
41
43
# Array to store the reponse JSON
42
# Array to store the reponse JSON
44
my $response = [];
43
my $response = [];
45
44
46
if ( $action eq "delete" ) {
45
if ( $action eq "delete" ) {
47
    # Build a hash of valid imagenumbers fr the given biblionumber
48
    my %valid_imagenumbers = map {$_ => 1} ListImagesForBiblio($biblionumber);
49
46
50
    foreach my $imagenumber ( @imagenumbers ) {
47
    foreach my $imagenumber ( @imagenumbers ) {
51
        if ( exists( $valid_imagenumbers{ $imagenumber } ) ) {
48
        eval {
52
            DelImage($imagenumber);
49
            DelImage($imagenumber);
50
        };
51
        if ( $@ ) {
53
            push @$response, {
52
            push @$response, {
54
                imagenumber => $imagenumber,
53
                imagenumber => $imagenumber,
55
                deleted => 1
54
                deleted => 0,
55
                error => "MSG_INVALID_IMAGENUMBER"
56
            };
56
            };
57
        } else {
57
        } else {
58
            push @$response, {
58
            push @$response, {
59
                imagenumber => $imagenumber,
59
                imagenumber => $imagenumber,
60
                deleted => 0,
60
                deleted => 1
61
                error => "MSG_INVALID_IMAGENUMBER"
62
            };
61
            };
63
        }
62
        }
64
    }
63
    }
(-)a/tools/upload-cover-image.pl (-11 / +23 lines)
Lines 46-51 use C4::Context; Link Here
46
use C4::Auth;
46
use C4::Auth;
47
use C4::Output;
47
use C4::Output;
48
use C4::Images;
48
use C4::Images;
49
use Koha::Items;
49
use Koha::UploadedFiles;
50
use Koha::UploadedFiles;
50
use C4::Log;
51
use C4::Log;
51
52
Lines 66-71 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
66
67
67
my $filetype       = $input->param('filetype');
68
my $filetype       = $input->param('filetype');
68
my $biblionumber   = $input->param('biblionumber');
69
my $biblionumber   = $input->param('biblionumber');
70
my $itemnumber     = $input->param('itemnumber');
69
#my $uploadfilename = $input->param('uploadfile'); # obsolete?
71
#my $uploadfilename = $input->param('uploadfile'); # obsolete?
70
my $replace        = !C4::Context->preference("AllowMultipleCovers")
72
my $replace        = !C4::Context->preference("AllowMultipleCovers")
71
  || $input->param('replace');
73
  || $input->param('replace');
Lines 75-82 my $sessionID = $cookies{'CGISESSID'}->value; Link Here
75
77
76
my $error;
78
my $error;
77
79
78
$template->{VARS}->{'filetype'}     = $filetype;
80
$template->param(
79
$template->{VARS}->{'biblionumber'} = $biblionumber;
81
    filetype     => $filetype,
82
    biblionumber => $biblionumber,
83
    itemnumber   => $itemnumber,
84
);
80
85
81
my $total = 0;
86
my $total = 0;
82
87
Lines 87-93 if ($fileID) { Link Here
87
        my $srcimage = GD::Image->new($fh);
92
        my $srcimage = GD::Image->new($fh);
88
        $fh->close if $fh;
93
        $fh->close if $fh;
89
        if ( defined $srcimage ) {
94
        if ( defined $srcimage ) {
90
            my $dberror = PutImage( $biblionumber, $srcimage, $replace );
95
            my $dberror = PutImage( { biblionumber => $biblionumber, itemnumber => $itemnumber, src_image => $srcimage, replace => $replace } );
91
            if ($dberror) {
96
            if ($dberror) {
92
                $error = 'DBERR';
97
                $error = 'DBERR';
93
            }
98
            }
Lines 157-165 if ($fileID) { Link Here
157
                            my $srcimage = GD::Image->new("$dir/$filename");
162
                            my $srcimage = GD::Image->new("$dir/$filename");
158
                            if ( defined $srcimage ) {
163
                            if ( defined $srcimage ) {
159
                                $total++;
164
                                $total++;
160
                                my $dberror =
165
                                my $dberror = PutImage(
161
                                  PutImage( $biblionumber, $srcimage,
166
                                    {
162
                                    $replace );
167
                                        biblionumber => $biblionumber,
168
                                        src_image    => $srcimage,
169
                                        replace      => $replace
170
                                    }
171
                                );
163
                                if ($dberror) {
172
                                if ($dberror) {
164
                                    $error = 'DBERR';
173
                                    $error = 'DBERR';
165
                                }
174
                                }
Lines 178-187 if ($fileID) { Link Here
178
            }
187
            }
179
        }
188
        }
180
    }
189
    }
181
    $template->{VARS}->{'total'}        = $total;
190
182
    $template->{VARS}->{'uploadimage'}  = 1;
191
    $template->param(
183
    $template->{VARS}->{'error'}        = $error;
192
        total        => $total,
184
    $template->{VARS}->{'biblionumber'} = $biblionumber;
193
        uploadimage  => 1,
194
        error        => $error,
195
        biblionumber => $biblionumber || Koha::Items->find($itemnumber)->biblionumber,
196
        itemnumber   => $itemnumber,
197
    );
185
}
198
}
186
199
187
output_html_with_http_headers $input, $cookie, $template->output;
200
output_html_with_http_headers $input, $cookie, $template->output;
188
- 

Return to bug 26145