Bug 10862: (follow-up) fix a couple of issues
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / addorderiso2709.tt
index 86b6b23..6f51956 100644 (file)
@@ -11,7 +11,7 @@
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'datatables.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
 <script type="text/JavaScript">
 //<![CDATA[
             "aaSorting": []
         } ) );
 
+        // keep copy of the inactive budgets
+        disabledBudgetsCopy = $("select[name='all_budget_id']").html();
+        $("select[name='all_budget_id'] .b_inactive").remove();
+        $("select[name='budget_id'] .b_inactive").remove();
+
+        $("#showallbudgets").click(function() {
+            if ($(this).is(":checked")) {
+                $("select[name='budget_id']").html(disabledBudgetsCopy)
+            }
+            else {
+                $("select[name='budget_id'] .b_inactive").remove();
+            }
+        });
+
+        $("#all_showallbudgets").click(function() {
+            if ($(this).is(":checked")) {
+                $("select[name='all_budget_id']").html(disabledBudgetsCopy);
+            }
+            else {
+                $("select[name='all_budget_id'] .b_inactive").remove();
+            }
+        });
+
         $("select[name='budget_id']").change(function(){
             var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
             var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
@@ -65,6 +88,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");
     });
 
     function disableUnchecked(form){
-        $("div.biblio.unselected").each(function(){
+        $("fieldset.biblio.unselected").each(function(){
             $(this).remove();
         });
         return 1;
                   <div id="records_to_import">
                     <span class="checkall"><a id="checkAll" href="#">Check all</a></span>
                     <span class="uncheckall"><a id="unCheckAll" href="#">Uncheck all</a></span>
+                    <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all funds:</label>
+                    <input type="checkbox" id="showallbudgets" />
                         <input type="hidden" name="op" value="import_records"/>
                         <input type="hidden" name="basketno" value="[% basketno %]" />
                         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
                                   <input type="hidden" size="20" name="budget_id" value="[% budget_id %]" />[% Budget_name %]
                                 [% ELSE %]
                                   <select id="fund_record_[% biblio.import_record_id %]" size="1" name="budget_id">
-                                    <option value=""></option>
+                                    <option value="">Select a fund</option>
                                     [% FOREACH budget IN budget_loop %]
                                         [% IF ( budget.b_id == biblio.budget_id ) %]
+                                          [% IF budget.b_active %]
                                             <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]" selected="selected">[% budget.b_txt %]</option>
+                                          [% ELSE %]
+                                            <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]" selected="selected">[% budget.b_txt %] (inactive)</option>
+                                          [% END %]
                                         [% ELSE %]
-                                            <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %]</option>
+                                            [% IF budget.b_active %]<option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %]</option>
+                                            [% ELSE %]<option value="[% budget.b_id %]" class="b_inactive" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %] (inactive)</option>
+                                            [% END %]
                                         [% END %]
                                     [% END %]
                                   </select>
                                         <li>
                                             <label for="all_budget_id">Fund: </label>
                                             <select id="all_budget_id" size="1" name="all_budget_id">
+                                              <option value="">Select a fund</option>
                                             [% FOREACH budget_loo IN budget_loop %]
-                                                [% IF ( budget_loo.b_sel ) %]
-                                                    <option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]" selected="selected">[% budget_loo.b_txt %]</option>
-                                                [% ELSE %]
-                                                    <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>
+                                                [% 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>
+                                                [% 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>
                                                 [% END %]
                                             [% END %]
                                             </select>
+                                            <label for="all_showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
+                                            <input type="checkbox" id="all_showallbudgets" />
                                         </li>
                                     [% END %]
                                 </li>
                                 </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>