Bug 10875: (follow-up) make displaying/hiding inactive funds work cross-browser
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / addorderiso2709.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Acquisitions &rsaquo; Order staged MARC records
4 [% IF ( batch_details ) %]
5  &rsaquo; Batch [% import_batch_id %]
6 [% ELSE %]
7  &rsaquo; Batch list
8 [% END %]
9 </title>
10 [% INCLUDE 'greybox.inc' %]
11 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
12 [% INCLUDE 'doc-head-close.inc' %]
13 [% INCLUDE 'datatables.inc' %]
14 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
15 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
16 <script type="text/JavaScript">
17 //<![CDATA[
18     $(document).ready(function() {
19         $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
20             "aoColumnDefs": [
21                 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
22                 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
23                 { "sType": "title-string", "aTargets" : [ "title-string" ] }
24             ],
25             "sPaginationType": "four_button",
26             "aaSorting": []
27         } ) );
28
29         // keep copy of the inactive budgets
30         disabledBudgetsCopy = $("select[name='all_budget_id']").html();
31         $("select[name='all_budget_id'] .b_inactive").remove();
32         $("select[name='budget_id'] .b_inactive").remove();
33
34         $("#showallbudgets").click(function() {
35             if ($(this).is(":checked")) {
36                 $("select[name='budget_id']").html(disabledBudgetsCopy)
37             }
38             else {
39                 $("select[name='budget_id'] .b_inactive").remove();
40             }
41         });
42
43         $("#all_showallbudgets").click(function() {
44             if ($(this).is(":checked")) {
45                 $("select[name='all_budget_id']").html(disabledBudgetsCopy);
46             }
47             else {
48                 $("select[name='all_budget_id'] .b_inactive").remove();
49             }
50         });
51
52         $("select[name='budget_id']").change(function(){
53             var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
54             var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
55             var destination_sort1 = $(this).parents('fieldset').find('li.sort1').find('input[name="sort1"]');
56             var sort1 = $(destination_sort1).val() || "";
57             if ( destination_sort1.length < 1 ) {
58                 destination_sort1 = $(this).parents('fieldset').find('li.sort1 > select[name="sort1"]');
59             }
60             var destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('input[name="sort2"]');
61             var sort2 = $(destination_sort2).val() || "";
62             if ( destination_sort2.length < 1 ) {
63                 destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('select[name="sort2"]');
64             }
65             getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
66
67             getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
68         } );
69
70         $("select[name='budget_id']").change();
71
72         $("select[name='all_budget_id']").change(function(){
73             var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
74             var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
75             var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
76             if ( destination_sort1.length < 1 ) {
77                 destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
78             }
79             var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
80             if ( destination_sort2.length < 1 ) {
81                 destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
82             }
83             getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
84             getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
85             $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
86             $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
87             $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
88             $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
89         } );
90
91         $("select[name='all_budget_id']").change();
92
93         $("#records_to_import fieldset.rows ol").hide();
94         $('input:checkbox[name="import_record_id"]').change(function(){
95             var container = $(this).parents("fieldset");
96             if ( $(this).is(':checked') ) {
97                 $(container).addClass("selected");
98                 $(container).removeClass("unselected");
99                 $(container).find("ol").toggle(true);
100             } else {
101                 $(container).addClass("unselected");
102                 $(container).removeClass("selected");
103                 $(container).find("ol").toggle(false);
104             }
105         } );
106
107         $("input:checkbox").attr("checked", false);
108         $("div.biblio.unselected select").attr("disabled", false);
109         $("div.biblio.unselected input").attr("disabled", false);
110
111         $("#checkAll").click(function(){
112             $("#Aform").checkCheckboxes();
113             $("input:checkbox[name='import_record_id']").change();
114             return false;
115         });
116         $("#unCheckAll").click(function(){
117             $("#Aform").unCheckCheckboxes();
118             $("input:checkbox[name='import_record_id']").change();
119             return false;
120         });
121
122         $("#Aform").on("submit", function(){
123             if ( $("input:checkbox[name='import_record_id']:checked").length < 1 ) {
124                 alert(_("There is no record selected"));
125                 return false;
126             }
127
128             var error = 0;
129             $("input:checkbox[name='import_record_id']:checked").parents('fieldset').find('input[name="quantity"]').each(function(){
130                 if ( $(this).val().length < 1 || isNaN( $(this).val() ) ) {
131                     error++;
132                 }
133             });
134             if ( error > 0 ) {
135                 alert(error + " " + _("quantity values are not filled in or are not numbers"));
136                 return false;
137             }
138
139             return disableUnchecked($(this));
140         });
141         $('#tabs').tabs();
142     });
143
144     function disableUnchecked(form){
145         $("fieldset.biblio.unselected").each(function(){
146             $(this).remove();
147         });
148         return 1;
149     }
150 //]]>
151 </script>
152 </head>
153 <body id="acq_addorderiso2709" class="acq">
154 [% INCLUDE 'header.inc' %]
155 [% INCLUDE 'acquisitions-search.inc' %]
156 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Basket [% basketno %]</a> &rsaquo;  Add orders from iso2709 file</div>
157 <div id="doc3" class="yui-t2">
158    <div id="bd">
159        <div id="yui-main">
160            <div class="yui-b">
161              [% IF ( batch_details ) %]
162                 <h1>Add orders from [% comments %]
163                     ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
164                 </h1>
165                 <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform">
166                 <div id="tabs" class="toptabs">
167                   <ul>
168                     <li><a href="#records_to_import">Select to import</a></li>
169                     <li><a href="#items_info" class="items_info">Item information</a></li>
170                     <li><a href="#accounting_details">Default accounting details</a></li>
171                   </ul>
172
173                   <div id="records_to_import">
174                     <span class="checkall"><a id="checkAll" href="#">Check all</a></span>
175                     <span class="uncheckall"><a id="unCheckAll" href="#">Uncheck all</a></span>
176                     <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all funds:</label>
177                     <input type="checkbox" id="showallbudgets" />
178                         <input type="hidden" name="op" value="import_records"/>
179                         <input type="hidden" name="basketno" value="[% basketno %]" />
180                         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
181                         <input type="hidden" name="import_batch_id" value="[%import_batch_id %]" />
182                         <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
183
184                         [% FOREACH cur IN loop_currencies %]
185                             <input type="hidden" name="[% cur.currency %]" value="[% cur.rate %]" />
186                         [% END %]
187
188                         [% FOREACH biblio IN biblio_list %]
189                         <fieldset class="biblio unselected rows" style="float:none;">
190                           <legend>
191                             <label for="record_[% biblio.import_record_id %]" style="width:auto;">
192                               <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id %]" value="[% biblio.import_record_id %]" />
193                               <span class="citation">[% biblio.citation %]</span>
194                             </label>
195                             <span class="links" style="font-weight: normal;">
196                               ( <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> )
197                             </span>
198                           </legend>
199                           <ol>
200                             <li class="status">
201                               <span class="match">
202                                 [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
203                                     No match
204                                 [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
205                                     Match applied
206                                 [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %]
207                                     Match found
208                                 [% ELSE %]
209                                     [% biblio_lis.overlay_status %]
210                                 [% END %]
211                                 [% IF ( biblio.match_biblionumber ) %]
212                                   Matches biblio [% biblio.match_biblionumber %] (score = [% biblio.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.match_biblionumber %]">[% biblio.match_citation %]</a>
213                                 [% END %]
214                               </span>
215                             </li>
216                             <li class="quantity">
217                                 <label for="quantity_record_[% biblio.import_record_id %]" class="required">Quantity: </label>
218                                 <input id="quantity_record_[% biblio.import_record_id %]" type="text" value="[% biblio.quantity.length ? biblio.quantity : 1 %]" name="quantity" />
219                             </li>
220                             <li class="price">
221                                 <label for="price_record_[% biblio.import_record_id %]">Price: </label>
222                                 <input id="price_record_[% biblio.import_record_id %]" type="text" value="[% biblio.price %]" name="price" />
223                             </li>
224                             <li class="discount">
225                                 <label for="discount_record_[% biblio.import_record_id %]">Discount: </label>
226                                 <input id="discount_record_[% biblio.import_record_id %]" type="text" value="[% biblio.discount %]" name="discount" size="6" /> %
227                                 (If empty, discount rate from vendor will be used)
228                             </li>
229                             <li class="budget">
230                                 <label for="fund_record_[% biblio.import_record_id %]">Fund: </label>
231                                 [% IF ( close ) %]
232                                   <input type="hidden" size="20" name="budget_id" value="[% budget_id %]" />[% Budget_name %]
233                                 [% ELSE %]
234                                   <select id="fund_record_[% biblio.import_record_id %]" size="1" name="budget_id">
235                                     <option value="">Select a fund</option>
236                                     [% FOREACH budget IN budget_loop %]
237                                         [% IF ( budget.b_id == biblio.budget_id ) %]
238                                           [% IF budget.b_active %]
239                                             <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>
240                                           [% ELSE %]
241                                             <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>
242                                           [% END %]
243                                         [% ELSE %]
244                                             [% 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>
245                                             [% 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>
246                                             [% END %]
247                                         [% END %]
248                                     [% END %]
249                                   </select>
250                                 [% END %]
251                             </li>
252                             <li class="sort1">
253                                 <label for="sort1_record_[% biblio.import_record_id %]">Statistic 1: </label>
254                                 <input id="sort1_record_[% biblio.import_record_id %]" type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 %]" />
255                             </li>
256                             <li class="sort2">
257                                 <label for="sort2_record_[% biblio.import_record_id %]">Statistic 2: </label>
258                                 <input id="sort2_record_[% biblio.import_record_id %]" type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
259                             </li>
260                           </ol>
261                         </fieldset>
262                         [% END %]
263                       </div>
264                       <div id="items_info">
265                         <h2>Item information</h2>
266                         <p>Import all the checked items in the basket with the following parameters:</p>
267
268                         [% IF ( items ) %]
269                         <fieldset class="rows" style="float:none;">
270                             <legend>Item</legend>
271                             [% IF ( NoACQframework ) %]
272                                 <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
273                             [% END %]
274                             [% FOREACH item IN items %]
275                             <div id="outeritemblock">
276                             <div id="itemblock">
277                                 <ol>
278                                 [% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
279                                     <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
280                                         [% IF (iteminformatio.mandatory) %]
281                                             <label class="required">[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
282                                         [% ELSE %]
283                                             <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
284                                         [% END %]
285
286                                         [% iteminformatio.marc_value %]
287                                         <input type="hidden" name="itemid" value="1" />
288                                         <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
289                                         <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
290                                         <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
291                                         <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
292                                         [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
293                                     </div></li>
294                                 [% END %]
295                                 </ol>
296                             </div><!-- /iteminformation -->
297                             </div>
298                             [% END %] <!-- /items -->
299                         </fieldset>
300                         [% END %] <!-- items -->
301                       </div>
302                       <div id="accounting_details">
303                         <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>
304                         <fieldset class="rows" style="float:none;">
305                             <legend>Accounting details</legend>
306                             <ol>
307                                 <li>
308                                     <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
309                                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
310                                 </li>
311                                 <li>
312                                     [% IF ( close ) %]
313                                         <span class="label">Fund: </span>
314                                         <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
315                                     [% ELSE %]
316                                         <li>
317                                             <label for="all_currency">Currency:</label>
318                                             <select name="all_currency" id="all_currency">
319                                             [% FOREACH loop_currencie IN loop_currencies %]
320                                                 [% IF ( loop_currencie.selected ) %]
321                                                     <option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>
322                                                 [% ELSE %]
323                                                     <option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>
324                                                 [% END %]
325                                             [% END %]
326                                             </select>
327                                         </li>
328                                         <li>
329                                             <label for="all_budget_id">Fund: </label>
330                                             <select id="all_budget_id" size="1" name="all_budget_id">
331                                               <option value="">Select a fund</option>
332                                             [% FOREACH budget_loo IN budget_loop %]
333                                                 [% 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>
334                                                 [% 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>
335                                                 [% END %]
336                                             [% END %]
337                                             </select>
338                                             <label for="all_showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
339                                             <input type="checkbox" id="all_showallbudgets" />
340                                         </li>
341                                     [% END %]
342                                 </li>
343                                 <li>
344                                     <label for="all_order_internalnote">Internal note: </label>
345                                     <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
346                                 </li>
347                                 <li>
348                                     <label for="all_order_vendornote">Vendor note: </label>
349                                     <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
350                                 </li>
351                                 <li>
352                                     <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
353                                     <label for="all_sort1">Statistic 1: </label>
354                                     <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
355                                 </li>
356                                 <li>
357                                     <label for="all_sort2">Statistic 2: </label>
358                                     <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
359                                 </li>
360                             </ol>
361                         </fieldset>
362                       </div>
363                       </div>
364
365                       <fieldset class="action">
366                           <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
367                       </fieldset>
368                     </form>
369                 [% ELSE %]
370                 <div>
371                   <h1>Choose the file to add to the basket</h1>
372                   <table id="files">
373                     <thead>
374                       <tr>
375                         <th>File name</th>
376                         <th>Comments</th>
377                         <th>Status</th>
378                         <th class="title-string">Staged</th>
379                         <th># Bibs</th>
380                         <th class="NoSort">&nbsp;</th>
381                       </tr>
382                     </thead>
383                     <tbody>
384                       [% FOREACH batch_lis IN batch_list %]
385                       <tr>
386                         <td>[% batch_lis.file_name %]</td>
387                         <td>[% batch_lis.comments %]</td>
388                         <td>
389                           [% IF ( batch_lis.import_status == 'cleaned' ) %]
390                             Cleaned
391                           [% ELSIF ( batch_lis.import_status == 'imported' ) %]
392                             Imported
393                           [% ELSIF ( batch_lis.import_status == 'importing' ) %]
394                             Importing
395                           [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
396                             Reverted
397                           [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
398                             Reverting
399                           [% ELSIF ( batch_lis.import_status == 'staged' ) %]
400                             Staged
401                           [% ELSE %]
402                             [% batch_lis.import_status %]
403                           [% END %]
404                         </td>
405                         <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 %]</span></td>
406                         <td>[% batch_lis.num_biblios %]</td>
407                         <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
408                       </tr>
409                       [% END %]
410                     </tbody>
411                   </table>
412                 </div>
413                 [% END %]
414            </div>
415        </div>
416    </div>
417 </div>
418 </body>
419 </html>