Bug 30082

Summary: Bibliographic details tab missing when user can't add local cover image
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrewfh, kyle, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.03,21.05.11
Bug Depends on: 22032    
Bug Blocks:    
Attachments: Screenshot showing the problem
Bug 30082: Bibliographic details tab missing when user can't add local cover image
Bug 30082: Bibliographic details tab missing when user can't add local cover image
Bug 30082: Bibliographic details tab missing when user can't add local cover image

Description Owen Leonard 2022-02-11 15:20:02 UTC
Created attachment 130506 [details]
Screenshot showing the problem

There is an error in the logic controlling whether the "Images" tab appears on the bibliographic detail page in the staff interface. If the LocalCoverImages preference is enabled but the logged-in user doesn't have CAN_user_tools_upload_local_cover_images permission the "No images..." text appears outside of the tabs.

This is because the logic for displaying the message differs from the logic for displaying the corresponding tab link.
Comment 1 Owen Leonard 2022-02-11 15:31:13 UTC
Created attachment 130510 [details] [review]
Bug 30082: Bibliographic details tab missing when user can't add local cover image

This patch corrects the template logic which determines whether the
"Images" tab should be displayed on the bibliographic detail page. The
"Images" tab should display whenever local cover images are enabled, not
just if the user has permission to manage cover images.

To test, apply the patch and go to Administration -> System preferences.

- Enable the LocalCoverImages system preference.
- Locate and view the detail page for a bibliographic record in the
  catalog which doesn't have a local cover image attached.

  - If you are logged in as a user with upload_local_cover_images
    permission you should see an "Images" tab with the message "No
    images have been uploaded for this bibliographic record yet" and an
    upload button.
  - If you are logged in as a user without upload_local_cover_images
    permission you should see an "Images" tab with just the "No
    images..." message.
Comment 2 David Nind 2022-02-12 03:25:23 UTC
Created attachment 130530 [details] [review]
Bug 30082: Bibliographic details tab missing when user can't add local cover image

This patch corrects the template logic which determines whether the
"Images" tab should be displayed on the bibliographic detail page. The
"Images" tab should display whenever local cover images are enabled, not
just if the user has permission to manage cover images.

To test, apply the patch and go to Administration -> System preferences.

- Enable the LocalCoverImages system preference.
- Locate and view the detail page for a bibliographic record in the
  catalog which doesn't have a local cover image attached.

  - If you are logged in as a user with upload_local_cover_images
    permission you should see an "Images" tab with the message "No
    images have been uploaded for this bibliographic record yet" and an
    upload button.
  - If you are logged in as a user without upload_local_cover_images
    permission you should see an "Images" tab with just the "No
    images..." message.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Katrin Fischer 2022-02-13 14:09:45 UTC
Created attachment 130537 [details] [review]
Bug 30082: Bibliographic details tab missing when user can't add local cover image

This patch corrects the template logic which determines whether the
"Images" tab should be displayed on the bibliographic detail page. The
"Images" tab should display whenever local cover images are enabled, not
just if the user has permission to manage cover images.

To test, apply the patch and go to Administration -> System preferences.

- Enable the LocalCoverImages system preference.
- Locate and view the detail page for a bibliographic record in the
  catalog which doesn't have a local cover image attached.

  - If you are logged in as a user with upload_local_cover_images
    permission you should see an "Images" tab with the message "No
    images have been uploaded for this bibliographic record yet" and an
    upload button.
  - If you are logged in as a user without upload_local_cover_images
    permission you should see an "Images" tab with just the "No
    images..." message.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Fridolin Somers 2022-02-16 21:52:43 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 5 Kyle M Hall 2022-02-18 12:55:15 UTC
Pushed to 21.11.x for 21.11.03
Comment 6 Andrew Fuerste-Henry 2022-02-21 17:08:04 UTC
Pushed to 21.05.x for 21.05.11
Comment 7 Victor Grousset/tuxayo 2022-03-18 00:13:13 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.