Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / orderreceive.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE Price %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Acquisitions &rsaquo; Receipt summary for : [% name | html %] [% IF ( invoice ) %]invoice, [% invoice | html %][% END %]</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="acq_orderreceive" class="acq">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'acquisitions-search.inc' %]
15
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% name | html %]</a> &rsaquo; Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]][% END %] (order #[% ordernumber | html %])</div>
17
18 <div id="doc3" class="yui-t2">
19    
20    <div id="bd">
21         <div id="yui-main">
22         <div class="yui-b">
23
24 <h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% ordernumber | html %])</h1>
25
26 [% IF ( count ) %]
27     <form action="/cgi-bin/koha/acqui/finishreceive.pl" method="post" onsubmit="return Check(this);">
28 <div class="yui-g">
29 <div class="yui-u first">
30     <div class="error" style="display:none"></div>
31
32     <fieldset class="rows">
33     <legend>Catalog details</legend>
34     <ol><li><span class="label">Title: </span><span class="title">[% title | html %]</span></li>
35     <li> <span class="label">Author: </span>
36         [% author | html %]</li>
37     <li><span class="label">Copyright: </span>
38         [% copyrightdate | html %]</li>
39     <li> <span class="label">ISBN: </span>
40         [% isbn | html %]</li>
41     <li> <span class="label">Series: </span>
42         [% seriestitle | html %]</li>
43     </ol>
44         </fieldset>
45
46     [% IF ( suggestionid ) %]
47         <fieldset class="rows">
48         <legend>Suggestion</legend>
49         <ol>
50           <li>
51             <span class="label">Suggested by: </span>
52             [% surnamesuggestedby | html %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid | html %]&amp;op=show">suggestion #[% suggestionid | html %]</a>)
53           </li>
54         </ol>
55         </fieldset>
56     [% END %]
57
58     [% IF (AcqCreateItemReceiving) %]
59         <div id="items_list" style="display:none">
60             <p><b>Items list</b></p>
61             <div style="width:100%;overflow:auto;">
62                 <table>
63                     <thead>
64                         <tr>
65                             <th>&nbsp;</th>
66                             <th>&nbsp;</th>
67                             <th>Barcode</th>
68                             <th>Home library</th>
69                             <th>Holding library</th>
70                             <th>Not for loan</th>
71                             <th>Restricted</th>
72                             <th>Location</th>
73                             <th>Call number</th>
74                             <th>Copy number</th>
75                             <th>Inventory number</th>
76                             <th>Collection code</th>
77                             <th>Item type</th>
78                             <th>Materials</th>
79                             <th>Notes</th>
80                         </tr>
81                     </thead>
82                     <tbody>
83                     </tbody>
84                 </table>
85             </div>
86         </div>
87
88         [% UNLESS subscriptionid %]
89           <fieldset class="rows" id="itemfieldset">
90               <legend>Item</legend>
91               [% IF ( NoACQframework ) %]
92                   <p class="required">
93                       No ACQ framework, using default. You should create a
94                       framework with code ACQ, the items framework would be
95                       used
96                   </p>
97               [% END %]
98               <div id="outeritemblock"></div>
99           </fieldset>
100         [% END %]
101     [% ELSIF (AcqCreateItem == 'ordering') %]
102         [% IF (items.size) %]
103             <h5>Items</h5>
104             <div style="width:100%;overflow:auto">
105                 <table>
106                     <thead>
107                         <tr>
108                             <th>Receive?</th>
109                             <th>&nbsp;</th>
110                             <th>Barcode</th>
111                             <th>Home branch</th>
112                             <th>Holding branch</th>
113                             <th>Not for loan</th>
114                             <th>Restricted</th>
115                             <th>Location</th>
116                             <th>Call number</th>
117                             <th>Copy number</th>
118                             <th>Inventory number</th>
119                             <th>Collection code</th>
120                             <th>Item type</th>
121                             <th>Materials</th>
122                             <th>Notes</th>
123                         </tr>
124                     </thead>
125                     <tbody>
126                         [% FOREACH item IN items %]
127                             <tr id="item_[% item.itemnumber | html %]">
128                                 <td style="text-align:center"><input type="checkbox" name="items_to_receive" value="[% item.itemnumber | html %]" /></td>
129                                 <td><a style="cursor:pointer" onclick="PopupEditPage([% item.biblionumber | html %],[% item.itemnumber | html %]);">Edit</a></td>
130                                 <td>[% item.barcode | html %]</td>
131                                 <td>[% Branches.GetName( item.homebranch ) | html %]</td>
132                                 <td>[% Branches.GetName( item.holdingbranch ) | html %]</td>
133                                 <td>[% item.notforloan | html %]</td>
134                                 <td>[% item.restricted | html %]</td>
135                                 <td>[% item.location | html %]</td>
136                                 <td>[% item.itemcallnumber | html %]</td>
137                                 <td>[% item.copynumber | html %]</td>
138                                 <td>[% item.stocknumber | html %]</td>
139                                 <td>[% item.collection | html %]</td>
140                                 <td>[% item.itemtype | html %]</td>
141                                 <td>[% item.materials | html %]</td>
142                                 <td>[% item.itemnotes | html %]</td>
143                             </tr>
144                         [% END %]
145                     </tbody>
146                 </table>
147             </div>
148         [% END %]
149     [% END %]
150     <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
151     <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
152     <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
153     <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
154         </div>
155         <div class="yui-u">
156     <fieldset class="rows">
157     <legend>Accounting details</legend>
158         <ol>
159             <li>
160                 <label for="datereceived">Date received: </label>
161                 <input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | $KohaDates %]" class="datepicker" />
162             </li>
163        <li><label for="bookfund">Fund: </label><select id="bookfund" name="bookfund">
164             <option value="">Keep current ([% budget_period_description | html %] - [% bookfund | html %])</option>
165             [% FOREACH period IN budget_loop %]
166                 <optgroup label="[% period.description | html %]">
167                 [% FOREACH fund IN period.funds %]
168                     [% IF ( fund.b_sel ) %]
169                         <option value="[% fund.b_id | html %]" selected="selected">[% fund.b_txt | html %]</option>
170                     [% ELSE %]
171                         <option value="[% fund.b_id | html %]">[% fund.b_txt | html %]</option>
172                     [% END %]
173                 [% END %]
174                 </optgroup>
175             [% END %]
176        </select></li>
177        <li><label>&nbsp;</label><span>(Current: [% budget_period_description | html %] - [% bookfund | html %])</span></li>
178        <li>
179         <label for="creator">Ordered by: </label>
180         <span>
181             [% INCLUDE 'patron-title.inc' patron = creator %]
182         </span>
183        </li>
184        <li><label for="quantity_to_receive">Quantity to receive: </label><span class="label">
185            [% IF ( edit and not subscriptionid) %]
186                <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity | html %]" />
187            [% ELSE%]
188                <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity | html %]" />
189            [% END %]
190            </span></li>
191         <li><label for="quantity">Quantity received: </label>
192           [% IF (AcqCreateItemReceiving) %]
193             [% IF ( subscriptionid ) %]
194               <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="1" />
195             [% ELSE %]
196               <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" />
197             [% END %]
198           [% ELSE %]
199             [% IF ( quantityreceived ) %]
200                 [% IF ( edit ) %]
201                     <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived | html %]" />
202                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
203                 [% ELSE %]
204                     [% IF ( items ) %]
205                         <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 | html %]" />
206                     [% ELSE %]
207                         <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 | html %]" />
208                     [% END %]
209                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
210                 [% END %]
211             [% ELSE %]
212                 [% IF ( subscriptionid ) %]
213                     <input type="text" readonly="readonly" id="quantity" size="20" name="quantityrec" value="1" />
214                 [% ELSE %]
215                     <input type="text" id="quantity" size="20" name="quantityrec" value="1" />
216                 [% END %]
217                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" />
218             [% END %]
219             <div id="qtyrecerror" style="display:none">
220                 <p class="error">Warning, you have entered more items than expected.
221                 Items will not be created.</p>
222             </div>
223           [% END %][%# IF (AcqCreateItemReceiving) %]
224                 </li>
225
226         [% IF ( gst_values ) %]
227             <li>
228                 <label for="tax_rate">Tax rate: </label>
229                 <select name="tax_rate" id="tax_rate">
230                 [% FOREACH gst IN gst_values %]
231                     [% IF gst.option == tax_rate %]
232                         <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
233                     [% ELSE %]
234                         <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
235                     [% END %]
236                 [% END %]
237                 </select>
238             </li>
239         [% ELSE %]
240             <input type="hidden" name="tax_rate" value="0" />
241         [% END %]
242
243         <li><label for="rrp">Replacement cost: </label>[% rrp | $Price | html %]</li>
244         <li><label for="ecost">Budgeted cost: </label>[% ecost | $Price | html %]</li>
245         <li>
246             <label for="unitprice">Actual cost:</label>
247             <input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 | html %]" />
248         </li>
249         <li><label for="order_internalnote">Internal note: </label><textarea name="order_internalnote" width="40" rows="8" >[% order_internalnote | html %]</textarea></li>
250         [% IF order_vendornote %]
251             <li><label for="order_vendornote">Vendor note: </label><span>[% order_vendornote | html %]</span></li>
252         [% END %]
253         </ol>
254     </fieldset>
255
256 </div>
257 </div><div class="yui-g"><fieldset class="action">
258         <input type="submit"  value="Save" class="button" accesskey="w" />
259         <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1">Cancel</a>
260 </fieldset></div>    </form>
261 [% ELSE %]
262     This ordernumber does not exist.
263 [% END %]
264
265 </div>
266 </div>
267 <div class="yui-b">
268 [% INCLUDE 'acquisitions-menu.inc' %]
269 </div>
270 </div>
271
272 [% MACRO jsinclude BLOCK %]
273     [% Asset.js("js/acquisitions-menu.js") | $raw %]
274 [% INCLUDE 'calendar.inc' %]
275     [% INCLUDE 'additem.js.inc' %]
276     [% Asset.js("js/additem.js") | $raw %]
277     [% Asset.js("js/cataloging.js") | $raw %]
278     [% Asset.js("js/prevent_submit.js") | $raw %]
279     <script type="text/javascript">
280         function Check(form) {
281             [% IF (AcqCreateItemReceiving) %]
282                 var total_errors = CheckMandatorySubfields(form);
283                 if (total_errors != 0) {
284                     var alertString = _("Form not submitted because of the following problem(s)");
285                     alertString += "\n------------------------------------------------------------------------------------\n";
286                     alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
287                     alert(alertString);
288                     return false;
289                 }
290
291                 if(check_additem('[% UniqueItemFields | html %]') == false){
292                     alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
293                     return false;
294                 };
295
296                 // Remove last itemblock if it is not in items_list
297                 var lastitemblock = $("#outeritemblock > div:last");
298                 var tobedeleted = true;
299                 var listitems = $("#items_list tr");
300                 $(listitems).each(function(){
301                     if($(this).attr('idblock') == $(lastitemblock).attr('id')){
302                         tobedeleted = false;
303                     }
304                 });
305                 if(tobedeleted){
306                     $(lastitemblock).remove();
307                 }
308
309                 if(check_additem('[% UniqueItemFields | html %]') == false){
310                     alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
311                     if(tobedeleted) {
312                         $(lastitemblock).appendTo("#outeritemblock");
313                     }
314                     return false;
315                 };
316             [% END %]
317
318             return true;
319         }
320
321         [% IF (AcqCreateItem == 'ordering') %]
322             var items_columns = [null, null, 'barcode', 'homebranchname',
323                 'holdingbranchname', 'notforloan', 'restricted', 'location',
324                 'itemcallnumber', 'copynumber', 'stocknumber', 'collection',
325                 'itemtype', 'materials', 'itemnotes'];
326
327             function PopupEditPage(biblionumber, itemnumber) {
328                 var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber="
329                     + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem";
330                 var w = window.open(url);
331                 var watchClose = setInterval(function() {
332                     if (w.closed) {
333                         clearTimeout(watchClose);
334                         $.getJSON('/cgi-bin/koha/catalogue/getitem-ajax.pl',
335                             {
336                                 'itemnumber': itemnumber
337                             },
338                             function(item) {
339                                 var tds = $("#item_"+itemnumber+" td");
340                                 for(var i=2; i<tds.length; i++) {
341                                     var column = items_columns[i];
342                                     var text = item[column];
343                                     if ( text == null ) text = '';
344                                     $(tds[i]).text(text);
345                                 }
346                             }
347                         );
348                     }
349                 }, 500);
350             }
351
352             function CalcQtyToReceive() {
353                 var qty = $("input[name='items_to_receive']:checked").length;
354                 $("#quantity").val(qty);
355             }
356
357             function CheckNItems(n) {
358                 $("input[name='items_to_receive']").each(function() {
359                     $(this).prop('checked', false);
360                 });
361                 $("input[name='items_to_receive']:lt("+n+")").each(function () {
362                     $(this).prop('checked', true);
363                 });
364             }
365         [% END %]
366
367         $(document).ready(function() {
368             [% IF (AcqCreateItemReceiving) %]
369                 cloneItemBlock(0, '[% UniqueItemFields | html %]');
370             [% ELSIF (AcqCreateItem == 'ordering') && not subscriptionid %]
371                 $("input[name='items_to_receive']").change(function() {
372                     CalcQtyToReceive();
373                 });
374                 CalcQtyToReceive();
375                 $("#quantity").keyup(function() {
376                     var qty = parseInt($("#quantity").val());
377                     var qtyto = parseInt($("#quantity_to_receive").val());
378                     if(qty > qtyto) {
379                         $("#qtyrecerror").show();
380                     } else {
381                         $("#qtyrecerror").hide();
382                     }
383                     CheckNItems($(this).val());
384                 });
385             [% END %]
386         });
387     </script>
388 [% END %]
389
390 [% INCLUDE 'intranet-bottom.inc' %]