Bugzilla – Attachment 110871 Details for
Bug 26145
Add the ability to attach a cover image at item level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26145: Correctly preserve itemnumber value
Bug-26145-Correctly-preserve-itemnumber-value.patch (text/plain), 5.00 KB, created by
Jonathan Druart
on 2020-09-28 15:03:16 UTC
(
hide
)
Description:
Bug 26145: Correctly preserve itemnumber value
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-09-28 15:03:16 UTC
Size:
5.00 KB
patch
obsolete
>From cf425f39c3591114f48ec12ca90504c0613d9a67 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 21 Aug 2020 18:14:50 +0200 >Subject: [PATCH] Bug 26145: Correctly preserve itemnumber value > >In order to know we are dealing with the cover images of a specific item >we need to pass it though the different forms. >--- > catalogue/imageviewer.pl | 6 ++++- > .../prog/en/modules/catalogue/imageviewer.tt | 25 ++++++++++++++++--- > 2 files changed, 26 insertions(+), 5 deletions(-) > >diff --git a/catalogue/imageviewer.pl b/catalogue/imageviewer.pl >index b71a3c2e75..df76644392 100755 >--- a/catalogue/imageviewer.pl >+++ b/catalogue/imageviewer.pl >@@ -81,10 +81,14 @@ if ( C4::Context->preference("LocalCoverImages") ) { > ); > } > $template->{VARS}->{'count'} = $itemcount; >-$template->{VARS}->{'biblionumber'} = $biblionumber; > $template->param(C4::Search::enabled_staff_search_views); > $template->{VARS}->{'biblio'} = $biblio; > >+$template->param( >+ biblionumber => $biblionumber, >+ itemnumber => $itemnumber, >+); >+ > my $hold_count = $biblio ? $biblio->holds->count : 0; > $template->param( holdcount => $hold_count ); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt >index 5477ec6544..1e887ff9ad 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt >@@ -56,7 +56,7 @@ > <div class="col-md-4"> > <ul class="thumbnails"> > [% FOREACH image IN images %] >- <li id="imagenumber-[% image.imagenumber | html %]" class="thumbnail"> >+ <li id="imagenumber-[% image.imagenumber | html %]" data-itemnumber="[% image.itemnumber %]" data-biblionumber="[% image.biblionumber %]" class="thumbnail"> > <a class="show_cover" data-coverimg="[% image.imagenumber | html %]" href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | html %]&imagenumber=[% image.imagenumber | html %]"> > [% IF loop.first %] > <img class="selected" id="thumbnail_[% image.imagenumber | html %]" src="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% image.imagenumber | html %]&thumbnail=1" alt="Thumbnail" /> >@@ -73,10 +73,21 @@ > </div> <!-- /.col-md-4 --> > </div> <!-- /.row --> > [% ELSE %] >- <div class="dialog message">There are no images for this record.</div> >+ [% IF itemnumber %] >+ <div class="dialog message">There are no images for this item.</div> >+ [% ELSE %] >+ <div class="dialog message">There are no images for this record.</div> >+ [% END %] > [% IF ( CAN_user_tools_upload_local_cover_images ) %] > <hr /> >- <p>Upload an image file: <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber | uri %]&filetype=image"><i class="fa fa-upload" aria-hidden="true"></i> Upload</a> >+ <p> >+ Upload an image file: >+ [% IF itemnumber %] >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=[% itemnumber | uri %]&filetype=image"> >+ [% ELSE %] >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber | uri %]&filetype=image"> >+ [% END %] >+ <i class="fa fa-upload" aria-hidden="true"></i> Upload</a> > </p> > [% END %] > [% END %] >@@ -126,6 +137,8 @@ > > function removeLocalImage(imagenumber) { > var thumbnail = $("#imagenumber-" + imagenumber ); >+ var itemnumber = $(thumbnail).data("itemnumber"); >+ var biblionumber = $(thumbnail).data("biblionumber"); > var copy = thumbnail.html(); > thumbnail.find("img").css("opacity", ".2"); > thumbnail.find("a.remove").html("<img style='display:inline-block' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' />"); >@@ -135,7 +148,11 @@ > success: function(data) { > $(data).each( function() { > if ( this.deleted == 1 ) { >- location.href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=" + biblionumber; >+ if( itemnumber ) { >+ location.href="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=" + itemnumber; >+ } else { >+ location.href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=" + biblionumber; >+ } > } else { > thumbnail.html( copy ); > alert(_("An error occurred on deleting this image")); >-- >2.20.1
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 26145
:
109225
|
109226
|
110342
|
110343
|
110344
|
110345
|
110346
|
110347
|
110348
|
110349
|
110350
|
110351
|
110352
|
110353
|
110354
|
110675
|
110676
|
110677
|
110678
|
110679
|
110680
|
110681
|
110682
|
110683
|
110684
|
110685
|
110800
|
110861
|
110862
|
110863
|
110864
|
110865
|
110866
|
110867
|
110868
|
110869
|
110870
|
110871
|
110872
|
110873
|
110874
|
110875
|
111446
|
111447
|
111448
|
111449
|
111450
|
111451
|
111452
|
111453
|
111454
|
111455
|
111456
|
111457
|
111458