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