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

(-)a/acqui/orderreceive.pl (-32 / +14 lines)
Lines 170-208 if ( $suggestion ) { Link Here
170
}
170
}
171
171
172
my $patron = Koha::Patrons->find( $loggedinuser )->unblessed;
172
my $patron = Koha::Patrons->find( $loggedinuser )->unblessed;
173
my @budget_loop;
173
my $budget_loop = [];
174
my $periods = GetBudgetPeriods( );
174
my $budgets = GetBudgetHierarchy( undef, undef, undef, 1 );
175
foreach my $period (@$periods) {
175
foreach my $r (@{$budgets}) {
176
    if ($period->{'budget_period_id'} == $budget->{'budget_period_id'}) {
176
    next unless (CanUserUseBudget($patron, $r, $userflags));
177
        $template->{'VARS'}->{'budget_period_description'} = $period->{'budget_period_description'};
177
    push @{$budget_loop}, {
178
    }
178
        b_id  => $r->{budget_id},
179
    next if $period->{'budget_period_locked'} || !$period->{'budget_period_description'};
179
        b_txt => $r->{budget_name},
180
    my $budget_hierarchy = GetBudgetHierarchy( $period->{'budget_period_id'}, undef, undef, 1 );
180
        b_sort1_authcat => $r->{'sort1_authcat'},
181
    my @funds;
181
        b_sort2_authcat => $r->{'sort2_authcat'},
182
    foreach my $r ( @{$budget_hierarchy} ) {
182
        b_active => $r->{budget_period_active},
183
        next unless ( CanUserUseBudget( $patron, $r, $userflags ) );
183
        b_sel => ( $r->{budget_id} == $order->budget_id ) ? 1 : 0,
184
        if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
184
        b_level => $r->{budget_level},
185
            next;
185
    };
186
        }
187
        push @funds,
188
          {
189
            b_id  => $r->{budget_id},
190
            b_txt => $r->{budget_name},
191
            b_sel => ( $r->{budget_id} == $order->budget_id ) ? 1 : 0,
192
          };
193
    }
194
195
    @funds = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @funds;
196
197
    push @budget_loop,
198
      {
199
        'id'          => $period->{'budget_period_id'},
200
        'description' => $period->{'budget_period_description'},
201
        'funds'       => \@funds
202
      };
203
}
186
}
204
187
$template->{'VARS'}->{'budget_loop'} = $budget_loop;
205
$template->{'VARS'}->{'budget_loop'} = \@budget_loop;
206
188
207
my $op = $input->param('op');
189
my $op = $input->param('op');
208
if ($op and $op eq 'edit'){
190
if ($op and $op eq 'edit'){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-13 / +50 lines)
Lines 280-299 Link Here
280
                <input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | html %]" class="flatpickr" />
280
                <input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | html %]" class="flatpickr" />
281
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
281
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
282
            </li>
282
            </li>
283
       <li><label for="bookfund">Fund: </label><select id="bookfund" name="bookfund">
283
       <li>
284
            <option value="">Keep current ([% budget_period_description | html %] - [% order.fund.budget_name | html %])</option>
284
            <label class="required" for="bookfund">Fund: </label>
285
            [% FOREACH period IN budget_loop %]
285
            [% active_count = 0 %]
286
                <optgroup label="[% period.description | html %]">
286
            [% IF !ordernumber %]
287
                [% FOREACH fund IN period.funds %]
287
                [% FOREACH budget_loo IN budget_loop %]
288
                    [% IF ( fund.b_sel ) %]
288
                    [% active_count= active_count + budget_loo.b_active %]
289
                        <option value="[% fund.b_id | html %]" selected="selected">[% fund.b_txt | html %]</option>
289
                [% END %]
290
                    [% ELSE %]
290
            [% END %]
291
                        <option value="[% fund.b_id | html %]">[% fund.b_txt | html %]</option>
291
            <select class="select2" id="bookfund" name="bookfund">
292
                    [% END %]
292
            [% FOREACH budget_loo IN budget_loop %]
293
               [% level_indent_cnt = 0 %]
294
                [% level_indent = "" %]
295
                [% WHILE level_indent_cnt < budget_loo.b_level %]
296
                    [% level_indent = level_indent _ " -- " %]
297
                    [% level_indent_cnt = level_indent_cnt +1 %]
298
                [% END %]
299
300
                [% IF ( budget_loo.b_sel ) %]
301
                    [% active_count = 0 #select no other fund %]
302
                    <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
303
                    >
304
                [% ELSIF active_count==1 && budget_loo.b_active %]
305
                    <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
306
                    >
307
                [% ELSE %]
308
                    [% bdgclass=budget_loo.b_active? "": "b_inactive" | html %]
309
                    <option value="[% budget_loo.b_id | html %]" class="[% bdgclass | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
310
                    >
293
                [% END %]
311
                [% END %]
294
                </optgroup>
312
                    [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %]
313
                </option>
295
            [% END %]
314
            [% END %]
296
       </select></li>
315
            </select>
316
            <span class="required">Required</span>
317
            <label for="showallbudgets" style="float:none;">&nbsp;Show inactive:</label>
318
            <input type="checkbox" id="showallbudgets" />
319
       </li>
297
       <li><label>&nbsp;</label><span>(Current: [% budget_period_description | html %] - [% bookfund | html %])</span></li>
320
       <li><label>&nbsp;</label><span>(Current: [% budget_period_description | html %] - [% bookfund | html %])</span></li>
298
       <li>
321
       <li>
299
        <label for="creator">Ordered by: </label>
322
        <label for="creator">Ordered by: </label>
Lines 427-432 Link Here
427
[% INCLUDE 'calendar.inc' %]
450
[% INCLUDE 'calendar.inc' %]
428
    [% Asset.js("js/additem.js") | $raw %]
451
    [% Asset.js("js/additem.js") | $raw %]
429
    [% Asset.js("js/cataloging.js") | $raw %]
452
    [% Asset.js("js/cataloging.js") | $raw %]
453
    [% INCLUDE 'select2.inc' %]
430
    <script>
454
    <script>
431
        function Check(form) {
455
        function Check(form) {
432
            [% IF (AcqCreateItem == 'receiving') %]
456
            [% IF (AcqCreateItem == 'receiving') %]
Lines 521-526 Link Here
521
        [% END %]
545
        [% END %]
522
546
523
        $(document).ready(function() {
547
        $(document).ready(function() {
548
549
            //keep a copy of all budgets before removing the inactives
550
            disabledBudgetsCopy = $('#bookfund').html();
551
            $('#bookfund .b_inactive').remove();
552
553
            $('#showallbudgets').click(function() {
554
                if ($(this).is(":checked")) {
555
                    $('#bookfund').html(disabledBudgetsCopy); //Puts back all the funds
556
                }
557
                else {
558
                    $('#bookfund .b_inactive').remove();
559
                }
560
            });
561
524
            [% IF (AcqCreateItem == 'receiving') %]
562
            [% IF (AcqCreateItem == 'receiving') %]
525
                cloneItemBlock(0, '[% Koha.Preference('UniqueItemFields') | html %]');
563
                cloneItemBlock(0, '[% Koha.Preference('UniqueItemFields') | html %]');
526
            [% ELSIF (AcqCreateItem == 'ordering') && not order.subscriptionid %]
564
            [% ELSIF (AcqCreateItem == 'ordering') && not order.subscriptionid %]
527
- 

Return to bug 31459