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

(-)a/Koha/Template/Plugin/ItemGroups.pm (+15 lines)
Lines 50-53 sub listGroups { Link Here
50
    );
50
    );
51
}
51
}
52
52
53
=head3 count
54
55
[% ItemGroups.count %]
56
57
returns count of item groups on a particular bibliographic record
58
59
=cut
60
61
sub count {
62
    my ( $self, $biblionumber ) = @_;
63
    return Koha::Biblio::ItemGroups->search(
64
        { biblio_id => $biblionumber },
65
    )->count;
66
}
67
53
1;
68
1;
(-)a/cataloguing/additem.pl (-3 lines)
Lines 752-765 if( my $default_location = C4::Context->preference('NewItemsDefaultLocation') ) Link Here
752
    $location_field->{marc_value}->{value} ||= $default_location;
752
    $location_field->{marc_value}->{value} ||= $default_location;
753
}
753
}
754
754
755
my @ig = Koha::Biblio::ItemGroups->search({ biblio_id => $biblionumber })->as_list();
756
#sort by display order
755
#sort by display order
757
my @sorted_ig = sort { $a->display_order <=> $b->display_order } @ig;
758
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
756
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
759
$template->param(
757
$template->param(
760
    biblio       => $biblio,
758
    biblio       => $biblio,
761
    items        => \@items,
759
    items        => \@items,
762
    item_groups      => \@sorted_ig,
763
    item_header_loop => \@header_value_loop,
760
    item_header_loop => \@header_value_loop,
764
    subfields        => $subfields,
761
    subfields        => $subfields,
765
    itemnumber       => $itemnumber,
762
    itemnumber       => $itemnumber,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-6 / +5 lines)
Lines 4-9 Link Here
4
[% USE Branches %]
4
[% USE Branches %]
5
[% USE KohaDates %]
5
[% USE KohaDates %]
6
[% USE Price %]
6
[% USE Price %]
7
[% USE ItemGroups %]
7
[% USE TablesSettings %]
8
[% USE TablesSettings %]
8
[% PROCESS 'i18n.inc' %]
9
[% PROCESS 'i18n.inc' %]
9
[% INCLUDE 'doc-head-open.inc' %]
10
[% INCLUDE 'doc-head-open.inc' %]
Lines 36-42 Link Here
36
[% INCLUDE 'str/cataloging_additem.inc' %]
37
[% INCLUDE 'str/cataloging_additem.inc' %]
37
[% Asset.js("js/cataloging_additem.js") | $raw %]
38
[% Asset.js("js/cataloging_additem.js") | $raw %]
38
    <script>
39
    <script>
39
        var has_item_groups = "[% item_groups.size | html %]";
40
        var has_item_groups = "[% ItemGroups.count(biblio.biblionumber) | html %]";
40
    </script>
41
    </script>
41
</head>
42
</head>
42
43
Lines 249-266 Link Here
249
    [% IF op != 'add_item' %]
250
    [% IF op != 'add_item' %]
250
        <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
251
        <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
251
    [% END %]
252
    [% END %]
252
253
[% IF ItemGroups.count(biblio.biblionumber) && op != 'saveitem' && CAN_user_editcatalogue_manage_item_groups %]
253
[% IF item_groups.size && op != 'saveitem' && CAN_user_editcatalogue_manage_item_groups %]
254
    <fieldset class="rows">
254
    <fieldset class="rows">
255
        <legend><i class="fa fa-plus"></i> Add to item group</legend>
255
        <legend><i class="fa fa-plus"></i> Add to item group</legend>
256
        [% FOREACH ig IN item_groups %]
256
        [% FOREACH ig IN ItemGroups.listGroups(biblio.biblionumber) %]
257
            <input type="hidden" id="item-group-[% ig.id | html %]" value="[% ig.description | html %]" />
257
            <input type="hidden" id="item-group-[% ig.id | html %]" value="[% ig.description | html %]" />
258
        [% END %]
258
        [% END %]
259
        <p>
259
        <p>
260
            <label for="select_item_group">Options: </label>
260
            <label for="select_item_group">Options: </label>
261
            <select name="item_group" id="item-group-add-or-create-form-select">
261
            <select name="item_group" id="item-group-add-or-create-form-select">
262
                <optgroup label="Use existing item group">
262
                <optgroup label="Use existing item group">
263
                    [% FOREACH ig IN item_groups %]
263
                    [% FOREACH ig IN ItemGroups.listGroups(biblio.biblionumber) %]
264
                        <option value="[% ig.id | html %]">[% ig.description | html %]</option>
264
                        <option value="[% ig.id | html %]">[% ig.description | html %]</option>
265
                    [% END %]
265
                    [% END %]
266
                </optgroup>
266
                </optgroup>
267
- 

Return to bug 34234