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

(-)a/acqui/neworderempty.pl (-31 / +4 lines)
Lines 261-266 foreach my $r (@{$budgets}) { Link Here
261
    push @{$budget_loop}, {
261
    push @{$budget_loop}, {
262
        b_id  => $r->{budget_id},
262
        b_id  => $r->{budget_id},
263
        b_txt => $r->{budget_name},
263
        b_txt => $r->{budget_name},
264
        b_sort1_authcat => $r->{'sort1_authcat'},
265
        b_sort2_authcat => $r->{'sort2_authcat'},
264
        b_active => $r->{budget_period_active},
266
        b_active => $r->{budget_period_active},
265
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
267
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
266
    };
268
    };
Lines 275-311 if ($close) { Link Here
275
277
276
}
278
}
277
279
278
my $CGIsort1;
280
$template->param( sort1 => $data->{'sort1'} );
279
if ($budget) {    # its a mod ..
281
$template->param( sort2 => $data->{'sort2'} );
280
    if ( defined $budget->{'sort1_authcat'} ) {    # with custom  Asort* planning values
281
        $CGIsort1 = GetAuthvalueDropbox( $budget->{'sort1_authcat'}, $data->{'sort1'} );
282
    }
283
} elsif(@{$budgets}){
284
    $CGIsort1 = GetAuthvalueDropbox(  @$budgets[0]->{'sort1_authcat'}, '' );
285
}
286
287
# if CGIsort is successfully fetched, the use it
288
# else - failback to plain input-field
289
if ($CGIsort1) {
290
    $template->param( CGIsort1 => $CGIsort1 );
291
} else {
292
    $template->param( sort1 => $data->{'sort1'} );
293
}
294
295
my $CGIsort2;
296
if ($budget) {
297
    if ( defined $budget->{'sort2_authcat'} ) {
298
        $CGIsort2 = GetAuthvalueDropbox(  $budget->{'sort2_authcat'}, $data->{'sort2'} );
299
    }
300
} elsif(@{$budgets}) {
301
    $CGIsort2 = GetAuthvalueDropbox(  @$budgets[0]->{sort2_authcat}, '' );
302
}
303
304
if ($CGIsort2) {
305
    $template->param( CGIsort2 => $CGIsort2 );
306
} else {
307
    $template->param( sort2 => $data->{'sort2'} );
308
}
309
282
310
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
283
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
311
    # Check if ACQ framework exists
284
    # Check if ACQ framework exists
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-36 / +18 lines)
Lines 141-146 $(document).ready(function() Link Here
141
                $('#budget_id .b_inactive').remove();
141
                $('#budget_id .b_inactive').remove();
142
            }
142
            }
143
        });
143
        });
144
145
        $("#budget_id").change(function(){
146
            var destination_sort1 = $(this).parents('fieldset.rows').find('[name="sort1"]');
147
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
148
            var sort1 = $(destination_sort1).val() || "";
149
            var destination_sort2 = $(this).parents('fieldset.rows').find('[name="sort2"]');
150
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
151
            var sort2 = $(destination_sort2).val() || "";
152
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
153
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
154
        });
155
        $("#budget_id").change();
144
    });
156
    });
145
//]]>
157
//]]>
146
</script>
158
</script>
Lines 414-427 $(document).ready(function() Link Here
414
                    <input type="hidden" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
426
                    <input type="hidden" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
415
                [% ELSE %]
427
                [% ELSE %]
416
                <label class="required" for="budget_id">Fund: </label>
428
                <label class="required" for="budget_id">Fund: </label>
417
                <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
429
                <select id="budget_id" size="1" name="budget_id">
418
                        <option value="">Select a fund</option>
430
                        <option value="">Select a fund</option>
419
                [% FOREACH budget_loo IN budget_loop %]
431
                [% FOREACH budget_loo IN budget_loop %]
420
                    [% IF ( budget_loo.b_sel ) %]
432
                    [% IF ( budget_loo.b_sel ) %]
421
                        <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
433
                        <option value="[% budget_loo.b_id %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option>
422
                    [% ELSE %]
434
                    [% ELSE %]
423
                        [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
435
                        [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option>
424
                        [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %]</option>
436
                        [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option>
425
                        [% END %]
437
                        [% END %]
426
                    [% END %]
438
                    [% END %]
427
                [% END %]
439
                [% END %]
Lines 540-578 $(document).ready(function() Link Here
540
            </li>
552
            </li>
541
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
553
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
542
                <label for="sort1">Statistic 1: </label>
554
                <label for="sort1">Statistic 1: </label>
543
                <span id="sort1_zone">
555
                <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
544
                [% IF CGIsort1 %]
545
                    <select id="sort1" size="1" name="sort1">
546
                    [% FOREACH sort_opt IN CGIsort1 %]
547
                       [% IF sort_opt.default %]
548
                          <option value="[% sort_opt.value %]" selected="selected">[% sort_opt.label %]</option>
549
                        [% ELSE %]
550
                          <option value="[% sort_opt.value %]">[% sort_opt.label %]</option>
551
                        [% END %]
552
                    [% END %]
553
                    </select>
554
                [% ELSE %]
555
                    <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
556
                [% END %]
557
                </span>
558
            </li>
559
            <li>
556
            <li>
560
                <label for="sort2">Statistic 2: </label>
557
                <label for="sort2">Statistic 2: </label>
561
                <span id="sort2_zone">
558
                <input id="sort2" type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
562
                [% IF CGIsort2 %]
563
                    <select id="sort2" size="1" name="sort2">
564
                    [% FOREACH sort_opt IN CGIsort2 %]
565
                       [% IF sort_opt.default %]
566
                          <option value="[% sort_opt.value %]" selected="selected">[% sort_opt.label %]</option>
567
                        [% ELSE %]
568
                          <option value="[% sort_opt.value %]">[% sort_opt.label %]</option>
569
                        [% END %]
570
                    [% END %]
571
                    </select>
572
                [% ELSE %]
573
                    <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
574
                [% END %]
575
                </span>
576
            </li>
559
            </li>
577
        </ol>
560
        </ol>
578
    </fieldset>
561
    </fieldset>
579
- 

Return to bug 7180