Bug 7180: (follow-up) reset statistic values on reloading the page
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 23 Apr 2014 07:56:26 +0000 (09:56 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Sun, 4 May 2014 20:46:51 +0000 (20:46 +0000)
On the "Default accounting details", if a dropdown list was created for
a statistic value, on reloading the page it still exist. It should not
given the fund value is reset.

The CGIsort variable is useless and can be remove: the dropdown list
is generated using the ajax call.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
acqui/addorderiso2709.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt

index f3c124e..456e840 100755 (executable)
@@ -311,37 +311,6 @@ foreach my $r ( @{$budgets_hierarchy} ) {
 }
 $template->param( budget_loop    => $budget_loop,);
 
-my $CGIsort1;
-if ($budget) {    # its a mod ..
-    if ( defined $budget->{'sort1_authcat'} ) {    # with custom  Asort* planning values
-        $CGIsort1 = GetAuthvalueDropbox(  $budget->{'sort1_authcat'}, $data->{'sort1'} );
-    }
-} elsif ( scalar(@$budgets) ) {
-} elsif ( scalar(@$budgets_hierarchy) ) {
-    $CGIsort1 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{'sort1_authcat'}, '' );
-}
-# if CGIsort is successfully fetched, the use it
-# else - failback to plain input-field
-if ($CGIsort1) {
-    $template->param( CGIsort1 => $CGIsort1 );
-} else {
-    $template->param( sort1 => $data->{'sort1'} );
-}
-
-my $CGIsort2;
-if ($budget) {
-    if ( defined $budget->{'sort2_authcat'} ) {
-        $CGIsort2 = GetAuthvalueDropbox(  $budget->{'sort2_authcat'}, $data->{'sort2'} );
-    }
-} elsif ( scalar(@$budgets_hierarchy) ) {
-    $CGIsort2 = GetAuthvalueDropbox( @$budgets_hierarchy[0]->{sort2_authcat}, '' );
-}
-if ($CGIsort2) {
-    $template->param( CGIsort2 => $CGIsort2 );
-} else {
-    $template->param( sort2 => $data->{'sort2'} );
-}
-
 output_html_with_http_headers $input, $cookie, $template->output;
 
 
index 86b6b23..9c36ff4 100644 (file)
@@ -65,6 +65,8 @@
             $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
         } );
 
+        $("select[name='all_budget_id']").change();
+
         $("#records_to_import fieldset.rows ol").hide();
         $('input:checkbox[name="import_record_id"]').change(function(){
             var container = $(this).parents("fieldset");
                                 </li>
                                 <li>
                                     <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
-                                    <label for="sort1">Statistic 1: </label>
-                                    [% IF CGIsort1 %]
-                                        <select id="all_sort1" size="1" name="all_sort1">
-                                        [% FOREACH sort_opt IN CGIsort1 %]
-                                            [% IF sort_opt.default %]
-                                                <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
-                                            [% ELSE %]
-                                                <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
-                                            [% END %]
-                                        [% END %]
-                                        </select>
-                                    [% ELSE %]
-                                        <input type="text" id="all_sort1" size="20" name="all_sort1" value="[% sort1 %]" />
-                                    [% END %]
+                                    <label for="all_sort1">Statistic 1: </label>
+                                    <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
                                 </li>
                                 <li>
-                                  <span id="sort2_zone">
-                                    <label for="sort2">Statistic 2: </label>
-                                    [% IF CGIsort2 %]
-                                        <select id="all_sort2" size="1" name="all_sort1">
-                                        [% FOREACH sort_opt IN CGIsort2 %]
-                                            [% IF sort_opt.default %]
-                                                <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
-                                            [% ELSE %]
-                                                <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
-                                            [% END %]
-                                        [% END %]
-                                        </select>
-                                    [% ELSE %]
-                                         <input type="text" id="all_sort2" size="20" name="all_sort2" value="[% sort2 %]" />
-                                    [% END %]
-                                  </span>
+                                    <label for="all_sort2">Statistic 2: </label>
+                                    <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
                                 </li>
                             </ol>
                         </fieldset>