Bug 9565: Deleting a biblio should alert/fail if there are existent subscriptions
authorTimothy Alexis Vass <timothy_alexis.vass@ub.lu.se>
Fri, 13 Nov 2020 09:47:32 +0000 (09:47 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Sat, 11 Dec 2021 07:15:30 +0000 (21:15 -1000)
Currently Koha will delete a biblio record if there are existent serial subscriptions.
This patch will prevent deleting the biblio until attached subscriptions are removed.

To test:
1) Add a subscription to a biblio, or check a biblio which has one attached already.
2) Remove all items if there are any.
3) Apply patch.
4) Confirm that the 'Delete record' item is disabled in the list.
5) Sign off.

Sponsored by: Lunds Universitetsbibliotek

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc

index e194411..1f352ab 100644 (file)
@@ -72,6 +72,8 @@
             [% IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %]
                 [% IF ( count ) %]
                     <li class="disabled"><a id="deletebiblio" data-toggle="tooltip" data-placement="left" title="[% count | html %] item(s) are attached to this record. You must delete all items before deleting this record." href="#">Delete record</a></li>
+                [% ELSIF ( biblio.subscriptions.count ) %]
+                    <li class="disabled"><a id="deletebiblio" data-toggle="tooltip" data-placement="left" title="[% biblio.subscriptions.count | html %] subscription(s) are attached to this record. You must delete all subscriptions before deleting this record." href="#">Delete record</a></li>
                 [% ELSE %]
                     <li><a id="deletebiblio" data-order-manage="[% CAN_user_acquisition_order_manage | html %]" href="#">Delete record</a></li>
                 [% END %]