Bug 30082 - Bibliographic details tab missing when user can't add local cover image
Summary: Bibliographic details tab missing when user can't add local cover image
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 22032
Blocks:
  Show dependency treegraph
 
Reported: 2022-02-11 15:20 UTC by Owen Leonard
Modified: 2022-12-12 21:23 UTC (History)
3 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:
22.05.00,21.11.03,21.05.11


Attachments
Screenshot showing the problem (53.67 KB, image/png)
2022-02-11 15:20 UTC, Owen Leonard
Details
Bug 30082: Bibliographic details tab missing when user can't add local cover image (2.39 KB, patch)
2022-02-11 15:31 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 30082: Bibliographic details tab missing when user can't add local cover image (2.44 KB, patch)
2022-02-12 03:25 UTC, David Nind
Details | Diff | Splinter Review
Bug 30082: Bibliographic details tab missing when user can't add local cover image (2.49 KB, patch)
2022-02-13 14:09 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.