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 <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Olivia Reynolds 2026-04-21 18:19:04 +00:00 committed by Lucas Gass
parent 1fe357b289
commit 994feda588
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
5 changed files with 43 additions and 32 deletions

View File

@ -160,7 +160,6 @@ sub _shared_preferences {
PrefillItem
z3950NormalizeAuthor
SpineLabelAutoPrint
SpineLabelShowPrintOnBibDetails
BlockReturnOfLostItems
BlockReturnOfWithdrawnItems
CalculateFinesOnReturn

View File

@ -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" );
},
};

View File

@ -786,7 +786,6 @@ INSERT INTO systempreferences ( `variable`, `value` ) VALUES
('SpecifyReturnDate','1'),
('SpineLabelAutoPrint','0'),
('SpineLabelFormat','<itemcallnumber><copynumber>'),
('SpineLabelShowPrintOnBibDetails','0'),
('staffClientBaseURL',''),
('StaffHighlightedWords','1'),
('StaffInterfaceLanguages','en'),

View File

@ -42,7 +42,7 @@
[% IF Koha.Preference('EasyAnalyticalRecords') %]<th id="[% tab | html %]_hostrecord" data-colname="hostrecord">Host records</th>[% END %]
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="usedin">Used in</th><th></th>[% END %]
[% IF Koha.Preference('UseCourseReserves') %]<th id="[% tab | html %]_course_reserves" data-colname="course_reserves">Course reserves</th>[% END %]
[% IF Koha.Preference('SpineLabelShowPrintOnBibDetails') %]<th id="[% tab | html %]_spinelabel" data-colname="spinelabel" class="no-sort">Spine label</th>[% END %]
<th id="[% tab | html %]_spinelabel" data-colname="spinelabel" class="no-sort">Spine label</th>
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="actions" class="no-sort no-export">&nbsp;</th>[% END %]
</tr>
</thead>
@ -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 '<a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=%s"><i class="fa fa-print"></i> %s</a>'.format(
escape_str(row.external_id),
escape_str(_("Print label"))
);
},
},
]
: []),
{
data: "",
searchable: false,
orderable: false,
render: function (data, type, row, meta) {
return '<a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=%s"><i class="fa fa-print"></i> %s</a>'.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]);

View File

@ -70,12 +70,6 @@ Cataloging:
- (Enter in columns from the <code>biblio</code>, <code>biblioitems</code> or <code>items</code> tables, surrounded by &lt; and &gt;.)
- 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:
-