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 call numbers for a record based on the itemcallnumber system preference",
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 call number feature','YesNo')
14
        }
15
        );
16
17
        say $out "Added new system preference 'EnablePopulateCallnumbers'";
18
    },
19
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 251-256 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
251
('EnableItemGroups','0','','Enable the item groups feature','YesNo'),
251
('EnableItemGroups','0','','Enable the item groups feature','YesNo'),
252
('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''),
252
('EnableOpacSearchHistory','1','YesNo','Enable or disable opac search history',''),
253
('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'),
253
('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo'),
254
('EnablePopulateCallnumbers','0','','Enable populate call number feature','YesNo'),
254
('EnableSearchHistory','0','','Enable or disable search history','YesNo'),
255
('EnableSearchHistory','0','','Enable or disable search history','YesNo'),
255
('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'),
256
('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'),
256
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
257
('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (+4 lines)
Lines 59-64 Link Here
59
                </li>
59
                </li>
60
            [% END %]
60
            [% END %]
61
61
62
            [% IF Koha.Preference('EnablePopulateCallnumbers') && ( ( 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 ) ) %]
63
                <li><a class="dropdown-item" id="populate-callnumbers-biblio" href="#" data-biblionumber="[% biblionumber | html %]" data-toggle="tooltip" data-placement="top" title="Populate call numbers for items with no callnumber."> Populate call numbers</a></li>
64
            [% END %]
65
62
            [% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %]
66
            [% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %]
63
                <li><a class="dropdown-item" id="manageitems" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber | html %]">Manage items</a></li>
67
                <li><a class="dropdown-item" id="manageitems" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber | html %]">Manage items</a></li>
64
            [% END %]
68
            [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (-2 / +9 lines)
Lines 775-785 Link Here
775
                data: function( row, type, val, meta ) {
775
                data: function( row, type, val, meta ) {
776
                    let nodes = '';
776
                    let nodes = '';
777
                    if ( can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length ){
777
                    if ( can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length ){
778
                        [% IF Koha.Preference('LocalCoverImages') OR Koha.Preference('OPACLocalCoverImages') %]
778
                        [% SET show_itemcallnumber_link = !item.itemcallnumber && Koha.Preference('EnablePopulateCallnumbers') %]
779
                        [% SET show_local_covers_link = Koha.Preference('LocalCoverImages') OR Koha.Preference('OPACLocalCoverImages') %]
780
                        [% IF show_itemcallnumber_link || show_local_covers_link %]
779
                            nodes += '<div class="btn-group">';
781
                            nodes += '<div class="btn-group">';
780
                            nodes += ' <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a><a class="btn btn-default btn-xs dropdown-toggle" data-bs-toggle="dropdown"><span class="caret"></span></a>'.format(row.biblio_id, row.item_id, _("Edit"));
782
                            nodes += ' <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a><a class="btn btn-default btn-xs dropdown-toggle" data-bs-toggle="dropdown"><span class="caret"></span></a>'.format(row.biblio_id, row.item_id, _("Edit"));
781
                            nodes += ' <ul class="dropdown-menu pull-right">';
783
                            nodes += ' <ul class="dropdown-menu pull-right">';
782
                            nodes += '  <li><a class="dropdown-item" href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=%s&amp;filetype=image"><i class="fa fa-upload"></i> %s</a></li>'.format(row.item_id, _("Upload image"));
784
                            [% IF show_local_covers_link %]
785
                                nodes += '  <li><a class="dropdown-item" href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=%s&amp;filetype=image"><i class="fa fa-upload"></i> %s</a></li>'.format(row.item_id, _("Upload image"));
786
                            [% END %]
787
                            [% IF show_itemcallnumber_link %]
788
                                nodes += '  <li><a class="dropdown-item populate-callnumber-item" href="#" data-itemnumber="%s" data-biblionumber="%s" data-toggle="tooltip" data-placement="left" title="Populate call number for this item."><i class="fa fa-bars"></i> %s</a></li>'.format(row.item_id, row.biblio_id, _("Populate call number"));
789
                            [% END %]
783
                            nodes += ' </ul>';
790
                            nodes += ' </ul>';
784
                            nodes += '</div>';
791
                            nodes += '</div>';
785
                        [% ELSE %]
792
                        [% ELSE %]
(-)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 catalog details page to populate empty item call numbers 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/js/catalog.js (-1 / +44 lines)
Lines 118-123 $(document).ready(function() { Link Here
118
    });
118
    });
119
    $("#export").remove(); // Hide embedded export form if JS menus available
119
    $("#export").remove(); // Hide embedded export form if JS menus available
120
120
121
    $("#populate-callnumbers-biblio")
122
        .on('click', function() {
123
            if ( confirm(__('Are you sure you want to populate call numbers for all items without a callnumber on this record?')) ) {
124
                const biblionumber = $(this).data('biblionumber');
125
                $.post( `/api/v1/rpc/biblios/${biblionumber}/items/populate_empty_callnumbers`, function( data ) {
126
                    const items_updated = data.modified_item_ids;
127
                    const callnumber = data.callnumber;
128
                    let msg = "";
129
                    if( items_updated ){
130
                        msg += __('Items populated with the call number "%s": %s').format(callnumber, items_updated);
131
                    } else {
132
                        msg += __('No ttems were updated');
133
                    }
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
    $("body")
148
        .on('click','.populate-callnumber-item', function() {
149
            if ( confirm(__('Are you sure you want to populate the call number for this item?')) ) {
150
                const biblionumber = $(this).data('biblionumber');
151
                const itemnumber  = $(this).data('itemnumber');
152
                const button = $(this);
153
                $.post( `/api/v1/rpc/biblios/${biblionumber}/items/${itemnumber}/populate_empty_callnumbers`, function( data ) {
154
                    const callnumber = data.callnumber;
155
                    let msg = __('Item populated with the call number "%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
121
    $(".addtolist").on("click", function (e) {
165
    $(".addtolist").on("click", function (e) {
122
        e.preventDefault();
166
        e.preventDefault();
123
        var shelfnumber = $(this).data("shelfnumber");
167
        var shelfnumber = $(this).data("shelfnumber");
124
- 

Return to bug 34784