Bug 17657: Fix locations of item types images
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 18 Nov 2016 08:23:16 +0000 (08:23 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 18 Nov 2016 14:06:33 +0000 (14:06 +0000)
Koha::ItemType->image_location takes the interface in parameter or
default to OPAC.
From the item types admin page, we need to specify the intranet
interface to retrieve the correct image's url

Test plan:
Go on the item types admin page, see the source of the page and find the
image' urls.
=> Without this patch, they point to the OPAC
=> With this patch, the location is correct

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt

index 95bbb7b..2c288b0 100644 (file)
@@ -185,7 +185,7 @@ Item types administration
                             <a href="#[% imageset.imagesetname %]">[% imageset.imagesetname %]</a>
                             </li>
                         [% END %]
-                        [% IF itemtype.image_location.match('^http') %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
+                        [% IF itemtype.image_location('intranet').match('^http') %]<li class="ui-tabs-active">[% ELSE %]<li>[% END %]<a href="#remote">Remote image</a></li>
                     </ul>
                     <div id="none">
                         <ul>
@@ -319,7 +319,8 @@ Item types administration
                 <tr>
                     <th scope="row">Image</th>
                     <td>
-                        [% IF itemtype.image_location %]<img src="[% itemtype.image_location %]" alt="" />[% END %]
+                        [% SET image_location = itemtype.image_location('intranet') %]
+                        [% IF image_location %]<img src="[% image_location %]" alt="" />[% END %]
                     </td>
                 </tr>
             [% END %]
@@ -352,7 +353,12 @@ Item types administration
           </thead>
           [% FOREACH itemtype IN itemtypes %]
             <tr>
-           [% UNLESS Koha.Preference('noItemTypeImages') %] <td>[% IF itemtype.image_location %]<img src="[% itemtype.image_location %]" alt="" />[% ELSE %]&nbsp;[% END %]</td>[% END %]
+                [% UNLESS Koha.Preference('noItemTypeImages') %]
+                    <td>
+                        [% SET image_location = itemtype.image_location('intranet') %]
+                        [% IF image_location %]<img src="[% image_location %]" alt="" />[% ELSE %]&nbsp;[% END %]
+                    </td>
+                [% END %]
             <td>
               <a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype |html %]">
                 [% itemtype.itemtype %]