Bug 37463

Summary: Include cover images from Amazon on staff interface check out screen for specific patron categories
Product: Koha Reporter: Danyon Sewell <danyonsewell>
Component: CirculationAssignee: Wainui Witika-Park <wainuiwitikapark>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aleisha, david, gmcharlt, kebliss, kyle, lucas, roman.dolny, wainuiwitikapark
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: Sponsored Comma delimited list of Sponsors: Pymble Ladies College
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement lets you show cover images (Amazon only at the moment) for selected patron categories on a patron's checkouts table in the staff interface. The patron categories that the cover images show for are set using the new system preference `CoverImagesCategories`.
Version(s) released in:
Circulation function:
Attachments: Bug 37463: Adding system preference.
Bug 37463: Adding system preference.
Bug 37463: Adding system preference.
Bug 37463: Adding system preference.
Bug 37463: Adding system preference.
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories

Description Danyon Sewell 2024-07-24 23:53:19 UTC
We would like to request an enhancement for cover images to be visible on the check out/issues screen a the time of issuing books.
We would like this option to be enabled for specific borrower categories, eg we would enable for student and staff categories, but not for general borrower categories such as Library trollies.
Comment 1 Danyon Sewell 2024-07-29 04:31:24 UTC
Created attachment 169807 [details] [review]
Bug 37463: Adding system preference.
Comment 2 Danyon Sewell 2024-07-29 04:34:17 UTC
Created attachment 169808 [details] [review]
Bug 37463: Adding system preference.
Comment 3 Danyon Sewell 2024-07-29 04:36:13 UTC
Created attachment 169809 [details] [review]
Bug 37463: Adding system preference.
Comment 4 Danyon Sewell 2024-07-30 01:33:36 UTC
Created attachment 169852 [details] [review]
Bug 37463: Adding system preference.
Comment 5 Danyon Sewell 2024-08-20 05:16:05 UTC
Created attachment 170492 [details] [review]
Bug 37463: Adding system preference.

This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now.

Test plan:
Step 1 - apply this patch
Step 2 - Make sure AmazonCoverImages syspref is set to "show"
step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is)
step 4 - checkout an item to your patron account
step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon
Comment 6 Danyon Sewell 2024-08-20 22:09:34 UTC
Bug 37463: Adding system preference.

This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now.

Test plan:
Step 1 - apply this patch
Step 2 - Make sure AmazonCoverImages syspref is set to "show"
step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is)
step 4 - checkout an item to your patron account
step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon

Sponsored by: Pymble Ladies College
Comment 7 Roman Dolny 2024-08-22 19:02:22 UTC
Applying: Bug 37463: Adding system preference.
.git/rebase-apply/patch:92: trailing whitespace.
                        + '.01.LZZZZZZZ.jpg" title="Amazon cover image"><img src="https://images-na.ssl-images-amazon.com/images/P/'
.git/rebase-apply/patch:93: trailing whitespace.
                        + oObj.isbn
.git/rebase-apply/patch:116: trailing whitespace.

error: sha1 information is lacking or useless (installer/data/mysql/atomicupdate/bug_37463-add_SCOCoverImagesCategories_syspref.pl).
error: could not build fake ancestor
Patch failed at 0001 Bug 37463: Adding system preference.
Comment 8 Danyon Sewell 2024-08-22 22:18:06 UTC
Created attachment 170623 [details] [review]
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories

This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now.

Test plan:
Step 1 - apply this patch
Step 2 - Make sure AmazonCoverImages syspref is set to "show"
step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is)
step 4 - checkout an item to your patron account
step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon
Comment 9 Roman Dolny 2024-08-23 22:01:49 UTC
Created attachment 170686 [details] [review]
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories

This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now.

Test plan:
Step 1 - apply this patch
Step 2 - Make sure AmazonCoverImages syspref is set to "show"
step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is)
step 4 - checkout an item to your patron account
step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 10 Lucas Gass (lukeg) 2025-01-17 21:26:57 UTC
I think you'll have to do something to deal with the 1px by 1px images that Amazon sometimes returns. In k-t-d I checked out itemnumber 308. You get the 1px by 1px image, which looks like no image at all, and then the text 'Image from Amazon.com'. 

You can see how its dealt with currently in js/pages/results.js.
Comment 11 Wainui Witika-Park 2025-02-03 04:34:42 UTC
Created attachment 177462 [details] [review]
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories

This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now.

Test plan:
Step 1 - apply this patch
Step 2 - Make sure AmazonCoverImages syspref is set to "show"
step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is)
step 4 - checkout an item to your patron account
step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon

Sponsored by: Pymble Ladies College
Comment 12 Wainui Witika-Park 2025-02-07 01:36:10 UTC
Created attachment 177606 [details] [review]
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories

This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now.

Test plan:
Step 1 - apply this patch
Step 2 - Make sure AmazonCoverImages syspref is set to "show"
step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is)
step 4 - checkout an item to your patron account
step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon

Sponsored by: Pymble Ladies College
Comment 13 Wainui Witika-Park 2025-02-07 01:48:03 UTC
(In reply to Lucas Gass (lukeg) from comment #10)
> I think you'll have to do something to deal with the 1px by 1px images that
> Amazon sometimes returns. In k-t-d I checked out itemnumber 308. You get the
> 1px by 1px image, which looks like no image at all, and then the text 'Image
> from Amazon.com'. 
> 
> You can see how its dealt with currently in js/pages/results.js.

Thanks for your advice!

I have now implemented dealing with 1px by 1px images from Amazon.com
Comment 14 Wainui Witika-Park 2025-11-21 01:50:51 UTC
Created attachment 189820 [details] [review]
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories

This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now.

Test plan:
Step 1 - apply this patch
Step 2 - Make sure AmazonCoverImages syspref is set to "show"
step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is)
step 4 - checkout an item to your patron account
step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon

Sponsored by: Pymble Ladies College
Comment 15 David Nind 2025-12-06 11:59:24 UTC
Created attachment 190260 [details] [review]
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories

This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now.

Test plan:
Step 1 - apply this patch
Step 2 - Make sure AmazonCoverImages syspref is set to "show"
step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is)
step 4 - checkout an item to your patron account
step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon

Sponsored by: Pymble Ladies College

Signed-off-by: David Nind <david@davidnind.com>
Comment 16 David Nind 2025-12-06 12:07:49 UTC
Where there is no Amazon cover image, the patron's checkouts table just shows the text "Image from Amazon.com".

Maybe either:
- show nothing or
- just the "No cover image available", without the "Image from Amazon.com" text.
Comment 17 Wainui Witika-Park 2025-12-17 03:14:25 UTC
(In reply to David Nind from comment #16)
> Where there is no Amazon cover image, the patron's checkouts table just
> shows the text "Image from Amazon.com".
> 
> Maybe either:
> - show nothing or
> - just the "No cover image available", without the "Image from Amazon.com"
> text.

Kia ora David,

I've had a look into this and when there is no image, it's usually because it is a 1px by 1px image being returned from Amazon which we have added in to the code to deal with. 

However, because it is dynamically fetching the height and width, the first few times the page is refreshed, the dimensions of all the images (whether there is a proper image available or not, is 0 by 0).

When you refresh a few times, it picks up the actual dimensions of the image and then "Image from Amazon.com" is no longer displayed.

So in summary, what you said has been implemented, but it doesn't seem to be working as expected from the start.

Ngā mihi,

Wainui
Comment 18 David Nind 2026-01-04 17:19:08 UTC
Created attachment 190869 [details] [review]
Bug 37463: Show Amazon cover images in checkouts table for selected patron categories

This patch allows cover images to display in the patron checkout module for selected patron categories but only ones from Amazon for now.

Test plan:
Step 1 - apply this patch
Step 2 - Make sure AmazonCoverImages syspref is set to "show"
step 3 - Search for the CoverImagesCategories syspref and enable it for a specific patron category (choose the category that your patron account is)
step 4 - checkout an item to your patron account
step 5 - in the patron checkouts page, click the "show checkouts" button, you should see the items cover image there, as long as there is one available from Amazon

Sponsored by: Pymble Ladies College

Signed-off-by: David Nind <david@davidnind.com>
Comment 19 David Nind 2026-01-04 17:26:28 UTC
(In reply to Wainui Witika-Park from comment #17)
 
> When you refresh a few times, it picks up the actual dimensions of the image
> and then "Image from Amazon.com" is no longer displayed.

Thanks Wainui - it does indeed do that!