From 994feda5880af7d5ece056c416a4c5704f5306c7 Mon Sep 17 00:00:00 2001 From: Olivia Reynolds Date: Tue, 21 Apr 2026 18:19:04 +0000 Subject: [PATCH] Bug 34353: Remove 'SpineLabelShowPrintOnBibDetails' syspref With the ability to customise which columns are hidden by default as part of "Table settings", this syspref is redundant. As part of the atomicupdate, we incorporate the previous syspref value into columns_settings. As there are six possible states the migration could start from (the syspref can be 0 or 1, and the table setting can be 0, 1, or NULL) and two final states it must be idempotent from, the test plan is unfortunately quite cumbersome. Test plan: 1. Reset the database, to clear the table settings. 2. Apply patch and update the database. 3. Navigate to Administration > System preferences > Cataloging. 4. Verify that "SpineLabelShowPrintOnBibDetails" does not appear. 5. Navigate to a catalogue detail page. 6. Verify that the "Spine label" column is hidden. 7. Update the database again. 8. Navigate to a catalogue detail page. 9. Verify that the "Spine label" column is hidden. 10. Revert the patch. 11. Reset the database, to clear the table settings. 12. Navigate to Administration > System preferences > Cataloging. 13. Set "SpineLabelShowPrintOnBibDetails" to "Show" and save. 14. Apply patch and update the database. 15. Navigate to a catalogue detail page. 16. Verify that the "Spine label" column is visible. 17. Update the database again. 18. Navigate to a catalogue detail page. 19. Verify that the "Spine label" column is visible. 20. Revert the patch. 21. Reset the database, to clear the table settings. 22. Navigate to Administration > Table settings. 23. Under Catalog > holdings_table, check "Is hidden by default" for "spinelabel" and save. 24. Apply patch and update the database. 25. Navigate to a catalogue detail page. 26. Verify that the "Spine label" column is hidden. 27. Revert the patch. 28. Reset the database, to clear the table settings. 29. Navigate to Administration > System preferences > Cataloging. 30. Set "SpineLabelShowPrintOnBibDetails" to "Show" and save. 31. Navigate to Administration > Table settings. 32. Under Catalog > holdings_table, check "Is hidden by default" for "spinelabel" and save. 33. Apply patch and update the database. 34. Navigate to a catalogue detail page. 35. Verify that the "Spine label" column is hidden. 36. Revert the patch. 37. Reset the database, to clear the table settings. 38. Navigate to Administration > Table settings. 39. Under Catalog > holdings_table, uncheck "Is hidden by default" for "spinelabel" and save. 40. Apply patch and update the database. 41. Navigate to a catalogue detail page. 42. Verify that the "Spine label" column is hidden. 43. Revert the patch. 44. Reset the database, to clear the table settings. 45. Navigate to Administration > System preferences > Cataloging. 46. Set "SpineLabelShowPrintOnBibDetails" to "Show" and save. 47. Navigate to Administration > Table settings. 48. Under Catalog > holdings_table, uncheck "Is hidden by default" for "spinelabel" and save. 49. Apply patch and update the database. 50. Navigate to a catalogue detail page. 51. Verify that the "Spine label" column is visible. Thanks-to: Katrin Fischer Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass --- C4/UsageStats.pm | 1 - ...spinelabelshowprintonbibdetails_syspref.pl | 26 ++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 - .../tables/items/catalogue_detail.inc | 41 ++++++++----------- .../admin/preferences/cataloguing.pref | 6 --- 5 files changed, 43 insertions(+), 32 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_34353-remove_spinelabelshowprintonbibdetails_syspref.pl diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 266236179b..25304fbfaf 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -160,7 +160,6 @@ sub _shared_preferences { PrefillItem z3950NormalizeAuthor SpineLabelAutoPrint - SpineLabelShowPrintOnBibDetails BlockReturnOfLostItems BlockReturnOfWithdrawnItems CalculateFinesOnReturn diff --git a/installer/data/mysql/atomicupdate/bug_34353-remove_spinelabelshowprintonbibdetails_syspref.pl b/installer/data/mysql/atomicupdate/bug_34353-remove_spinelabelshowprintonbibdetails_syspref.pl new file mode 100644 index 0000000000..32f79b6b32 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_34353-remove_spinelabelshowprintonbibdetails_syspref.pl @@ -0,0 +1,26 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "34353", + description => "Delete the SpineLabelShowPrintOnBibDetails syspref", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do( + q{INSERT INTO columns_settings + (module, page, tablename, columnname, cannot_be_toggled, is_hidden) + VALUES + ('catalogue', 'detail', 'holdings_table', 'spinelabel', 0, + (SELECT IFNULL( + (SELECT NOT value FROM systempreferences WHERE variable='SpineLabelShowPrintOnBibDetails'), + 0))) + ON DUPLICATE KEY UPDATE is_hidden=(is_hidden OR VALUES(is_hidden))} + ); + + $dbh->do(q{DELETE FROM systempreferences WHERE variable='SpineLabelShowPrintOnBibDetails'}); + + say_success( $out, "Deleted 'SpineLabelShowPrintOnBibDetails' syspref" ); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index bb9c7c19d5..c3036df4b6 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -786,7 +786,6 @@ INSERT INTO systempreferences ( `variable`, `value` ) VALUES ('SpecifyReturnDate','1'), ('SpineLabelAutoPrint','0'), ('SpineLabelFormat',''), -('SpineLabelShowPrintOnBibDetails','0'), ('staffClientBaseURL',''), ('StaffHighlightedWords','1'), ('StaffInterfaceLanguages','en'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index d350f2fca9..43455b4e74 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -42,7 +42,7 @@ [% IF Koha.Preference('EasyAnalyticalRecords') %]Host records[% END %] [% IF ( analyze ) %]Used in[% END %] [% IF Koha.Preference('UseCourseReserves') %]Course reserves[% END %] - [% IF Koha.Preference('SpineLabelShowPrintOnBibDetails') %]Spine label[% END %] + Spine label [% IF ( CAN_user_editcatalogue_edit_items ) %] [% END %] @@ -146,7 +146,6 @@ noItemTypeImages: [% Koha.Preference('noItemTypeImages') ? 1 : 0 | html %], DisplayPublishedDate: [% Koha.Preference('DisplayPublishedDate') ? 1 : 0 | html %], canreservefromotherbranches: [% Koha.Preference('canreservefromotherbranches') ? 1 : 0 | html %], - SpineLabelShowPrintOnBibDetails: [% Koha.Preference('SpineLabelShowPrintOnBibDetails') ? 1 : 0 | html %], }); Koha.addPermissions({ CAN_user_editcatalogue_edit_items: [% CAN_user_editcatalogue_edit_items ? 1 : 0 | html %], @@ -868,21 +867,17 @@ }, ] : []), - ...(Koha.prefs.SpineLabelShowPrintOnBibDetails - ? [ - { - data: "", - searchable: false, - orderable: false, - render: function (data, type, row, meta) { - return ' %s'.format( - escape_str(row.external_id), - escape_str(_("Print label")) - ); - }, - }, - ] - : []), + { + data: "", + searchable: false, + orderable: false, + render: function (data, type, row, meta) { + return ' %s'.format( + escape_str(row.external_id), + escape_str(_("Print label")) + ); + }, + }, ...(Koha.permissions.CAN_user_editcatalogue_edit_items ? [ { @@ -966,13 +961,11 @@ container.find(".bottom.pager").remove(); } - if (Koha.prefs.SpineLabelShowPrintOnBibDetails) { - $(".print-label").on("click", function (e) { - e.preventDefault(); - link = $(this).attr("href"); - openWindow(link, "Print spine label", 400, 400); - }); - } + $(".print-label").on("click", function (e) { + e.preventDefault(); + link = $(this).attr("href"); + openWindow(link, "Print spine label", 400, 400); + }); if (api.data().length) { update_columns_visibility(api, items_table_settings[tab_id], user_colvis[tab_id]); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index 816dcb9695..d3a9b15d8e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -70,12 +70,6 @@ Cataloging: - (Enter in columns from the biblio, biblioitems or items tables, surrounded by < and >.) - pref: SpineLabelFormat type: textarea - - - - pref: SpineLabelShowPrintOnBibDetails - choices: - 1: Show - 0: "Don't show" - - buttons on the bibliographic details page to print item spine labels. Record structure: -