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