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