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