Bug 30972

Summary: "Replace existing covers" checkbox replaces ALL local covers for a biblio, not only the specific item's covers
Product: Koha Reporter: Manos PETRIDIS <egpetridis>
Component: ToolsAssignee: Jonathan Druart <jonathan.druart+koha>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: arthur.suzuki, jonathan.druart+koha, lucas, m.de.rooy, oleonard
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30976
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.01
Bug Depends on: 30234    
Bug Blocks:    
Attachments: Bug 30972: Don't replace biblio's local cover images when uploading an image's image
Bug 30972: Don't replace biblio's local cover images when uploading an image's image
Bug 30972: Don't replace biblio's local cover images when uploading an image's image

Description Manos PETRIDIS 2022-06-16 07:36:56 UTC
It seems that the "Replace existing covers" checkbox in 
/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=2385&filetype=image#
now replaces ALL covers for a biblio, not only the specific item's cover(s).

This is a departure from how koha worked in the past, is undocumented and could become a major problem for libraries keeping Continuing Resources local cover images, discarding years' work in an instance.

When one uploads a cover for a specific issue, replace should work for only the cover(s) linked to that specific issue.

The problem may also be related to issue cover images now appearing as alternate cover images for the biblio. In the past if one wanted the biblio to have a cover image attached, one had to upload an image to the biblio itself.
Comment 1 Jonathan Druart 2022-06-16 10:29:07 UTC
Are talking about cover images you attached to an *item* (vs bibliographic record)?
This feature has been added by bug 26145 and is not in Koha "for years" ;)
Comment 2 Jonathan Druart 2022-06-16 10:32:55 UTC
Created attachment 136145 [details] [review]
Bug 30972: Don't replace biblio's local cover images when uploading an image's image

When attaching a new cover image to an item we should not replace cover
images attached to the bibliographic record if "Replace existing covers"
is ticked.

Test plan:
Attach 1+ image to a bibliographic record
Attach 1 image to an item of this biblio
Attach another image to the item and seect "replace existing covers"
=> Without this patch the images attached to the biblio are removed
=> With this patch applied only the images attached to the image are
removed

Same if you tick the checkbox when attaching an image to the biblio
Comment 3 David Nind 2022-06-16 12:59:40 UTC
Created attachment 136160 [details] [review]
Bug 30972: Don't replace biblio's local cover images when uploading an image's image

When attaching a new cover image to an item we should not replace cover
images attached to the bibliographic record if "Replace existing covers"
is ticked.

Test plan:
Attach 1+ image to a bibliographic record
Attach 1 image to an item of this biblio
Attach another image to the item and seect "replace existing covers"
=> Without this patch the images attached to the biblio are removed
=> With this patch applied only the images attached to the image are
removed

Same if you tick the checkbox when attaching an image to the biblio

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Manos PETRIDIS 2022-06-18 09:39:22 UTC
(In reply to Jonathan Druart from comment #1)
> Are talking about cover images you attached to an *item* (vs bibliographic
> record)?
> This feature has been added by bug 26145 and is not in Koha "for years" ;)

Well, if left unresolved, it could very well ruin many a years' work in the future ;)
Comment 5 Katrin Fischer 2022-06-18 20:40:38 UTC
Created attachment 136322 [details] [review]
Bug 30972: Don't replace biblio's local cover images when uploading an image's image

When attaching a new cover image to an item we should not replace cover
images attached to the bibliographic record if "Replace existing covers"
is ticked.

Test plan:
Attach 1+ image to a bibliographic record
Attach 1 image to an item of this biblio
Attach another image to the item and seect "replace existing covers"
=> Without this patch the images attached to the biblio are removed
=> With this patch applied only the images attached to the image are
removed

Same if you tick the checkbox when attaching an image to the biblio

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Tomás Cohen Arazi 2022-06-20 14:51:07 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 7 Lucas Gass 2022-06-24 16:19:55 UTC
Backported to 22.05.x for 22.05.01
Comment 8 Arthur Suzuki 2022-06-30 08:16:02 UTC
I don't reproduce the issue on 21.11.x. not backporting :)