From bfd3be6c4c4e03918f1c6d353ccfff19a9e8c0b7 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 8 Mar 2024 21:04:53 +0000 Subject: [PATCH] Bug 15461: Add StaffLocationOnDetail system preference To test; 1. APPLY patch, updatedatabase, restart services 2. Search for the new system preference 'StaffLocationOnDetail' 3. Read the description and make sure it makes sense. Check that the 'Table settings' link works. 4. By default it should be set to 'below the home library'. 5. Check to make sure that is where it displays. 6. Try 'below the holding library' and 'below both home and holding libraries', making sure each works properly. 7. Try 'on a sperate column', in which case you need to make sure that 'holdings_shelvinglocation' is properly checked under Administration > Table settings 8. Play with other Table settings to make sure they all work as they should. Signed-off-by: Andrew Fuerste-Henry --- admin/columns_settings.yml | 4 ++ .../data/mysql/atomicupdate/bug_15461.pl | 18 +++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../tables/items/catalogue_detail.inc | 51 ++++++++++++++----- .../admin/preferences/staff_interface.pref | 9 ++++ 5 files changed, 71 insertions(+), 12 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_15461.pl diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 3aa182a6b9..551921ee90 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -384,6 +384,8 @@ modules: columnname: holdings_holdingbranch - columnname: holdings_homebranch + - + columnname: holdings_shelvinglocation - columnname: holdings_ccode - @@ -450,6 +452,8 @@ modules: columnname: otherholdings_holdingbranch - columnname: otherholdings_homebranch + - + columnname: otherholdings_shelvinglocation - columnname: otherholdings_ccode - diff --git a/installer/data/mysql/atomicupdate/bug_15461.pl b/installer/data/mysql/atomicupdate/bug_15461.pl new file mode 100755 index 0000000000..d7ed32ee0c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_15461.pl @@ -0,0 +1,18 @@ +use Modern::Perl; + +return { + bug_number => "15461", + description => "Add system preference StaffLocationOnDetail", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Do you stuffs here + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`) + VALUES ('StaffLocationOnDetail','home','holding|home|both|column','In the staff interface, display the shelving location on its own column or under a library columns.','Choice') + }); + + say $out "Added new system preference 'StaffLocationOnDetail'"; + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 4c372bad78..9d985c3dc1 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -730,6 +730,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('StaffDetailItemSelection', '1', NULL, 'Enable item selection in record detail page', 'YesNo'), ('StaffHighlightedWords','1','','Highlight search terms on staff interface','YesNo'), ('StaffLangSelectorMode','footer','top|both|footer','Select the location to display the language selector in staff interface','Choice'), +('StaffLocationOnDetail','home','holding|home|both|column','In the staff interface detail, display the shelving location on its own column or under a library columns.', 'Choice'), ('StaffLoginInstructions', '', NULL, 'HTML to go into the login box for the staff interface','Free'), ('StaffSearchResultsDisplayBranch','holdingbranch','holdingbranch|homebranch','Controls the display of the home or holding branch for staff search results','Choice'), ('StaffSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the staff interface','Integer'), 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 3c08fe3ec7..88c2e010b0 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 @@ -16,6 +16,9 @@ [% IF ( item_level_itypes ) %]Item type[% END %] Current library Home library + [% IF Koha.Preference('StaffLocationOnDetail') == 'column' %] + Shelving location + [% END %] Collection [% IF Koha.Preference('EnableItemGroups') %] Item group @@ -363,7 +366,22 @@ searchable: true, orderable: true, render: function (data, type, row, meta) { - return escape_str(row._strings.holding_library_id.str); + let nodes = '%s'.format(escape_str(row._strings.holding_library_id.str)); + [% IF ( Koha.Preference('StaffLocationOnDetail') == 'home' || Koha.Preference('StaffLocationOnDetail') == 'both' ) %] + nodes += '' + [%# If permanent location is defined, show description or code and %] + [%# display current location in parentheses. If not, display current location. %] + [%# Note that permanent location is a code, and location may be an authval. %] + let loc_str = row._strings.location.str; + if ( row.permanent_location && row.permanent_location != row.location ) { + let permanent_loc_str = av_loc.get(row.permanent_location); + nodes += '%s (%s)'.format(escape_str(permanent_loc_str), escape_str(loc_str)); + } else { + nodes += escape_str(loc_str); + } + [% END %] + nodes += ''; + return nodes; } }, { @@ -373,21 +391,30 @@ orderable: true, render: function (data, type, row, meta) { let nodes = '%s'.format(escape_str(row._strings.home_library_id.str)); - nodes += '' - [%# If permanent location is defined, show description or code and %] - [%# display current location in parentheses. If not, display current location. %] - [%# Note that permanent location is a code, and location may be an authval. %] - let loc_str = row._strings.location.str; - if ( row.permanent_location && row.permanent_location != row.location ) { - let permanent_loc_str = av_loc.get(row.permanent_location); - nodes += '%s (%s)'.format(escape_str(permanent_loc_str), escape_str(loc_str)); - } else { - nodes += escape_str(loc_str); - } + [% IF ( Koha.Preference('StaffLocationOnDetail') == 'home' || Koha.Preference('StaffLocationOnDetail') == 'both' ) %] + nodes += '' + let loc_str = row._strings.location.str; + if ( row.permanent_location && row.permanent_location != row.location ) { + let permanent_loc_str = av_loc.get(row.permanent_location); + nodes += '%s (%s)'.format(escape_str(permanent_loc_str), escape_str(loc_str)); + } else { + nodes += escape_str(loc_str); + } + [% END %] nodes += ''; return nodes; } }, + [% IF Koha.Preference('StaffLocationOnDetail') == 'column' %] + { + data: "me.location", + searchable: true, + orderable: true, + render: function (data, type, row, meta) { + return escape_str(row._strings.collection_code.str); + } + }, + [% END %] { data: "me.collection_code", searchable: true, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref index 62dca5a673..526956641d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref @@ -125,6 +125,15 @@ Staff interface: type: textarea syntax: text/html class: code + - + - 'Display the shelving location ' + - pref: StaffLocationOnDetail + choices: + home: "below the home library" + holding: "below the holding library" + both: "below both home and holding libraries" + column: "on a separate column" + - 'for items on the staff interface record details page.
Note: If on a separate column is selected, you still need to enable holdings_shelving location on the Table settings adminstration page.' - - pref: StaffHighlightedWords type: boolean -- 2.30.2