Bugzilla – Attachment 158628 Details for
Bug 34784
Add ability to populate empty item call numbers for a record based on the itemcallnumber system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34784: Implement feature in staff interface
Bug-34784-Implement-feature-in-staff-interface.patch (text/plain), 10.25 KB, created by
Katrin Fischer
on 2023-11-07 21:50:03 UTC
(
hide
)
Description:
Bug 34784: Implement feature in staff interface
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-11-07 21:50:03 UTC
Size:
10.25 KB
patch
obsolete
>From 1a1b43cfcabb533ef71563a1ddd80f750a0157ac Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 14 Sep 2023 12:22:55 -0400 >Subject: [PATCH] Bug 34784: Implement feature in staff interface > >Some libraries would like to auto-populate item callnumbers for items on a record based on the system preference "itemcallnumber". Only items with empty callnumbers would affected. This would add a button "Populate empty item callnumbers" on catalogue/detail.pl, as well as a "Populate callnumber" button for each line in the holdings table to set the callnumber for that specific item. > >Test Plan: >1) Set the systempreference to something ( "245a" will make the > callnumber the record title for testing purposes ) >2) Apply this patch set >3) Restart all the things! >4) Browse to a record details page, note no new buttons >5) Enable the new syspref EnablePopulateCallnumbers >5) Reload the record details, note the new "Populate callnumbers" button > in the cataloging toolbar >7) Add one or more items with no callnumber to the record >8) Test the "Populate callnumbers" button >9) Add another item with no callnumber to the record >10) Test the "Populate callnumber" button for that single item > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../data/mysql/atomicupdate/bug_34784.pl | 19 +++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 5 ++- > .../prog/en/includes/cat-toolbar.inc | 8 ++++ > .../admin/preferences/cataloguing.pref | 6 +++ > .../prog/en/modules/catalogue/detail.tt | 3 ++ > koha-tmpl/intranet-tmpl/prog/js/catalog.js | 39 +++++++++++++++++++ > 6 files changed, 78 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_34784.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_34784.pl b/installer/data/mysql/atomicupdate/bug_34784.pl >new file mode 100755 >index 0000000000..448e54c67b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_34784.pl >@@ -0,0 +1,19 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "34784", >+ description => "Add ability to populate empty item callnumbers for a record based on the itemcallnumber syspref", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) >+ VALUES ('EnablePopulateCallnumbers','0','','Enable populate callnumber feature','YesNo') >+ } >+ ); >+ >+ say $out "Added new system preference 'EnablePopulateCallnumbers'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 044361b6ad..72b949c9a7 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -228,11 +228,12 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('EnableAdvancedCatalogingEditor','0','','Enable the Rancor advanced cataloging editor','YesNo'), > ('EnableBorrowerFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'), > ('EnableExpiredPasswordReset', '0', NULL, 'Enable ability for patrons with expired password to reset their password directly', 'YesNo'), >+('EnableItemGroupHolds','0','','Enable item groups holds feature','YesNo'), >+('EnableItemGroups','0','','Enable the item groups feature','YesNo'), > ('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''), > ('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'), >+('EnablePopulateCallnumbers','0','','Enable populate callnumber feature','YesNo'), > ('EnableSearchHistory','0','','Enable or disable search history','YesNo'), >-('EnableItemGroups','0','','Enable the item groups feature','YesNo'), >-('EnableItemGroupHolds','0','','Enable item groups holds feature','YesNo'), > ('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'), > ('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'), > ('ERMModule', '0', NULL, 'Enable the e-resource management module', 'YesNo'), >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 93818826d2..6a64686b92 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -211,6 +211,14 @@ > [% END %] > [% END %] > >+[% IF Koha.Preference('EnablePopulateCallnumbers') %] >+[% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items || CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel ) or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >+ <div class="btn-group"> >+ <button id="populate-callnumbers-biblio" class="btn btn-default" href="#" data-biblionumber="[% biblionumber | html %]" data-toggle="tooltip" data-placement="top" title="Populate callnumbers for items with no callnumber."><i class="fa fa-bars"></i> Populate callnumbers</button> >+ </div> >+[% END %] >+[% END %] >+ > [% FOREACH p IN plugins %] > [% p.intranet_catalog_biblio_enhancements_toolbar_button | $raw %] > [% END %] >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 5a6346ed46..37eff97140 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 >@@ -77,6 +77,12 @@ Cataloging: > 0: "Don't show" > - buttons on the bibliographic details page to print item spine labels. > - >+ - pref: EnablePopulateCallnumbers >+ choices: >+ 1: Show >+ 0: "Don't show" >+ - buttons on the bibliographic details page to populate empty item callnumbers from the record based on the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=itemcallnumber">itemcallnumber</a> system preference. >+ - > Record structure: > - > - "Fill in the default language for field 008 Range 35-37 of MARC21 records (e.g. eng, nor, ger, see <a href='http://www.loc.gov/marc/languages/language_code.html'>MARC Code List for Languages</a>):" >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 05da5acf56..9fc75ebf99 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -652,6 +652,9 @@ > [% ELSE %] > <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | html %]&itemnumber=[% item.itemnumber | html %]#edititem"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> > [% END %] >+ [% IF !item.itemcallnumber && Koha.Preference('EnablePopulateCallnumbers') %] >+ <button class="populate-callnumber-item" class="btn btn-default" href="#" data-itemnumber="[% item.itemnumber | html %]" data-biblionumber="[% item.biblionumber | html %]" data-toggle="tooltip" data-placement="top" title="Populate callnumber for this item."><i class="fa fa-bars"></i> Populate callnumber</button> >+ [% END %] > [% END %] > [% IF bundlesEnabled %] > <button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> Manage bundle ([% item.bundled | html %]|[% item.bundled_lost | html %])</button> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/catalog.js b/koha-tmpl/intranet-tmpl/prog/js/catalog.js >index 8a3694fb8d..d04a71c25f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/catalog.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/catalog.js >@@ -124,6 +124,45 @@ $(document).ready(function() { > }) > .tooltip(); > >+ $("#populate-callnumbers-biblio") >+ .on('click', function() { >+ if ( confirm(__('Are you sure you want to populate callnumbers for all items without a callnumber on this record?')) ) { >+ const biblionumber = $(this).data('biblionumber'); >+ $.post( `/api/v1/biblios/${biblionumber}/items/populate_empty_callnumbers`, function( data ) { >+ const items_updated = data.items_updated; >+ const callnumber = data.callnumber; >+ let msg = __('Items populated with the callnumber "%s": %s').format(callnumber, items_updated); >+ >+ if ( items_updated ) { >+ msg += __('\nReload the page?'); >+ if( confirm(msg) ) { >+ location.reload(true); >+ } >+ } else { >+ alert(msg); >+ } >+ }); >+ } >+ }).tooltip(); >+ >+ $(".populate-callnumber-item") >+ .on('click', function() { >+ if ( confirm(__('Are you sure you want to populate the callnumber for this item?')) ) { >+ const biblionumber = $(this).data('biblionumber'); >+ const itemnumber = $(this).data('itemnumber'); >+ const button = $(this); >+ $.post( `/api/v1/biblios/${biblionumber}/items/${itemnumber}/populate_empty_callnumbers`, function( data ) { >+ const callnumber = data.callnumber; >+ let msg = __('Item populated with the callnumber "%s"\nReload the page?').format(callnumber); >+ if( confirm(msg) ) { >+ location.reload(true); >+ } else { >+ button.hide(); >+ } >+ }); >+ } >+ }).tooltip(); >+ > $(".addtolist").on("click", function (e) { > e.preventDefault(); > var shelfnumber = $(this).data("shelfnumber"); >-- >2.30.2
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 34784
:
155623
|
155624
|
155626
|
155627
|
156140
|
156141
|
158554
|
158555
|
158556
|
158569
|
158570
|
158571
|
158572
|
158593
|
158627
|
158628
|
158629
|
158630
|
158631
|
160349
|
173076
|
173077
|
173078
|
174241