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

(-)a/Koha/Biblio.pm (-1 / +2 lines)
Lines 37-49 use Koha::ArticleRequest::Status; Link Here
37
use Koha::ArticleRequests;
37
use Koha::ArticleRequests;
38
use Koha::Biblio::Metadatas;
38
use Koha::Biblio::Metadatas;
39
use Koha::Biblio::Volumes;
39
use Koha::Biblio::Volumes;
40
use Koha::Biblio::Volumes;
40
use Koha::Biblioitems;
41
use Koha::Biblioitems;
41
use Koha::CirculationRules;
42
use Koha::CirculationRules;
42
use Koha::Item::Transfer::Limits;
43
use Koha::Item::Transfer::Limits;
43
use Koha::Items;
44
use Koha::Items;
44
use Koha::Libraries;
45
use Koha::Libraries;
45
use Koha::Suggestions;
46
use Koha::Subscriptions;
46
use Koha::Subscriptions;
47
use Koha::Suggestions;
47
48
48
=head1 NAME
49
=head1 NAME
49
50
(-)a/catalogue/detail.pl (-14 / +53 lines)
Lines 21-53 use Modern::Perl; Link Here
21
use CGI qw ( -utf8 );
21
use CGI qw ( -utf8 );
22
use HTML::Entities;
22
use HTML::Entities;
23
use Try::Tiny;
23
use Try::Tiny;
24
25
use C4::Acquisition qw(GetOrdersByBiblionumber);
24
use C4::Auth;
26
use C4::Auth;
27
use C4::Biblio;
28
use C4::Circulation;
25
use C4::Context;
29
use C4::Context;
30
use C4::CourseReserves qw(GetItemCourseReservesInfo);
31
use C4::External::Amazon;
32
use C4::HTML5Media;
33
use C4::Images;
34
use C4::Items;
26
use C4::Koha;
35
use C4::Koha;
27
use C4::Serials;    #uses getsubscriptionfrom biblionumber
28
use C4::Output;
36
use C4::Output;
29
use C4::Biblio;
30
use C4::Items;
31
use C4::Circulation;
32
use C4::Reserves;
37
use C4::Reserves;
33
use C4::Serials;
34
use C4::XISBN qw(get_xisbns);
35
use C4::External::Amazon;
36
use C4::Search;        # enabled_staff_search_views
38
use C4::Search;        # enabled_staff_search_views
39
use C4::Serials;
40
use C4::Serials;    #uses getsubscriptionfrom biblionumber
37
use C4::Tags qw(get_tags);
41
use C4::Tags qw(get_tags);
42
use C4::XISBN qw(get_xisbns);
38
use C4::XSLT;
43
use C4::XSLT;
39
use C4::Images;
44
40
use Koha::DateUtils;
41
use C4::HTML5Media;
42
use C4::CourseReserves qw(GetItemCourseReservesInfo);
43
use C4::Acquisition qw(GetOrdersByBiblionumber);
44
use Koha::AuthorisedValues;
45
use Koha::AuthorisedValues;
46
use Koha::Biblio::Volume::Items;
45
use Koha::Biblios;
47
use Koha::Biblios;
46
use Koha::Items;
48
use Koha::DateUtils;
47
use Koha::ItemTypes;
49
use Koha::ItemTypes;
50
use Koha::Items;
48
use Koha::Patrons;
51
use Koha::Patrons;
49
use Koha::Virtualshelves;
50
use Koha::Plugins;
52
use Koha::Plugins;
53
use Koha::Virtualshelves;
51
54
52
my $query = CGI->new();
55
my $query = CGI->new();
53
56
Lines 114-119 if ( not defined $record ) { Link Here
114
eval { $biblio->metadata->record };
117
eval { $biblio->metadata->record };
115
$template->param( decoding_error => $@ );
118
$template->param( decoding_error => $@ );
116
119
120
my $op = $query->param('op') || q{};
121
if ( $op eq 'set_volume' ) {
122
    my $volume_id   = $query->param('volume_id');
123
    my @itemnumbers = $query->multi_param('itemnumber');
124
125
    foreach my $itemnumber (@itemnumbers) {
126
        my $volume_item =
127
          Koha::Biblio::Volume::Items->find( { itemnumber => $itemnumber } );
128
129
        if ($volume_item) {
130
            $volume_item->volume_id($volume_id);
131
        }
132
        else {
133
            $volume_item = Koha::Biblio::Volume::Item->new(
134
                {
135
                    itemnumber => $itemnumber,
136
                    volume_id  => $volume_id,
137
                }
138
            );
139
        }
140
141
        $volume_item->store();
142
    }
143
}
144
elsif ( $op eq 'unset_volume' ) {
145
    my $volume_id   = $query->param('volume_id');
146
    my @itemnumbers = $query->multi_param('itemnumber');
147
148
    foreach my $itemnumber (@itemnumbers) {
149
        my $volume_item =
150
          Koha::Biblio::Volume::Items->find( { itemnumber => $itemnumber } );
151
        $volume_item->delete() if $volume_item;
152
    }
153
}
154
117
if($query->cookie("holdfor")){ 
155
if($query->cookie("holdfor")){ 
118
    my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") );
156
    my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") );
119
    $template->param(
157
    $template->param(
Lines 333-338 foreach my $item (@items) { Link Here
333
371
334
    # checking for holds
372
    # checking for holds
335
    my $item_object = Koha::Items->find( $item->{itemnumber} );
373
    my $item_object = Koha::Items->find( $item->{itemnumber} );
374
    $item->{object} = $item_object;
336
    my $holds = $item_object->current_holds;
375
    my $holds = $item_object->current_holds;
337
    if ( my $first_hold = $holds->next ) {
376
    if ( my $first_hold = $holds->next ) {
338
        $item->{first_hold} = $first_hold;
377
        $item->{first_hold} = $first_hold;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +108 lines)
Lines 220-225 Link Here
220
              [% IF CAN_user_tools_items_batchmod %]
220
              [% IF CAN_user_tools_items_batchmod %]
221
                <a class="itemselection_action_modify"><i class="fa fa-pencil"></i> Modify selected items</a>
221
                <a class="itemselection_action_modify"><i class="fa fa-pencil"></i> Modify selected items</a>
222
              [% END %]
222
              [% END %]
223
              [% IF biblio.volumes.count %]
224
                <a class="itemselection_action_volume_set" href="#"><i class="fa fa-book"></i> Add/move to volume</a>
225
                <a class="itemselection_action_volume_unset" href="#"><i class="fa fa-unlink"></i> Remove from volume</a>
226
              [% END %]
223
            </span>
227
            </span>
224
        [% END %]
228
        [% END %]
225
    </div>
229
    </div>
Lines 231-236 Link Here
231
                <th id="[% tab | html %]_holdingbranch" data-colname="[% tab | html %]_holdingbranch">Current location</th>
235
                <th id="[% tab | html %]_holdingbranch" data-colname="[% tab | html %]_holdingbranch">Current location</th>
232
                <th id="[% tab | html %]_homebranch" data-colname="[% tab | html %]_homebranch">Home library</th>
236
                <th id="[% tab | html %]_homebranch" data-colname="[% tab | html %]_homebranch">Home library</th>
233
                [% IF ( itemdata_ccode ) %]<th id="[% tab | html %]_ccode" data-colname="[% tab | html %]_ccode">Collection</th>[% END %]
237
                [% IF ( itemdata_ccode ) %]<th id="[% tab | html %]_ccode" data-colname="[% tab | html %]_ccode">Collection</th>[% END %]
238
                [% IF Koha.Preference('EnableVolumes') %]<th>Volume</th>[% END %]
234
                <th id="[% tab | html %]_itemcallnumber" data-colname="[% tab | html %]_itemcallnumber">Call number</th>
239
                <th id="[% tab | html %]_itemcallnumber" data-colname="[% tab | html %]_itemcallnumber">Call number</th>
235
                [% IF volinfo %]
240
                [% IF volinfo %]
236
                [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting%]
241
                [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting%]
Lines 292-297 Note that permanent location is a code, and location may be an authval. Link Here
292
                        </span>
297
                        </span>
293
                    </td>
298
                    </td>
294
                    [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
299
                    [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
300
                    [% IF Koha.Preference('EnableVolumes') %]<td>[% item.object.volume.description | html %]</td>[% END %]
295
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
301
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
296
                    [% IF ( volinfo ) %]
302
                    [% IF ( volinfo ) %]
297
                        <td class="enumchron">
303
                        <td class="enumchron">
Lines 974-980 Note that permanent location is a code, and location may be an authval. Link Here
974
    </div>
980
    </div>
975
</div>
981
</div>
976
982
977
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label">
983
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-delete-label">
978
    <div class="modal-dialog">
984
    <div class="modal-dialog">
979
        <div class="modal-content">
985
        <div class="modal-content">
980
            <div class="modal-header">
986
            <div class="modal-header">
Lines 992-997 Note that permanent location is a code, and location may be an authval. Link Here
992
    </div>
998
    </div>
993
</div>
999
</div>
994
1000
1001
<div class="modal fade" id="modal-volume-set" tabindex="-1" role="dialog" aria-labelledby="modal-volume-set-label">
1002
    <div class="modal-dialog">
1003
        <div class="modal-content">
1004
            <div class="modal-header">
1005
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1006
                <h3 id="modal-volume-set-label"><i class='fa fa-book'></i> Set volume for items</h3>
1007
            </div>
1008
            <form id="modal-volume-set-form" class="validated">
1009
                <div class="modal-body">
1010
                    <fieldset>
1011
                        <p>
1012
                            <label for="volume" class="required">Volume: </label>
1013
                            <select name="volume" id="volume-add-form-select">
1014
                                [% FOREACH v IN biblio.volumes %]
1015
                                    <option value="[% v.id | html %]">[% v.description | html %]</option>
1016
                                [% END %]
1017
                            </select>
1018
                            <span class="required">Required</span>
1019
                        </p>
1020
                    </fieldset>
1021
                </div>
1022
                <div class="modal-footer">
1023
                    <button id="modal-volume-set-submit" class="btn btn-default"><i class='fa fa-book'></i> Set volume</button>
1024
                    <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1025
                </div>
1026
            </form>
1027
        </div>
1028
    </div>
1029
</div>
1030
1031
<div class="modal fade" id="modal-volume-unset" tabindex="-1" role="dialog" aria-labelledby="modal-volume-unset-label">
1032
    <div class="modal-dialog">
1033
        <div class="modal-content">
1034
            <div class="modal-header">
1035
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1036
                <h3 id="modal-volume-unset-label"><i class='fa fa-unlink'></i> Remove item from volume</h3>
1037
            </div>
1038
            <div class="modal-body">
1039
                Are you sure you want to remove these item(s) from their volume(s)?
1040
            </div>
1041
            <div class="modal-footer">
1042
                <button id="modal-volume-unset-submit" class="btn btn-danger"><i class='fa fa-unlink'></i> Remove</button>
1043
                <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
1044
            </div>
1045
        </div>
1046
    </div>
1047
</div>
1048
995
[% MACRO jsinclude BLOCK %]
1049
[% MACRO jsinclude BLOCK %]
996
    [% INCLUDE 'catalog-strings.inc' %]
1050
    [% INCLUDE 'catalog-strings.inc' %]
997
    [% Asset.js("js/catalog.js") | $raw %]
1051
    [% Asset.js("js/catalog.js") | $raw %]
Lines 1441-1446 Note that permanent location is a code, and location may be an authval. Link Here
1441
                    }
1495
                    }
1442
                });
1496
                });
1443
            });
1497
            });
1498
1499
            // Add item(s) to a volume
1500
            $('.itemselection_action_volume_set').on('click', function(){
1501
                $('#modal-volume-set').modal('show');
1502
            });
1503
1504
            $("#modal-volume-set-form").validate({
1505
                submitHandler: function(form) {
1506
                    $('#modal-volume-set-submit').attr('disabled', 'disabled');
1507
1508
                    const volume_id = $('#volume-add-form-select').val();
1509
1510
                    let itemnumbers = new Array();
1511
                    $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
1512
                        const itemnumber = $(this).val();
1513
                        itemnumbers.push( itemnumber );
1514
                    });
1515
                    if (itemnumbers.length > 0) {
1516
                        let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_volume';
1517
                        url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1518
                        url += '&biblionumber=[% biblionumber | uri %]';
1519
                        url += `&volume_id=${volume_id}`;
1520
1521
                        window.location.replace(url);
1522
                    }
1523
1524
                    $('#modal-volume-set').modal('hide');
1525
                }
1526
            });
1527
1528
            // Remove item(s) from a volume
1529
            $('.itemselection_action_volume_unset').on('click', function(){
1530
                $('#modal-volume-unset').modal('show');
1531
            });
1532
1533
            $("#modal-volume-unset-submit").on('click', function(){
1534
                $('#modal-volume-unset-submit').attr('disabled', 'disabled');
1535
1536
                let itemnumbers = new Array();
1537
                $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
1538
                    const itemnumber = $(this).val();
1539
                    itemnumbers.push( itemnumber );
1540
                });
1541
                if (itemnumbers.length > 0) {
1542
                    let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_volume';
1543
                    url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1544
                    url += '&biblionumber=[% biblionumber | uri %]';
1545
1546
                    window.location.replace(url);
1547
                }
1548
1549
                $('#modal-volume-unset').modal('hide');
1550
            });
1444
        [% END %]
1551
        [% END %]
1445
    </script>
1552
    </script>
1446
[% END %]
1553
[% END %]
1447
- 

Return to bug 24857