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 115-120 if ( not defined $record ) { Link Here
115
eval { $biblio->metadata->record };
118
eval { $biblio->metadata->record };
116
$template->param( decoding_error => $@ );
119
$template->param( decoding_error => $@ );
117
120
121
my $op = $query->param('op') || q{};
122
if ( $op eq 'set_volume' ) {
123
    my $volume_id   = $query->param('volume_id');
124
    my @itemnumbers = $query->multi_param('itemnumber');
125
126
    foreach my $itemnumber (@itemnumbers) {
127
        my $volume_item =
128
          Koha::Biblio::Volume::Items->find( { itemnumber => $itemnumber } );
129
130
        if ($volume_item) {
131
            $volume_item->volume_id($volume_id);
132
        }
133
        else {
134
            $volume_item = Koha::Biblio::Volume::Item->new(
135
                {
136
                    itemnumber => $itemnumber,
137
                    volume_id  => $volume_id,
138
                }
139
            );
140
        }
141
142
        $volume_item->store();
143
    }
144
}
145
elsif ( $op eq 'unset_volume' ) {
146
    my $volume_id   = $query->param('volume_id');
147
    my @itemnumbers = $query->multi_param('itemnumber');
148
149
    foreach my $itemnumber (@itemnumbers) {
150
        my $volume_item =
151
          Koha::Biblio::Volume::Items->find( { itemnumber => $itemnumber } );
152
        $volume_item->delete() if $volume_item;
153
    }
154
}
155
118
if($query->cookie("holdfor")){ 
156
if($query->cookie("holdfor")){ 
119
    my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") );
157
    my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") );
120
    $template->param(
158
    $template->param(
Lines 320-325 foreach my $item (@items) { Link Here
320
358
321
    # checking for holds
359
    # checking for holds
322
    my $item_object = Koha::Items->find( $item->{itemnumber} );
360
    my $item_object = Koha::Items->find( $item->{itemnumber} );
361
    $item->{object} = $item_object;
323
    my $holds = $item_object->current_holds;
362
    my $holds = $item_object->current_holds;
324
    if ( my $first_hold = $holds->next ) {
363
    if ( my $first_hold = $holds->next ) {
325
        $item->{first_hold} = $first_hold;
364
        $item->{first_hold} = $first_hold;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +108 lines)
Lines 218-223 Link Here
218
              [% IF CAN_user_tools_items_batchmod %]
218
              [% IF CAN_user_tools_items_batchmod %]
219
                <a class="itemselection_action_modify"><i class="fa fa-pencil"></i> Modify selected items</a>
219
                <a class="itemselection_action_modify"><i class="fa fa-pencil"></i> Modify selected items</a>
220
              [% END %]
220
              [% END %]
221
              [% IF biblio.volumes.count %]
222
                <a class="itemselection_action_volume_set" href="#"><i class="fa fa-book"></i> Add/move to volume</a>
223
                <a class="itemselection_action_volume_unset" href="#"><i class="fa fa-unlink"></i> Remove from volume</a>
224
              [% END %]
221
            </span>
225
            </span>
222
        [% END %]
226
        [% END %]
223
    </div>
227
    </div>
Lines 229-234 Link Here
229
                <th>Current location</th>
233
                <th>Current location</th>
230
                <th>Home library</th>
234
                <th>Home library</th>
231
                [% IF ( itemdata_ccode ) %]<th>Collection</th>[% END %]
235
                [% IF ( itemdata_ccode ) %]<th>Collection</th>[% END %]
236
                [% IF Koha.Preference('EnableVolumes') %]<th>Volume</th>[% END %]
232
                <th>Call number</th>
237
                <th>Call number</th>
233
                [% IF ( volinfo ) %]<th>Serial enumeration / chronology</th>[% END %]
238
                [% IF ( volinfo ) %]<th>Serial enumeration / chronology</th>[% END %]
234
                <th>Status</th>
239
                <th>Status</th>
Lines 284-289 Note that permanent location is a code, and location may be an authval. Link Here
284
                        </span>
289
                        </span>
285
                    </td>
290
                    </td>
286
                    [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
291
                    [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
292
                    [% IF Koha.Preference('EnableVolumes') %]<td>[% item.object.volume.description | html %]</td>[% END %]
287
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
293
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
288
                    [% IF ( volinfo ) %]
294
                    [% IF ( volinfo ) %]
289
                        <td class="enumchron">
295
                        <td class="enumchron">
Lines 886-892 Note that permanent location is a code, and location may be an authval. Link Here
886
    </div>
892
    </div>
887
</div>
893
</div>
888
894
889
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label">
895
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-delete-label">
890
    <div class="modal-dialog">
896
    <div class="modal-dialog">
891
        <div class="modal-content">
897
        <div class="modal-content">
892
            <div class="modal-header">
898
            <div class="modal-header">
Lines 904-909 Note that permanent location is a code, and location may be an authval. Link Here
904
    </div>
910
    </div>
905
</div>
911
</div>
906
912
913
<div class="modal fade" id="modal-volume-set" tabindex="-1" role="dialog" aria-labelledby="modal-volume-set-label">
914
    <div class="modal-dialog">
915
        <div class="modal-content">
916
            <div class="modal-header">
917
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
918
                <h3 id="modal-volume-set-label"><i class='fa fa-book'></i> Set volume for items</h3>
919
            </div>
920
            <form id="modal-volume-set-form" class="validated">
921
                <div class="modal-body">
922
                    <fieldset>
923
                        <p>
924
                            <label for="volume" class="required">Volume: </label>
925
                            <select name="volume" id="volume-add-form-select">
926
                                [% FOREACH v IN biblio.volumes %]
927
                                    <option value="[% v.id | html %]">[% v.description | html %]</option>
928
                                [% END %]
929
                            </select>
930
                            <span class="required">Required</span>
931
                        </p>
932
                    </fieldset>
933
                </div>
934
                <div class="modal-footer">
935
                    <button id="modal-volume-set-submit" class="btn btn-default"><i class='fa fa-book'></i> Set volume</button>
936
                    <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
937
                </div>
938
            </form>
939
        </div>
940
    </div>
941
</div>
942
943
<div class="modal fade" id="modal-volume-unset" tabindex="-1" role="dialog" aria-labelledby="modal-volume-unset-label">
944
    <div class="modal-dialog">
945
        <div class="modal-content">
946
            <div class="modal-header">
947
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
948
                <h3 id="modal-volume-unset-label"><i class='fa fa-unlink'></i> Remove item from volume</h3>
949
            </div>
950
            <div class="modal-body">
951
                Are you sure you want to remove these item(s) from their volume(s)?
952
            </div>
953
            <div class="modal-footer">
954
                <button id="modal-volume-unset-submit" class="btn btn-danger"><i class='fa fa-unlink'></i> Remove</button>
955
                <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
956
            </div>
957
        </div>
958
    </div>
959
</div>
960
907
[% MACRO jsinclude BLOCK %]
961
[% MACRO jsinclude BLOCK %]
908
    [% INCLUDE 'catalog-strings.inc' %]
962
    [% INCLUDE 'catalog-strings.inc' %]
909
    [% Asset.js("js/catalog.js") | $raw %]
963
    [% Asset.js("js/catalog.js") | $raw %]
Lines 1325-1330 Note that permanent location is a code, and location may be an authval. Link Here
1325
                    alert(message);
1379
                    alert(message);
1326
                });
1380
                });
1327
            });
1381
            });
1382
1383
            // Add item(s) to a volume
1384
            $('.itemselection_action_volume_set').on('click', function(){
1385
                $('#modal-volume-set').modal('show'); 
1386
            });
1387
1388
            $("#modal-volume-set-form").validate({
1389
                submitHandler: function(form) {
1390
                    $('#modal-volume-set-submit').attr('disabled', 'disabled');
1391
1392
                    const volume_id = $('#volume-add-form-select').val();
1393
1394
                    let itemnumbers = new Array();
1395
                    $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
1396
                        const itemnumber = $(this).val();
1397
                        itemnumbers.push( itemnumber );
1398
                    });
1399
                    if (itemnumbers.length > 0) {
1400
                        let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_volume';
1401
                        url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1402
                        url += '&biblionumber=[% biblionumber | uri %]';
1403
                        url += `&volume_id=${volume_id}`;
1404
1405
                        window.location.replace(url);
1406
                    }
1407
1408
                    $('#modal-volume-set').modal('hide'); 
1409
                }
1410
            });
1411
1412
            // Remove item(s) from a volume
1413
            $('.itemselection_action_volume_unset').on('click', function(){
1414
                $('#modal-volume-unset').modal('show'); 
1415
            });
1416
1417
            $("#modal-volume-unset-submit").on('click', function(){
1418
                $('#modal-volume-unset-submit').attr('disabled', 'disabled');
1419
1420
                let itemnumbers = new Array();
1421
                $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
1422
                    const itemnumber = $(this).val();
1423
                    itemnumbers.push( itemnumber );
1424
                });
1425
                if (itemnumbers.length > 0) {
1426
                    let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_volume';
1427
                    url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1428
                    url += '&biblionumber=[% biblionumber | uri %]';
1429
1430
                    window.location.replace(url);
1431
                }
1432
1433
                $('#modal-volume-unset').modal('hide'); 
1434
            });
1328
        [% END %]
1435
        [% END %]
1329
    </script>
1436
    </script>
1330
[% END %]
1437
[% END %]
1331
- 

Return to bug 24857