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

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

Return to bug 7180