View | Details | Raw Unified | Return to bug 34784
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_34784.pl (+19 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "34784",
5
    description => "Add ability to populate empty item callnumbers for a record based on the itemcallnumber syspref",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{
12
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
13
            VALUES ('EnablePopulateCallnumbers','0','','Enable populate callnumber feature','YesNo')
14
        }
15
        );
16
17
        say $out "Added new system preference 'EnablePopulateCallnumbers'";
18
    },
19
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-2 / +3 lines)
Lines 223-233 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
223
('EnableAdvancedCatalogingEditor','0','','Enable the Rancor advanced cataloging editor','YesNo'),
223
('EnableAdvancedCatalogingEditor','0','','Enable the Rancor advanced cataloging editor','YesNo'),
224
('EnableBorrowerFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'),
224
('EnableBorrowerFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'),
225
('EnableExpiredPasswordReset', '0', NULL, 'Enable ability for patrons with expired password to reset their password directly', 'YesNo'),
225
('EnableExpiredPasswordReset', '0', NULL, 'Enable ability for patrons with expired password to reset their password directly', 'YesNo'),
226
('EnableItemGroupHolds','0','','Enable item groups holds feature','YesNo'),
227
('EnableItemGroups','0','','Enable the item groups feature','YesNo'),
226
('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''),
228
('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''),
227
('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'),
229
('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'),
230
('EnablePopulateCallnumbers','0','','Enable populate callnumber feature','YesNo'),
228
('EnableSearchHistory','0','','Enable or disable search history','YesNo'),
231
('EnableSearchHistory','0','','Enable or disable search history','YesNo'),
229
('EnableItemGroups','0','','Enable the item groups feature','YesNo'),
230
('EnableItemGroupHolds','0','','Enable item groups holds feature','YesNo'),
231
('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'),
232
('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'),
232
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
233
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
233
('ERMModule', '0', NULL, 'Enable the e-resource management module', 'YesNo'),
234
('ERMModule', '0', NULL, 'Enable the e-resource management module', 'YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (+8 lines)
Lines 206-211 Link Here
206
    [% END %]
206
    [% END %]
207
[% END %]
207
[% END %]
208
208
209
[% IF Koha.Preference('EnablePopulateCallnumbers') %]
210
[% 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 ) %]
211
    <div class="btn-group">
212
        <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>
213
    </div>
214
[% END %]
215
[% END %]
216
209
[% FOREACH p IN plugins %]
217
[% FOREACH p IN plugins %]
210
    [% p.intranet_catalog_biblio_enhancements_toolbar_button | $raw %]
218
    [% p.intranet_catalog_biblio_enhancements_toolbar_button | $raw %]
211
[% END %]
219
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (+6 lines)
Lines 77-82 Cataloging: Link Here
77
                  0:  "Don't show"
77
                  0:  "Don't show"
78
            - buttons on the bibliographic details page to print item spine labels.
78
            - buttons on the bibliographic details page to print item spine labels.
79
        -
79
        -
80
            - pref: EnablePopulateCallnumbers
81
              choices:
82
                  1: Show
83
                  0:  "Don't show"
84
            - 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.
85
        -
80
    Record structure:
86
    Record structure:
81
        -
87
        -
82
            - "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>):"
88
            - "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>):"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (+3 lines)
Lines 647-652 Link Here
647
                            [% ELSE %]
647
                            [% ELSE %]
648
                                <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>
648
                                <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>
649
                            [% END %]
649
                            [% END %]
650
                            [% IF !item.itemcallnumber && Koha.Preference('EnablePopulateCallnumbers') %]
651
                                <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>
652
                            [% END %]
650
                        [% END %]
653
                        [% END %]
651
                        [% IF bundlesEnabled %]
654
                        [% IF bundlesEnabled %]
652
                            <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>
655
                            <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>
(-)a/koha-tmpl/intranet-tmpl/prog/js/catalog.js (-1 / +39 lines)
Lines 123-128 $(document).ready(function() { Link Here
123
        })
123
        })
124
        .tooltip();
124
        .tooltip();
125
125
126
    $("#populate-callnumbers-biblio")
127
        .on('click', function() {
128
            if ( confirm(__('Are you sure you want to populate callnumbers for all items without a callnumber on this record?')) ) {
129
                const biblionumber = $(this).data('biblionumber');
130
                $.post( `/api/v1/biblios/${biblionumber}/items/populate_empty_callnumbers`, function( data ) {
131
                    const items_updated = data.items_updated;
132
                    const callnumber = data.callnumber;
133
                    let msg = __('Items populated with the callnumber "%s": %s').format(callnumber, items_updated);
134
135
                    if ( items_updated ) {
136
                        msg += __('\nReload the page?');
137
                        if( confirm(msg) ) {
138
                            location.reload(true);
139
                        }
140
                    } else {
141
                        alert(msg);
142
                    }
143
                });
144
            }
145
        }).tooltip();
146
147
    $(".populate-callnumber-item")
148
        .on('click', function() {
149
            if ( confirm(__('Are you sure you want to populate the callnumber for this item?')) ) {
150
                const biblionumber = $(this).data('biblionumber');
151
                const itemnumber  = $(this).data('itemnumber');
152
                const button = $(this);
153
                $.post( `/api/v1/biblios/${biblionumber}/items/${itemnumber}/populate_empty_callnumbers`, function( data ) {
154
                    const callnumber = data.callnumber;
155
                    let msg = __('Item populated with the callnumber "%s"\nReload the page?').format(callnumber);
156
                    if( confirm(msg) ) {
157
                        location.reload(true);
158
                    } else {
159
                        button.hide();
160
                    }
161
                });
162
            }
163
        }).tooltip();
164
126
    $(".addtolist").on("click", function (e) {
165
    $(".addtolist").on("click", function (e) {
127
        e.preventDefault();
166
        e.preventDefault();
128
        var shelfnumber = $(this).data("shelfnumber");
167
        var shelfnumber = $(this).data("shelfnumber");
129
- 

Return to bug 34784