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 %]
238
                [% IF volinfo %]
234
                    [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting%]
239
                    [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting%]
Lines 290-295 Note that permanent location is a code, and location may be an authval. Link Here
290
                        </span>
295
                        </span>
291
                    </td>
296
                    </td>
292
                    [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
297
                    [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
298
                    [% IF Koha.Preference('EnableVolumes') %]<td>[% item.object.volume.description | html %]</td>[% END %]
293
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
299
                    <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
294
                    [% IF ( volinfo ) %]
300
                    [% IF ( volinfo ) %]
295
                        <td class="enumchron">
301
                        <td class="enumchron">
Lines 898-904 Note that permanent location is a code, and location may be an authval. Link Here
898
    </div>
904
    </div>
899
</div>
905
</div>
900
906
901
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-create-label">
907
<div class="modal fade" id="modal-volume-delete" tabindex="-1" role="dialog" aria-labelledby="modal-volume-delete-label">
902
    <div class="modal-dialog">
908
    <div class="modal-dialog">
903
        <div class="modal-content">
909
        <div class="modal-content">
904
            <div class="modal-header">
910
            <div class="modal-header">
Lines 916-921 Note that permanent location is a code, and location may be an authval. Link Here
916
    </div>
922
    </div>
917
</div>
923
</div>
918
924
925
<div class="modal fade" id="modal-volume-set" tabindex="-1" role="dialog" aria-labelledby="modal-volume-set-label">
926
    <div class="modal-dialog">
927
        <div class="modal-content">
928
            <div class="modal-header">
929
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
930
                <h3 id="modal-volume-set-label"><i class='fa fa-book'></i> Set volume for items</h3>
931
            </div>
932
            <form id="modal-volume-set-form" class="validated">
933
                <div class="modal-body">
934
                    <fieldset>
935
                        <p>
936
                            <label for="volume" class="required">Volume: </label>
937
                            <select name="volume" id="volume-add-form-select">
938
                                [% FOREACH v IN biblio.volumes %]
939
                                    <option value="[% v.id | html %]">[% v.description | html %]</option>
940
                                [% END %]
941
                            </select>
942
                            <span class="required">Required</span>
943
                        </p>
944
                    </fieldset>
945
                </div>
946
                <div class="modal-footer">
947
                    <button id="modal-volume-set-submit" class="btn btn-default"><i class='fa fa-book'></i> Set volume</button>
948
                    <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
949
                </div>
950
            </form>
951
        </div>
952
    </div>
953
</div>
954
955
<div class="modal fade" id="modal-volume-unset" tabindex="-1" role="dialog" aria-labelledby="modal-volume-unset-label">
956
    <div class="modal-dialog">
957
        <div class="modal-content">
958
            <div class="modal-header">
959
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
960
                <h3 id="modal-volume-unset-label"><i class='fa fa-unlink'></i> Remove item from volume</h3>
961
            </div>
962
            <div class="modal-body">
963
                Are you sure you want to remove these item(s) from their volume(s)?
964
            </div>
965
            <div class="modal-footer">
966
                <button id="modal-volume-unset-submit" class="btn btn-danger"><i class='fa fa-unlink'></i> Remove</button>
967
                <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
968
            </div>
969
        </div>
970
    </div>
971
</div>
972
919
[% MACRO jsinclude BLOCK %]
973
[% MACRO jsinclude BLOCK %]
920
    [% INCLUDE 'catalog-strings.inc' %]
974
    [% INCLUDE 'catalog-strings.inc' %]
921
    [% Asset.js("js/catalog.js") | $raw %]
975
    [% Asset.js("js/catalog.js") | $raw %]
Lines 1352-1357 Note that permanent location is a code, and location may be an authval. Link Here
1352
                    }
1406
                    }
1353
                });
1407
                });
1354
            });
1408
            });
1409
1410
            // Add item(s) to a volume
1411
            $('.itemselection_action_volume_set').on('click', function(){
1412
                $('#modal-volume-set').modal('show');
1413
            });
1414
1415
            $("#modal-volume-set-form").validate({
1416
                submitHandler: function(form) {
1417
                    $('#modal-volume-set-submit').attr('disabled', 'disabled');
1418
1419
                    const volume_id = $('#volume-add-form-select').val();
1420
1421
                    let itemnumbers = new Array();
1422
                    $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
1423
                        const itemnumber = $(this).val();
1424
                        itemnumbers.push( itemnumber );
1425
                    });
1426
                    if (itemnumbers.length > 0) {
1427
                        let url = '/cgi-bin/koha/catalogue/detail.pl?op=set_volume';
1428
                        url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1429
                        url += '&biblionumber=[% biblionumber | uri %]';
1430
                        url += `&volume_id=${volume_id}`;
1431
1432
                        window.location.replace(url);
1433
                    }
1434
1435
                    $('#modal-volume-set').modal('hide');
1436
                }
1437
            });
1438
1439
            // Remove item(s) from a volume
1440
            $('.itemselection_action_volume_unset').on('click', function(){
1441
                $('#modal-volume-unset').modal('show');
1442
            });
1443
1444
            $("#modal-volume-unset-submit").on('click', function(){
1445
                $('#modal-volume-unset-submit').attr('disabled', 'disabled');
1446
1447
                let itemnumbers = new Array();
1448
                $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
1449
                    const itemnumber = $(this).val();
1450
                    itemnumbers.push( itemnumber );
1451
                });
1452
                if (itemnumbers.length > 0) {
1453
                    let url = '/cgi-bin/koha/catalogue/detail.pl?op=unset_volume';
1454
                    url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
1455
                    url += '&biblionumber=[% biblionumber | uri %]';
1456
1457
                    window.location.replace(url);
1458
                }
1459
1460
                $('#modal-volume-unset').modal('hide');
1461
            });
1355
        [% END %]
1462
        [% END %]
1356
    </script>
1463
    </script>
1357
[% END %]
1464
[% END %]
1358
- 

Return to bug 24857