Koha-FFZG#1517: Actual cost kod zaprimanja je 0 a trebalo bi prepisati Budgeted cost
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / addorderiso2709.tt
index b817dde..31822d9 100644 (file)
@@ -7,11 +7,11 @@
  › Batch list
 [% END %]
 </title>
-[% INCLUDE 'greybox.inc' %]
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+<style type="text/css">#dataPreview { width : 80%; margin-left : -40%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
 [% 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");
             return disableUnchecked($(this));
         });
         $('#tabs').tabs();
+        $(".previewData").on("click", function(e){
+            e.preventDefault();
+            var ltitle = $(this).text();
+            var page = $(this).attr("href");
+            $("#dataPreviewLabel").text(ltitle);
+            $("#dataPreview .modal-body").load(page + " div");
+            $('#dataPreview').modal({show:true});
+        });
+        $("#dataPreview").on("hidden", function(){
+            $("#dataPreviewLabel").html("");
+            $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
+        });
     });
 
     function disableUnchecked(form){
-        $("div.biblio.unselected").each(function(){
+        $("fieldset.biblio.unselected").each(function(){
             $(this).remove();
         });
         return 1;
    <div id="bd">
        <div id="yui-main">
            <div class="yui-b">
+             [% IF ( allmatch ) %]<div class="dialog alert">
+              <h4>No records imported</h4>
+             No record have been imported because they all match an existing record in your catalog.<br />You'll have to treat them individually.
+             </div>
+             [% END %]
+
              [% IF ( batch_details ) %]
                 <h1>Add orders from [% comments %]
                     ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
                   </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>
+                    <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 inactive 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="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 %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% biblio.import_record_id %]" class="previewData">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 value 1: </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 value 2: </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>
+                            <div id="dataPreview" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
+                                <div class="modal-header">
+                                    <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
+                                    <h3 id="dataPreviewLabel">MARC preview</h3>
+                                </div>
+                                <div class="modal-body">
+                                    <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
+                                </div>
+                                <div class="modal-footer">
+                                    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
+                                </div>
+                            </div>
                         [% END %]
                       </div>
                       <div id="items_info">
                                             <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
                                         [% END %]
 
+                                        [% IF ( iteminformatio.marc_value.type == 'select' ) %]
+                                            <select name="field_value" size="1">
+                                            [% FOREACH value IN iteminformatio.marc_value.values %]
+                                                [% IF ( value == iteminformatio.marc_value.default ) %]
+                                                    <option value="[% value %]" selected="selected">[% iteminformatio.marc_value.labels.$value %]</option>
+                                                [% ELSE %]
+                                                    <option value="[% value %]">[% iteminformatio.marc_value.labels.$value %]</option>
+                                                [% END %]
+                                            [% END %]
+                                            </select>
+                                        [% ELSE %]
                                         [% iteminformatio.marc_value %]
+                                        [% END %]
                                         <input type="hidden" name="itemid" value="1" />
                                         <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
                                         <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
                         [% END %] <!-- items -->
                       </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>
                                             <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 inactive:</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 value 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">Planning value 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>
                           [% END %]
                         </td>
                         <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 %]</span></td>
-                        <td>[% batch_lis.num_biblios %]</td>
+                        <td>[% batch_lis.num_records %]</td>
                         <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
                       </tr>
                       [% END %]