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