Bug 10862: (follow-up) fix a couple of issues
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / addorderiso2709.tt
index 9cc0df9..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');
             $(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");
             if ( $(this).is(':checked') ) {
                 $(container).addClass("selected");
                 $(container).removeClass("unselected");
-                $(container).find("ol").toggle();
+                $(container).find("ol").toggle(true);
             } else {
                 $(container).addClass("unselected");
                 $(container).removeClass("selected");
-                $(container).find("ol").toggle();
+                $(container).find("ol").toggle(false);
             }
         } );
 
 
         $("#Aform").on("submit", function(){
             if ( $("input:checkbox[name='import_record_id']:checked").length < 1 ) {
-                alert("There is no record selected");
+                alert(_("There is no record selected"));
                 return false;
             }
 
                 }
             });
             if ( error > 0 ) {
-                alert(error + " quantity values are not filled or not a number");
+                alert(error + " " + _("quantity values are not filled in or are not numbers"));
                 return false;
             }
 
             return disableUnchecked($(this));
         });
+        $('#tabs').tabs();
     });
 
     function disableUnchecked(form){
-        $("div.biblio.unselected").each(function(){
-            $(this).find('select').attr('disabled', 'disabled');
-            $(this).find('input').attr('disabled', 'disabled');
+        $("fieldset.biblio.unselected").each(function(){
+            $(this).remove();
         });
         return 1;
     }
                 <h1>Add orders from [% comments %]
                     ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
                 </h1>
-                <div>
+                <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform">
+                <div id="tabs" class="toptabs">
+                  <ul>
+                    <li><a href="#records_to_import">Select to import</a></li>
+                    <li><a href="#items_info" class="items_info">Item information</a></li>
+                    <li><a href="#accounting_details">Default accounting details</a></li>
+                  </ul>
+
                   <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>
-                    <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform">
+                    <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 %]" />
                         [% END %]
 
                         [% FOREACH biblio IN biblio_list %]
-                        <fieldset class="biblio unselected rows">
+                        <fieldset class="biblio unselected rows" style="float:none;">
                           <legend>
                             <label for="record_[% biblio.import_record_id %]" style="width:auto;">
                               <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id %]" value="[% biblio.import_record_id %]" />
                               <span class="citation">[% biblio.citation %]</span>
                             </label>
-                            ( Show <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% biblio.import_record_id %]" title="MARC" rel="gb_page_center[600,500]">Card</a> )
-
+                            <span class="links" style="font-weight: normal;">
+                              ( <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% biblio.import_record_id %]" title="Card" rel="gb_page_center[600,500]">Card</a> | <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;breedingid=[% biblio.import_record_id %]&amp;import_batch_id=[% biblio.import_batch_id %]&amp;biblionumber=[% biblio.match_biblionumber %]">Add order</a> )
+                            </span>
                           </legend>
-                          <input type="hidden" value="[% biblio.rrp %]" name="rrp" />
                           <ol>
                             <li class="status">
                               <span class="match">
                             </li>
                             <li class="discount">
                                 <label for="discount_record_[% biblio.import_record_id %]">Discount: </label>
-                                <input id="discount_record_[% biblio.import_record_id %]" type="text" value="[% biblio.discount %]" name="discount" />
+                                <input id="discount_record_[% biblio.import_record_id %]" type="text" value="[% biblio.discount %]" name="discount" size="6" /> %
+                                (If empty, discount rate from vendor will be used)
                             </li>
                             <li class="budget">
                                 <label for="fund_record_[% biblio.import_record_id %]">Fund: </label>
                                   <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>
                                 [% END %]
                             </li>
                             <li class="sort1">
-                                <label for="sort1_record_[% biblio.import_record_id %]">Planning value1: </label>
+                                <label for="sort1_record_[% biblio.import_record_id %]">Statistic 1: </label>
                                 <input id="sort1_record_[% biblio.import_record_id %]" type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 %]" />
                             </li>
                             <li class="sort2">
-                                <label for="sort2_record_[% biblio.import_record_id %]">Planning value2: </label>
+                                <label for="sort2_record_[% biblio.import_record_id %]">Statistic 2: </label>
                                 <input id="sort2_record_[% biblio.import_record_id %]" type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
                             </li>
                           </ol>
                         </fieldset>
                         [% END %]
                       </div>
-                      <div id="import_all">
-                        <h2>Import all</h2>
-                        <p>Import all the lines in the basket with the following parameters:</p>
+                      <div id="items_info">
+                        <h2>Item information</h2>
+                        <p>Import all the checked items in the basket with the following parameters:</p>
 
                         [% IF ( items ) %]
-                        <fieldset class="rows">
+                        <fieldset class="rows" style="float:none;">
                             <legend>Item</legend>
                             [% IF ( NoACQframework ) %]
                                 <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
                             [% END %] <!-- /items -->
                         </fieldset>
                         [% END %] <!-- items -->
-
-                        <fieldset class="rows">
+                      </div>
+                      <div id="accounting_details">
+                        <p>Import all the checked items in the basket with the following accounting details (used only if no information is filled for the item):</p>
+                        <fieldset class="rows" style="float:none;">
                             <legend>Accounting details</legend>
                             <ol>
                                 <li>
                                 </li>
                                 <li>
                                     [% IF ( close ) %]
-                                        <span class="label">Budget: </span>
+                                        <span class="label">Fund: </span>
                                         <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
                                     [% ELSE %]
                                         <li>
                                             </select>
                                         </li>
                                         <li>
-                                            <label for="all_budget_id">Budget: </label>
+                                            <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">Planning value1: </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">Planning value2: </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>
-                        <fieldset class="action">
-                            <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
-                        </fieldset>
+                      </div>
+                      </div>
 
-                        </div>
+                      <fieldset class="action">
+                          <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
+                      </fieldset>
                     </form>
                 [% ELSE %]
                 <div>