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

(-)a/acqui/addorderiso2709.pl (-13 / +16 lines)
Lines 400-424 my $patron = Koha::Patrons->find( $loggedinuser )->unblessed; Link Here
400
my $budget = GetBudget($budget_id);
400
my $budget = GetBudget($budget_id);
401
401
402
# build budget list
402
# build budget list
403
my $budget_loop = [];
403
my %budget_loops;
404
my $budgets_hierarchy = GetBudgetHierarchy;
404
my $budgets_hierarchy = GetBudgetHierarchy;
405
foreach my $r ( @{$budgets_hierarchy} ) {
405
foreach my $r ( @{$budgets_hierarchy} ) {
406
    next unless (CanUserUseBudget($patron, $r, $userflags));
406
    next unless ( CanUserUseBudget( $patron, $r, $userflags ) );
407
    push @{$budget_loop},
407
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
408
      { b_id  => $r->{budget_id},
408
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
409
        b_txt => $r->{budget_name},
409
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
410
        b_code => $r->{budget_code},
410
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
411
    }
412
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
413
        b_id            => $r->{budget_id},
414
        b_txt           => $r->{budget_name},
415
        b_code          => $r->{budget_code},
411
        b_sort1_authcat => $r->{'sort1_authcat'},
416
        b_sort1_authcat => $r->{'sort1_authcat'},
412
        b_sort2_authcat => $r->{'sort2_authcat'},
417
        b_sort2_authcat => $r->{'sort2_authcat'},
413
        b_active => $r->{budget_period_active},
418
        b_active        => $r->{budget_period_active},
414
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
419
        b_sel           => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
415
      };
420
        b_level         => $r->{budget_level},
421
    };
416
}
422
}
417
423
418
@{$budget_loop} =
424
$template->param( budget_loop => \%budget_loops );
419
  sort { uc( $a->{b_txt}) cmp uc( $b->{b_txt}) } @{$budget_loop};
420
421
$template->param( budget_loop    => $budget_loop,);
422
425
423
output_html_with_http_headers $input, $cookie, $template->output;
426
output_html_with_http_headers $input, $cookie, $template->output;
424
427
(-)a/acqui/duplicate_orders.pl (-12 / +14 lines)
Lines 102-129 elsif ( $op eq 'cud-batch_edit' ) { Link Here
102
    @ordernumbers = $input->multi_param('ordernumber');
102
    @ordernumbers = $input->multi_param('ordernumber');
103
103
104
    # build budget list
104
    # build budget list
105
    my $budget_loop       = [];
105
    my %budget_loops;
106
    my $budgets_hierarchy = GetBudgetHierarchy;
106
    my $budgets = GetBudgetHierarchy;
107
    foreach my $r ( @{$budgets_hierarchy} ) {
107
    foreach my $r ( @{$budgets} ) {
108
        next
108
        next unless ( CanUserUseBudget( $patron, $r, $userflags ) );
109
          unless ( C4::Budgets::CanUserUseBudget( $patron, $r, $userflags ) );
109
        unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
110
110
            $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
111
        push @{$budget_loop},
111
            $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
112
          {
112
            $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
113
        }
114
        push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
113
            b_id            => $r->{budget_id},
115
            b_id            => $r->{budget_id},
114
            b_txt           => $r->{budget_name},
116
            b_txt           => $r->{budget_name},
115
            b_code          => $r->{budget_code},
117
            b_code          => $r->{budget_code},
116
            b_sort1_authcat => $r->{'sort1_authcat'},
118
            b_sort1_authcat => $r->{'sort1_authcat'},
117
            b_sort2_authcat => $r->{'sort2_authcat'},
119
            b_sort2_authcat => $r->{'sort2_authcat'},
118
            b_active        => $r->{budget_period_active},
120
            b_active        => $r->{budget_period_active},
119
          };
121
            b_sel           => ( $r->{budget_id} == scalar $input->param('budget') ) ? 1 : 0,
122
            b_level         => $r->{budget_level},
123
        };
120
    }
124
    }
121
    @{$budget_loop} =
122
      sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
123
125
124
    $template->param(
126
    $template->param(
125
        currencies  => Koha::Acquisition::Currencies->search,
127
        currencies  => Koha::Acquisition::Currencies->search,
126
        budget_loop => $budget_loop,
128
        budget_loop => \%budget_loops,
127
    );
129
    );
128
}
130
}
129
elsif ( $op eq 'cud-do_duplicate' ) {
131
elsif ( $op eq 'cud-do_duplicate' ) {
(-)a/acqui/invoice.pl (-16 / +16 lines)
Lines 293-319 push @foot_loop, map {$_} values %foot; Link Here
293
my $shipmentcost_budgetid = $details->{shipmentcost_budgetid};
293
my $shipmentcost_budgetid = $details->{shipmentcost_budgetid};
294
294
295
# build budget list
295
# build budget list
296
my $budget_loop = [];
296
my %budget_loops;
297
my $budgets     = GetBudgetHierarchy();
297
my $budgets = GetBudgetHierarchy;
298
foreach my $r ( @{$budgets} ) {
298
foreach my $r ( @{$budgets} ) {
299
    next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) );
299
    next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) );
300
300
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
301
    my $selected = $shipmentcost_budgetid ? $r->{budget_id} eq $shipmentcost_budgetid : 0;
301
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
302
302
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
303
    push @{$budget_loop},
303
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
304
      {
304
    }
305
        b_id     => $r->{budget_id},
305
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
306
        b_txt    => $r->{budget_name},
306
        b_id            => $r->{budget_id},
307
        b_active => $r->{budget_period_active},
307
        b_txt           => $r->{budget_name},
308
        selected => $selected,
308
        b_code          => $r->{budget_code},
309
        b_sort1_authcat => $r->{'sort1_authcat'},
309
        b_sort1_authcat => $r->{'sort1_authcat'},
310
        b_sort2_authcat => $r->{'sort2_authcat'},
310
        b_sort2_authcat => $r->{'sort2_authcat'},
311
      };
311
        b_active        => $r->{budget_period_active},
312
        b_sel           => $shipmentcost_budgetid ? $r->{budget_id} eq $shipmentcost_budgetid : 0,
313
        b_level         => $r->{budget_level},
314
    };
312
}
315
}
313
316
314
@{$budget_loop} =
315
  sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
316
317
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({ invoiceid => $details->{'invoiceid'} });
317
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({ invoiceid => $details->{'invoiceid'} });
318
if ( $adjustments ) { $template->param( adjustments => $adjustments ); }
318
if ( $adjustments ) { $template->param( adjustments => $adjustments ); }
319
319
Lines 345-351 $template->param( Link Here
345
    total_tax_included_shipment => $total_tax_included + $shipmentcost,
345
    total_tax_included_shipment => $total_tax_included + $shipmentcost,
346
    invoiceincgst               => $bookseller->invoiceincgst,
346
    invoiceincgst               => $bookseller->invoiceincgst,
347
    currency                    => $active_currency,
347
    currency                    => $active_currency,
348
    budgets                     => $budget_loop,
348
    budget_loop                 => \%budget_loops,
349
    budget                      => GetBudget( $shipmentcost_budgetid ),
349
    budget                      => GetBudget( $shipmentcost_budgetid ),
350
    has_invoice_unitprice       => $has_invoice_unitprice,
350
    has_invoice_unitprice       => $has_invoice_unitprice,
351
);
351
);
(-)a/acqui/neworderempty.pl (-12 / +17 lines)
Lines 333-356 my $active_currency = Koha::Acquisition::Currencies->get_active; Link Here
333
# build bookfund list
333
# build bookfund list
334
my $patron = Koha::Patrons->find( $loggedinuser )->unblessed;
334
my $patron = Koha::Patrons->find( $loggedinuser )->unblessed;
335
335
336
my $budget =  GetBudget($budget_id);
336
my $budget = GetBudget($budget_id);
337
337
# build budget list
338
# build budget list
338
my $budget_loop = [];
339
my %budget_loops;
339
my $budgets = GetBudgetHierarchy;
340
my $budgets = GetBudgetHierarchy;
340
foreach my $r (@{$budgets}) {
341
foreach my $r ( @{$budgets} ) {
341
    next unless (CanUserUseBudget($patron, $r, $userflags));
342
    next unless ( CanUserUseBudget( $patron, $r, $userflags ) );
342
    push @{$budget_loop}, {
343
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
343
        b_id  => $r->{budget_id},
344
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
344
        b_txt => $r->{budget_name},
345
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
346
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
347
    }
348
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
349
        b_id            => $r->{budget_id},
350
        b_txt           => $r->{budget_name},
345
        b_sort1_authcat => $r->{'sort1_authcat'},
351
        b_sort1_authcat => $r->{'sort1_authcat'},
346
        b_sort2_authcat => $r->{'sort2_authcat'},
352
        b_sort2_authcat => $r->{'sort2_authcat'},
347
        b_active => $r->{budget_period_active},
353
        b_active        => $r->{budget_period_active},
348
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
354
        b_sel           => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
349
        b_level => $r->{budget_level},
355
        b_level         => $r->{budget_level},
350
    };
356
    };
351
}
357
}
352
358
353
354
$template->param( sort1 => $data->{'sort1'} );
359
$template->param( sort1 => $data->{'sort1'} );
355
$template->param( sort2 => $data->{'sort2'} );
360
$template->param( sort2 => $data->{'sort2'} );
356
361
Lines 487-493 $template->param( Link Here
487
    author               => $data->{'author'},
492
    author               => $data->{'author'},
488
    publicationyear      => $data->{'publicationyear'} ? $data->{'publicationyear'} : $data->{'copyrightdate'},
493
    publicationyear      => $data->{'publicationyear'} ? $data->{'publicationyear'} : $data->{'copyrightdate'},
489
    editionstatement     => $data->{'editionstatement'},
494
    editionstatement     => $data->{'editionstatement'},
490
    budget_loop          => $budget_loop,
495
    budget_loop          => \%budget_loops,
491
    isbn                 => $data->{'isbn'},
496
    isbn                 => $data->{'isbn'},
492
    ean                  => $data->{'ean'},
497
    ean                  => $data->{'ean'},
493
    seriestitle          => $data->{'seriestitle'},
498
    seriestitle          => $data->{'seriestitle'},
(-)a/acqui/orderreceive.pl (-1 / +1 lines)
Lines 199-205 foreach my $budget (@{$budgets}) { Link Here
199
        b_level => $budget->{budget_level},
199
        b_level => $budget->{budget_level},
200
    };
200
    };
201
}
201
}
202
$template->{'VARS'}->{'budget_loops'} = \%budget_loops;
202
$template->{'VARS'}->{'budget_loop'} = \%budget_loops;
203
203
204
my $op = $input->param('op');
204
my $op = $input->param('op');
205
if ($op and $op eq 'cud-edit'){
205
if ($op and $op eq 'cud-edit'){
(-)a/acqui/parcels.pl (-12 / +18 lines)
Lines 198-218 if ($count_parcels) { Link Here
198
}
198
}
199
199
200
# build budget list
200
# build budget list
201
my $budget_loop = [];
201
my %budget_loops;
202
my $budgets = GetBudgetHierarchy;
202
my $budgets = GetBudgetHierarchy;
203
foreach my $r (@{$budgets}) {
203
foreach my $r ( @{$budgets} ) {
204
    next unless (CanUserUseBudget($loggedinuser, $r, $flags));
204
    next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) );
205
    push @{$budget_loop}, {
205
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
206
        b_id  => $r->{budget_id},
206
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
207
        b_txt => $r->{budget_name},
207
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
208
        b_active => $r->{budget_period_active},
208
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
209
    }
210
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
211
        b_id            => $r->{budget_id},
212
        b_txt           => $r->{budget_name},
213
        b_code          => $r->{budget_code},
214
        b_sort1_authcat => $r->{'sort1_authcat'},
215
        b_sort2_authcat => $r->{'sort2_authcat'},
216
        b_active        => $r->{budget_period_active},
217
        b_sel           => ( $r->{budget_id} == $shipmentcost_budgetid ) ? 1 : 0,
218
        b_level         => $r->{budget_level},
209
    };
219
    };
210
}
220
}
211
221
212
@{$budget_loop} =
213
  sort { uc( $a->{b_txt}) cmp uc( $b->{b_txt}) } @{$budget_loop};
214
215
216
$template->param(
222
$template->param(
217
    orderby                  => $order,
223
    orderby                  => $order,
218
    filter                   => $code,
224
    filter                   => $code,
Lines 223-229 $template->param( Link Here
223
    shipmentdate_today       => dt_from_string,
229
    shipmentdate_today       => dt_from_string,
224
    booksellerid             => $booksellerid,
230
    booksellerid             => $booksellerid,
225
    GST                      => C4::Context->preference('TaxRates'),
231
    GST                      => C4::Context->preference('TaxRates'),
226
    budgets                  => $budget_loop,
232
    budget_loop              => \%budget_loops,
227
);
233
);
228
234
229
output_html_with_http_headers $input, $cookie, $template->output;
235
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/budgets_loop.inc (+28 lines)
Line 0 Link Here
1
[% FOREACH budget_period_id IN budget_loop.keys %]
2
    [% SET budget_period = budget_loop.$budget_period_id %]
3
    [% IF budget_period.active %]
4
        <optgroup label="[% budget_period.description | html %]">
5
    [% ELSE %]
6
        <optgroup class="[% inactive_class | html %]" label="[% budget_period.description | html %] (Inactive)">
7
    [% END %]
8
    [% FOREACH budget_loo IN budget_period.funds %]
9
        [% level_indent_cnt = 0 %]
10
        [% level_indent = "" %]
11
        [% WHILE level_indent_cnt < budget_loo.b_level %]
12
            [% level_indent = level_indent _ " -- " %]
13
            [% level_indent_cnt = level_indent_cnt +1 %]
14
        [% END %]
15
        [% IF ( budget_loo.b_sel ) %]
16
            [% active_count = 0 #select no other fund %]
17
                <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 %]">
18
            [% ELSIF active_count==1 && budget_loo.b_active %]
19
                <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 %]">
20
            [% ELSE %]
21
                [% bdgclass=budget_loo.b_active? "": inactive_class | html %]
22
                <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 %]">
23
            [% END %]
24
            [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %]
25
            </option>
26
        [% END %]
27
    </optgroup>
28
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-35 / +3 lines)
Lines 213-231 Link Here
213
                                                                        <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
213
                                                                        <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
214
                                                                        <select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id_[% biblio.import_record_id | html %]">
214
                                                                        <select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id_[% biblio.import_record_id | html %]">
215
                                                                            <option value="">Select a fund (will use default if set)</option>
215
                                                                            <option value="">Select a fund (will use default if set)</option>
216
                                                                            [% FOREACH budget IN budget_loop %]
216
                                                                            [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
217
                                                                                [% IF ( budget.b_id == biblio.budget_id ) %]
218
                                                                                [% IF budget.b_active %]
219
                                                                                    <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]" selected="selected">[% budget.b_txt | html %]</option>
220
                                                                                [% ELSE %]
221
                                                                                <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]" selected="selected">[% budget.b_txt | html %] (inactive)</option>
222
                                                                            [% END %]
223
                                                                            [% ELSE %]
224
                                                                                [% IF budget.b_active %]<option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %]</option>
225
                                                                                [% ELSE %]<option value="[% budget.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %] (inactive)</option>
226
                                                                                [% END %]
227
                                                                                [% END %]
228
                                                                            [% END %]
229
                                                                        </select>
217
                                                                        </select>
230
                                                                        <span class="required" style="display:none">Required</span>
218
                                                                        <span class="required" style="display:none">Required</span>
231
                                                                    [% END %]
219
                                                                    [% END %]
Lines 345-365 Link Here
345
                                                                                    <label for="budget_code_item_[% item.item_id | html %]">budget_code</label>
333
                                                                                    <label for="budget_code_item_[% item.item_id | html %]">budget_code</label>
346
                                                                                    <select class="budget_code_item bci_all" id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% biblio.import_record_id | html %]" hidden="hidden" disabled="disabled">
334
                                                                                    <select class="budget_code_item bci_all" id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% biblio.import_record_id | html %]" hidden="hidden" disabled="disabled">
347
                                                                                        <option value="">Select a fund (will use default if set)</option>
335
                                                                                        <option value="">Select a fund (will use default if set)</option>
348
                                                                                        [% FOREACH budget_loo IN budget_loop %]
336
                                                                                        [% INCLUDE 'budgets_loop.inc' inactive_class = "budget_item_inactive" %]
349
                                                                                            [% IF ( budget_loo.b_active ) %]
350
                                                                                                [% IF ( budget_loo.b_id ) == ( item.budget_id ) %]
351
                                                                                                    <option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
352
                                                                                                [% ELSE %]
353
                                                                                                    <option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
354
                                                                                                [% END %]
355
                                                                                            [% ELSE %]
356
                                                                                                [% IF ( budget_loo.b_id ) == ( item.budget_id ) %]
357
                                                                                                <option value="[% budget_loo.b_id | html %]" class="buget_item_inactive" selected="selected">[% budget_loo.b_txt | html %] (inactive)</option>
358
                                                                                                [% ELSE %]
359
                                                                                                <option value="[% budget_loo.b_id | html %]" class="budget_item_inactive">[% budget_loo.b_txt | html %] (inactive)</option>
360
                                                                                                [% END %]
361
                                                                                            [% END %]
362
                                                                                        [% END %]
363
                                                                                    </select>
337
                                                                                    </select>
364
                                                                                    <span class="item_fund required">Required</span>
338
                                                                                    <span class="item_fund required">Required</span>
365
                                                                                </li>
339
                                                                                </li>
Lines 506-518 Link Here
506
                                                    <label for="all_budget_id">Fund: </label>
480
                                                    <label for="all_budget_id">Fund: </label>
507
                                                    <select id="all_budget_id" name="all_budget_id">
481
                                                    <select id="all_budget_id" name="all_budget_id">
508
                                                        <option value="">Select a fund (will populate orders/items if set)</option>
482
                                                        <option value="">Select a fund (will populate orders/items if set)</option>
509
                                                        [% FOREACH budget_loo IN budget_loop %]
483
                                                        [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
510
                                                            [% IF ( budget_loo.b_active ) %]
511
                                                                <option value="[% budget_loo.b_id | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %]</option>
512
                                                            [% ELSE %]
513
                                                                <option value="[% budget_loo.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %] (inactive)</option>
514
                                                            [% END %]
515
                                                        [% END %]
516
                                                    </select>
484
                                                    </select>
517
                                                    <label for="all_showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive:</label>
485
                                                    <label for="all_showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive:</label>
518
                                                    <input type="checkbox" id="all_showallbudgets" />
486
                                                    <input type="checkbox" id="all_showallbudgets" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt (-5 / +1 lines)
Lines 211-221 Link Here
211
                  <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" />
211
                  <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" />
212
                  <select id="all_budget_id" name="all_budget_id">
212
                  <select id="all_budget_id" name="all_budget_id">
213
                    <option value="">Select a fund</option>
213
                    <option value="">Select a fund</option>
214
                  [% FOREACH budget_loo IN budget_loop %]
214
                    [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
215
                      [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %]</option>
216
                      [% ELSE %]<option value="[% budget_loo.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %] (inactive)</option>
217
                      [% END %]
218
                  [% END %]
219
                  </select>
215
                  </select>
220
                  <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;">&nbsp;Show inactive:</label>
216
                  <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;">&nbsp;Show inactive:</label>
221
                  <input type="checkbox" id="all_showallbudgets" />
217
                  <input type="checkbox" id="all_showallbudgets" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt (-8 / +2 lines)
Lines 10-16 Link Here
10
    <select id="[% form_id | html %]" name="[% form_name | html %]" class="fund_dropdown" data-selected="[% selected | html %]">
10
    <select id="[% form_id | html %]" name="[% form_name | html %]" class="fund_dropdown" data-selected="[% selected | html %]">
11
    </select>
11
    </select>
12
    <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
12
    <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
13
    <input type="checkbox" class="showallfunds" />
13
    <input type="checkbox" class="showallfunds" id="showallfunds" />
14
[% END %]
14
[% END %]
15
15
16
[% INCLUDE 'doc-head-open.inc' %]
16
[% INCLUDE 'doc-head-open.inc' %]
Lines 528-540 Link Here
528
528
529
<span style="display:none;" id="all_fund_dropdown">
529
<span style="display:none;" id="all_fund_dropdown">
530
    <option value="">No fund</option>
530
    <option value="">No fund</option>
531
    [% FOREACH budget IN budgets %]
531
    [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
532
        [% IF ( budget.b_active ) %]
533
            <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %]</option>
534
        [% ELSE %]
535
            <option value="[% budget.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat |html %]">[% budget.b_txt | html %] (inactive)</option>
536
        [% END %]
537
    [% END # /FOREACH budget %]
538
</span> <!-- /#all_fund_dropdown -->
532
</span> <!-- /#all_fund_dropdown -->
539
533
540
[% MACRO jsinclude BLOCK %]
534
[% MACRO jsinclude BLOCK %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-30 / +1 lines)
Lines 592-628 Link Here
592
            </li>
592
            </li>
593
            <li>
593
            <li>
594
                <label class="required" for="budget_id">Fund: </label>
594
                <label class="required" for="budget_id">Fund: </label>
595
                [% active_count = 0 %]
596
                [% IF !ordernumber %]
597
                    [% FOREACH budget_loo IN budget_loop %]
598
                        [% active_count= active_count + budget_loo.b_active %]
599
                    [% END %]
600
                [% END %]
601
                <select class="select2" id="budget_id" name="budget_id">
595
                <select class="select2" id="budget_id" name="budget_id">
602
                    <option value="">Select a fund</option>
596
                    [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
603
                [% FOREACH budget_loo IN budget_loop %]
604
                   [% level_indent_cnt = 0 %]
605
                    [% level_indent = "" %]
606
                    [% WHILE level_indent_cnt < budget_loo.b_level %]
607
                        [% level_indent = level_indent _ " -- " %]
608
                        [% level_indent_cnt = level_indent_cnt +1 %]
609
                    [% END %]
610
611
                    [% IF ( budget_loo.b_sel ) %]
612
                        [% active_count = 0 #select no other fund %]
613
                        <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 %]"
614
                        >
615
                    [% ELSIF active_count==1 && budget_loo.b_active %]
616
                        <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 %]"
617
                        >
618
                    [% ELSE %]
619
                        [% bdgclass=budget_loo.b_active? "": "b_inactive" | html %]
620
                        <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 %]"
621
                        >
622
                    [% END %]
623
                        [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %]
624
                    </option>
625
                [% END %]
626
                </select>
597
                </select>
627
                <span class="required">Required</span>
598
                <span class="required">Required</span>
628
                <label for="showallbudgets" style="float:none;">&nbsp;Show inactive:</label>
599
                <label for="showallbudgets" style="float:none;">&nbsp;Show inactive:</label>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-29 / +1 lines)
Lines 291-325 Link Here
291
                                                <optgroup label="Current">
291
                                                <optgroup label="Current">
292
                                                    <option id="selected_bookfund" selected="selected"></option>
292
                                                    <option id="selected_bookfund" selected="selected"></option>
293
                                                </optgroup>
293
                                                </optgroup>
294
                                            [% FOREACH budget_period_id IN budget_loops.keys %]
294
                                                [% INCLUDE 'budgets_loop.inc' inactive_class = "inactive_budget" %]
295
                                                [% SET budget_period = budget_loops.$budget_period_id %]
296
                                                [% IF budget_period.active %]
297
                                                    <optgroup label="[% budget_period.description | html %]">
298
                                                [% ELSE %]
299
                                                    <optgroup class="inactive_budget" label="[% budget_period.description | html %] (Inactive)">
300
                                                [% END %]
301
                                                [% FOREACH budget_loo IN budget_period.funds %]
302
                                                [% level_indent_cnt = 0 %]
303
                                                    [% level_indent = "" %]
304
                                                    [% WHILE level_indent_cnt < budget_loo.b_level %]
305
                                                        [% level_indent = level_indent _ " -- " %]
306
                                                        [% level_indent_cnt = level_indent_cnt +1 %]
307
                                                    [% END %]
308
309
                                                    [% IF ( budget_loo.b_sel ) %]
310
                                                        [% active_count = 0 #select no other fund %]
311
                                                        <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 %]">
312
                                                    [% ELSIF active_count==1 && budget_loo.b_active %]
313
                                                        <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 %]">
314
                                                    [% ELSE %]
315
                                                        [% bdgclass=budget_loo.b_active? "": "inactive_budget" | html %]
316
                                                        <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 %]">
317
                                                    [% END %]
318
                                                        [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %]
319
                                                    </option>
320
                                                [% END %]
321
                                                </optgroup>
322
                                            [% END %]
323
                                            </select>
295
                                            </select>
324
                                            <span class="required">Required</span>
296
                                            <span class="required">Required</span>
325
                                        </li>
297
                                        </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt (-7 / +1 lines)
Lines 179-191 Link Here
179
            <label for="shipmentcost_budgetid">Shipping fund: </label>
179
            <label for="shipmentcost_budgetid">Shipping fund: </label>
180
            <select id="shipmentcost_budgetid" name="shipmentcost_budgetid">
180
            <select id="shipmentcost_budgetid" name="shipmentcost_budgetid">
181
                <option value="">No fund</option>
181
                <option value="">No fund</option>
182
                [% FOREACH budget IN budgets %]
182
                [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
183
                    [% IF ( budget.b_active ) %]
184
                        <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
185
                    [% ELSE %]
186
                        <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option>
187
                    [% END %]
188
                [% END %]
189
            </select>
183
            </select>
190
            <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
184
            <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
191
            <input type="checkbox" id="showallfunds" />
185
            <input type="checkbox" id="showallfunds" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-9 / +1 lines)
Lines 594-608 Link Here
594
                            <label for="budgetid">Fund:</label>
594
                            <label for="budgetid">Fund:</label>
595
                            <select name="budgetid" id="budgetid">
595
                            <select name="budgetid" id="budgetid">
596
                                <option value="">Any</option>
596
                                <option value="">Any</option>
597
                                [% FOREACH budget IN sugg_budgets %]
597
                                [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
598
                                    [% IF ( budget.selected ) %]
599
                                        <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option>
600
                                    [% ELSIF ( budget.b_active ) %]
601
                                        <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
602
                                    [% ELSE %]
603
                                        <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option>
604
                                    [% END %]
605
                                [% END %]
606
                            </select>
598
                            </select>
607
                            <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
599
                            <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
608
                            <input type="checkbox" id="showallfunds" />
600
                            <input type="checkbox" id="showallfunds" />
(-)a/suggestion/suggestion.pl (-13 / +19 lines)
Lines 486-506 foreach my $budget ( @{$budgets} ) { Link Here
486
$template->param( budgetsloop => \@budgets_loop);
486
$template->param( budgetsloop => \@budgets_loop);
487
487
488
# Budgets for suggestion add or edition
488
# Budgets for suggestion add or edition
489
my $sugg_budget_loop = [];
489
my %budget_loops;
490
my $sugg_budgets     = GetBudgetHierarchy();
490
my $sugg_budgets = GetBudgetHierarchy;
491
foreach my $r ( @{$sugg_budgets} ) {
491
foreach my $r ( @{$sugg_budgets} ) {
492
    next unless ( CanUserUseBudget( $borrowernumber, $r, $userflags ) );
492
    next unless ( CanUserUseBudget( $borrowernumber, $r, $userflags ) );
493
    my $selected = ( $$suggestion_ref{budgetid} && $r->{budget_id} eq $$suggestion_ref{budgetid} ) ? 1 : 0;
493
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
494
    push @{$sugg_budget_loop},
494
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
495
      {
495
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
496
        b_id     => $r->{budget_id},
496
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
497
        b_txt    => $r->{budget_name},
497
    }
498
        b_active => $r->{budget_period_active},
498
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
499
        selected => $selected,
499
        b_id            => $r->{budget_id},
500
      };
500
        b_txt           => $r->{budget_name},
501
        b_code          => $r->{budget_code},
502
        b_sort1_authcat => $r->{'sort1_authcat'},
503
        b_sort2_authcat => $r->{'sort2_authcat'},
504
        b_active        => $r->{budget_period_active},
505
        b_sel           => ( $$suggestion_ref{budgetid} && $r->{budget_id} eq $$suggestion_ref{budgetid} ) ? 1 : 0,
506
        b_level         => $r->{budget_level},
507
    };
501
}
508
}
502
@{$sugg_budget_loop} = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$sugg_budget_loop};
509
503
$template->param( sugg_budgets => $sugg_budget_loop);
510
$template->param( budget_loop => \%budget_loops );
504
511
505
if( $suggestion_ref->{STATUS} ) {
512
if( $suggestion_ref->{STATUS} ) {
506
    $template->param(
513
    $template->param(
507
- 

Return to bug 31606