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

(-)a/acqui/addorderiso2709.pl (-8 / +10 lines)
Lines 314-325 my $patron = Koha::Patrons->find($loggedinuser)->unblessed; Link Here
314
my $budget = GetBudget($budget_id);
314
my $budget = GetBudget($budget_id);
315
315
316
# build budget list
316
# build budget list
317
my $budget_loop       = [];
317
my %budget_loops;
318
my $budgets_hierarchy = GetBudgetHierarchy;
318
my $budgets_hierarchy = GetBudgetHierarchy;
319
foreach my $r ( @{$budgets_hierarchy} ) {
319
foreach my $r ( @{$budgets_hierarchy} ) {
320
    next unless ( CanUserUseBudget( $patron, $r, $userflags ) );
320
    next unless ( CanUserUseBudget( $patron, $r, $userflags ) );
321
    push @{$budget_loop},
321
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
322
        {
322
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
323
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
324
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
325
    }
326
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
323
        b_id            => $r->{budget_id},
327
        b_id            => $r->{budget_id},
324
        b_txt           => $r->{budget_name},
328
        b_txt           => $r->{budget_name},
325
        b_code          => $r->{budget_code},
329
        b_code          => $r->{budget_code},
Lines 327-338 foreach my $r ( @{$budgets_hierarchy} ) { Link Here
327
        b_sort2_authcat => $r->{'sort2_authcat'},
331
        b_sort2_authcat => $r->{'sort2_authcat'},
328
        b_active        => $r->{budget_period_active},
332
        b_active        => $r->{budget_period_active},
329
        b_sel           => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
333
        b_sel           => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
330
        };
334
        b_level         => $r->{budget_level},
335
    };
331
}
336
}
332
337
333
@{$budget_loop} =
338
$template->param( budget_loop => \%budget_loops );
334
    sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
335
336
$template->param( budget_loop => $budget_loop, );
337
339
338
output_html_with_http_headers $input, $cookie, $template->output;
340
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/duplicate_orders.pl (-12 / +14 lines)
Lines 102-129 if ( $op eq 'select' ) { 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
} elsif ( $op eq 'cud-do_duplicate' ) {
130
} elsif ( $op eq 'cud-do_duplicate' ) {
129
    my @fields_to_copy = $input->multi_param('copy_existing_value');
131
    my @fields_to_copy = $input->multi_param('copy_existing_value');
(-)a/acqui/invoice.pl (-13 / +14 lines)
Lines 287-313 push @foot_loop, map { $_ } values %foot; Link Here
287
my $shipmentcost_budgetid = $details->{shipmentcost_budgetid};
287
my $shipmentcost_budgetid = $details->{shipmentcost_budgetid};
288
288
289
# build budget list
289
# build budget list
290
my $budget_loop = [];
290
my %budget_loops;
291
my $budgets     = GetBudgetHierarchy();
291
my $budgets = GetBudgetHierarchy;
292
foreach my $r ( @{$budgets} ) {
292
foreach my $r ( @{$budgets} ) {
293
    next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) );
293
    next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) );
294
294
295
    my $selected = $shipmentcost_budgetid ? $r->{budget_id} eq $shipmentcost_budgetid : 0;
295
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
296
296
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
297
    push @{$budget_loop},
297
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
298
        {
298
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
299
    }
300
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
299
        b_id            => $r->{budget_id},
301
        b_id            => $r->{budget_id},
300
        b_txt           => $r->{budget_name},
302
        b_txt           => $r->{budget_name},
301
        b_active        => $r->{budget_period_active},
303
        b_code          => $r->{budget_code},
302
        selected        => $selected,
303
        b_sort1_authcat => $r->{'sort1_authcat'},
304
        b_sort1_authcat => $r->{'sort1_authcat'},
304
        b_sort2_authcat => $r->{'sort2_authcat'},
305
        b_sort2_authcat => $r->{'sort2_authcat'},
305
        };
306
        b_active        => $r->{budget_period_active},
307
        b_sel           => $shipmentcost_budgetid ? $r->{budget_id} eq $shipmentcost_budgetid : 0,
308
        b_level         => $r->{budget_level},
309
    };
306
}
310
}
307
311
308
@{$budget_loop} =
309
    sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
310
311
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search( { invoiceid => $details->{'invoiceid'} } );
312
my $adjustments = Koha::Acquisition::Invoice::Adjustments->search( { invoiceid => $details->{'invoiceid'} } );
312
if ($adjustments) { $template->param( adjustments => $adjustments ); }
313
if ($adjustments) { $template->param( adjustments => $adjustments ); }
313
314
Lines 337-343 $template->param( Link Here
337
    total_tax_included_shipment => $total_tax_included + $shipmentcost,
338
    total_tax_included_shipment => $total_tax_included + $shipmentcost,
338
    invoiceincgst               => $bookseller->invoiceincgst,
339
    invoiceincgst               => $bookseller->invoiceincgst,
339
    currency                    => $active_currency,
340
    currency                    => $active_currency,
340
    budgets                     => $budget_loop,
341
    budget_loop                 => \%budget_loops,
341
    budget                      => GetBudget($shipmentcost_budgetid),
342
    budget                      => GetBudget($shipmentcost_budgetid),
342
    has_invoice_unitprice       => $has_invoice_unitprice,
343
    has_invoice_unitprice       => $has_invoice_unitprice,
343
);
344
);
(-)a/acqui/neworderempty.pl (-4 / +9 lines)
Lines 333-343 my $patron = Koha::Patrons->find($loggedinuser)->unblessed; Link Here
333
my $budget = GetBudget($budget_id);
333
my $budget = GetBudget($budget_id);
334
334
335
# build budget list
335
# build budget list
336
my $budget_loop = [];
336
my %budget_loops;
337
my $budgets     = GetBudgetHierarchy;
337
my $budgets = GetBudgetHierarchy;
338
foreach my $r ( @{$budgets} ) {
338
foreach my $r ( @{$budgets} ) {
339
    next unless ( CanUserUseBudget( $patron, $r, $userflags ) );
339
    next unless ( CanUserUseBudget( $patron, $r, $userflags ) );
340
    push @{$budget_loop}, {
340
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
341
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
342
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
343
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
344
    }
345
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
341
        b_id            => $r->{budget_id},
346
        b_id            => $r->{budget_id},
342
        b_txt           => $r->{budget_name},
347
        b_txt           => $r->{budget_name},
343
        b_sort1_authcat => $r->{'sort1_authcat'},
348
        b_sort1_authcat => $r->{'sort1_authcat'},
Lines 484-490 $template->param( Link Here
484
    author               => $data->{'author'},
489
    author               => $data->{'author'},
485
    publicationyear      => $data->{'publicationyear'} ? $data->{'publicationyear'} : $data->{'copyrightdate'},
490
    publicationyear      => $data->{'publicationyear'} ? $data->{'publicationyear'} : $data->{'copyrightdate'},
486
    editionstatement     => $data->{'editionstatement'},
491
    editionstatement     => $data->{'editionstatement'},
487
    budget_loop          => $budget_loop,
492
    budget_loop          => \%budget_loops,
488
    isbn                 => $data->{'isbn'},
493
    isbn                 => $data->{'isbn'},
489
    ean                  => $data->{'ean'},
494
    ean                  => $data->{'ean'},
490
    seriestitle          => $data->{'seriestitle'},
495
    seriestitle          => $data->{'seriestitle'},
(-)a/acqui/orderreceive.pl (-1 / +1 lines)
Lines 197-203 foreach my $budget ( @{$budgets} ) { Link Here
197
        b_level         => $budget->{budget_level},
197
        b_level         => $budget->{budget_level},
198
    };
198
    };
199
}
199
}
200
$template->{'VARS'}->{'budget_loops'} = \%budget_loops;
200
$template->{'VARS'}->{'budget_loop'} = \%budget_loops;
201
201
202
my $op = $input->param('op');
202
my $op = $input->param('op');
203
if ( $op and $op eq 'cud-edit' ) {
203
if ( $op and $op eq 'cud-edit' ) {
(-)a/acqui/parcels.pl (-10 / +17 lines)
Lines 204-223 if ($count_parcels) { Link Here
204
}
204
}
205
205
206
# build budget list
206
# build budget list
207
my $budget_loop = [];
207
my %budget_loops;
208
my $budgets     = GetBudgetHierarchy;
208
my $budgets = GetBudgetHierarchy;
209
foreach my $r ( @{$budgets} ) {
209
foreach my $r ( @{$budgets} ) {
210
    next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) );
210
    next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) );
211
    push @{$budget_loop}, {
211
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
212
        b_id     => $r->{budget_id},
212
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
213
        b_txt    => $r->{budget_name},
213
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
214
        b_active => $r->{budget_period_active},
214
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
215
    }
216
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
217
        b_id            => $r->{budget_id},
218
        b_txt           => $r->{budget_name},
219
        b_code          => $r->{budget_code},
220
        b_sort1_authcat => $r->{'sort1_authcat'},
221
        b_sort2_authcat => $r->{'sort2_authcat'},
222
        b_active        => $r->{budget_period_active},
223
        b_sel           => ( $r->{budget_id} == $shipmentcost_budgetid ) ? 1 : 0,
224
        b_level         => $r->{budget_level},
215
    };
225
    };
216
}
226
}
217
227
218
@{$budget_loop} =
219
    sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop};
220
221
$template->param(
228
$template->param(
222
    orderby               => $order,
229
    orderby               => $order,
223
    filter                => $code,
230
    filter                => $code,
Lines 229-235 $template->param( Link Here
229
    shipmentdate_today    => dt_from_string,
236
    shipmentdate_today    => dt_from_string,
230
    booksellerid          => $booksellerid,
237
    booksellerid          => $booksellerid,
231
    GST                   => C4::Context->preference('TaxRates'),
238
    GST                   => C4::Context->preference('TaxRates'),
232
    budgets               => $budget_loop,
239
    budgets               => \%budget_loops,
233
);
240
);
234
241
235
output_html_with_http_headers $input, $cookie, $template->output;
242
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
    <optgroup class="[% UNLESS budget_period.active %][% inactive_class | html %][% END %]" label="[% budget_period.description | html %][% UNLESS budget_period.active %](Inactive)[% END %]">
4
        [% FOREACH budget_loo IN budget_period.funds %]
5
            [% level_indent_cnt = 0 %]
6
            [% level_indent = "" %]
7
            [% WHILE level_indent_cnt < budget_loo.b_level %]
8
                [% level_indent = level_indent _ " -- " %]
9
                [% level_indent_cnt = level_indent_cnt +1 %]
10
            [% END %]
11
            [% IF ( budget_loo.b_sel ) %]
12
                [% active_count = 0 #select no other fund %]
13
                <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 %]">
14
                    [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %]
15
                </option>
16
            [% ELSIF active_count==1 && budget_loo.b_active %]
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
                    [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %]
19
                </option>
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
                    [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %]
24
                </option>
25
            [% END %]
26
        [% END %]
27
    </optgroup>
28
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-65 / +39 lines)
Lines 179-184 Link Here
179
                                                                    [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %]
179
                                                                    [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %]
180
                                                                        <span>Match found</span>
180
                                                                        <span>Match found</span>
181
                                                                    [% ELSE %]
181
                                                                    [% ELSE %]
182
<<<<<<< HEAD
182
                                                                        [% biblio_lis.overlay_status | html %]
183
                                                                        [% biblio_lis.overlay_status | html %]
183
                                                                    [% END %]
184
                                                                    [% END %]
184
                                                                    [% IF ( biblio.match_biblionumber ) %]
185
                                                                    [% IF ( biblio.match_biblionumber ) %]
Lines 239-279 Link Here
239
                                                                    <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
240
                                                                    <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
240
                                                                    <select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id_[% biblio.import_record_id | html %]">
241
                                                                    <select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id_[% biblio.import_record_id | html %]">
241
                                                                        <option value="">Select a fund (will use default if set)</option>
242
                                                                        <option value="">Select a fund (will use default if set)</option>
242
                                                                        [% FOREACH budget IN budget_loop %]
243
                                                                        [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
243
                                                                            [% IF ( budget.b_id == biblio.budget_id ) %]
244
                                                                                [% IF budget.b_active %]
245
                                                                                    <option
246
                                                                                        value="[% budget.b_id | html %]"
247
                                                                                        data-sort1-authcat="[% budget.b_sort1_authcat | html %]"
248
                                                                                        data-sort2-authcat="[% budget.b_sort2_authcat | html %]"
249
                                                                                        selected="selected"
250
                                                                                        >[% budget.b_txt | html %]</option
251
                                                                                    >
252
                                                                                [% ELSE %]
253
                                                                                    <option
254
                                                                                        value="[% budget.b_id | html %]"
255
                                                                                        data-sort1-authcat="[% budget.b_sort1_authcat | html %]"
256
                                                                                        data-sort2-authcat="[% budget.b_sort2_authcat | html %]"
257
                                                                                        selected="selected"
258
                                                                                        >[% budget.b_txt | html %] (inactive)</option
259
                                                                                    >
260
                                                                                [% END %]
261
                                                                            [% ELSE %]
262
                                                                                [% IF budget.b_active %]
263
                                                                                    <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]"
264
                                                                                        >[% budget.b_txt | html %]</option
265
                                                                                    >
266
                                                                                [% ELSE %]
267
                                                                                    <option
268
                                                                                        value="[% budget.b_id | html %]"
269
                                                                                        class="b_inactive"
270
                                                                                        data-sort1-authcat="[% budget.b_sort1_authcat | html %]"
271
                                                                                        data-sort2-authcat="[% budget.b_sort2_authcat | html %]"
272
                                                                                        >[% budget.b_txt | html %] (inactive)</option
273
                                                                                    >
274
                                                                                [% END %]
275
                                                                            [% END %]
276
                                                                        [% END %]
277
                                                                    </select>
244
                                                                    </select>
278
                                                                    <span class="required" style="display:none">Required</span>
245
                                                                    <span class="required" style="display:none">Required</span>
279
                                                                [% END %]
246
                                                                [% END %]
Lines 302-307 Link Here
302
                                                                                            <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
269
                                                                                            <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
303
                                                                                        [% ELSE %]
270
                                                                                        [% ELSE %]
304
                                                                                            <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
271
                                                                                            <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
272
=======
273
                                                                        <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
274
                                                                        <select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id_[% biblio.import_record_id | html %]">
275
                                                                            <option value="">Select a fund (will use default if set)</option>
276
                                                                            [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
277
                                                                        </select>
278
                                                                        <span class="required" style="display:none">Required</span>
279
                                                                    [% END %]
280
                                                                </li>
281
                                                                <li class="sort1">
282
                                                                    <label for="sort1_record_[% biblio.import_record_id | html %]">Statistic 1: </label>
283
                                                                    <input id="sort1_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort1_[% biblio.import_record_id | html %]" value="[% biblio.sort1 | html %]" />
284
                                                                </li>
285
                                                                <li class="sort2">
286
                                                                    <label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label>
287
                                                                    <input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2_[% biblio.import_record_id | html %]" value="[% biblio.sort2 | html %]" />
288
                                                                </li>
289
                                                            </ol>
290
                                                            [% IF ( biblio.iteminfos.size ) %]
291
                                                                <div class="item_edit_form">
292
                                                                    [% IF biblio.item_error %]Item records could not be processed because the number of item fields was uneven.[% END %]
293
                                                                    [% FOREACH item IN biblio.iteminfos %]
294
                                                                        <fieldset class="rows">
295
                                                                            <legend>Item record [% item.item_id | html %]</legend>
296
                                                                            <ol>
297
                                                                                <li>
298
                                                                                    <label for="homebranch_item_[% item.item_id | html %]">homebranch</label>
299
                                                                                    <select id="homebranch_item_[% item.item_id | html %]" name="homebranch_[% biblio.import_record_id | html %]">
300
                                                                                        [% FOREACH l IN libraries %]
301
                                                                                            [% IF l.branchcode == item.homebranch %]
302
                                                                                                <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
303
                                                                                            [% ELSE %]
304
                                                                                                <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
305
                                                                                            [% END %]
306
>>>>>>> Bug 31606: Make acquisitions fund dropdown consistently show budget name
305
                                                                                        [% END %]
307
                                                                                        [% END %]
306
                                                                                    [% END %]
308
                                                                                    [% END %]
307
                                                                                </select>
309
                                                                                </select>
Lines 409-429 Link Here
409
                                                                                    disabled="disabled"
411
                                                                                    disabled="disabled"
410
                                                                                >
412
                                                                                >
411
                                                                                    <option value="">Select a fund (will use default if set)</option>
413
                                                                                    <option value="">Select a fund (will use default if set)</option>
412
                                                                                    [% FOREACH budget_loo IN budget_loop %]
414
                                                                                    [% INCLUDE 'budgets_loop.inc' inactive_class = "budget_item_inactive" %]
413
                                                                                        [% IF ( budget_loo.b_active ) %]
414
                                                                                            [% IF ( budget_loo.b_id ) == ( item.budget_id ) %]
415
                                                                                                <option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
416
                                                                                            [% ELSE %]
417
                                                                                                <option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
418
                                                                                            [% END %]
419
                                                                                        [% ELSE %]
420
                                                                                            [% IF ( budget_loo.b_id ) == ( item.budget_id ) %]
421
                                                                                                <option value="[% budget_loo.b_id | html %]" class="buget_item_inactive" selected="selected">[% budget_loo.b_txt | html %] (inactive)</option>
422
                                                                                            [% ELSE %]
423
                                                                                                <option value="[% budget_loo.b_id | html %]" class="budget_item_inactive">[% budget_loo.b_txt | html %] (inactive)</option>
424
                                                                                            [% END %]
425
                                                                                        [% END %]
426
                                                                                    [% END %]
427
                                                                                </select>
415
                                                                                </select>
428
                                                                                <span class="item_fund required">Required</span>
416
                                                                                <span class="item_fund required">Required</span>
429
                                                                            </li>
417
                                                                            </li>
Lines 602-622 Link Here
602
                                                <label for="all_budget_id">Fund: </label>
590
                                                <label for="all_budget_id">Fund: </label>
603
                                                <select id="all_budget_id" name="all_budget_id">
591
                                                <select id="all_budget_id" name="all_budget_id">
604
                                                    <option value="">Select a fund (will populate orders/items if set)</option>
592
                                                    <option value="">Select a fund (will populate orders/items if set)</option>
605
                                                    [% FOREACH budget_loo IN budget_loop %]
593
                                                    [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
606
                                                        [% IF ( budget_loo.b_active ) %]
607
                                                            <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 %]"
608
                                                                >[% budget_loo.b_txt | html %]</option
609
                                                            >
610
                                                        [% ELSE %]
611
                                                            <option
612
                                                                value="[% budget_loo.b_id | html %]"
613
                                                                class="b_inactive"
614
                                                                data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]"
615
                                                                data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
616
                                                                >[% budget_loo.b_txt | html %] (inactive)</option
617
                                                            >
618
                                                        [% END %]
619
                                                    [% END %]
620
                                                </select>
594
                                                </select>
621
                                                <label for="all_showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive:</label>
595
                                                <label for="all_showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive:</label>
622
                                                <input type="checkbox" id="all_showallbudgets" />
596
                                                <input type="checkbox" id="all_showallbudgets" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt (-11 / +1 lines)
Lines 215-231 Link Here
215
                            <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" />
215
                            <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" />
216
                            <select id="all_budget_id" name="all_budget_id">
216
                            <select id="all_budget_id" name="all_budget_id">
217
                                <option value="">Select a fund</option>
217
                                <option value="">Select a fund</option>
218
                                [% FOREACH budget_loo IN budget_loop %]
218
                                [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
219
                                    [% IF ( budget_loo.b_active ) %]
220
                                        <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 %]"
221
                                            >[% budget_loo.b_txt | html %]</option
222
                                        >
223
                                    [% ELSE %]
224
                                        <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 %]"
225
                                            >[% budget_loo.b_txt | html %] (inactive)</option
226
                                        >
227
                                    [% END %]
228
                                [% END %]
229
                            </select>
219
                            </select>
230
                            <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;">&nbsp;Show inactive:</label>
220
                            <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;">&nbsp;Show inactive:</label>
231
                            <input type="checkbox" id="all_showallbudgets" />
221
                            <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 %]"> </select>
10
    <select id="[% form_id | html %]" name="[% form_name | html %]" class="fund_dropdown" data-selected="[% selected | html %]"> </select>
11
    <label style="float:none;width:auto;"
11
    <label style="float:none;width:auto;"
12
        >&nbsp;Show inactive:
12
        >&nbsp;Show inactive:
13
        <input type="checkbox" data-select-id="[% form_id | html %]" class="showallfunds" />
13
        <input type="checkbox" data-select-id="[% form_id | html %]" class="showallfunds" id="showallfunds" />
14
    </label>
14
    </label>
15
[% END %]
15
[% END %]
16
16
Lines 527-539 Link Here
527
<div style="display:none;">
527
<div style="display:none;">
528
    <select id="all_fund_dropdown">
528
    <select id="all_fund_dropdown">
529
        <option value="">No fund</option>
529
        <option value="">No fund</option>
530
        [% FOREACH budget IN budgets %]
530
        [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
531
            [% IF ( budget.b_active ) %]
532
                <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>
533
            [% ELSE %]
534
                <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>
535
            [% END %]
536
        [% END # /FOREACH budget %]
537
    </select>
531
    </select>
538
</div>
532
</div>
539
<!-- /#all_fund_dropdown -->
533
<!-- /#all_fund_dropdown -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-28 / +1 lines)
Lines 584-618 Link Here
584
                </li>
584
                </li>
585
                <li>
585
                <li>
586
                    <label class="required" for="budget_id">Fund: </label>
586
                    <label class="required" for="budget_id">Fund: </label>
587
                    [% active_count = 0 %]
588
                    [% IF !ordernumber %]
589
                        [% FOREACH budget_loo IN budget_loop %]
590
                            [% active_count= active_count + budget_loo.b_active %]
591
                        [% END %]
592
                    [% END %]
593
                    <select class="select2" id="budget_id" name="budget_id">
587
                    <select class="select2" id="budget_id" name="budget_id">
594
                        <option value="">Select a fund</option>
588
                        [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
595
                        [% FOREACH budget_loo IN budget_loop %]
596
                            [% level_indent_cnt = 0 %]
597
                            [% level_indent = "" %]
598
                            [% WHILE level_indent_cnt < budget_loo.b_level %]
599
                                [% level_indent = level_indent _ " -- " %]
600
                                [% level_indent_cnt = level_indent_cnt +1 %]
601
                            [% END %]
602
603
                            [% SET bdgclass = "" %]
604
                            [% IF ( budget_loo.b_sel ) %]
605
                                [% active_count = 0 #select no other fund %]
606
                            [% ELSIF active_count==1 && budget_loo.b_active %]
607
608
                            [% ELSE %]
609
                                [% bdgclass=budget_loo.b_active? "": "b_inactive" | html %]
610
                            [% END %]
611
612
                            <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 %]">
613
                                [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %]
614
                            </option>
615
                        [% END %]
616
                    </select>
589
                    </select>
617
                    <span class="required">Required</span>
590
                    <span class="required">Required</span>
618
                    <label for="showallbudgets" style="float:none;">&nbsp;Show inactive:</label>
591
                    <label for="showallbudgets" style="float:none;">&nbsp;Show inactive:</label>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-38 / +1 lines)
Lines 284-327 Link Here
284
                                                    <optgroup label="Current">
284
                                                    <optgroup label="Current">
285
                                                        <option id="selected_bookfund" selected="selected"></option>
285
                                                        <option id="selected_bookfund" selected="selected"></option>
286
                                                    </optgroup>
286
                                                    </optgroup>
287
                                                    [% FOREACH budget_period_id IN budget_loops.keys %]
287
                                                    [% INCLUDE 'budgets_loop.inc' inactive_class = "inactive_budget" %]
288
                                                        [% SET budget_period = budget_loops.$budget_period_id %]
289
                                                        [% SET optgroup_class = "" %]
290
                                                        [% SET optgroup_label = budget_period.description %]
291
                                                        [% IF budget_period.active %]
292
                                                            [% SET optgroup_class = "inactive_budget" %]
293
                                                            [% SET optgroup_label = t("{budget_description} (Inactive)", {budget_description = budget_period.description}) %]
294
                                                        [% END %]
295
296
                                                        <optgroup class="inactive_budget" label="[% optgroup_label | html %]">
297
                                                            [% FOREACH budget_loo IN budget_period.funds %]
298
                                                                [% level_indent_cnt = 0 %]
299
                                                                [% level_indent = "" %]
300
                                                                [% WHILE level_indent_cnt < budget_loo.b_level %]
301
                                                                    [% level_indent = level_indent _ " -- " %]
302
                                                                    [% level_indent_cnt = level_indent_cnt +1 %]
303
                                                                [% END %]
304
305
                                                                [% SET bdgclass = "" %]
306
                                                                [% IF ( budget_loo.b_sel ) %]
307
                                                                    [% active_count = 0 #select no other fund %]
308
                                                                [% ELSIF active_count==1 && budget_loo.b_active %]
309
310
                                                                [% ELSE %]
311
                                                                    [% bdgclass=budget_loo.b_active? "": "inactive_budget" | html %]
312
                                                                [% END %]
313
314
                                                                <option
315
                                                                    value="[% budget_loo.b_id | html %]"
316
                                                                    class="[% bdgclass | html %]"
317
                                                                    data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]"
318
                                                                    data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
319
                                                                >
320
                                                                    [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %]
321
                                                                </option>
322
                                                            [% END %]
323
                                                        </optgroup>
324
                                                    [% END %]
325
                                                </select>
288
                                                </select>
326
                                                <span class="required">Required</span>
289
                                                <span class="required">Required</span>
327
                                            </li>
290
                                            </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt (-7 / +1 lines)
Lines 182-194 Link Here
182
                                    <label for="shipmentcost_budgetid">Shipping fund: </label>
182
                                    <label for="shipmentcost_budgetid">Shipping fund: </label>
183
                                    <select id="shipmentcost_budgetid" name="shipmentcost_budgetid">
183
                                    <select id="shipmentcost_budgetid" name="shipmentcost_budgetid">
184
                                        <option value="">No fund</option>
184
                                        <option value="">No fund</option>
185
                                        [% FOREACH budget IN budgets %]
185
                                        [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
186
                                            [% IF ( budget.b_active ) %]
187
                                                <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
188
                                            [% ELSE %]
189
                                                <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option>
190
                                            [% END %]
191
                                        [% END %]
192
                                    </select>
186
                                    </select>
193
                                    <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
187
                                    <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
194
                                    <input type="checkbox" id="showallfunds" />
188
                                    <input type="checkbox" id="showallfunds" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-10 / +2 lines)
Lines 1218-1236 Link Here
1218
        [% ELSE %]
1218
        [% ELSE %]
1219
            <option value="__NONE__">None</option>
1219
            <option value="__NONE__">None</option>
1220
        [% END %]
1220
        [% END %]
1221
        [% FOREACH budget IN sugg_budgets %]
1221
        [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %]
1222
            [% IF ( budget.selected ) %]
1223
                <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option>
1224
            [% ELSIF ( budget.b_active ) %]
1225
                <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
1226
            [% ELSE %]
1227
                <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option>
1228
            [% END %]
1229
        [% END %]
1230
    </select>
1222
    </select>
1231
    <!-- this is needed -->
1223
    <!-- this is needed -->
1232
    <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
1224
    <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
1233
    <input type="checkbox" class="showallfunds" />
1225
    <input type="checkbox" class="showallfunds" id="showallfunds" />
1234
[% END %]
1226
[% END %]
1235
1227
1236
[% MACRO jsinclude BLOCK %]
1228
[% MACRO jsinclude BLOCK %]
(-)a/suggestion/suggestion.pl (-13 / +19 lines)
Lines 545-565 my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG"); Link Here
545
$template->param( patron_reason_loop => $patron_reason_loop );
545
$template->param( patron_reason_loop => $patron_reason_loop );
546
546
547
# Budgets for suggestion add or edition
547
# Budgets for suggestion add or edition
548
my $sugg_budget_loop = [];
548
my %budget_loops;
549
my $sugg_budgets     = GetBudgetHierarchy();
549
my $sugg_budgets = GetBudgetHierarchy;
550
foreach my $r ( @{$sugg_budgets} ) {
550
foreach my $r ( @{$sugg_budgets} ) {
551
    next unless ( CanUserUseBudget( $borrowernumber, $r, $userflags ) );
551
    next unless ( CanUserUseBudget( $borrowernumber, $r, $userflags ) );
552
    my $selected = ( $$suggestion_ref{budgetid} && $r->{budget_id} eq $$suggestion_ref{budgetid} ) ? 1 : 0;
552
    unless ( defined $budget_loops{ $r->{budget_period_id} } ) {
553
    push @{$sugg_budget_loop},
553
        $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description};
554
        {
554
        $budget_loops{ $r->{budget_period_id} }->{active}      = $r->{budget_period_active};
555
        b_id     => $r->{budget_id},
555
        $budget_loops{ $r->{budget_period_id} }->{funds}       = [];
556
        b_txt    => $r->{budget_name},
556
    }
557
        b_active => $r->{budget_period_active},
557
    push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, {
558
        selected => $selected,
558
        b_id            => $r->{budget_id},
559
        };
559
        b_txt           => $r->{budget_name},
560
        b_code          => $r->{budget_code},
561
        b_sort1_authcat => $r->{'sort1_authcat'},
562
        b_sort2_authcat => $r->{'sort2_authcat'},
563
        b_active        => $r->{budget_period_active},
564
        b_sel           => ( $$suggestion_ref{budgetid} && $r->{budget_id} eq $$suggestion_ref{budgetid} ) ? 1 : 0,
565
        b_level         => $r->{budget_level},
566
    };
560
}
567
}
561
@{$sugg_budget_loop} = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$sugg_budget_loop};
568
562
$template->param( sugg_budgets => $sugg_budget_loop );
569
$template->param( budget_loop => \%budget_loops );
563
570
564
if ( $suggestion_ref->{STATUS} ) {
571
if ( $suggestion_ref->{STATUS} ) {
565
    $template->param(
572
    $template->param(
566
- 

Return to bug 31606