Bug 12904: Force browser to load new javascript files after upgrade
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / addorderiso2709.tt
1 [% USE KohaDates %]
2 [% USE Branches %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Acquisitions &rsaquo; Order staged MARC records
6 [% IF ( batch_details ) %]
7  &rsaquo; Batch [% import_batch_id %]
8 [% ELSE %]
9  &rsaquo; Batch list
10 [% END %]
11 </title>
12 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
13 <style type="text/css">#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
14 [% INCLUDE 'doc-head-close.inc' %]
15 </head>
16
17 <body id="acq_addorderiso2709" class="acq">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'acquisitions-search.inc' %]
20 <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>
21 <div id="doc3" class="yui-t2">
22    <div id="bd">
23        <div id="yui-main">
24            <div class="yui-b">
25              [% IF ( allmatch ) %]<div class="dialog alert">
26               <h4>No records imported</h4>
27              No record have been imported because they all match an existing record in your catalog.<br />You'll have to treat them individually.
28              </div>
29              [% END %]
30
31              [% IF ( batch_details ) %]
32                 <h1>Add orders from [% comments %]
33                     ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
34                 </h1>
35                 <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform">
36                 <div id="tabs" class="toptabs">
37                   <ul>
38                     <li><a href="#records_to_import">Select to import</a></li>
39                     <li><a href="#items_info" class="items_info">Item information</a></li>
40                     <li><a href="#accounting_details">Default accounting details</a></li>
41                   </ul>
42
43                   <div id="records_to_import">
44                     <div id="searchheader">
45                         <div>
46                             <span class="checkall"><a id="checkAll" href="#">Select all</a></span>
47                             |
48                             <span class="uncheckall"><a id="unCheckAll" href="#">Clear all</a></span>
49                             |
50                             <span>
51                                 <label for="matcher_id">Matching:</label>
52                                     <select name="matcher_id" id="matcher_id">
53                                         <option value="_TITLE_AUTHOR_">Title and author</option>
54                                         <option value="">Do not look for matching records</option>
55                                         [% FOREACH available_matcher IN available_matchers %]
56                                             [% IF ( available_matcher.code == current_matcher_code ) %]
57                                                 <option value="[% available_matcher.matcher_id %]" selected="selected">
58                                                     [% available_matcher.code %] ([% available_matcher.description %])
59                                                 </option>
60                                             [% ELSE %]
61                                                 <option value="[% available_matcher.matcher_id %]">
62                                                     [% available_matcher.code %] ([% available_matcher.description %])
63                                                 </option>
64                                             [% END %]
65                                         [% END %]
66                                     </select>
67                             </span>
68                             |
69                             <span>
70                                 <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive funds:</label>
71                                 <input type="checkbox" id="showallbudgets" />
72                             </span>
73                         </div>
74                     </div>
75
76                         <input type="hidden" name="op" value="import_records"/>
77                         <input type="hidden" name="basketno" value="[% basketno %]" />
78                         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
79                         <input type="hidden" name="import_batch_id" value="[%import_batch_id %]" />
80                         <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
81
82                         [% FOREACH biblio IN biblio_list %]
83                         <fieldset class="biblio unselected rows" style="float:none;">
84                           <legend>
85                             <label for="record_[% biblio.import_record_id %]" style="width:auto;">
86                               <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id %]" value="[% biblio.import_record_id %]" />
87                               <span class="citation">[% biblio.citation %]</span>
88                             </label>
89                             <span class="links" style="font-weight: normal;">
90                               ( <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> )
91                             </span>
92                           </legend>
93                           <div style="float:left">
94                           <ol>
95                             <li class="status">
96                               <span class="match">
97                                 [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
98                                     No match
99                                 [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
100                                     Match applied
101                                 [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %]
102                                     Match found
103                                 [% ELSE %]
104                                     [% biblio_lis.overlay_status %]
105                                 [% END %]
106                                 [% IF ( biblio.match_biblionumber ) %]
107                                   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>
108                                 [% END %]
109                               </span>
110                             </li>
111                             <li class="quantity">
112                                 <label for="quantity_record_[% biblio.import_record_id %]" class="required">Quantity: </label>
113                                 <input id="quantity_record_[% biblio.import_record_id %]" type="text" value="[% biblio.quantity.length ? biblio.quantity : 1 %]" name="quantity" />
114                             </li>
115                             <li class="price">
116                                 <label for="price_record_[% biblio.import_record_id %]">Price: </label>
117                                 <input id="price_record_[% biblio.import_record_id %]" type="text" value="[% biblio.price %]" name="price" />
118                             </li>
119                             <li class="discount">
120                                 <label for="discount_record_[% biblio.import_record_id %]">Discount: </label>
121                                 <input id="discount_record_[% biblio.import_record_id %]" type="text" value="[% biblio.discount %]" name="discount" size="6" /> %
122                                 (If empty, discount rate from vendor will be used)
123                             </li>
124                             <li class="budget">
125                                 <label for="fund_record_[% biblio.import_record_id %]">Fund: </label>
126                                 [% IF ( close ) %]
127                                   <input type="hidden" size="20" name="budget_id" value="[% budget_id %]" />[% Budget_name %]
128                                 [% ELSE %]
129                                   <select id="fund_record_[% biblio.import_record_id %]" size="1" name="budget_id">
130                                     <option value="">Select a fund</option>
131                                     [% FOREACH budget IN budget_loop %]
132                                         [% IF ( budget.b_id == biblio.budget_id ) %]
133                                           [% IF budget.b_active %]
134                                             <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>
135                                           [% ELSE %]
136                                             <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>
137                                           [% END %]
138                                         [% ELSE %]
139                                             [% 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>
140                                             [% 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>
141                                             [% END %]
142                                         [% END %]
143                                     [% END %]
144                                   </select>
145                                 [% END %]
146                             </li>
147                             <li class="sort1">
148                                 <label for="sort1_record_[% biblio.import_record_id %]">Statistic 1: </label>
149                                 <input id="sort1_record_[% biblio.import_record_id %]" type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 %]" />
150                             </li>
151                             <li class="sort2">
152                                 <label for="sort2_record_[% biblio.import_record_id %]">Statistic 2: </label>
153                                 <input id="sort2_record_[% biblio.import_record_id %]" type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
154                             </li>
155                           </ol>
156                         </div>
157                         <div style="float:right">
158                         [% IF biblio.item_error %]Item records could not be processed because the number of item fields was uneven.[% END %]
159                         [% FOREACH item IN biblio.iteminfos %]
160                         <fieldset>
161                         <legend>Item Record [% item.item_id %]</legend>
162                         <ol>
163                         <li>
164                         <label for="homebranch_item_[% item.item_id %]">homebranch</label><select id="homebranch_item_[% item.item_id %]" name="homebranch_[% item.biblio_count %]">
165                         [% FOREACH l IN libraries %]
166                           [% IF l.branchcode == item.homebranch %]
167                             <option value="[% l.branchcode %]" selected="selected">[% l.branchname %]</option>
168                           [% ELSE %]
169                             <option value="[% l.branchcode %]">[% l.branchname %]</option>
170                           [% END %]
171                         [% END %]
172                         </select>
173                         </li>
174
175                         <li><label for="holdingbranch_item_[% item.item_id %]">holdingbranch</label><select id="holdingbranch_item_[% item.item_id %]" name="holdingbranch_[% item.biblio_count %]">
176                         [% FOREACH l IN libraries %]
177                           [% IF l.branchcode == item.holdingbranch %]
178                             <option value="[% l.branchcode %]" selected="selected">[% l.branchname %]</option>
179                           [% ELSE %]
180                             <option value="[% l.branchcode %]">[% l.branchname %]</option>
181                           [% END %]
182                         [% END %]
183                         </select>
184                         </li>
185                         <li><label for="itype_item_[% item.item_id %]">itype</label><select id="itype_item_[% item.item_id %]" name="itype_[% item.biblio_count %]">
186                         [% FOREACH itypeloo IN itypeloop %]
187                           [% IF ( itypeloo.itemtype ) == ( item.itype ) %]
188                             <option value="[% itypeloo.itemtype %]" selected="selected">[% itypeloo.description |html %]</option>
189                           [% ELSE %]
190                             <option value="[% itypeloo.itemtype %]">[% itypeloo.description |html %]</option>
191                           [% END %]
192                         [% END %]
193                         </select>
194                         </li>
195
196                         <li><label for="nonpublic_note_item_[% item.item_id %]">nonpublic_note</label><input type="text" id="nonpublic_note_item_[% item.item_id %]" name="nonpublic_note_[% item.biblio_count %]" value="[% item.nonpublic_note %]"></li>
197                         <li><label for="public_note_item_[% item.item_id %]">public_note</label><input type="text" id="public_note_item_[% item.item_id %]" name="public_note_[% item.biblio_count %]" value="[% item.public_note %]"></li>
198                         <li><label for="loc_item_[% item.item_id %]">loc</label><select id="loc_item_[% item.item_id %]" name="loc_[% item.biblio_count %]">
199                         <option value=""> </option>
200                         [% FOREACH locationloo IN locationloop %]
201                             [% IF ( locationloo.code ) == (item.loc) %]<option value="[% locationloo.code %]" selected="selected">[% locationloo.description %]</option>[% ELSE %]<option value="[% locationloo.code %]">[% locationloo.description %]</option>[% END %]
202                         [% END %]
203                        </select>
204                         </li>
205
206                         <li><label for="ccode_item_[% item.item_id %]">ccode</label><select id="ccode_item_[% item.item_id %]" name="ccode_[% item.biblio_count %]">
207                         [% FOREACH ccodeloo IN ccodeloop %]
208                             [% IF ( ccodeloo.code ) == (item.ccode) %]<option value="[% ccodeloo.code %]" selected="selected">[% ccodeloo.description %]</option>[% ELSE %]<option value="[% ccodeloo.code %]">[% ccodeloo.description %]</option>[% END %]
209                         [% END %]
210                         </select>
211                         </li>
212
213                         <li><label for="notforloan_item_[% item.item_id %]">notforloan</label><select id="notforloan_item_[% item.item_id %]" name="notforloan_[% item.biblio_count %]">
214                         [% FOREACH n IN notforloanloop %]
215                             [% IF n.code == item.notforloan %]
216                                 <option value="[% n.code %]" selected="selected">[% n.description %]</option>
217                             [% ELSE %]
218                                 <option value="[% n.code %]">[% n.description %]</option>
219                             [% END %]
220                         [% END %]
221                         </select>
222                         </li>
223                         <li><label for="uri_item_[% item.item_id %]">uri</label><input type="text" id="uri_item_[% item.item_id %]" name="uri_[% item.biblio_count %]" value="[% item.uri %]"></li>
224                         <li><label for="copyno_item_[% item.item_id %]">copyno</label><input type="text" id="copyno_item_[% item.item_id %]" name="copyno_[% item.biblio_count %]" value="[% item.copyno %]"></li>
225                         <li><label for="budget_code_item_[% item.item_id %]">budget_code</label><select id="budget_code_item_[% item.item_id %]" name="budget_code_[% item.biblio_count %]">
226                         <option value="">Select a fund</option>
227                         [% FOREACH budget_loo IN budget_loop %]
228                             [% IF ( budget_loo.b_code ) == ( item.budget_code ) %]<option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
229                             [% ELSE %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
230                             [% END %]
231                         [% END %]
232                         </select>
233                         </li>
234                         <li><label for="price_item_[% item.item_id %]">price</label><input type="text" id="price_item_[% item.item_id %]" name="itemprice_[% item.biblio_count %]" value="[% item.itemprice %]"></li>
235                         <li><label for="replacementprice_item_[% item.item_id %]">replacement price</label><input type="text" id="replacementprice_item_[% item.item_id %]" name="replacementprice_[% item.biblio_count %]" value="[% item.replacementprice %]"></li>
236                         <li><label for="callnumber_item_[% item.item_id %]">callnumber</label><input type="text" id="callnumber_item_[% item.item_id %]" name="itemcallnumber_[% item.biblio_count %]" value="[% item.itemcallnumber %]"></li>
237                         </ol>
238                         </fieldset>
239                         [% END %]
240                         </div>
241                         </fieldset>
242                             <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
243                                 <div class="modal-dialog">
244                                 <div class="modal-content">
245                                 <div class="modal-header">
246                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
247                                     <h3 id="dataPreviewLabel">MARC preview</h3>
248                                 </div>
249                                 <div class="modal-body">
250                                     <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
251                                 </div>
252                                 <div class="modal-footer">
253                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
254                                 </div>
255                                 </div>
256                                 </div>
257                             </div>
258                         [% END %]
259                       </div>
260                       <div id="items_info">
261                         <h2>Item information</h2>
262                         <p>Import all the checked items in the basket with the following parameters:</p>
263
264                         [% IF ( items ) %]
265                         <fieldset class="rows" style="float:none;">
266                             <legend>Item</legend>
267                             [% IF ( NoACQframework ) %]
268                                 <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
269                             [% END %]
270                             [% FOREACH item IN items %]
271                             <div id="outeritemblock">
272                             <div id="itemblock">
273                                 <ol>
274                                 [% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
275                                     <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
276                                         [% IF (iteminformatio.mandatory) %]
277                                             <label class="required">[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
278                                         [% ELSE %]
279                                             <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
280                                         [% END %]
281
282                                         [% IF ( iteminformatio.marc_value.type == 'select' ) %]
283                                             <select name="field_value" size="1">
284                                             [% FOREACH value IN iteminformatio.marc_value.values %]
285                                                 [% IF ( value == iteminformatio.marc_value.default ) %]
286                                                     <option value="[% value %]" selected="selected">[% iteminformatio.marc_value.labels.$value %]</option>
287                                                 [% ELSE %]
288                                                     <option value="[% value %]">[% iteminformatio.marc_value.labels.$value %]</option>
289                                                 [% END %]
290                                             [% END %]
291                                             </select>
292                                         [% ELSE %]
293                                         [% iteminformatio.marc_value %]
294                                         [% END %]
295                                         <input type="hidden" name="itemid" value="1" />
296                                         <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
297                                         <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
298                                         <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
299                                         <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
300                                         [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
301                                     </div></li>
302                                 [% END %]
303                                 </ol>
304                             </div><!-- /iteminformation -->
305                             </div>
306                             [% END %] <!-- /items -->
307                         </fieldset>
308                         [% END %] <!-- items -->
309                       </div>
310                       <div id="accounting_details">
311                         <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>
312                         <fieldset class="rows" style="float:none;">
313                             <legend>Accounting details</legend>
314                             <ol>
315                                 <li>
316                                     <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
317                                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
318                                 </li>
319                                 <li>
320                                     [% IF ( close ) %]
321                                         <span class="label">Fund: </span>
322                                         <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
323                                     [% ELSE %]
324                                         <li>
325                                             <label for="all_currency">Currency:</label>
326                                             <select name="all_currency" id="all_currency">
327                                             [% FOREACH currency IN currencies %]
328                                                 [% IF currency.currency == bookseller.listprice %]
329                                                     <option value="[% currency.currency %]" selected="selected">[% currency.currency %]</option>
330                                                 [% ELSIF not currency.archived %]
331                                                     <option value="[% currency.currency %]">[% currency.currency %]</option>
332                                                 [% END %]
333                                             [% END %]
334                                             </select>
335                                         </li>
336                                         <li>
337                                             <label for="all_budget_id">Fund: </label>
338                                             <select id="all_budget_id" size="1" name="all_budget_id">
339                                               <option value="">Select a fund</option>
340                                             [% FOREACH budget_loo IN budget_loop %]
341                                                 [% 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>
342                                                 [% 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>
343                                                 [% END %]
344                                             [% END %]
345                                             </select>
346                                             <label for="all_showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive:</label>
347                                             <input type="checkbox" id="all_showallbudgets" />
348                                         </li>
349                                     [% END %]
350                                 </li>
351                                 <li>
352                                     <label for="all_order_internalnote">Internal note: </label>
353                                     <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
354                                 </li>
355                                 <li>
356                                     <label for="all_order_vendornote">Vendor note: </label>
357                                     <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
358                                 </li>
359                                 <li>
360                                     <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
361                                     <label for="all_sort1">Statistic 1: </label>
362                                     <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
363                                 </li>
364                                 <li>
365                                     <label for="all_sort2">Statistic 2: </label>
366                                     <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
367                                 </li>
368                             </ol>
369                         </fieldset>
370                       </div>
371                       </div>
372
373                       <fieldset class="action">
374                           <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
375                       </fieldset>
376                     </form>
377                 [% ELSE %]
378                 <div>
379                   <h1>Choose the file to add to the basket</h1>
380                   <table id="files">
381                     <thead>
382                       <tr>
383                         <th>File name</th>
384                         <th>Comments</th>
385                         <th>Status</th>
386                         <th class="title-string">Staged</th>
387                         <th># Bibs</th>
388                         <th class="NoSort">&nbsp;</th>
389                       </tr>
390                     </thead>
391                     <tbody>
392                       [% FOREACH batch_lis IN batch_list %]
393                       <tr>
394                         <td>[% batch_lis.file_name %]</td>
395                         <td>[% batch_lis.comments %]</td>
396                         <td>
397                           [% IF ( batch_lis.import_status == 'cleaned' ) %]
398                             Cleaned
399                           [% ELSIF ( batch_lis.import_status == 'imported' ) %]
400                             Imported
401                           [% ELSIF ( batch_lis.import_status == 'importing' ) %]
402                             Importing
403                           [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
404                             Reverted
405                           [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
406                             Reverting
407                           [% ELSIF ( batch_lis.import_status == 'staged' ) %]
408                             Staged
409                           [% ELSE %]
410                             [% batch_lis.import_status %]
411                           [% END %]
412                         </td>
413                         <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 %]</span></td>
414                         <td>[% batch_lis.num_records %]</td>
415                         <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
416                       </tr>
417                       [% END %]
418                     </tbody>
419                   </table>
420                 </div>
421                 [% END %]
422            </div>
423        </div>
424    </div>
425 </div>
426
427 [% MACRO jsinclude BLOCK %]
428     <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
429 [% INCLUDE 'datatables.inc' %]
430     <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min_[% KOHA_VERSION %].js"></script>
431     <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script>
432     <script type="text/JavaScript">
433         $(document).ready(function() {
434             $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
435                 "aoColumnDefs": [
436                     { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
437                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
438                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
439                 ],
440                 "sPaginationType": "four_button",
441                 "aaSorting": []
442             } ) );
443
444             // keep copy of the inactive budgets
445             disabledBudgetsCopy = $("select[name='all_budget_id']").html();
446             $("select[name='all_budget_id'] .b_inactive").remove();
447             $("select[name='budget_id'] .b_inactive").remove();
448
449             $("#showallbudgets").click(function() {
450                 if ($(this).is(":checked")) {
451                     $("select[name='budget_id']").html(disabledBudgetsCopy)
452                 }
453                 else {
454                     $("select[name='budget_id'] .b_inactive").remove();
455                 }
456             });
457
458             $("#all_showallbudgets").click(function() {
459                 if ($(this).is(":checked")) {
460                     $("select[name='all_budget_id']").html(disabledBudgetsCopy);
461                 }
462                 else {
463                     $("select[name='all_budget_id'] .b_inactive").remove();
464                 }
465             });
466
467             $("select[name='budget_id']").change(function(){
468                 var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
469                 var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
470                 var destination_sort1 = $(this).parents('fieldset').find('li.sort1').find('input[name="sort1"]');
471                 var sort1 = $(destination_sort1).val() || "";
472                 if ( destination_sort1.length < 1 ) {
473                     destination_sort1 = $(this).parents('fieldset').find('li.sort1 > select[name="sort1"]');
474                 }
475                 var destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('input[name="sort2"]');
476                 var sort2 = $(destination_sort2).val() || "";
477                 if ( destination_sort2.length < 1 ) {
478                     destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('select[name="sort2"]');
479                 }
480                 getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
481
482                 getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
483             } );
484
485             $("select[name='budget_id']").change();
486
487             $("select[name='all_budget_id']").change(function(){
488                 var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
489                 var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
490                 var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
491                 if ( destination_sort1.length < 1 ) {
492                     destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
493                 }
494                 var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
495                 if ( destination_sort2.length < 1 ) {
496                     destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
497                 }
498                 getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
499                 getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
500                 $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
501                 $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
502                 $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
503                 $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
504             } );
505
506             $("select[name='all_budget_id']").change();
507
508             $("#records_to_import fieldset.rows div").hide();
509             $('input:checkbox[name="import_record_id"]').change(function(){
510                 var container = $(this).parents("fieldset");
511                 if ( $(this).is(':checked') ) {
512                     $(container).addClass("selected");
513                     $(container).removeClass("unselected");
514                     $(container).find("div").toggle(true);
515                 } else {
516                     $(container).addClass("unselected");
517                     $(container).removeClass("selected");
518                     $(container).find("div").toggle(false);
519                 }
520             } );
521
522             $("input:checkbox").prop("checked", false);
523             $("div.biblio.unselected select").prop('disabled', false);
524             $("div.biblio.unselected input").prop('disabled', false);
525
526             $("#checkAll").click(function(){
527                 $("#Aform").checkCheckboxes();
528                 $("input:checkbox[name='import_record_id']").change();
529                 return false;
530             });
531             $("#unCheckAll").click(function(){
532                 $("#Aform").unCheckCheckboxes();
533                 $("input:checkbox[name='import_record_id']").change();
534                 return false;
535             });
536
537             $("#Aform").on("submit", function(){
538                 if ( $("input:checkbox[name='import_record_id']:checked").length < 1 ) {
539                     alert(_("There is no record selected"));
540                     return false;
541                 }
542
543                 var error = 0;
544                 $("input:checkbox[name='import_record_id']:checked").parents('fieldset').find('input[name="quantity"]').each(function(){
545                     if ( $(this).val().length < 1 || isNaN( $(this).val() ) ) {
546                         error++;
547                     }
548                 });
549                 if ( error > 0 ) {
550                     alert(error + " " + _("quantity values are not filled in or are not numbers"));
551                     return false;
552
553                 }
554                 var error = 0;
555                 $("select[name='budget_id']").each(function() {
556                     if (!$(this).val()) {
557                         error++;
558                     }
559                 });
560                 if ( error > 0 ) {
561                     alert(_("Some budgets are not defined in item records"));
562                     return false;
563                 }
564
565                 return disableUnchecked($(this));
566             });
567             $('#tabs').tabs();
568             $(".previewData").on("click", function(e){
569                 e.preventDefault();
570                 var ltitle = $(this).text();
571                 var page = $(this).attr("href");
572                 $("#dataPreviewLabel").text(ltitle);
573                 $("#dataPreview .modal-body").load(page + " div");
574                 $('#dataPreview').modal({show:true});
575             });
576             $("#dataPreview").on("hidden", function(){
577                 $("#dataPreviewLabel").html("");
578                 $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
579             });
580         });
581
582         function disableUnchecked(form){
583             $("fieldset.biblio.unselected").each(function(){
584                 $(this).remove();
585             });
586             return 1;
587         }
588     </script>
589 [% END %]
590
591 [% INCLUDE 'intranet-bottom.inc' %]