Bug 29234: Further clean Z3950 Tests
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / neworderempty.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Price %]
6 [% USE ItemTypes %]
7 [% SET footerjs = 1 %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>[% IF ( ordernumber ) %]Modify order details (line #[% ordernumber | html %])[% ELSE %]New order[% END %] &rsaquo; Basket [% basketno | html %] &rsaquo; Acquisitions &rsaquo; Koha</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% FILTER collapse %]
12     <style>
13         #itemfieldset label,
14         #itemfieldset span.label {
15             flex-basis: 25%;
16             font-weight: 700;
17             margin-right: 1rem;
18             text-align: right;
19             width: 9rem;
20             font-size: 100%;
21             width: 25%;
22         }
23
24         #itemfieldset .input_marceditor {
25             flex-basis: 50%;
26         }
27
28         #itemfieldset .input_marceditor.flatpickr-input {
29             width: 50%;
30         }
31
32         #itemfieldset  .subfield_line {
33             display: flex;
34             flex-basis: 100%;
35         }
36     </style>
37 [% END %]
38 </head>
39
40 <body id="acq_neworderempty" class="acq">
41
42 [% WRAPPER 'header.inc' %]
43     [% INCLUDE 'acquisitions-search.inc' %]
44 [% END %]
45
46 [% WRAPPER 'sub-header.inc' %]
47 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
48     <ol>
49         <li>
50             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
51         </li>
52         <li>
53             <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
54         </li>
55         <li>
56             <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% name | html %]</a>
57         </li>
58         <li>
59             <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | uri %]">Basket [% basketno | html %]</a>
60         </li>
61
62         [% IF ( ordernumber ) %]
63             <li>
64                 <a href="#" aria-current="page">
65                     Modify order details (line #[% ordernumber | html %])
66                 </a>
67             </li>
68         [% ELSE %]
69             <li>
70                 <a href="#" aria-current="page">
71                     New order
72                 </a>
73             </li>
74         [% END %]
75     </ol>
76 </nav>
77 [% END %]
78
79 [% INCLUDE 'blocking_errors.inc' %]
80
81 <div class="main container-fluid">
82     <div class="row">
83         <div class="col-sm-10 col-sm-push-2">
84             <main>
85
86 <h1>
87     [% IF ( ordernumber ) %]
88         Modify order line
89     [% ELSE %]
90         New order
91     [% END %]
92 </h1>
93
94 <div class="dialog alert order_error" style="display:none"></div>
95
96 [% IF ( basketno ) %]
97     <div id="acqui_basket_summary">
98     <fieldset class="rows">
99         <legend>Basket details</legend>
100         <ol>
101         [% IF ( basketnote ) %]<li><span class="label">Internal note:</span> [% basketnote | html %]</li>[% END %]
102         [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote | html %]</li>[% END %]
103         [% IF ( basketcontractno ) %]
104             <li><span class="label">Contract number: </span>[% basketcontractno | html %]</li>
105             <li><span class="label">Contract name:</span> <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% basketcontractno | uri %]">[% basketcontractname | html %]</a></li>
106         [% END %]
107         [% IF ( authorisedbyname ) %]<li><span class="label">Managed by:</span>  [% authorisedbyname | html %]</li>[% END %]
108         [% IF ( creationdate ) %]<li><span class="label">Open on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
109         [% IF ( closedate ) %]
110         <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="post">
111         <li><span class="label">Closed on:</span>  [% closedate | $KohaDates %]</li>
112         [% IF ( basketgroups ) %]
113             <li>Basketgroup: <select id="basketgroupid" name="basketgroupid">
114                 [% FOREACH basketgroup IN basketgroups %]
115                     [% IF ( basketgroup.default ) %]
116                     <option value="[% basketgroup.id | html %]" selected="selected">[% basketgroup.name | html %]</option>
117                     [% ELSE %]
118                     <option value="[% basketgroup.id | html %]">[% basketgroup.name | html %]</option>
119                     [% END %]
120                 [% END %]
121                 </select>
122                 <input type="hidden" id="basketno" value="[% basketno | html %]" name="basketno" />
123                 <input type="hidden" value="mod_basket" name="op" />
124                 <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
125             </li>
126             <fieldset class="action"><input type="submit" class="btn btn-primary" value="Change basketgroup" /></fieldset>
127         [% END %]
128         </form>
129         [% END %]
130         </ol>
131     </fieldset>
132     </div>
133 [% END %]
134
135 <form action="/cgi-bin/koha/acqui/addorder.pl" method="post" class="validated noEnterSubmit" id="Aform" onsubmit="return Check(this);" >
136
137     <fieldset class="rows">
138         <legend>Patrons</legend>
139         <ol>
140             <li>
141                 <span class="label">To notify on receiving:</span>
142                 <div style="float:left">
143                     <ul id="users_names" style="padding-left:0">
144                       [% FOREACH user IN users %]
145                         <li id="user_[% user.borrowernumber | html %]">
146                             [% user.firstname | html %] [% user.surname | html %]
147                             [<a onclick="del_user([% user.borrowernumber | html %]);" style="cursor:pointer">Delete user</a>]
148                         </li>
149                       [% END %]
150                     </ul>
151                     <input type="hidden" id="users_ids" name="users_ids" value="[% users_ids | html %]" />
152                     <input type="hidden" id="op" name="op" value="mod_users" />
153                     <input type="button" id="add_user" class="btn btn-default" onclick="UserSearchPopup();" value="Add user" />
154                 </div>
155             </li>
156         </ol>
157     </fieldset>
158
159 <fieldset class="rows">
160         <legend>
161             Catalog details
162             [% IF ( biblionumber ) %]
163                 <span><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber | uri %]"> Edit record</a></span>
164             [% END %]
165         </legend>
166         [% UNLESS ( existing ) %]
167         <input type="hidden" name="existing" value="no" />
168         [% END %]
169         <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
170         <input type="hidden" name="basketno" value="[% basketno | html %]" />
171         <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
172         <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
173         <input type="hidden" name="listinc" id="listinc" value="[% listincgst | html %]" />
174         <input type="hidden" name="invoiceincgst" id="invoiceincgst" value="[% invoiceincgst | html %]" />
175         <input type="hidden" name="suggestionid" value="[% suggestionid | html %]" />
176         <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
177
178         [% FOREACH c IN currencies %]
179             <input type="hidden" id="currency_rate_[% c.currency | html %]"  name="[% c.currency | html %]" value="[% c.rate | html %]" />
180         [% END %]
181
182         [% IF NOT Koha.Preference('UseACQFrameworkForBiblioRecords') OR NoACQframework %]
183             <ol><li>
184                 [% IF ( biblionumber ) %]
185                 <span class="label">Title</span>
186                     <input type="hidden" name="title" value="[% title | html %]" /> <span class="title">[% title | html %]</span>
187                 [% ELSE %]
188                 <label for="entertitle">Title: </label>
189                     <input type="text" id="entertitle" size="50" name="title" value="[% title | html %]" class="focus" required="required" />
190                     <span class="required">Required</span>
191                 [% END %]
192             </li>
193             <li>
194                 [% IF ( biblionumber ) %]
195                 <span class="label">Author: </span>
196                     <input type="hidden" name="author" id="author" value="[% author | html %]" />[% author | html %]
197                 [% ELSE %]
198                 <label for="author">Author: </label>
199                     <input type="text" size="50" name="author" id="author" value="[% author | html %]" />
200                 [% END %]
201             </li>
202             <li>
203                 [% IF ( biblionumber ) %]
204                 <span class="label">Publisher: </span>
205                     <input type="hidden" name="publishercode" id="publishercode" value="[% publishercode | html %]" />[% publishercode | html %]
206                 [% ELSE %]
207                 <label for="publishercode"> Publisher: </label>
208                     <input type="text" size="50" name="publishercode" id="publishercode" value="[% publishercode | html %]" />
209                 [% END %]
210             </li>
211             <li>
212                 [% IF ( biblionumber ) %]
213                 <span class="label">Edition: </span>
214                     <input type="hidden" name="editionstatement" id="editionstatement" value="[% editionstatement | html %]" />[% editionstatement | html %]
215
216                 [% ELSE %]
217                 <label for="editionstatement">Edition: </label>
218                     <input type="text" size="20" name="editionstatement" id="editionstatement" value="[% editionstatement | html %]" />
219                 [% END %]
220             </li>
221             <li>
222                 [% IF ( biblionumber ) %]
223                 <span class="label">Publication year: </span>
224                     <input type="hidden" name="publicationyear" id="publicationyear" value="[% publicationyear | html %]" />[% publicationyear | html %]
225                 [% ELSE %]
226                 <label for="publicationyear">Publication year: </label>
227                     <input type="text" size="10" name="publicationyear" id="publicationyear" value="[% publicationyear | html %]" />
228                 [% END %]
229             </li>
230             <li>
231                 [% IF ( biblionumber ) %]
232                 <span class="label">ISBN: </span>
233                     <input type="hidden" name="isbn" id="ISBN" value="[% isbn | html %]" />[% isbn | html %]
234                 [% ELSE %]
235                 <label for="ISBN">ISBN: </label>
236                     <input type="text" size="50" name="isbn" id="ISBN" value="[% isbn | html %]" />
237                 [% END %]
238             </li>
239             [% IF (UNIMARC) %]
240             <li>
241                 [% IF ( biblionumber ) %]
242                 <span class="label">EAN: </span>
243                     <input type="hidden" name="ean" id="EAN" value="[% ean | html %]" />[% ean | html %]
244                 [% ELSE %]
245                 <label for="EAN">EAN: </label>
246                     <input type="text" size="20" name="ean" id="EAN" value="[% ean | html %]" />
247                 [% END %]
248             </li>
249             [% END %]
250             <li>
251                 [% IF ( biblionumber ) %]
252                 <span class="label">Series: </span>
253                     <input type="hidden" name="series" id="series" value="[% seriestitle | html %]" />[% seriestitle | html %]
254                 [% ELSE %]
255                 <label for="series">Series: </label>
256                     <input type="text" size="50" name="series" id="series" value="[% seriestitle | html %]" />
257                 [% END %]
258             </li>
259                 [% UNLESS ( biblionumber ) %]
260                 [% IF ( itemtypeloop ) %]
261                 <li>
262                     <span class="label">Item type:</span>
263                     <select name="itemtype" style="width:12em;">
264                     [% FOREACH itemtype IN itemtypeloop %]
265                         <option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
266                     [% END %]
267                     </select>
268                 </li>
269                 [% END %]
270                 [% END %]
271             </ol>
272         [% ELSE %]
273             <input type="hidden" name="use_ACQ_framework" value="1" />
274             [% IF biblionumber %]
275                 <ol>
276                     [% FOREACH field IN catalog_details %]
277                         <li>
278                             <div class="subfield_line">
279                                 <label>[% field.lib | html %] ([% field.tag | html %][% field.subfield | html %])</label>
280                                 [% field.value | html %]
281                             </div>
282                         </li>
283                     [% END %]
284                 </ol>
285             [% ELSE %]
286                 <ol>
287                     [% FOREACH field IN catalog_details %]
288                         <li>
289                             <div class="subfield_line">
290                                 [% PROCESS display_subfield field=field %]
291                             </div>
292                         </li>
293                     [% END %]
294                 </ol>
295             [% END %]
296         [% END %]
297     </fieldset>
298
299     [% IF ( suggestionid ) %]
300         <fieldset class="rows">
301         <legend>Suggestion</legend>
302         <ol>
303           <li>
304             <span class="label">Suggested by: </span>
305             [% surnamesuggestedby | html %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid | uri %]&amp;op=show">suggestion #[% suggestionid | html %]</a>)
306           </li>
307         </ol>
308         </fieldset>
309     [% END %]
310
311     [% UNLESS subscriptionid || basket.is_standing %][% # it is a suggestion, we have not items %]
312       [% IF (AcqCreateItemOrdering) %]
313
314       <div id="items_list" class="page-section" style="display:none">
315           <p><strong>Items list</strong></p>
316           <div style="width:100%;overflow:auto;">
317               <table>
318                   <thead>
319                       <tr>
320                           <th class="noExport">Actions</th>
321                           <th>Barcode</th>
322                           <th>Home library</th>
323                           <th>Holding library</th>
324                           <th>Not for loan</th>
325                           <th>Restricted</th>
326                           <th>Location</th>
327                           <th>Call number</th>
328                           <th>Copy number</th>
329                           <th>Inventory number</th>
330                           <th>Collection</th>
331                           <th>Item type</th>
332                           <th>Materials</th>
333                           <th>Notes</th>
334                       </tr>
335                   </thead>
336                   <tbody>
337                   </tbody>
338               </table>
339           </div>
340       </div>
341
342       <fieldset class="rows" id="itemfieldset">
343           <legend>Item</legend>
344           [% IF ( NoACQframework ) %]
345               <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
346           [% END %]
347
348           [% UNLESS Koha.Preference('autoBarcode') == 'OFF' %]
349               <div class="dialog message">The autoBarcode system preference is set to [% Koha.Preference('autoBarcode') | html %] and items with blank barcodes will have barcodes generated upon save to database</div>
350           [% END %]
351
352           <div id="outeritemblock"></div>
353
354       </fieldset>
355       [% END %][%# | html UNLESS subscriptionid %]
356     [% END %][%# IF (AcqCreateItemOrdering) %]
357     <fieldset class="rows">
358         <legend>Accounting details</legend>
359         <ol>
360             <li>
361                 <label class="required" for="quantity">Quantity: </label>
362                 [% IF subscriptionid %]
363                     <input type="text" size="20" id="quantity" name="quantity" value="1" onchange="updateCosts();" />
364                 [% ELSIF AcqCreateItemOrdering %]
365                     [% IF basket.is_standing %]
366                         <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
367                     [% ELSE %]
368                         <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
369                     [% END %]
370                 [% ELSE %]
371                     [% IF basket.is_standing %]
372                         <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
373                     [% ELSE %]
374                         <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec | html %]" onchange="updateCosts();" />
375                     [% END %]
376                 [% END %]
377                 <span class="required">Required</span>
378                 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, useful when receiveing an order -->
379                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
380
381                 [% IF subscription %]
382                     <br/>
383                     <div class="hint">
384                         <span>Frequency:</span> [% subscription.frequency.description | html %] |
385                         [% IF subscription.numberlength %]<span>Number of issues: [% subscription.numberlength | html %]</span>[% END %]
386                         [% IF subscription.weeklength   %]<span>Number of weeks: [% subscription.weeklength | html %]</span>[% END %]
387                         [% IF subscription.monthlength  %]<span>Number of months: [% subscription.monthlength | html %]</span>[% END %]
388                     </div>
389                 [% END %]
390             </li>
391             <li>
392                 <label class="required" for="budget_id">Fund: </label>
393                 [% active_count = 0 %]
394                 [% IF !ordernumber %]
395                     [% FOREACH budget_loo IN budget_loop %]
396                         [% active_count= active_count + budget_loo.b_active %]
397                     [% END %]
398                 [% END %]
399                 <select class="select2" id="budget_id" name="budget_id">
400                     <option value="">Select a fund</option>
401                 [% FOREACH budget_loo IN budget_loop %]
402                    [% level_indent_cnt = 0 %]
403                     [% level_indent = "" %]
404                     [% WHILE level_indent_cnt < budget_loo.b_level %]
405                         [% level_indent = level_indent _ " -- " %]
406                         [% level_indent_cnt = level_indent_cnt +1 %]
407                     [% END %]
408
409                     [% IF ( budget_loo.b_sel ) %]
410                         [% active_count = 0 #select no other fund %]
411                         <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
412                         >
413                     [% ELSIF active_count==1 && budget_loo.b_active %]
414                         <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
415                         >
416                     [% ELSE %]
417                         [% bdgclass=budget_loo.b_active? "": "b_inactive" | html %]
418                         <option value="[% budget_loo.b_id | html %]" class="[% bdgclass | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"
419                         >
420                     [% END %]
421                         [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %]
422                     </option>
423                 [% END %]
424                 </select>
425                 <span class="required">Required</span>
426                 <label for="showallbudgets" style="float:none;">&nbsp;Show inactive:</label>
427                 <input type="checkbox" id="showallbudgets" />
428             </li>
429                 <li>
430                         <label for="currency">Currency:</label>
431             <select name="currency" id="currency" onchange="updateCosts();">
432                 [% FOREACH c IN currencies %]
433                     [% IF ordernumber and c.currency == currency or not ordernumber and c.currency == vendor_currency %]
434                         <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
435                     [% ELSIF not c.archived %]
436                         <option value="[% c.currency | html %]">[% c.currency | html %]</option>
437                     [% END %]
438                 [% END %]
439             </select>
440                 </li>
441             <li>
442                 <label for="listprice">Vendor price: </label>
443                     <input type="text" size="20" name="listprice" id="listprice" value="[% listprice | html %]" onchange="updateCosts()" /> [% IF (listincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]
444             </li>
445             <li>
446                     <label for="uncertainprice">Uncertain price: </label>
447                     [% IF ( uncertainprice ) %]
448                     <input type="checkbox" name="uncertainprice"  id="uncertainprice" value="1" checked="checked" />
449                     [% ELSE %]
450                     <input type="checkbox" name="uncertainprice" id="uncertainprice" value="1" />
451                 [% END %]
452             </li>
453             [% IF ( gst_values ) %]
454                 <li>
455                     <label for="tax_rate">Tax rate: </label>
456                     <select name="tax_rate" id="tax_rate" onchange="updateCosts();">
457                         [% SET gst_found = 0 %]
458                         [% FOREACH gst IN gst_values %]
459                           [% IF ( gst.option == tax_rate ) %]
460                             <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
461                             [% SET gst_found = 1 %]
462                           [% ELSE %]
463                             <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
464                           [% END %]
465                         [% END %]
466
467                         [% IF !gst_found %]
468                             <option value="[% tax_rate | html %]" selected="selected">[% tax_rate * 100 | html %]%</option>
469                         [% END %]
470                     </select>
471
472                     [% IF !gst_found %]<span class="required">Tax rate not defined in system preference TaxRates!</span>[% END %]
473             [% ELSE %]
474                     <input type="hidden" name="tax_rate" value="0" />
475                 </li>
476             [% END %]
477             <li>
478                 <label for="discount">Discount: </label>
479                 [% IF ( ordernumber ) %]
480                     <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount | html %]" onchange="updateCosts();" />%
481                 [% ELSE %]
482                     <input type="text" size="6" name="discount" id="discount" value="[% discount | html %]" onchange="updateCosts();" />%
483                 [% END %]
484             </li>
485             <li>
486                 <label for="rrp">Retail price: </label>
487                 <input type="text" size="20" name="rrp" id="rrp" value="[% rrp | html %]" /> (adjusted for [% cur_active | html %], [% IF (listincgst == 1) %]tax inclusive[% ELSE %]tax exclusive[% END %])
488             </li>
489             <li>
490                 <label for="replacementprice">Replacement cost: </label>
491                 <input type="text" size="20" name="replacementprice" id="replacementprice" value="[% replacementprice | html | $Price on_editing => 1 %]" />
492             </li>
493             <li>
494                 <label for="ecost">Budgeted cost: </label>
495                 <input type="text" size="20" name="ecost" id="ecost" value="[% ecost | html %]" readonly="readonly"  /> [% IF (listincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]
496             </li>
497             <li>
498                 <label for="total">Total: </label>
499                 <input type="text" id="total" size="20" name="total" value="[% total | html %]" readonly="readonly" /> (budgeted cost * quantity)
500             </li>
501             <li class="ordering_unitprice">
502                 <label for="unitprice">Actual cost: </label>
503                 <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice | html %]" />
504                 [% IF (invoiceincgst == 1) %](tax inc.)[% ELSE %](tax exc.)[% END %]
505             </li>
506             <li>
507                 <label for="order_internalnote">Internal note: </label>
508                 <textarea id="order_internalnote" cols="30" rows="3" name="order_internalnote" >[% IF ( order_internalnote ) %][% order_internalnote | html %][% END %]</textarea>
509             </li>
510             <li>
511                 <label for="order_vendornote">Vendor note: </label>
512                 <textarea id="order_vendornote" cols="30" rows="3" name="order_vendornote" >[% IF ( order_vendornote ) %][% order_vendornote | html %][% END %]</textarea>
513             </li>
514             <li>
515                 <label for="estimated_delivery_date">Estimated delivery date: </label>
516                 <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | html %]"/>
517                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
518             </li>
519             <li>
520                 <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
521             </li>
522             <li>
523                 <label for="sort1">Statistic 1: </label>
524                 <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 | html %]" />
525             </li>
526             <li>
527                 <label for="sort2">Statistic 2: </label>
528                 <input id="sort2" type="text" id="sort2" size="20" name="sort2" value="[% sort2 | html %]" />
529             </li>
530         </ol>
531     </fieldset>
532     <fieldset class="action">
533         <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
534         <input type="submit" class="btn btn-primary" value="Save" />
535         [% IF (suggestionid) %]
536             <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]">Cancel</a>
537         [% ELSE %]
538             [% IF subscriptionid %]
539                 <a class="cancel" href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]">Cancel</a>
540             [% ELSE %]
541                 <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Cancel</a>
542             [% END %]
543         [% END %]
544     </fieldset>
545 </form>
546
547 <div id="procModal" data-backdrop="static" class="modal fade" aria-labelledby="procModal" aria-hidden="true">
548     <div class="modal-dialog">
549     <div class="modal-content">
550     <div class="modal-body">
551     <h3>Processing multiple items</h3>
552     </div>
553     </div>
554     </div>
555 </div>
556
557 <div id="multiCountModal" class="modal fade" aria-labelledby="multiCountModal" aria-hidden="true">
558     <div class="modal-dialog">
559     <div class="modal-content">
560     <h3>Invalid number of copies</h3>
561     <p>Please enter a <strong>number</strong>, greater than or equal to 1</p>
562     </div>
563     </div>
564 </div>
565
566 </main>
567 </div> <!-- /.col-sm-10.col-sm-push-2 -->
568
569 <div class="col-sm-2 col-sm-pull-10">
570     <aside>
571         [% INCLUDE 'acquisitions-menu.inc' %]
572     </aside>
573 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
574 </div> <!-- /.row -->
575
576 [% MACRO jsinclude BLOCK %]
577     [% Asset.js("js/acquisitions-menu.js") | $raw %]
578     [% Asset.js("js/acq.js") | $raw %]
579     [% Asset.js("js/additem.js") | $raw %]
580     [% Asset.js("js/cataloging.js") | $raw %]
581     [% INCLUDE 'calendar.inc' %]
582     [% INCLUDE 'select2.inc' %]
583     <script>
584         actTotal = "";
585
586         function Check(ff) {
587             [% IF (AcqCreateItemOrdering) %]
588                 // Remove last itemblock if it is not in items_list
589                 var lastitemblock = $("#outeritemblock > div:last");
590                 var tobedeleted = true;
591                 var listitems = $("#items_list tr");
592                 $(listitems).each(function(){
593                     if($(this).attr('idblock') == $(lastitemblock).attr('id')){
594                         tobedeleted = false;
595                     }
596                 });
597                 if(tobedeleted){
598                     $(lastitemblock).remove();
599                 }
600             [% END %]
601
602             var ok=0;
603             var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
604
605             _alertString +="-------------------------------------------------------------------\n\n";
606
607             if(isNull(ff.budget_id,1)){
608                 ok=1;
609                 _alertString += "\n- "+ _("You must select a fund");
610             }
611
612             if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){
613                 ok=1;
614                             _alertString += "\n- " + _("Quantity must be greater than '0'");
615             }
616
617             if (!(isNum(ff.listprice,0))){
618                 ok=1;
619                             _alertString += "\n- " + _("Vendor price must be a number");
620             }
621
622             if (!(isNum(ff.total,0))){
623                 ok=1;
624                             _alertString += "\n- " + _("Total must be a number");
625             }
626
627             if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
628                 ok=1;
629                 _alertString += "\n- " + _("Order total (%s) exceeds budget available (%s)").format(ff.total.value, actTotal);
630             }
631
632             if ( ff.field_value ) {
633                 var empty_item_mandatory = CheckMandatorySubfields(ff);
634                 if (empty_item_mandatory > 0) {
635                     ok = 1;
636                     _alertString +=
637                         "\n- " + _("%s item mandatory fields empty").format(empty_item_mandatory);
638                 }
639
640             }
641
642             if (ok) {
643                 alert(_alertString);
644                 [% IF (AcqCreateItemOrdering) %]
645                     if(tobedeleted) {
646                         $(lastitemblock).appendTo('#outeritemblock');
647                     }
648                 [% END %]
649                 return false;
650             }
651
652             [% IF (AcqCreateItemOrdering) %]
653                 if(check_additem('[% UniqueItemFields | html %]') == false) {
654                     alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
655                     if(tobedeleted) {
656                         $(lastitemblock).appendTo('#outeritemblock');
657                     }
658                     return false;
659                 }
660             [% END %]
661         }
662
663         $(document).ready(function(){
664             [% IF AcqCreateItemOrdering and not basket.is_standing %]
665                 cloneItemBlock(0, '[% UniqueItemFields | html %]');
666             [% END %]
667
668             [% IF ( suggestionid ) %]updateCosts();[% END %]
669             $("#quantity").change(function() {
670                 updateCosts();
671             });
672
673             //We apply the fonction only for modify option
674             [% IF ( quantityrec and not subscriptionid ) %]
675                 [% IF ( acqcreate ) %]
676                     $('#quantity').blur(function(){
677                         // if user decreases the quantity
678                         if($(this).val() < [% quantityrec | html %]){
679                             alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"));
680                             return true;
681                         } else {
682                             // if user increases the quantity
683                             alert(_("You can't add a new item, please create a new order line"));
684                             // and we replace the original value
685                             $(this).val([% quantityrec | html %])
686                             updateCosts(); // blur is invoked after change which updated values
687                             return false;
688                         }
689                     });
690                 [% END %]
691             [% END %]
692
693             //keep a copy of all budgets before removing the inactives
694             disabledBudgetsCopy = $('#budget_id').html();
695             $('#budget_id .b_inactive').remove();
696
697             $('#showallbudgets').click(function() {
698                 if ($(this).is(":checked")) {
699                     $('#budget_id').html(disabledBudgetsCopy); //Puts back all the funds
700                 }
701                 else {
702                     $('#budget_id .b_inactive').remove();
703                 }
704             });
705
706             $("#budget_id").change(function(){
707                 var destination_sort1 = $(this).parents('fieldset.rows').find('input[name="sort1"]');
708                 var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
709                 var sort1 = $(destination_sort1).val() || "";
710                 if ( destination_sort1.length < 1 ) {
711                     destination_sort1 = $(this).parents('fieldset.rows').find('select[name="sort1"]');
712                 }
713                 var destination_sort2 = $(this).parents('fieldset.rows').find('input[name="sort2"]');
714                 var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
715                 var sort2 = $(destination_sort2).val() || "";
716                 if ( destination_sort2.length < 1 ) {
717                     destination_sort2 = $(this).parents('fieldset.rows').find('select[name="sort2"]');
718                 }
719                 getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
720                 getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
721             });
722             $("#budget_id").change();
723         });
724
725         function UserSearchPopup(f) {
726             window.open(
727                 "/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,action&selection_type=add",
728                 'UserSearchPopup',
729                 'width=1024, height=768, scrollbars=yes, toolbar=no,'
730              );
731         }
732
733         function add_user(borrowernumber, borrowername) {
734             var ids = $("#users_ids").val();
735             if(ids.length > 0) {
736                 ids = ids.split(':');
737             } else {
738                 ids = new Array;
739             }
740         if (ids.indexOf(borrowernumber.toString()) < 0) {
741                 ids.push(borrowernumber);
742                 $("#users_ids").val(ids.join(':'));
743                 var li = '<li id="user_'+borrowernumber+'">'+borrowername
744                     + ' [<a style="cursor:pointer" onclick="del_user('+borrowernumber+');">'
745                     + _("Delete user") + '</a>]</li>';
746                 $("#users_names").append(li);
747                 return 0;
748             }
749             return -1;
750         }
751
752         function del_user(borrowernumber) {
753             $("#user_"+borrowernumber).remove();
754             var ids = $("#users_ids").val().split(':');
755             ids.splice(ids.indexOf(borrowernumber.toString()), 1);
756             $("#users_ids").val(ids.join(':'));
757         }
758     </script>
759 [% END %]
760
761 [% INCLUDE 'intranet-bottom.inc' %]
762
763 [% BLOCK display_subfield %]
764     <label>[% field.lib | html %] ([% field.tag | html %][% field.subfield | html %])</label>
765     [% IF field.authorised_value %]
766         [% SWITCH field.authorised_value %]
767         [% CASE 'branches' %]
768             [% IF field.mandatory %]
769             <select name="bib_field_value" required="required">
770             [% ELSE %]
771             <select name="bib_field_value">
772             [% END %]
773                 <option value=""></option>
774                 [% PROCESS options_for_libraries libraries => Branches.all( selected => "FIXME" ) %]
775             </select>
776         [% CASE 'itemtypes' %]
777             [% IF field.mandatory %]
778             <select name="bib_field_value" required="required">
779             [% ELSE %]
780             <select name="bib_field_value">
781             [% END %]
782                 <option value=""></option>
783                 [% PROCESS options_for_item_types itemtypes => ItemTypes.Get(), selected_itemtype => "FIXME" %]
784             </select>
785         [% CASE 'cn_source' %]
786         [% CASE %]
787             [% PROCESS 'av-build-dropbox.inc' name="bib_field_value", category=field.authorised_value, default="FIXME" %]
788         [% END %]
789     [% ELSE %]
790         [% IF field.mandatory %]
791         <input type="text" name="bib_field_value" value="[% field.value | html %]" required="required" size="50" />
792         [% ELSE %]
793         <input type="text" name="bib_field_value" value="[% field.value | html %]" size="50" />
794         [% END %]
795
796     [% END %]
797     <input type="hidden" name="bib_kohafield" value="[% field.kohafield | html %]" />
798     <input type="hidden" name="bib_tag" value="[% field.tag | html %]" />
799     <input type="hidden" name="bib_subfield" value="[% field.subfield | html %]" />
800     [% IF field.mandatory %] <span class="required">Required</span>[% END %]
801 [% END %]