From f82870f929ac846440ada3450bec7fbc528a33c0 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Tue, 13 Jun 2023 14:11:33 +0000
Subject: [PATCH] Bug 33999: Subscription details link on bibliographic detail
 page should have permission check

This patch wraps the "Subscription details" link on the bibliographic
detail page with a permissions check, "CAN_user_serials," so that a user
lacking permission to access the Serials module will not be shown the
link.

To test, apply the patch and view the bibliographic detail page of a
serial record.

- When viewing the "Subscriptions" tab as a user with Serials
  permissions you should see the "Subscription details" link.
- When viewing the tab as a user without the correct permissions the
  link should not be present.
---
 koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
index d4ead1659f..c4b4e9d3b8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -810,7 +810,11 @@
             [% END %]
             </table>
             [% END %]
-            <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | uri %]">Subscription details</a>
+            [% IF ( CAN_user_serials ) %]
+                <p>
+                    <a class="btn btn-default" href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | uri %]">Subscription details</a>
+                </p>
+            [% END %]
     [% END %]
 </div>
 </div>
-- 
2.30.2