Bug 32909 - Item type icons broken when placing an item-level hold
Summary: Item type icons broken when placing an item-level hold
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Andreas Roussos
QA Contact: Martin Renvoize
URL: reserve/request.pl
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-08 14:01 UTC by Andreas Roussos
Modified: 2023-12-28 20:43 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.03,22.05.11, 21.11.19


Attachments
When trying to place a hold, no item type icon is displayed (61.97 KB, image/png)
2023-02-08 14:04 UTC, Andreas Roussos
Details
When trying to place a hold, the item type icon is displayed correctly (62.66 KB, image/png)
2023-02-08 14:05 UTC, Andreas Roussos
Details
Bug 32909: Load item type icons from the correct path (2.50 KB, patch)
2023-02-08 14:12 UTC, Andreas Roussos
Details | Diff | Splinter Review
Bug 32909: Load item type icons from the correct path (2.57 KB, patch)
2023-02-10 16:34 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Roussos 2023-02-08 14:01:35 UTC
When placing an item-level hold in the Staff interface,
the table at the bottom of the screen (under the "Place
a hold on a specific item" heading) should display the
icon associated with the item type of each item.

This feature broke in v22.05.00 and is still broken [*]
in the current master (ac1e80400d), as the <img> tag for
the item type icon points to a path that begins with:
/opac-tmpl/bootstrap/itemtypeimg
instead of the correct path that begins with:
/intranet-tmpl/prog/img/itemtypeimg

So, instead of fetching the corresponding item type icon
you get a 404 in your web server logs and the default
'broken image URL' image in your web browser. I will
attach a couple of screenshots to demonstrate the problem.

`git bisect` tells me that the relevant commit is
d4855131e3b8e5852f221182ed9588f4ddc67368 from Bug 29660.

[*] Please note: the bug outlined above occurs on Debian
    package installations. Koha instances created using
    koha-testing-docker or the Koha Sandboxes seem to be
    unaffected. I believe this has to do with the values
    of the <intrahtdocs> and <opachtdocs> settings in
    koha-conf.xml, and the fact that Gitified instances
    served by Apache use the same DocumentRoot path in
    their VirtualHost directives for both the OPAC and
    the Staff interface.

    However, when trying to reproduce this bug on Koha
    instances created with methods other than a Debian
    package install, you can still observe that the item
    type icon URL is wrong by right-clicking on the
    icon and selecting 'Inspect' to see its properties.
Comment 1 Andreas Roussos 2023-02-08 14:04:09 UTC
Created attachment 146389 [details]
When trying to place a hold, no item type icon is displayed
Comment 2 Andreas Roussos 2023-02-08 14:05:20 UTC
Created attachment 146390 [details]
When trying to place a hold, the item type icon is displayed correctly
Comment 3 Andreas Roussos 2023-02-08 14:06:43 UTC
Steps to reproduce:

1) (if needed) Configure the following System preferences:
   - item-level_itypes => 'specific item'
   - noItemTypeImages  => 'Show'
2) (if needed) In Koha Administration > Item types, create 
   an item type and associate it with an icon
3) (if needed) Create a test bibliographic record, and add
   an item to it that has an item type with an icon

Then, visit the bibliographic record's details page in the
Staff interface. Select 'Holds' on the left hand side, then
pick a patron. The "Place a hold on ..." page should load.
In the 'Item type' column of the table at the bottom of the
screen notice that instead of seeing the icon associated with
the item type of each item you get the default 'broken image
URL' image of your web browser.

[If you try the above in a Dockerised Koha instance the icon
will -most likely- be displayed just fine. However, you can
still verify that it's being loaded from the wrong path by
right-clicking on the icon and selecting 'Inspect'.]
Comment 4 Andreas Roussos 2023-02-08 14:12:34 UTC
Created attachment 146391 [details] [review]
Bug 32909: Load item type icons from the correct path

When placing an item-level hold in the Staff interface,
the table at the bottom of the screen (under the "Place
a hold on a specific item" heading) should display the
icon associated with the item type of each item in the
'Item type' column.

This feature broke in v22.05.00 (for Debian package installs):
instead of the item type icon you get the default 'broken
image URL' image of your web browser.

This patch fixes that.

Test plan:

1) (if needed) Configure the following System preferences:
   - item-level_itypes => 'specific item'
   - noItemTypeImages  => 'Show'

2) (if needed) In Koha Administration > Item types, create
   an item type and associate it with an icon

3) (if needed) Create a test bibliographic record, and add
   an item to it that has an item type with an icon

4) Visit the bibliographic record's details page in the
   Staff interface. Select 'Holds' on the left hand side,
   then pick a patron. The "Place a hold on ..." page should
   load. In the 'Item type' column of the table at the bottom
   of the screen notice that instead of seeing the icon
   associated with the item type of each item you get the
   default 'broken image URL' image of your web browser [*]

   [*] In non-Debian package installs, the 'href' property
       of the item type icon's <img> tag should start with
       '/opac-tmpl/bootstrap/itemtypeimg'

5) Apply this patch, restart Plack and refresh the page.
   The item type icon should now be displayed correctly.

   KTD and Koha Sandboxes users: To verify the patch has
   worked, you should right-click on the item type icon and
   click 'Inspect': the 'href' property of the <img> tag
   should now start with: '/intranet-tmpl/prog/img/itemtypeimg'
Comment 5 Andreas Roussos 2023-02-08 14:16:08 UTC
I just wanted to point out that this bug is similar to the one
George reported in Bug 32908, but actually has a different scope
as it occurs when trying to place a hold. It also affects a wider
range of Koha versions (v22.05.00 onwards) and has a test plan
that's slightly different. Which is why I decided to submit a
separate bug report and not a follow-up patch.
Comment 6 Laura Escamilla 2023-02-08 16:44:04 UTC
(In reply to Andreas Roussos from comment #4)
> Created attachment 146391 [details] [review] [review]
> Bug 32909: Load item type icons from the correct path
> 
> When placing an item-level hold in the Staff interface,
> the table at the bottom of the screen (under the "Place
> a hold on a specific item" heading) should display the
> icon associated with the item type of each item in the
> 'Item type' column.
> 
> This feature broke in v22.05.00 (for Debian package installs):
> instead of the item type icon you get the default 'broken
> image URL' image of your web browser.
> 
> This patch fixes that.
> 
> Test plan:
> 
> 1) (if needed) Configure the following System preferences:
>    - item-level_itypes => 'specific item'
>    - noItemTypeImages  => 'Show'
> 
> 2) (if needed) In Koha Administration > Item types, create
>    an item type and associate it with an icon
> 
> 3) (if needed) Create a test bibliographic record, and add
>    an item to it that has an item type with an icon
> 
> 4) Visit the bibliographic record's details page in the
>    Staff interface. Select 'Holds' on the left hand side,
>    then pick a patron. The "Place a hold on ..." page should
>    load. In the 'Item type' column of the table at the bottom
>    of the screen notice that instead of seeing the icon
>    associated with the item type of each item you get the
>    default 'broken image URL' image of your web browser [*]
> 
>    [*] In non-Debian package installs, the 'href' property
>        of the item type icon's <img> tag should start with
>        '/opac-tmpl/bootstrap/itemtypeimg'
> 
> 5) Apply this patch, restart Plack and refresh the page.
>    The item type icon should now be displayed correctly.
> 
>    KTD and Koha Sandboxes users: To verify the patch has
>    worked, you should right-click on the item type icon and
>    click 'Inspect': the 'href' property of the <img> tag
>    should now start with: '/intranet-tmpl/prog/img/itemtypeimg'

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Comment 7 Martin Renvoize 2023-02-10 16:34:41 UTC
Created attachment 146494 [details] [review]
Bug 32909: Load item type icons from the correct path

When placing an item-level hold in the Staff interface,
the table at the bottom of the screen (under the "Place
a hold on a specific item" heading) should display the
icon associated with the item type of each item in the
'Item type' column.

This feature broke in v22.05.00 (for Debian package installs):
instead of the item type icon you get the default 'broken
image URL' image of your web browser.

This patch fixes that.

Test plan:

1) (if needed) Configure the following System preferences:
   - item-level_itypes => 'specific item'
   - noItemTypeImages  => 'Show'

2) (if needed) In Koha Administration > Item types, create
   an item type and associate it with an icon

3) (if needed) Create a test bibliographic record, and add
   an item to it that has an item type with an icon

4) Visit the bibliographic record's details page in the
   Staff interface. Select 'Holds' on the left hand side,
   then pick a patron. The "Place a hold on ..." page should
   load. In the 'Item type' column of the table at the bottom
   of the screen notice that instead of seeing the icon
   associated with the item type of each item you get the
   default 'broken image URL' image of your web browser [*]

   [*] In non-Debian package installs, the 'href' property
       of the item type icon's <img> tag should start with
       '/opac-tmpl/bootstrap/itemtypeimg'

5) Apply this patch, restart Plack and refresh the page.
   The item type icon should now be displayed correctly.

   KTD and Koha Sandboxes users: To verify the patch has
   worked, you should right-click on the item type icon and
   click 'Inspect': the 'href' property of the <img> tag
   should now start with: '/intranet-tmpl/prog/img/itemtypeimg'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2023-02-10 16:35:31 UTC
All working, No qa script issues.. Passing QA
Comment 9 Tomás Cohen Arazi 2023-02-15 12:34:46 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 10 Pedro Amorim 2023-02-16 10:35:12 UTC
Nice work everyone!

Pushed to 22.11.x for next release
Comment 11 Lucas Gass 2023-03-01 13:54:23 UTC
Backported to 22.05.x for upcoming 22.05.11
Comment 12 Arthur Suzuki 2023-03-29 08:52:06 UTC
applied to 21.11.x for 21.11.19
Comment 13 wainuiwitikapark 2023-04-27 03:53:24 UTC
Not backported to 21.05.x