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

(-)a/acqui/addorderiso2709.pl (-6 lines)
Lines 298-307 if ($budget) { # its a mod .. Link Here
298
    }
298
    }
299
} elsif ( scalar(@$budgets) ) {
299
} elsif ( scalar(@$budgets) ) {
300
    $CGIsort1 = GetAuthvalueDropbox(  @$budgets[0]->{'sort1_authcat'}, '' );
300
    $CGIsort1 = GetAuthvalueDropbox(  @$budgets[0]->{'sort1_authcat'}, '' );
301
} else {
302
    $CGIsort1 = GetAuthvalueDropbox(  '', '' );
303
}
301
}
304
305
# if CGIsort is successfully fetched, the use it
302
# if CGIsort is successfully fetched, the use it
306
# else - failback to plain input-field
303
# else - failback to plain input-field
307
if ($CGIsort1) {
304
if ($CGIsort1) {
Lines 317-326 if ($budget) { Link Here
317
    }
314
    }
318
} elsif ( scalar(@$budgets) ) {
315
} elsif ( scalar(@$budgets) ) {
319
    $CGIsort2 = GetAuthvalueDropbox(  @$budgets[0]->{sort2_authcat}, '' );
316
    $CGIsort2 = GetAuthvalueDropbox(  @$budgets[0]->{sort2_authcat}, '' );
320
} else {
321
    $CGIsort2 = GetAuthvalueDropbox( '', '' );
322
}
317
}
323
324
if ($CGIsort2) {
318
if ($CGIsort2) {
325
    $template->param( CGIsort2 => $CGIsort2 );
319
    $template->param( CGIsort2 => $CGIsort2 );
326
} else {
320
} else {
(-)a/acqui/fetch_sort_dropbox.pl (-22 / +36 lines)
Lines 54-93 Sort number. 1 or 2 for the moment. Link Here
54
my $input = new CGI;
54
my $input = new CGI;
55
55
56
my $budget_id = $input->param('budget_id');
56
my $budget_id = $input->param('budget_id');
57
my $sort_id   = $input->param('sort');
57
my $sort_nb   = $input->param('sort');
58
die "sort parameter can only be 1 or 2" unless ($sort_nb == 1 || $sort_nb == 2);
58
59
59
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
60
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
60
    {   template_name   => "acqui/ajax.tmpl",
61
    {   template_name   => "acqui/ajax.tmpl",
61
        query           => $input,
62
        query           => $input,
62
        type            => "intranet",
63
        type            => "intranet",
63
        authnotrequired => 0,
64
        authnotrequired => 0,
64
        flagsrequired => {editcatalogue => 'edit_catalogue'},
65
        flagsrequired => {acquisition => 'order_manage'},
65
        debug => 0,
66
        debug => 0,
66
    }
67
    }
67
);
68
);
68
69
69
my $budget = GetBudget($budget_id);
70
my $ret_html;
70
my $dropbox_values = GetAuthvalueDropbox( $budget->{'sort'.$sort_id.'_authcat'}, '' );
71
my $name = 'sort'.$sort_nb;
72
my $authcat_field = 'sort'.$sort_nb.'_authcat';
71
73
72
my @authorised_values;
74
my $budget = GetBudget($budget_id);
73
my %authorised_lib;
74
75
75
foreach ( @$dropbox_values) {
76
if ( $budget && $budget->{$authcat_field} ) {
76
    push @authorised_values, $_->{value};
77
    # with custom  Asort* planning values
77
    $authorised_lib{$_->{value}} = $_->{label};
78
    my $dropbox_values = GetAuthvalueDropbox( $budget->{$authcat_field}, '' );
79
80
    my @authorised_values;
81
    my %authorised_lib;
82
    my $default_value;
83
    
84
    foreach ( @$dropbox_values) {
85
        push @authorised_values, $_->{value};
86
        $authorised_lib{$_->{value}} = $_->{label};
87
        $default_value = $_->{value} if $_->{'default'};
88
    }
89
    
90
    $ret_html = CGI::scrolling_list(
91
        -values   => \@authorised_values,
92
        -labels   => \%authorised_lib,
93
        -default  => $default_value,
94
        -override => 1,
95
        -size     => 1,
96
        -multiple => 0,
97
        -name     => $name,
98
        -id       => $name,
99
    );
100
    
101
} else {
102
    # free input
103
    $ret_html = '<input type="text" size="20" name="'.$name.'" id="'.$name.'" />';
78
}
104
}
79
105
80
my $budget_authvalue_dropbox = CGI::scrolling_list(
106
$template->param( 'return' => $ret_html );
81
    -values   => \@authorised_values,
82
    -labels   => \%authorised_lib,
83
    -default  => $authorised_values[0],
84
);
85
86
87
# strip off select tags
88
$budget_authvalue_dropbox =~ s/^\<select.*?\"\>//;
89
$budget_authvalue_dropbox =~ s/\<\/select\>$//;
90
chomp $budget_authvalue_dropbox;
91
92
$template->param( return => $budget_authvalue_dropbox );
93
output_html_with_http_headers $input, $cookie, $template->output;
107
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/neworderempty.pl (-4 lines)
Lines 281-288 if ($budget) { # its a mod .. Link Here
281
    }
281
    }
282
} elsif(@{$budgets}){
282
} elsif(@{$budgets}){
283
    $CGIsort1 = GetAuthvalueDropbox(  @$budgets[0]->{'sort1_authcat'}, '' );
283
    $CGIsort1 = GetAuthvalueDropbox(  @$budgets[0]->{'sort1_authcat'}, '' );
284
}else{
285
    $CGIsort1 = GetAuthvalueDropbox( '', '' );
286
}
284
}
287
285
288
# if CGIsort is successfully fetched, the use it
286
# if CGIsort is successfully fetched, the use it
Lines 300-307 if ($budget) { Link Here
300
    }
298
    }
301
} elsif(@{$budgets}) {
299
} elsif(@{$budgets}) {
302
    $CGIsort2 = GetAuthvalueDropbox(  @$budgets[0]->{sort2_authcat}, '' );
300
    $CGIsort2 = GetAuthvalueDropbox(  @$budgets[0]->{sort2_authcat}, '' );
303
}else{
304
    $CGIsort2 = GetAuthvalueDropbox( '', '' );
305
}
301
}
306
302
307
if ($CGIsort2) {
303
if ($CGIsort2) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js (-2 / +8 lines)
Lines 744-750 function fetchSortDropbox(f) { Link Here
744
744
745
for (i=1;i<=2;i++) {
745
for (i=1;i<=2;i++) {
746
746
747
    var sort_dropbox = document.getElementById('sort'+i);
747
    var sort_zone = document.getElementById('sort'+i+'_zone');
748
    var url = '../acqui/fetch_sort_dropbox.pl?sort='+i+'&budget_id='+budgetId;
748
    var url = '../acqui/fetch_sort_dropbox.pl?sort='+i+'&budget_id='+budgetId;
749
749
750
    var xmlhttp = null;
750
    var xmlhttp = null;
Lines 764-770 for (i=1;i<=2;i++) { Link Here
764
        }
764
        }
765
    };
765
    };
766
    // rc =  eval ( xmlhttp.responseText );
766
    // rc =  eval ( xmlhttp.responseText );
767
    sort_dropbox.innerHTML  =  xmlhttp.responseText;
767
    var retRootType = xmlhttp.responseXML.firstChild.nodeName;
768
    var existingInputs = sort_zone.getElementsByTagName('input');
769
    if (existingInputs.length > 0 && retRootType == 'input') {
770
        // when sort is already an input, do not override to preseve value
771
        return;
772
    }
773
    sort_zone.innerHTML = xmlhttp.responseText;
768
}
774
}
769
}
775
}
770
776
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt (-13 / +15 lines)
Lines 188-194 Link Here
188
                        </li>
188
                        </li>
189
                        <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
189
                        <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
190
                            <label for="sort1">Planning value1: </label>
190
                            <label for="sort1">Planning value1: </label>
191
191
                            <span id="sort1_zone">
192
                            [% IF CGIsort1 %]
192
                            [% IF CGIsort1 %]
193
                                <select id="sort1" size="1" name="sort1">
193
                                <select id="sort1" size="1" name="sort1">
194
                                [% FOREACH sort_opt IN CGIsort1 %]
194
                                [% FOREACH sort_opt IN CGIsort1 %]
Lines 202-224 Link Here
202
                            [% ELSE %]
202
                            [% ELSE %]
203
                                <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
203
                                <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
204
                            [% END %]
204
                            [% END %]
205
                            </span>
205
                        </li>
206
                        </li>
206
                        <li>
207
                        <li>
207
                            <label for="sort2">Planning value2: </label>
208
                            <label for="sort2">Planning value2: </label>
208
209
                            <span id="sort2_zone">
209
                        [% IF CGIsort2 %]
210
                            [% IF CGIsort2 %]
210
                            <select id="sort2" size="1" name="sort1">
211
                                <select id="sort2" size="1" name="sort1">
211
                            [% FOREACH sort_opt IN CGIsort2 %]
212
                                [% FOREACH sort_opt IN CGIsort2 %]
212
                                [% IF sort_opt.default %]
213
                                    [% IF sort_opt.default %]
213
                                    <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
214
                                        <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
214
                                [% ELSE %]
215
                                    [% ELSE %]
215
                                    <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
216
                                        <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
217
                                    [% END %]
216
                                [% END %]
218
                                [% END %]
219
                                </select>
220
                            [% ELSE %]
221
                                 <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
217
                            [% END %]
222
                            [% END %]
218
                            </select>
223
                            </span>
219
                        [% ELSE %]
220
                             <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
221
                        [% END %]
222
                        </li>
224
                        </li>
223
                        <li>
225
                        <li>
224
                            
226
                            
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-4 / +4 lines)
Lines 508-514 $(document).ready(function() Link Here
508
            </li>
508
            </li>
509
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
509
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
510
                <label for="sort1">Statistic 1: </label>
510
                <label for="sort1">Statistic 1: </label>
511
511
                <span id="sort1_zone">
512
                [% IF CGIsort1 %]
512
                [% IF CGIsort1 %]
513
                    <select id="sort1" size="1" name="sort1">
513
                    <select id="sort1" size="1" name="sort1">
514
                    [% FOREACH sort_opt IN CGIsort1 %]
514
                    [% FOREACH sort_opt IN CGIsort1 %]
Lines 520-532 $(document).ready(function() Link Here
520
                    [% END %]
520
                    [% END %]
521
                    </select>
521
                    </select>
522
                [% ELSE %]
522
                [% ELSE %]
523
524
                    <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
523
                    <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" />
525
                [% END %]
524
                [% END %]
525
                </span>
526
            </li>
526
            </li>
527
            <li>
527
            <li>
528
                <label for="sort2">Statistic 2: </label>
528
                <label for="sort2">Statistic 2: </label>
529
529
                <span id="sort2_zone">
530
                [% IF CGIsort2 %]
530
                [% IF CGIsort2 %]
531
                    <select id="sort2" size="1" name="sort2">
531
                    <select id="sort2" size="1" name="sort2">
532
                    [% FOREACH sort_opt IN CGIsort2 %]
532
                    [% FOREACH sort_opt IN CGIsort2 %]
Lines 540-545 $(document).ready(function() Link Here
540
                [% ELSE %]
540
                [% ELSE %]
541
                    <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
541
                    <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" />
542
                [% END %]
542
                [% END %]
543
                </span>
543
            </li>
544
            </li>
544
</ol>
545
</ol>
545
    </fieldset>
546
    </fieldset>
546
- 

Return to bug 8629