Bugzilla – Attachment 190281 Details for
Bug 35953
Add delete_any_record cataloguing subpermission
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35953: Add delete_any_record cataloguing subpermission
0001-Bug-35953-Add-delete_any_record-cataloguing-subpermi.patch (text/plain), 9.04 KB, created by
Emmi Takkinen
on 2025-12-08 11:40:28 UTC
(
hide
)
Description:
Bug 35953: Add delete_any_record cataloguing subpermission
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2025-12-08 11:40:28 UTC
Size:
9.04 KB
patch
obsolete
>From 1a8282d35e26d978dfa50eab96e03354dc2ac7bd Mon Sep 17 00:00:00 2001 >From: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> >Date: Thu, 8 Feb 2024 11:20:38 +1300 >Subject: [PATCH 1/3] Bug 35953: Add delete_any_record cataloguing > subpermission > >To test: >- apply patch >- create a new test user >- give the test user "catalogue" permissions so that they can enter the staff interface >- also give the test user the "edit_catalogue" subpermission under the "editcatalogue" permission >- login to the staff interface as the test user >- do a catalogue search >- click on a result and go to their biblio details page >- notice there is an "Edit" button dropdown >- click on the "Edit" button dropdown and notice there is no option to "Delete record" >- change the permissions of the test user to also have "delete_any_record" subpermission under the "editcatalogue" permission >- do another catalogue search and click on the result >- click on the "Edit" button dropdown and notice there is now an option to "Delete record" > >Sponsored-by: Education Services Australia SCIS >Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com> >--- > ...53_-_add_delete_any_record_permission.perl | 6 +++ > .../data/mysql/mandatory/userpermissions.sql | 1 + > .../prog/en/includes/cat-toolbar.inc | 54 ++++++++++--------- > .../prog/en/includes/permissions.inc | 2 + > 4 files changed, 39 insertions(+), 24 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_35953_-_add_delete_any_record_permission.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_35953_-_add_delete_any_record_permission.perl b/installer/data/mysql/atomicupdate/bug_35953_-_add_delete_any_record_permission.perl >new file mode 100644 >index 0000000000..6ce64928b4 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35953_-_add_delete_any_record_permission.perl >@@ -0,0 +1,6 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (9, 'delete_any_record', 'Delete any existing record')}); >+ >+ NewVersion( $DBversion, undef, "Add delete_any_record user permission" ); >+} >diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql >index 34b868d2d5..47483081df 100644 >--- a/installer/data/mysql/mandatory/userpermissions.sql >+++ b/installer/data/mysql/mandatory/userpermissions.sql >@@ -65,6 +65,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 9, 'delete_all_items', 'Delete all items at once'), > ( 9, 'manage_item_groups', 'Create, update and delete item groups, add or remove items from a item groups'), > ( 9, 'manage_item_editor_templates', 'Update and delete item editor template owned by others'), >+ ( 9, 'delete_any_record', 'Delete any existing record'), > ( 9, 'edit_any_item', 'Edit any item regardless of home library'), > ( 9, 'edit_locked_records', 'Edit locked records'), > ( 9, 'set_record_sources', 'Set record source'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index 7b4ac6920f..3bb87c2c6c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -128,32 +128,38 @@ > > [% IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] > [% IF ( count ) %] >- <li >- data-bs-toggle="tooltip" >- data-bs-placement="left" >- title="[%- I18N.tnx('There is an item attached to this record. You must delete all items before deleting this record', 'There are {count} items attached to this record. You must delete all items before deleting this record', count, { count => count }) -%]" >- > >- <a class="dropdown-item disabled" aria-disabled="true" id="deletebiblio" href="#">Delete record</a> >- </li> >+ [% IF CAN_user_editcatalogue_delete_any_record %] >+ <li >+ data-bs-toggle="tooltip" >+ data-bs-placement="left" >+ title="[%- I18N.tnx('There is an item attached to this record. You must delete all items before deleting this record', 'There are {count} items attached to this record. You must delete all items before deleting this record', count, { count => count }) -%]" >+ > >+ <a class="dropdown-item disabled" aria-disabled="true" id="deletebiblio" href="#">Delete record</a> >+ </li> >+ [% END %] > [% ELSIF ( biblio.subscriptions.count ) %] >- [%- SET subscriptions_count = biblio.subscriptions.count -%] >- <li >- data-bs-toggle="tooltip" >- data-bs-placement="left" >- title="[%- I18N.tnx('There is a subscription attached to this record. You must delete all subscriptions before deleting this record', 'There are {subscriptions_count} subscriptions attached to this record. You must delete all subscriptions before deleting this record', subscriptions_count, { subscriptions_count => subscriptions_count }) -%]" >- > >- <a class="dropdown-item disabled" aria-disabled="true" id="deletebiblio" href="#">Delete record</a> >- </li> >+ [% IF CAN_user_editcatalogue_delete_any_record %] >+ [%- SET subscriptions_count = biblio.subscriptions.count -%] >+ <li >+ data-bs-toggle="tooltip" >+ data-bs-placement="left" >+ title="[%- I18N.tnx('There is a subscription attached to this record. You must delete all subscriptions before deleting this record', 'There are {subscriptions_count} subscriptions attached to this record. You must delete all subscriptions before deleting this record', subscriptions_count, { subscriptions_count => subscriptions_count }) -%]" >+ > >+ <a class="dropdown-item disabled" aria-disabled="true" id="deletebiblio" href="#">Delete record</a> >+ </li> >+ [% END %] > [% ELSE %] >- <li> >- <form action="/cgi-bin/koha/cataloguing/addbiblio.pl" method="post"> >- [% INCLUDE 'csrf-token.inc' %] >- <input type="hidden" name="op" value="cud-delete" /> >- <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" /> >- <input type="hidden" name="searchid" value="[% searchid | html %]" /> >- </form> >- <a class="dropdown-item" id="deletebiblio" data-order-manage="[% CAN_user_acquisition_order_manage | html %]" href="#">Delete record</a> >- </li> >+ [% IF CAN_user_editcatalogue_delete_any_record %] >+ <li> >+ <form action="/cgi-bin/koha/cataloguing/addbiblio.pl" method="post"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-delete" /> >+ <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" /> >+ <input type="hidden" name="searchid" value="[% searchid | html %]" /> >+ </form> >+ <a class="dropdown-item" id="deletebiblio" data-order-manage="[% CAN_user_acquisition_order_manage | html %]" href="#">Delete record</a> >+ </li> >+ [% END %] > [% END %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index 9aae9efba0..65a598b856 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -293,6 +293,8 @@ > [%- CASE 'fast_cataloging' -%] > <span class="sub_permission fast_cataloging_subpermission"> Fast cataloging </span> > <span class="permissioncode">([% name | html %])</span> >+ [%- CASE 'delete_any_record' -%] >+ <span class="sub_permission delete_any_record_subpermission"> Delete any existing record </span> > [%- CASE 'manage_item_groups' -%] > <span class="sub_permission manage_item_groups_subpermission"> Create, update and delete item groups, add or remove items from an item group </span> > <span class="permissioncode">([% name | html %])</span> >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35953
:
161720
|
161859
|
162129
|
162402
| 190281 |
190282
|
190283