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 228-238 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
228
('EnableAdvancedCatalogingEditor','0','','Enable the Rancor advanced cataloging editor','YesNo'),
228
('EnableAdvancedCatalogingEditor','0','','Enable the Rancor advanced cataloging editor','YesNo'),
229
('EnableBorrowerFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'),
229
('EnableBorrowerFiles','0',NULL,'If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'),
230
('EnableExpiredPasswordReset', '0', NULL, 'Enable ability for patrons with expired password to reset their password directly', 'YesNo'),
230
('EnableExpiredPasswordReset', '0', NULL, 'Enable ability for patrons with expired password to reset their password directly', 'YesNo'),
231
('EnableItemGroupHolds','0','','Enable item groups holds feature','YesNo'),
232
('EnableItemGroups','0','','Enable the item groups feature','YesNo'),
231
('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''),
233
('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''),
232
('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'),
234
('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'),
235
('EnablePopulateCallnumbers','0','','Enable populate callnumber feature','YesNo'),
233
('EnableSearchHistory','0','','Enable or disable search history','YesNo'),
236
('EnableSearchHistory','0','','Enable or disable search history','YesNo'),
234
('EnableItemGroups','0','','Enable the item groups feature','YesNo'),
235
('EnableItemGroupHolds','0','','Enable item groups holds feature','YesNo'),
236
('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'),
237
('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'),
237
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
238
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
238
('ERMModule', '0', NULL, 'Enable the e-resource management module', 'YesNo'),
239
('ERMModule', '0', NULL, 'Enable the e-resource management module', 'YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (+8 lines)
Lines 211-216 Link Here
211
    [% END %]
211
    [% END %]
212
[% END %]
212
[% END %]
213
213
214
[% IF Koha.Preference('EnablePopulateCallnumbers') %]
215
[% 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 ) %]
216
    <div class="btn-group">
217
        <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>
218
    </div>
219
[% END %]
220
[% END %]
221
214
[% FOREACH p IN plugins %]
222
[% FOREACH p IN plugins %]
215
    [% p.intranet_catalog_biblio_enhancements_toolbar_button | $raw %]
223
    [% p.intranet_catalog_biblio_enhancements_toolbar_button | $raw %]
216
[% END %]
224
[% 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 652-657 Link Here
652
                            [% ELSE %]
652
                            [% ELSE %]
653
                                <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>
653
                                <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>
654
                            [% END %]
654
                            [% END %]
655
                            [% IF !item.itemcallnumber && Koha.Preference('EnablePopulateCallnumbers') %]
656
                                <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>
657
                            [% END %]
655
                        [% END %]
658
                        [% END %]
656
                        [% IF bundlesEnabled %]
659
                        [% IF bundlesEnabled %]
657
                            <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>
660
                            <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 124-129 $(document).ready(function() { Link Here
124
        })
124
        })
125
        .tooltip();
125
        .tooltip();
126
126
127
    $("#populate-callnumbers-biblio")
128
        .on('click', function() {
129
            if ( confirm(__('Are you sure you want to populate callnumbers for all items without a callnumber on this record?')) ) {
130
                const biblionumber = $(this).data('biblionumber');
131
                $.post( `/api/v1/biblios/${biblionumber}/items/populate_empty_callnumbers`, function( data ) {
132
                    const items_updated = data.items_updated;
133
                    const callnumber = data.callnumber;
134
                    let msg = __('Items populated with the callnumber "%s": %s').format(callnumber, items_updated);
135
136
                    if ( items_updated ) {
137
                        msg += __('\nReload the page?');
138
                        if( confirm(msg) ) {
139
                            location.reload(true);
140
                        }
141
                    } else {
142
                        alert(msg);
143
                    }
144
                });
145
            }
146
        }).tooltip();
147
148
    $(".populate-callnumber-item")
149
        .on('click', function() {
150
            if ( confirm(__('Are you sure you want to populate the callnumber for this item?')) ) {
151
                const biblionumber = $(this).data('biblionumber');
152
                const itemnumber  = $(this).data('itemnumber');
153
                const button = $(this);
154
                $.post( `/api/v1/biblios/${biblionumber}/items/${itemnumber}/populate_empty_callnumbers`, function( data ) {
155
                    const callnumber = data.callnumber;
156
                    let msg = __('Item populated with the callnumber "%s"\nReload the page?').format(callnumber);
157
                    if( confirm(msg) ) {
158
                        location.reload(true);
159
                    } else {
160
                        button.hide();
161
                    }
162
                });
163
            }
164
        }).tooltip();
165
127
    $(".addtolist").on("click", function (e) {
166
    $(".addtolist").on("click", function (e) {
128
        e.preventDefault();
167
        e.preventDefault();
129
        var shelfnumber = $(this).data("shelfnumber");
168
        var shelfnumber = $(this).data("shelfnumber");
130
- 

Return to bug 34784