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