From dbb7782175a9cf8ec3ca9961af32369a7772e72d 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 | 53 ++++++++++++++----- .../admin/preferences/staff_interface.pref | 9 ++++ 5 files changed, 72 insertions(+), 13 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_15461.pl diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 8ab19fdf96b..5dff66d46eb 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -423,6 +423,8 @@ modules: columnname: holdings_holdingbranch - columnname: holdings_homebranch + - + columnname: holdings_shelvinglocation - columnname: holdings_ccode - @@ -490,6 +492,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 00000000000..d7ed32ee0ce --- /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 34ada9d8376..c15c84e3c68 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -751,6 +751,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('StaffHighlightedWords','1','','Highlight search terms on staff interface','YesNo'), ('StaffInterfaceLanguages','en',NULL,'Set the default language in the staff interface.','Languages'), ('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'), ('StaffLoginLibraryBasedOnIP', '1','', 'Set the logged in library for the user based on their current IP','YesNo'), ('StaffLoginRestrictLibraryByIP','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff interface from unauthorized IP addresses based on branch','YesNo'), 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 7e44c02a5a1..b680124f0dd 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 @@ -377,7 +380,22 @@ searchable: true, orderable: true, render: function (data, type, row, meta) { - return escape_str(row._strings.holding_library_id ? row._strings.holding_library_id.str : row.holding_library_id); + 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; } }, { @@ -386,22 +404,31 @@ searchable: true, orderable: true, render: function (data, type, row, meta) { - let nodes = '%s'.format(escape_str(row._strings.home_library_id ? row._strings.home_library_id.str : row.home_library_id)); - 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 ? row._strings.location.str : row.location; - 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); - } + let nodes = '%s'.format(escape_str(row._strings.home_library_id.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 23337a2e395..9dab7035067 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 @@ -124,6 +124,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.39.2