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