Lines 27-35
Link Here
|
27 |
[% END %] |
27 |
[% END %] |
28 |
[% WRAPPER breadcrumb_item bc_active= 1 %] |
28 |
[% WRAPPER breadcrumb_item bc_active= 1 %] |
29 |
[% IF ( invoice ) %] |
29 |
[% IF ( invoice ) %] |
30 |
<span>Receive items from: [% name | html %] [[% invoice | html %]] (order #[% order.ordernumber | html %])</span> |
30 |
<span>Receive items from: [% name | html %] [[% invoice | html %]] (order #[% multiple_orders | html %])</span> |
31 |
[% ELSE %] |
31 |
[% ELSE %] |
32 |
<span>Receive items from: [% name | html %] (order #[% order.ordernumber | html %])</span> |
32 |
<span>Receive items from: [% name | html %] (order #[% multiple_orders | html %])</span> |
33 |
[% END %] |
33 |
[% END %] |
34 |
[% END %] |
34 |
[% END %] |
35 |
[% END #/ WRAPPER breadcrumbs %] |
35 |
[% END #/ WRAPPER breadcrumbs %] |
Lines 37-459
Link Here
|
37 |
|
37 |
|
38 |
<div class="main container-fluid"> |
38 |
<div class="main container-fluid"> |
39 |
<div class="row"> |
39 |
<div class="row"> |
40 |
[% AcqCreateItem = order.basket.effective_create_items %] |
|
|
41 |
<div class="col-sm-10 col-sm-push-2"> |
40 |
<div class="col-sm-10 col-sm-push-2"> |
42 |
<main> |
41 |
<main> |
43 |
|
42 |
|
44 |
<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% order.ordernumber | html %])</h1> |
43 |
<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% multiple_orders | html %])</h1> |
45 |
|
44 |
|
46 |
[% IF ( order ) %] |
45 |
[% IF multiple_orders %] |
47 |
<form id="f" action="/cgi-bin/koha/acqui/finishreceive.pl" class="noEnterSubmit" method="post" onsubmit="return Check(this);"> |
46 |
<table id="multiple_orders" class="table table-bordered table-striped"> |
48 |
<div class="row"> |
47 |
<thead> |
49 |
<div class="col-sm-6"> |
48 |
<tr> |
50 |
<div class="dialog alert order_error" style="display:none"></div> |
49 |
<th>Order</td> |
51 |
|
50 |
<th>Title</th> |
52 |
<fieldset class="rows"> |
51 |
<th>Author</th> |
53 |
<legend>Catalog details</legend> |
52 |
<th>ISBN</th> |
54 |
<ol> |
53 |
<th>Date received</th> |
55 |
<li> |
54 |
<th>Fund</th> |
56 |
<span class="label">Title: </span> |
55 |
<th>Quantity</th> |
57 |
[% INCLUDE 'biblio-title.inc' biblio=order.biblio link = 1 %] |
56 |
<th> </th> |
58 |
</li> |
57 |
</tr> |
59 |
<li> <span class="label">Author: </span> |
58 |
</thead> |
60 |
[% order.biblio.author | html %]</li> |
59 |
</table> |
61 |
<li><span class="label">Copyright: </span> |
60 |
|
62 |
[% order.biblio.copyrightdate | html %]</li> |
61 |
<div class="col"> |
63 |
<li> <span class="label">ISBN: </span> |
62 |
<fieldset class="action"> |
64 |
[% order.biblio.biblioitem.isbn | html %]</li> |
63 |
<button class="save btn btn-primary" disabled>Save</button> |
65 |
<li> <span class="label">Series: </span> |
64 |
<a class="cancel btn btn-default" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1">Cancel</a> |
66 |
[% order.biblio.seriestitle | html %]</li> |
|
|
67 |
</ol> |
68 |
</fieldset> |
69 |
|
70 |
[% IF suggestion %] |
71 |
<fieldset class="rows"> |
72 |
<legend>Suggestion</legend> |
73 |
<ol> |
74 |
<li> |
75 |
<span class="label">Suggested by: </span> |
76 |
[% suggestion.surnamesuggestedby | html %][% IF suggestion.firstnamesuggestedby %], [% suggestion.firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestion.suggestionid | uri %]&op=show">suggestion #[% suggestion.suggestionid | html %]</a>) |
77 |
[% IF suggestion.reason %] |
78 |
<li> |
79 |
<span class="label">Reason:</span> |
80 |
[% SET suggestion_reasons = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %] |
81 |
[% SET other_reason = 1 %] |
82 |
<select class="select-reason" id="reason" name="reason"> |
83 |
<option value=""> -- Choose a reason -- </option> |
84 |
[% FOREACH reason IN suggestion_reasons %] |
85 |
[% IF reason.lib == suggestion.reason %] |
86 |
<option value="[% reason.lib | html %]" selected="selected">[% reason.lib | html %]</option> |
87 |
[% SET other_reason = 0 %] |
88 |
[% ELSE %] |
89 |
<option value="[% reason.lib | html %]">[% reason.lib | html %]</option> |
90 |
[% END %] |
91 |
[% END %] |
92 |
<option value="other">Others...</option> |
93 |
</select> |
94 |
|
95 |
<span id="other_reason" name="other_reason"> |
96 |
[% IF other_reason %] |
97 |
<input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason | html %]"/> |
98 |
[% ELSE %] |
99 |
<input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." /> |
100 |
[% END %] |
101 |
<a href="#back">Cancel</a> |
102 |
</span> |
103 |
|
104 |
<input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" /> |
105 |
</li> |
106 |
[% END %] |
107 |
</li> |
108 |
</ol> |
109 |
</fieldset> |
110 |
[% END %] |
111 |
|
112 |
[% IF order.subscriptionid and orders.count %] |
113 |
<fieldset class="rows"> |
114 |
<legend>Receipt history for this subscription</legend> |
115 |
<table id="orders"> |
116 |
<thead> |
117 |
<tr> |
118 |
<th>Invoice</th> |
119 |
<th>Order number</th> |
120 |
<th>Creation date</th> |
121 |
<th>Receive date</th> |
122 |
<th>Quantity received</th> |
123 |
<th>Status</th> |
124 |
<th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th> |
125 |
<th>Internal note</th> |
126 |
</tr> |
127 |
</thead> |
128 |
<tbody> |
129 |
[% FOR suborder IN orders %] |
130 |
<tr> |
131 |
<td> |
132 |
[% IF suborder.invoice %] |
133 |
[% IF CAN_user_acquisition %] |
134 |
<a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% suborder.invoiceid | uri %]" title="Invoice detail page"> |
135 |
[% suborder.invoice.invoicenumber | html %]</a> |
136 |
[% ELSE %] |
137 |
[% suborder.invoice.invoicenumber | html %] |
138 |
[% END %] |
139 |
[% END %] |
140 |
</td> |
141 |
<td>[% suborder.ordernumber | html %]</td> |
142 |
<td data-order="[% suborder.basket.creationdate | uri %]">[% suborder.basket.creationdate | $KohaDates%]</td> |
143 |
<td data-order="[% suborder.datereceived | uri %]"> |
144 |
[% IF suborder.datereceived %] |
145 |
[% suborder.datereceived | $KohaDates %] |
146 |
[% END %] |
147 |
</td> |
148 |
<td>[% suborder.quantityreceived | html %]</td> |
149 |
[% SWITCH suborder.orderstatus %] |
150 |
[%# FIXME We should only see/display Complete here, right? %] |
151 |
[% CASE 'new' %] |
152 |
<td data-order="status_1"> |
153 |
<span>New</span> |
154 |
[% CASE 'ordered' %] |
155 |
<td data-order="status_2"> |
156 |
<span>Ordered</span> |
157 |
[% CASE 'partial' %] |
158 |
<td data-order="status_3"> |
159 |
<span>Partial</span> |
160 |
[% CASE 'complete' %] |
161 |
<td data-order="status_4"> |
162 |
<span>Complete</span> |
163 |
[% CASE 'cancelled' %] |
164 |
<td data-order="status_5"> |
165 |
<span>Cancelled</span> |
166 |
[% END %] |
167 |
</td> |
168 |
<td> |
169 |
[% IF suborder.datereceived %][%# FIXME Should only be true, right? %] |
170 |
[%# FIXME What if unitprice has not been filled? %] |
171 |
[% suborder.unitprice_tax_excluded * suborder.quantity | $Price %] / [% suborder.unitprice_tax_included * suborder.quantity | $Price %] |
172 |
[% END %] |
173 |
</td> |
174 |
<td>[% suborder.order_internalnote | html %]</td> |
175 |
</tr> |
176 |
[% END %] |
177 |
</tbody> |
178 |
</table> |
179 |
</fieldset> |
65 |
</fieldset> |
180 |
[% ELSIF (AcqCreateItem == 'receiving') %] |
66 |
<div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div> |
181 |
<div id="items_list" style="display:none"> |
67 |
</div> |
182 |
<p><strong>Items list</strong></p> |
|
|
183 |
<div style="width:100%;overflow:auto;"> |
184 |
<table> |
185 |
<thead> |
186 |
<tr> |
187 |
<th class="noExport">Actions</th> |
188 |
<th>Barcode</th> |
189 |
<th>Home library</th> |
190 |
<th>Holding library</th> |
191 |
<th>Not for loan</th> |
192 |
<th>Restricted</th> |
193 |
<th>Location</th> |
194 |
<th>Call number</th> |
195 |
<th>Copy number</th> |
196 |
<th>Inventory number</th> |
197 |
<th>Collection</th> |
198 |
<th>Item type</th> |
199 |
<th>Materials</th> |
200 |
<th>Notes</th> |
201 |
</tr> |
202 |
</thead> |
203 |
<tbody> |
204 |
</tbody> |
205 |
</table> |
206 |
</div> |
207 |
</div> |
208 |
|
68 |
|
209 |
[% UNLESS order.subscriptionid %] |
69 |
<div class="modal fade" id="order_edit" tabindex="-1" role="dialog" aria-labelledby="Order edit"> |
210 |
<fieldset class="rows" id="itemfieldset"> |
70 |
<div id="receive-modal" class="modal-dialog modal-lg" role="document"> |
211 |
<legend>Item</legend> |
71 |
<div class="modal-content modal-lg"> |
212 |
[% IF ( NoACQframework ) %] |
72 |
<div class="modal-header row"> |
213 |
<p class="required"> |
73 |
<h4 class="col-md-11 modal-title"></h4> |
214 |
No ACQ framework, using default. You should create a |
74 |
<button type="button" class="close col-md-1" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
215 |
framework with code ACQ, the items framework would be |
75 |
</div> |
216 |
used |
76 |
<div class="modal-body"> |
217 |
</p> |
77 |
<div class="hide" id="loading">Loading ...</div> |
218 |
[% END %] |
78 |
<div id="modal-order-main row"> |
219 |
<div id="outeritemblock"></div> |
79 |
<!--ul> |
220 |
</fieldset> |
80 |
<li><a href="#info-panel">Info</a></li> |
221 |
[% END %] |
81 |
<li><a href="#accounting-panel">Accounting</a></li> |
222 |
[% ELSIF (AcqCreateItem == 'ordering') %] |
82 |
<li><a href="#history-panel">Receipt history</a></li> |
223 |
[% IF (order.items) %] |
83 |
<li><a href="#items-panel">Items</a></li> |
224 |
<div class="page-section" style="width:100%;overflow:auto"> |
84 |
</ul--> |
225 |
<h2>Items</h2> |
85 |
|
226 |
<table> |
86 |
<div class="col-md-12 col-lg-6"> |
227 |
<thead> |
87 |
<div id="info-panel" class="page-section"> |
228 |
<tr> |
88 |
<div> |
229 |
<th>Receive?</th> |
89 |
<h4>Catalog details</h4> |
230 |
<th> </th> |
90 |
|
231 |
<th>Barcode</th> |
91 |
<div class="row"> <span class="lbl col-sm-4">Title: </span><span class="col-sm-8" id="biblio_title"></span></div> |
232 |
<th>Home library</th> |
92 |
<div class="row"> <span class="lbl col-sm-4">Author: </span><span class="col-sm-8" id="biblio_author"></span></div> |
233 |
<th>Current library</th> |
93 |
<div class="row"> <span class="lbl col-sm-4">Copyright: </span><span class="col-sm-8" id="biblio_copyright_date"></span></div> |
234 |
<th>Not for loan</th> |
94 |
<div class="row"> <span class="lbl col-sm-4">ISBN: </span><span class="col-sm-8" id="biblio_isbn"></span></div> |
235 |
<th>Restricted</th> |
95 |
<div class="row"> <span class="lbl col-sm-4">Series: </span><span class="col-sm-8" id="biblio_series_title"></span></div> |
236 |
<th>Location</th> |
96 |
|
237 |
<th>Call number</th> |
97 |
</div> |
238 |
<th>Copy number</th> |
98 |
<div id="suggestion_fieldset"> |
239 |
<th>Inventory number</th> |
99 |
<h4>Suggestion</h4> |
240 |
<th>Collection</th> |
100 |
<div class="row"> |
241 |
<th>Item type</th> |
101 |
<span class="lbl col-sm-4">Suggested by: </span> <span class="col-sm-8" id="biblio_suggestion_suggester"></span> |
242 |
<th>Materials</th> |
102 |
</div> |
243 |
<th>Notes</th> |
103 |
<div class="row" id="suggestion_reason"> |
244 |
</tr> |
104 |
<span class="lbl col-sm-4">Reason:</span> |
245 |
</thead> |
105 |
<div class="col-sm-8"> |
246 |
<tbody> |
106 |
[% SET suggestion_reasons = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %] |
247 |
[% FOREACH item IN order.items %] |
107 |
<select class="select-reason" id="reason" name="reason"> |
248 |
<tr id="item_[% item.itemnumber | html %]"> |
108 |
<option value=""> -- Choose a reason -- </option> |
249 |
<td style="text-align:center"><input type="checkbox" name="items_to_receive" value="[% item.itemnumber | html %]" /></td> |
109 |
[% FOREACH reason IN suggestion_reasons %] |
250 |
<td><a style="cursor:pointer" onclick="PopupEditPage([% item.biblionumber | html %],[% item.itemnumber | html %]);">Edit</a></td> |
110 |
<option value="[% reason.lib | html %]">[% reason.lib | html %]</option> |
251 |
<td>[% item.barcode | html %]</td> |
111 |
[% END %] |
252 |
<td>[% Branches.GetName( item.homebranch ) | html %]</td> |
112 |
<option value="other">Others...</option> |
253 |
<td>[% Branches.GetName( item.holdingbranch ) | html %]</td> |
113 |
</select> |
254 |
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) | html %]</td> |
114 |
|
255 |
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) | html %]</td> |
115 |
<span id="other_reason" name="other_reason"> |
256 |
<td><span class="shelvingloc">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]</span></td> |
116 |
<input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." /> |
257 |
<td>[% item.itemcallnumber | html %]</td> |
117 |
<a href="#back">Cancel</a> |
258 |
<td>[% item.copynumber | html %]</td> |
118 |
</span> |
259 |
<td>[% item.stocknumber | html %]</td> |
119 |
</div> |
260 |
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td> |
120 |
</div> |
261 |
<td>[% ItemTypes.GetDescription( item.itype ) | html %]</td> |
121 |
</div> |
262 |
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.materials', authorised_value => item.materials ) | html %]</td> |
122 |
</div> |
263 |
<td>[% item.itemnotes | html %]</td> |
123 |
<div id="history-panel" class="page-section"> |
264 |
</tr> |
124 |
<div id="child_orders"> |
265 |
[% END %] |
125 |
<h4>Receipt history for this subscription</h4> |
266 |
</tbody> |
126 |
<table id="child_orders_table"> |
267 |
</table> |
127 |
<thead> |
|
|
128 |
<tr> |
129 |
<th>Invoice</th> |
130 |
<th>Order number</th> |
131 |
<th>Creation date</th> |
132 |
<th>Receive date</th> |
133 |
<th>Quantity received</th> |
134 |
<th>Status</th> |
135 |
<th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th> |
136 |
<th>Internal note</th> |
137 |
</tr> |
138 |
</thead> |
139 |
</table> |
140 |
</div> |
141 |
</div> |
142 |
<div id="items-panel" class="page-section"> |
143 |
<div id="acq-create-receiving"> |
144 |
<div id="items_list" style="display: none"> |
145 |
<h4>Items list</h4> |
146 |
<div style="width:100%;overflow:auto;"> |
147 |
<table> |
148 |
<thead> |
149 |
<tr> |
150 |
<th>Actions</th> |
151 |
<th>Barcode</th> |
152 |
<th>Home library</th> |
153 |
<th>Holding library</th> |
154 |
<th>Not for loan</th> |
155 |
<th>Restricted</th> |
156 |
<th>Location</th> |
157 |
<th>Call number</th> |
158 |
<th>Copy number</th> |
159 |
<th>Inventory number</th> |
160 |
<th>Collection</th> |
161 |
<th>Item type</th> |
162 |
<th>Materials</th> |
163 |
<th>Notes</th> |
164 |
</tr> |
165 |
</thead> |
166 |
<tbody> |
167 |
</tbody> |
168 |
</table> |
169 |
</div> |
170 |
</div> |
171 |
|
172 |
<div id="itemfieldset"> |
173 |
<h4>Item</h4> |
174 |
[% IF ( NoACQframework ) %] |
175 |
<p class="required"> |
176 |
No ACQ framework, using default. You should create a |
177 |
framework with code ACQ, the items framework would be |
178 |
used |
179 |
</p> |
180 |
[% END %] |
181 |
<div id="outeritemblock"></div> |
182 |
</div> |
183 |
</div> |
184 |
<div id="acq-create-ordering"> |
185 |
<h4>Items</h4> |
186 |
<div style="width:100%;overflow:auto"> |
187 |
<table> |
188 |
<thead> |
189 |
<tr> |
190 |
<th>Receive?</th> |
191 |
<th> </th> |
192 |
<th>Barcode</th> |
193 |
<th>Home library</th> |
194 |
<th>Current library</th> |
195 |
<th>Not for loan</th> |
196 |
<th>Restricted</th> |
197 |
<th>Location</th> |
198 |
<th>Call number</th> |
199 |
<th>Copy number</th> |
200 |
<th>Inventory number</th> |
201 |
<th>Collection</th> |
202 |
<th>Item type</th> |
203 |
<th>Materials</th> |
204 |
<th>Notes</th> |
205 |
</tr> |
206 |
</thead> |
207 |
<tbody> |
208 |
</tbody> |
209 |
</table> |
210 |
</div> |
211 |
</div> |
212 |
</div> |
213 |
</div> |
214 |
<div class="col-md-12 col-lg-6"> |
215 |
<div id="accounting-panel" class="page-section"> |
216 |
<h4>Accounting details</h4> |
217 |
<ol> |
218 |
<li> |
219 |
<label for="datereceived">Date received: </label> |
220 |
<input type="text" size="10" id="datereceived" name="datereceived" class="datepicker" /> |
221 |
</li> |
222 |
<li> |
223 |
<label for="bookfund">Fund: </label> |
224 |
<select id="bookfund" name="bookfund"> |
225 |
<option value=""></option> |
226 |
[% FOREACH period IN budget_loop %] |
227 |
<optgroup label="[% period.description | html %]"> |
228 |
[% FOREACH fund IN period.funds %] |
229 |
<option value="[% fund.b_id | html %]">[% fund.b_txt | html %]</option> |
230 |
[% END %] |
231 |
</optgroup> |
232 |
[% END %] |
233 |
</select> |
234 |
</li> |
235 |
<li> |
236 |
<label> </label> |
237 |
<span id="current-fund"></span> |
238 |
</li> |
239 |
<li> |
240 |
<label for="creator">Ordered by: </label> |
241 |
<span id="creator"></span> |
242 |
</li> |
243 |
<li> |
244 |
<label for="quantity_to_receive">Quantity ordered: </label> |
245 |
<input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" /> |
246 |
</li> |
247 |
<li> |
248 |
<label for="quantity">Quantity received: </label> |
249 |
<input type="text" size="20" name="quantityrec" id="quantity" /> |
250 |
<div id="qtyrecerror" style="display:none"> |
251 |
<p class="error">Warning, you have entered more items than expected. |
252 |
Items will not be created.</p> |
253 |
</div> |
254 |
</li> |
255 |
|
256 |
[% IF ( gst_values ) %] |
257 |
<li> |
258 |
<label for="tax_rate">Tax rate: </label> |
259 |
<select name="tax_rate" id="tax_rate"> |
260 |
[% FOREACH gst IN gst_values %] |
261 |
<option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option> |
262 |
[% END %] |
263 |
</select> |
264 |
</li> |
265 |
[% END %] |
266 |
|
267 |
<li> |
268 |
<label for="rrp">Retail price: </label> |
269 |
<span id="rrp"></span> |
270 |
<li> |
271 |
<label for="replacementprice">Replacement price:</label> |
272 |
<input type="text" size="20" name="replacementprice" id="replacementprice" /> |
273 |
</li> |
274 |
<li> |
275 |
<label for="ecost">Budgeted cost: </label> |
276 |
<span id="ecost"></span> |
277 |
</li> |
278 |
<li> |
279 |
<label for="unitprice">Actual cost:</label> |
280 |
<input type="text" size="20" name="unitprice" id="unitprice" /> |
281 |
<span id="unitprice_hint" class="hint"></span> |
282 |
<label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label> |
283 |
</li> |
284 |
<li id="select_currency"> |
285 |
<label for="unitprice_currency"></label> |
286 |
<input type="text" size="20" name="unitprice_currency" id="unitprice_currency" value="" /> |
287 |
[% IF currencies.count %] |
288 |
<select name="currency"> |
289 |
<option value="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option> |
290 |
[% FOR currency IN currencies %] |
291 |
<option value="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option> |
292 |
[% END %] |
293 |
</select> |
294 |
[% END %] |
295 |
</li> |
296 |
<li> |
297 |
<label for="order_internalnote">Internal note: </label> |
298 |
<textarea name="order_internalnote" id="order_internalnote" width="40" rows="8" ></textarea> |
299 |
</li> |
300 |
<li> |
301 |
<label for="order_vendornote">Vendor note: </label> |
302 |
<span id="order_vendornote"></span> |
303 |
</li> |
304 |
</ol> |
305 |
</div> |
306 |
</div> |
307 |
</div> |
308 |
</div> |
309 |
<div class="modal-footer"> |
310 |
<button type="button" class="btn btn-defualt modal-prev">Previous order</button> |
311 |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
312 |
<button type="button" class="btn btn-primary modal-save">Save changes</button> |
313 |
<button type="button" class="btn btn-defualt modal-next">Next order</button> |
314 |
</div> |
268 |
</div> |
315 |
</div> |
269 |
[% END %] |
316 |
</div> |
270 |
[% END %] |
317 |
</div> |
271 |
<input type="hidden" name="biblionumber" value="[% order.biblionumber | html %]" /> |
318 |
<div class="modal fade" id="modal_messages" tabindex="-1" role="dialog" aria-labelledby="Order edit"> |
272 |
<input type="hidden" name="invoiceid" value="[% invoiceid | html %]" /> |
319 |
<div class="modal-dialog" role="document"> |
273 |
<input type="hidden" name="ordernumber" value="[% order.ordernumber | html %]" /> |
320 |
<div class="modal-content"> |
274 |
<input type="hidden" name="booksellerid" value="[% order.basket.booksellerid | html %]" /> |
321 |
<div class="modal-header"> |
275 |
</div> |
322 |
<h4 class="col-md-11 modal-title"></h4> |
276 |
<div class="col-sm-6"> |
323 |
<button type="button" class="close col-md-1" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
277 |
<fieldset class="rows"> |
324 |
</div> |
278 |
<legend>Accounting details</legend> |
325 |
<div class="modal-body"> |
279 |
<ol> |
326 |
<ul></ul> |
280 |
<li> |
327 |
</div> |
281 |
<label for="datereceived">Date received: </label> |
328 |
<div class="modal-footer"> |
282 |
<input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | html %]" class="flatpickr" /> |
329 |
<button type="button" class="btn btn-primary accept">Accept</button> |
283 |
<div class="hint">[% INCLUDE 'date-format.inc' %]</div> |
330 |
<button type="button" class="btn btn-default cancel">Cancel</button> |
284 |
</li> |
331 |
</div> |
285 |
<li> |
|
|
286 |
<label class="required" for="bookfund">Fund: </label> |
287 |
[% active_count = 0 %] |
288 |
[% IF !ordernumber %] |
289 |
[% FOREACH budget_period IN budget_loops.keys %] |
290 |
[% FOREACH fund IN budget_loops.$budget_period.funds %] |
291 |
[% active_count= active_count + fund.b_active %] |
292 |
[% END %] |
293 |
[% END %] |
294 |
[% END %] |
295 |
<select class="select2" id="bookfund" name="bookfund"> |
296 |
<optgroup label="Current"> |
297 |
<option value="[% order.fund.budget.id | html %]" selected="selected" data-sort1-authcat="[% order.fund.sort1_authcat | html %]" data-sort2-authcat="[% order.fund.sort2_authcat | html %]"> |
298 |
Keep current ([% order.fund.budget_name | html %])</option> |
299 |
</optgroup> |
300 |
[% FOREACH budget_period_id IN budget_loops.keys %] |
301 |
[% SET budget_period = budget_loops.$budget_period_id %] |
302 |
[% IF budget_period.active %] |
303 |
<optgroup label="[% budget_period.description | html %]"> |
304 |
[% ELSE %] |
305 |
<optgroup class="inactive_budget" label="[% budget_period.description | html %] (Inactive)"> |
306 |
[% END %] |
307 |
[% FOREACH budget_loo IN budget_period.funds %] |
308 |
[% level_indent_cnt = 0 %] |
309 |
[% level_indent = "" %] |
310 |
[% WHILE level_indent_cnt < budget_loo.b_level %] |
311 |
[% level_indent = level_indent _ " -- " %] |
312 |
[% level_indent_cnt = level_indent_cnt +1 %] |
313 |
[% END %] |
314 |
|
315 |
[% IF ( budget_loo.b_sel ) %] |
316 |
[% active_count = 0 #select no other fund %] |
317 |
<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 %]"> |
318 |
[% ELSIF active_count==1 && budget_loo.b_active %] |
319 |
<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 %]"> |
320 |
[% ELSE %] |
321 |
[% bdgclass=budget_loo.b_active? "": "inactive_budget" | html %] |
322 |
<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 %]"> |
323 |
[% END %] |
324 |
[% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %] |
325 |
</option> |
326 |
[% END %] |
327 |
</optgroup> |
328 |
[% END %] |
329 |
</select> |
330 |
<span class="required">Required</span> |
331 |
<label for="showallbudgets" style="float:none;"> Show inactive:</label> |
332 |
<input type="checkbox" id="showallbudgets" /> |
333 |
</li> |
334 |
<li><label> </label><span>(Current: [% budget_period_description | html %] - [% bookfund | html %])</span></li> |
335 |
<li> |
336 |
<label for="creator">Ordered by: </label> |
337 |
<span> |
338 |
[% INCLUDE 'patron-title.inc' patron = creator %] |
339 |
</span> |
340 |
</li> |
341 |
<li><label for="quantity_to_receive">Quantity ordered: </label><span class="label"> |
342 |
[% IF edit or order.subscriptionid %] |
343 |
<input type="text" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" /> |
344 |
[% ELSE%] |
345 |
<input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" /> |
346 |
[% END %] |
347 |
</span></li> |
348 |
<li><label for="quantity">Quantity received: </label> |
349 |
[% IF order.subscriptionid %] |
350 |
<input type="text" inputmode="numeric" pattern="[0-9]*" size="20" name="quantityrec" id="quantity" value="[% order.quantity | html %]" /> |
351 |
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" /> |
352 |
[% ELSIF AcqCreateItem == 'receiving' %] |
353 |
<input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" /> |
354 |
[% ELSE %] |
355 |
[% IF ( order.quantityreceived ) %] |
356 |
[% IF ( edit ) %] |
357 |
<input type="text" inputmode="numeric" pattern="[0-9]*" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived | html %]" /> |
358 |
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" /> |
359 |
[% ELSE %] |
360 |
[% IF ( order.items.count ) %] |
361 |
<input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived + 1 | html %]" /> |
362 |
[% ELSE %] |
363 |
<input type="text" inputmode="numeric" pattern="[0-9]*" size="20" name="quantityrec" id="quantity" value="[% quantityreceived + 1 | html %]" /> |
364 |
[% END %] |
365 |
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" /> |
366 |
[% END %] |
367 |
[% ELSE %] |
368 |
<input type="text" inputmode="numeric" pattern="[0-9]*" id="quantity" size="20" name="quantityrec" value="1" /> |
369 |
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" /> |
370 |
[% END %] |
371 |
<div id="qtyrecerror" style="display:none"> |
372 |
<p class="error">Warning, you have entered more items than expected. |
373 |
Items will not be created.</p> |
374 |
</div> |
332 |
</div> |
375 |
[% END %][%# IF (order.subscriptionid) ELSIF (AcqCreateItem == 'receiving' ) %] |
333 |
</div> |
376 |
</li> |
334 |
</div> |
377 |
|
|
|
378 |
[% IF ( gst_values ) %] |
379 |
<li> |
380 |
<label for="tax_rate">Tax rate: </label> |
381 |
<select name="tax_rate" id="tax_rate"> |
382 |
[% tax_rate = order.tax_rate_on_receiving || order.tax_rate_on_ordering %] |
383 |
[% tax_rate = tax_rate + 0 %] |
384 |
[% FOREACH gst IN gst_values %] |
385 |
[% IF gst.option == tax_rate %] |
386 |
<option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option> |
387 |
[% ELSE %] |
388 |
<option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option> |
389 |
[% END %] |
390 |
[% END %] |
391 |
</select> |
392 |
</li> |
393 |
[% ELSE %] |
394 |
<input type="hidden" name="tax_rate" value="0" /> |
395 |
[% END %] |
396 |
|
397 |
<li><label for="rrp">Retail price: </label> |
398 |
[% IF (invoiceincgst == 1) %] |
399 |
[% order.rrp_tax_included | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax inclusive)</span></li> |
400 |
[% ELSE %] |
401 |
[% order.rrp_tax_excluded | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax exclusive)</span></li> |
402 |
[% END %] |
403 |
<li> |
404 |
<label for="replacementprice">Replacement price:</label> |
405 |
<input type="text" size="20" name="replacementprice" id="replacementprice" value="[% order.replacementprice | $Price on_editing => 1 %]" /> |
406 |
</li> |
407 |
<li> |
408 |
[% IF (invoiceincgst) %] |
409 |
<label for="ecost">Budgeted cost: </label>[% order.ecost_tax_included | $Price %] <span class="hint">(tax inclusive)</span> |
410 |
[% ELSE %] |
411 |
<label for="ecost">Budgeted cost: </label>[% order.ecost_tax_excluded | $Price %] <span class="hint">(tax exclusive)</span> |
412 |
[% END %] |
413 |
</li> |
414 |
<li> |
415 |
<label for="unitprice">Actual cost:</label> |
416 |
[% IF (invoiceincgst) %] |
417 |
[% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_included : order.ecost_tax_included %] |
418 |
<input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax inclusive)</span> |
419 |
[% ELSE %] |
420 |
[% SET unitprice = order.unitprice_tax_included > 0 ? order.unitprice_tax_excluded : order.ecost_tax_excluded %] |
421 |
<input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" /> <span class="hint">(tax exclusive)</span> |
422 |
[% END %] |
423 |
<label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label> |
424 |
</li> |
425 |
<li id="select_currency"> |
426 |
<label for="invoice_unitprice"></label> |
427 |
<input type="text" size="20" name="invoice_unitprice" id="invoice_unitprice" value="[% order.invoice_unitprice | $Price on_editing => 1 %]" /> |
428 |
[% IF currencies.count %] |
429 |
<select name="invoice_currency"> |
430 |
[% IF order.invoice_currency == active_currency.currency %] |
431 |
<option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option> |
432 |
[% ELSE %] |
433 |
<option value="[% active_currency.currency | html %]" data-rate="[% active_currency.rate | html %]">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option> |
434 |
[% END %] |
435 |
[% FOR currency IN currencies %] |
436 |
[% IF order.invoice_currency == currency.currency %] |
437 |
<option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]" selected="selected">[% currency.currency | html %] ([% currency.symbol | html %])</option> |
438 |
[% ELSE %] |
439 |
<option value="[% currency.currency | html%]" data-rate="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option> |
440 |
[% END %] |
441 |
[% END %] |
442 |
</select> |
443 |
[% END %] |
444 |
</li> |
445 |
<li><label for="order_internalnote">Internal note: </label><textarea name="order_internalnote" width="40" rows="8" >[% order_internalnote | html %]</textarea></li> |
446 |
[% IF order_vendornote %] |
447 |
<li><label for="order_vendornote">Vendor note: </label><span>[% order_vendornote | html %]</span></li> |
448 |
[% END %] |
449 |
</ol> |
450 |
</fieldset> |
451 |
|
452 |
</div> |
453 |
</div><div class="row"><fieldset class="action"> |
454 |
<input type="submit" value="Save" class="btn btn-primary" accesskey="w" /> |
455 |
<a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]">Cancel</a> |
456 |
</fieldset></div> </form> |
457 |
[% ELSE %] |
335 |
[% ELSE %] |
458 |
This ordernumber does not exist. |
336 |
This ordernumber does not exist. |
459 |
[% END %] |
337 |
[% END %] |
Lines 469-650
Link Here
|
469 |
</div> <!-- /.row --> |
347 |
</div> <!-- /.row --> |
470 |
[% MACRO jsinclude BLOCK %] |
348 |
[% MACRO jsinclude BLOCK %] |
471 |
[% Asset.js("js/acquisitions-menu.js") | $raw %] |
349 |
[% Asset.js("js/acquisitions-menu.js") | $raw %] |
472 |
[% INCLUDE 'calendar.inc' %] |
350 |
[% INCLUDE 'calendar.inc' %] |
473 |
[% Asset.js("js/additem.js") | $raw %] |
351 |
[% Asset.js("js/additem.js") | $raw %] |
474 |
[% Asset.js("js/cataloging.js") | $raw %] |
352 |
[% Asset.js("js/cataloging.js") | $raw %] |
475 |
[% INCLUDE 'select2.inc' %] |
353 |
[% INCLUDE 'select2.inc' %] |
|
|
354 |
[% INCLUDE 'datatables.inc' %] |
355 |
[% INCLUDE 'js-date-format.inc' %] |
356 |
[% INCLUDE 'format_price.inc' %] |
357 |
[% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] |
358 |
<style> |
359 |
@media (min-width: 1200px) { |
360 |
#receive-modal, #receive-modal .modal-content { |
361 |
width: 1150px; |
362 |
} |
363 |
} |
364 |
#receive-modal .modal-body { |
365 |
background-color: #F3F4F4; |
366 |
} |
367 |
|
368 |
.lbl { |
369 |
font-weight: 700; |
370 |
text-align: right; |
371 |
} |
372 |
.modal-body ol { |
373 |
list-style-type: none; |
374 |
} |
375 |
|
376 |
.modal-body ol li { |
377 |
list-style-type: none; |
378 |
padding-bottom: 1em; |
379 |
width: 100%; |
380 |
} |
381 |
|
382 |
.modal-body h4 { |
383 |
margin-left: 1em; |
384 |
padding: .2em .5em; |
385 |
margin-bottom: 17px; |
386 |
} |
387 |
|
388 |
.modal-body label { |
389 |
margin-right: 1em; |
390 |
text-align: right; |
391 |
width: 11em; |
392 |
display: inline-block; |
393 |
font-weight: 700; |
394 |
} |
395 |
|
396 |
.modal-body textarea { |
397 |
vertical-align: text-top; |
398 |
} |
399 |
</style> |
476 |
<script> |
400 |
<script> |
477 |
function Check(form) { |
401 |
function display_string(key, strings, fallback) { |
478 |
[% IF (AcqCreateItem == 'receiving') %] |
402 |
if ( strings.hasOwnProperty(key) ) { |
479 |
var total_errors = CheckMandatorySubfields(form); |
403 |
return strings[key].str && escape_str(strings[key].str) || ''; |
480 |
if (total_errors != 0) { |
404 |
} |
481 |
var alertString = _("Form not submitted because of the following problem(s)"); |
405 |
return fallback != null ? fallback : ''; |
482 |
alertString += "\n------------------------------------------------------------------------------------\n"; |
406 |
} |
483 |
alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors); |
407 |
|
484 |
alert(alertString); |
408 |
var _build_item = function(item, tr) { |
485 |
return false; |
409 |
var chb = $('<input type="checkbox" name="items_to_receive" value="'+item.item_id+'" />') |
|
|
410 |
.prop('checked', item._checked) |
411 |
.change(function() { |
412 |
item._checked = $(this).prop('checked'); |
413 |
}); |
414 |
tr.append($('<td style="text-align:center"></td>').append(chb)); |
415 |
tr.append('<td><a style="cursor:pointer" onclick="PopupEditPage('+item.biblio_id+', '+item.item_id+');">'+EDIT[0].toUpperCase()+EDIT.substr(1).toLowerCase()+'</a></td>'); |
416 |
tr.append('<td>'+(item.external_id||'')+'</td>'); |
417 |
tr.append('<td>'+display_string( 'home_library_id', item._strings, item.home_library_id ) || ''+'</td>'); |
418 |
tr.append('<td>'+display_string( 'holding_library_id', item._strings, item.holding_library_id )+'</td>'); |
419 |
tr.append('<td>'+display_string( 'not_for_loan_status', item._strings, item.not_for_loan_status )+'</td>'); |
420 |
tr.append('<td>'+display_string( 'restricted_status', item._strings, item.restricted_status )+'</td>'); |
421 |
tr.append('<td><span class="shelvingloc">'+display_string( 'location', item._strings, item.location )+'</span></td>'); |
422 |
tr.append('<td>'+(item.callnumber||'')+'</td>'); |
423 |
tr.append('<td>'+(item.copy_number||'')+'</td>'); |
424 |
tr.append('<td>'+(item.inventory_number||'')+'</td>'); |
425 |
tr.append('<td>'+display_string( 'collection', item._strings, item.collection )+'</td>'); |
426 |
tr.append('<td>'+display_string( 'item_type_id', item._strings, item.item_type_id )+'</td>'); |
427 |
tr.append('<td>'+display_string( 'materials_notes', item._strings, item.materials_notes )+'</td>'); |
428 |
tr.append('<td>'+(item.public_notes||'')+'</td>'); |
429 |
}; |
430 |
|
431 |
var items_columns = [null, null, 'external_id', 'home_library_id', |
432 |
'holding_library_id', 'not_for_loan_status', 'restricted_status', 'location', |
433 |
'callnumber', 'copy_number', 'inventory_number', 'collection_code', |
434 |
'item_type', 'materials_notes', 'public_notes']; |
435 |
|
436 |
function PopupEditPage(biblionumber, itemnumber) { |
437 |
var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=" |
438 |
+ biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem"; |
439 |
var w = window.open(url); |
440 |
var watchClose = setInterval(function() { |
441 |
if (w.closed) { |
442 |
clearTimeout(watchClose); |
443 |
$.ajax({ |
444 |
dataType: "json", |
445 |
headers: { |
446 |
"x-koha-embed": "+strings" |
447 |
}, |
448 |
url: '/api/v1/items/'+itemnumber, |
449 |
success: function(item) { |
450 |
var tr = $("#item_"+itemnumber); |
451 |
tr.html(''); |
452 |
_build_item(item, tr); |
453 |
} |
454 |
}); |
486 |
} |
455 |
} |
|
|
456 |
}, 500); |
457 |
} |
487 |
|
458 |
|
488 |
if(check_additem('[% Koha.Preference("UniqueItemFields") | html %]') == false){ |
459 |
var periods={}; |
489 |
alert(_("Duplicate values detected. Please correct the errors and resubmit.") ); |
460 |
var funds={}; |
490 |
return false; |
461 |
var funds_tree = []; |
491 |
}; |
462 |
|
|
|
463 |
var QTY_TOTAL = _("Receiving %0$s out of %1$s"); |
464 |
var EDIT = _("edit"); |
465 |
var MOD_TITLE = _("Edit %s"); |
466 |
var SUGGESTION = _("suggestion #%s"); |
467 |
var FUND_KEEP = _("Keep current (%0$s - %1$s)"); |
468 |
var FUNC_CUR = _("(Current: %0$s - %1$s)"); |
469 |
var ADJ_TAX_INC = _("(adjusted for %s, tax inclusive)"); |
470 |
var ADJ_TAX_EXC = _("(adjusted for %s, tax exclusive)"); |
471 |
var TAX_INC = _("(tax inclusive)"); |
472 |
var TAX_EXC = _("(tax exclusive)"); |
473 |
var SAVE_WARNING = _("Order %s: Warning, you have entered more items than expected. Extra items will not be created."); |
474 |
var SAVE_WARNING_NO_ITEMS = _("Order %s: No quantity to receive set. No items will be created."); |
475 |
var SAVE_ERROR = _("Order %s: An error occurred while saving"); |
476 |
var SAVE_WARNING_TITLE = _("Warning"); |
477 |
var SAVE_ERROR_TITLE = _("Error"); |
478 |
|
479 |
|
480 |
var CAN_user_acquisition = "[% CAN_user_acquisition | html %]"; |
481 |
var AcqCreateItem = "[% Koha.Preference('AcqCreateItem') | html %]"; |
482 |
var edit_mode = "[% edit | html %]"; |
483 |
var invoiceincgst = "[% invoiceincgst | html %]"; |
484 |
var active_currency = "[% active_currency.currency | html %]"; |
485 |
var invoice_id = "[% invoiceid | html %]"; |
492 |
|
486 |
|
493 |
// Remove last itemblock if it is not in items_list |
487 |
$(document).ready(function(){ |
494 |
var lastitemblock = $("#outeritemblock > div:last"); |
488 |
var base_query = { "order_id": {"in": [[% multiple_orders | html %]]}}; |
495 |
var tobedeleted = true; |
489 |
var pending_orders_url = "/api/v1/acquisitions/orders?only_active=1"; |
496 |
var listitems = $("#items_list tr"); |
490 |
var options = { |
497 |
$(listitems).each(function(){ |
491 |
"ajax": { |
498 |
if($(this).attr('idblock') == $(lastitemblock).attr('id')){ |
492 |
"url": pending_orders_url + "&q=" + encodeURI(JSON.stringify(base_query)) |
499 |
tobedeleted = false; |
493 |
}, |
|
|
494 |
"embed": [ |
495 |
"basket", |
496 |
"biblio.suggestions.suggester", |
497 |
"fund.budget", |
498 |
"items+strings", |
499 |
"creator" |
500 |
], |
501 |
'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
502 |
"columns": [ |
503 |
{ |
504 |
"data": "order_id", |
505 |
"searchable": true, |
506 |
"orderable": true |
507 |
}, |
508 |
{ |
509 |
"data": "biblio.title", |
510 |
"searchable": true, |
511 |
"orderable": true, |
512 |
"render": function(data, type, row, meta) { |
513 |
if ( data == null ) { |
514 |
return ""; |
515 |
} |
516 |
else { |
517 |
return data; |
518 |
} |
519 |
} |
520 |
}, |
521 |
{ |
522 |
"data": "biblio.author", |
523 |
"searchable": true, |
524 |
"orderable": true, |
525 |
"render": function(data, type, row, meta) { |
526 |
if ( data == null ) { |
527 |
return ""; |
528 |
} |
529 |
else { |
530 |
return data; |
531 |
} |
532 |
} |
533 |
}, |
534 |
{ |
535 |
"data": "biblio.isbn", |
536 |
"searchable": true, |
537 |
"orderable": true, |
538 |
"render": function(data, type, row, meta) { |
539 |
if ( data == null ) { |
540 |
return ""; |
541 |
} |
542 |
else { |
543 |
return data; |
544 |
} |
545 |
} |
546 |
}, |
547 |
{ |
548 |
"searchable": false, |
549 |
"orderable": false, |
550 |
"data": function(row, type, val, meta) { |
551 |
return $date(row.date_received||new Date().toISOString()); |
552 |
} |
553 |
}, |
554 |
{ |
555 |
"data": "fund.name", |
556 |
"searchable": true, |
557 |
"orderable": false, |
558 |
"render": function(data, type, row, meta) { |
559 |
return row.fund.budget.budget_period_description+" - "+row.fund.name; |
560 |
} |
561 |
}, |
562 |
{ |
563 |
"searchable": false, |
564 |
"orderable": true, |
565 |
"data": "quantity_received", |
566 |
"render": function(data, type, row, meta) { |
567 |
var data = $("#order_edit").data(); |
568 |
return QTY_TOTAL.format(row.subscription_id&&(!data.saved||!data.saved.hasOwnProperty(row.order_id))?row.quantity:row.quantity_received, row.quantity); |
569 |
} |
570 |
}, |
571 |
{ |
572 |
"searchable": false, |
573 |
"orderable": false, |
574 |
"render": function(data, type, row, meta) { |
575 |
return '<a data-toggle="modal" href="#order_edit" data-row="'+meta.row+'" class="order_edit_toggle">'+EDIT+'</a>'; |
576 |
} |
500 |
} |
577 |
} |
501 |
}); |
578 |
] |
502 |
if(tobedeleted){ |
579 |
}; |
503 |
$(lastitemblock).remove(); |
580 |
var orders_table = $("#multiple_orders").kohaTable(options); |
504 |
} |
581 |
var api = orders_table.api(); |
505 |
|
582 |
|
506 |
if(check_additem('[% Koha.Preference("UniqueItemFields") | html %]') == false){ |
583 |
api.on('preDraw', function() { |
507 |
alert(_("Duplicate values detected. Please correct the errors and resubmit.") ); |
584 |
var saved = $("#order_edit").data('saved'); |
508 |
if(tobedeleted) { |
585 |
if(saved) { |
509 |
$(lastitemblock).appendTo("#outeritemblock"); |
586 |
var data = api.data(); |
|
|
587 |
for(var i = 0; i<data.length; i++) { |
588 |
var row = data[i]; |
589 |
var srow = saved[row.order_id]; |
590 |
if(srow) { |
591 |
if(row.fund_id != srow.fund_id) { |
592 |
row.fund.budget.budget_period_description = $("#bookfund option[value="+srow.fund_id+"]").parent().attr('label'); |
593 |
row.fund.name = $("#bookfund option[value="+srow.fund_id+"]").html(); |
594 |
} |
595 |
row.date_received = srow.date_received; |
596 |
row.quantity = srow.quantity; |
597 |
row.quantity_received = srow.quantity_received; |
598 |
} |
510 |
} |
599 |
} |
511 |
return false; |
600 |
} |
512 |
}; |
601 |
}); |
513 |
[% END %] |
|
|
514 |
|
602 |
|
515 |
if( $("#quantity").val() < 1 ) { |
603 |
var _doSave = function(params) { |
516 |
alert(_("You must receive at least one item")); |
604 |
$.ajax($.extend({ |
517 |
return false; |
605 |
method: 'POST', |
518 |
} |
606 |
url: '/cgi-bin/koha/acqui/finishreceive.pl' |
|
|
607 |
}, params)); |
608 |
}; |
519 |
|
609 |
|
520 |
return true; |
610 |
var _transform_row = function(row, origrec) { |
521 |
} |
611 |
var params = {}; |
|
|
612 |
params['biblionumber'] = row.biblio_id; |
613 |
params['invoiceid'] = invoice_id; |
614 |
params['ordernumber'] = row.order_id; |
615 |
params['booksellerid'] = row.basket.vendor_id; |
522 |
|
616 |
|
523 |
[% IF (AcqCreateItem == 'ordering') %] |
617 |
if(row.biblio.suggestions.length && row.biblio.suggestions[0].reason) { |
524 |
var items_columns = [null, null, 'barcode', 'homebranchname', |
618 |
params["suggestionid"] = row.biblio.suggestions[0].suggestion_id; |
525 |
'holdingbranchname', 'notforloan', 'restricted', 'location', |
619 |
if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) { |
526 |
'itemcallnumber', 'copynumber', 'stocknumber', 'collection', |
620 |
params['reason'] = row.biblio.suggestions[0].reason; |
527 |
'itemtype', 'materials', 'itemnotes']; |
621 |
} else { |
528 |
|
622 |
params['reason'] = 'other'; |
529 |
function PopupEditPage(biblionumber, itemnumber) { |
623 |
params['other_reason'] = row.biblio.suggestions[0].reason; |
530 |
var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=" |
624 |
} |
531 |
+ biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem"; |
625 |
} |
532 |
var w = window.open(url); |
626 |
params['datereceived'] = row.date_received; |
533 |
var watchClose = setInterval(function() { |
627 |
params['bookfund'] = row.fund_id; |
534 |
if (w.closed) { |
628 |
params['quantity'] = row.quantity; |
535 |
clearTimeout(watchClose); |
629 |
params['quantityrec'] = row.quantity_received; |
536 |
$.getJSON('/cgi-bin/koha/catalogue/getitem-ajax.pl', |
630 |
params['origquantityrec'] = origrec; |
537 |
{ |
631 |
var effective_create_items = row.basket.create_items || AcqCreateItem; |
538 |
'itemnumber': itemnumber |
632 |
params['tax_rate'] = (effective_create_items == 'receiving')?row.tax_rate_on_receiving:row.tax_rate_on_ordering; |
|
|
633 |
params['replacementprice'] = row.replacement_price; |
634 |
params['unitprice'] = invoiceincgst=="1"?row.unit_price_tax_included:row.unit_price_tax_excluded; |
635 |
params['order_internalnote'] = row.internal_note; |
636 |
if(effective_create_items == 'receiving') { |
637 |
Object.keys(row.items).forEach(function(key) { |
638 |
var item = row.items[key]; |
639 |
Object.keys(item).forEach(function(key) { |
640 |
var field = item[key]; |
641 |
Object.keys(field).forEach(function(key) { |
642 |
if(!params[key]) params[key] = []; |
643 |
params[key].push(item[key]); |
644 |
}); |
645 |
}); |
646 |
}); |
647 |
} else if(effective_create_items == 'ordering') { |
648 |
params['items_to_receive'] = (row.items||[]) |
649 |
.filter(function(item) { |
650 |
return item._checked |
651 |
}) |
652 |
.map(function(item) { |
653 |
item.item_id; |
654 |
}) |
655 |
} |
656 |
return params; |
657 |
}; |
658 |
|
659 |
var save_rows = function(rows, data) { |
660 |
if(rows.length) { |
661 |
$('#jobpanel, #jobstatus').show(); |
662 |
errors = [] |
663 |
var loopRows = function(i) { |
664 |
var row = rows[i]; |
665 |
if(!row) { |
666 |
if(!errors.length) { |
667 |
location.href = "/cgi-bin/koha/acqui/parcel.pl?invoiceid="+invoice_id |
668 |
} else { |
669 |
$('#modal_messages .modal-header h4').html(SAVE_ERROR_TITLE); |
670 |
$('#modal_messages .modal-body ul').html(''); |
671 |
errors.forEach(function(error) { |
672 |
$('#modal_messages .modal-body ul').append('<li>'+error+'</li>'); |
673 |
}); |
674 |
$('#modal_messages .modal-footer .cancel').hide(); |
675 |
$('#modal_messages .modal-footer .accept').html(_("Accept")); |
676 |
$('#modal_messages .modal-footer .accept').one('click', function() { |
677 |
location.href = "/cgi-bin/koha/acqui/parcel.pl?invoiceid="+invoice_id |
678 |
}); |
679 |
$('#modal_messages').modal('show'); |
680 |
} |
681 |
return; |
682 |
} |
683 |
if(data.saved && data.saved[row.order_id]) { |
684 |
row = data.saved[row.order_id]; |
685 |
var origrec = data.origrec[row.order_id]; |
686 |
} else { |
687 |
var origrec = row.quantity_received; |
688 |
} |
689 |
var _set_percentage = function() { |
690 |
var percentage = Math.round(( (i+1) / rows.length) * 100); |
691 |
var bgproperty = (parseInt(percentage*2)-300)+"px 0px"; |
692 |
$("#jobprogress").css("background-position",bgproperty); |
693 |
$("#jobprogresspercent").text(percentage); |
694 |
} |
695 |
_doSave({ |
696 |
data: _transform_row(row, origrec), |
697 |
success: function() { |
698 |
_set_percentage(); |
699 |
loopRows(i+1); |
539 |
}, |
700 |
}, |
540 |
function(item) { |
701 |
error: function() { |
541 |
var tds = $("#item_"+itemnumber+" td"); |
702 |
_set_percentage() |
542 |
for(var i=2; i<tds.length; i++) { |
703 |
errors.push(SAVE_ERROR.format(row.order_id)); |
543 |
var column = items_columns[i]; |
704 |
loopRows(i+1); |
544 |
var text = item[column]; |
|
|
545 |
if ( text == null ) text = ''; |
546 |
$(tds[i]).text(text); |
547 |
} |
548 |
} |
705 |
} |
549 |
); |
706 |
}); |
|
|
707 |
}; |
708 |
loopRows(0) |
709 |
} |
710 |
}; |
711 |
|
712 |
var get_warnings = function(rows) { |
713 |
var warnings = []; |
714 |
rows.forEach(function(row) { |
715 |
if(row.quantity_received > row.quantity) { |
716 |
warnings.push(SAVE_WARNING.format(row.order_id)); |
717 |
row.quantity_received = row.quantity; |
550 |
} |
718 |
} |
551 |
}, 500); |
719 |
if(row.quantity_received == '0') { |
|
|
720 |
warnings.push(SAVE_WARNING_NO_ITEMS.format(row.order_id)); |
721 |
} |
722 |
}) |
723 |
return warnings; |
552 |
} |
724 |
} |
553 |
|
725 |
|
554 |
function CalcQtyToReceive() { |
726 |
$('#modal_messages .modal-footer .cancel').on('click', function() { |
555 |
var qty = $("input[name='items_to_receive']:checked").length; |
727 |
$('#modal_messages .modal-footer .accept').off('click'); |
556 |
$("#quantity").val(qty); |
728 |
$('#modal_messages').modal('hide'); |
557 |
} |
729 |
}) |
|
|
730 |
$('.save').click(function() { |
731 |
var data = $("#order_edit").data(); |
732 |
var rows = api.rows().data().toArray(); |
733 |
var redirect = true; |
734 |
var warnings = get_warnings(rows); |
735 |
if(warnings.length) { |
736 |
$('#modal_messages .modal-header h4').html(SAVE_WARNING_TITLE); |
737 |
$('#modal_messages .modal-body ul').html(''); |
738 |
warnings.forEach(function(warning) { |
739 |
$('#modal_messages .modal-body ul').append('<li>'+warning+'</li>'); |
740 |
}); |
741 |
$('#modal_messages .modal-footer .cancel').show(); |
742 |
$('#modal_messages .modal-footer .accept').html(_("Continue")); |
743 |
$('#modal_messages .modal-footer .accept').one('click', function() { |
744 |
$('#modal_messages').modal('hide'); |
745 |
save_rows(rows, data); |
746 |
}); |
747 |
$('#modal_messages').modal('show'); |
748 |
} else { |
749 |
save_rows(rows, data); |
750 |
} |
751 |
}); |
558 |
|
752 |
|
559 |
function CheckNItems(n) { |
|
|
560 |
$("input[name='items_to_receive']").each(function() { |
561 |
$(this).prop('checked', false); |
562 |
}); |
563 |
$("input[name='items_to_receive']:lt("+n+")").each(function () { |
564 |
$(this).prop('checked', true); |
565 |
}); |
566 |
} |
567 |
[% END %] |
568 |
|
753 |
|
569 |
$(document).ready(function() { |
754 |
$("#order_edit").on("change", "#reason", function() { |
|
|
755 |
var val = $(this).val(); |
756 |
var row = $("#order_edit").data('row'); |
757 |
if(val == 'other') { |
758 |
$("#other_reason").show(); |
759 |
$(this).hide(); |
760 |
} else { |
761 |
row.biblio.suggestions[0].reason = val; |
762 |
} |
763 |
}); |
764 |
|
765 |
$("#order_edit").on("change", "#select-other_reason", function() { |
766 |
var val = $(this).val(); |
767 |
var row = $("#order_edit").data('row'); |
768 |
row.biblio.suggestions[0].reason = val; |
769 |
}); |
570 |
|
770 |
|
571 |
//keep a copy of all budgets before removing the inactives |
771 |
$("#order_edit").on("click", "#other_reason a", function() { |
572 |
disabledBudgetsCopy = $('#bookfund').html(); |
772 |
$("#other_reason").hide(); |
573 |
$('#bookfund .inactive_budget').remove(); |
773 |
$("#reason").val(null).show(); |
|
|
774 |
}); |
574 |
|
775 |
|
575 |
$('#showallbudgets').click(function() { |
776 |
$("#order_edit").on("change", "#datereceived", function() { |
576 |
if ($(this).is(":checked")) { |
777 |
var val = $(this).val(); |
577 |
$('#bookfund').html(disabledBudgetsCopy); //Puts back all the funds |
778 |
var row = $("#order_edit").data('row'); |
578 |
} |
779 |
row.date_received = val; |
579 |
else { |
780 |
}); |
580 |
$('#bookfund .inactive_budget').remove(); |
781 |
|
|
|
782 |
$("#order_edit").on("change", "#bookfund", function() { |
783 |
var val = $(this).val(); |
784 |
var row = $("#order_edit").data('row'); |
785 |
row.fund_id = val; |
786 |
}); |
787 |
|
788 |
$("#order_edit").on("change", "#quantity_to_receive", function() { |
789 |
var val = $(this).val(); |
790 |
var row = $("#order_edit").data('row'); |
791 |
row.quantity = val; |
792 |
if(row.subscription_id) { |
793 |
$("#quantity").val(val).change(); |
581 |
} |
794 |
} |
582 |
}); |
795 |
}); |
583 |
|
796 |
|
584 |
[% IF (AcqCreateItem == 'receiving') %] |
797 |
$("#order_edit").on("change", "#quantity", function() { |
585 |
cloneItemBlock(0, '[% Koha.Preference('UniqueItemFields') | html %]'); |
798 |
var val = $(this).val(); |
586 |
[% ELSIF (AcqCreateItem == 'ordering') && not order.subscriptionid %] |
799 |
var row = $("#order_edit").data('row'); |
587 |
$("input[name='items_to_receive']").change(function() { |
800 |
row.quantity_received = val; |
588 |
CalcQtyToReceive(); |
801 |
var qtyto = parseInt($("#quantity_to_receive").val()); |
|
|
802 |
if(parseInt(val) > qtyto) { |
803 |
$("#qtyrecerror").show(); |
804 |
} else { |
805 |
$("#qtyrecerror").hide(); |
806 |
} |
807 |
$("input[name='items_to_receive']").each(function() { |
808 |
$(this).prop('checked', false).change(); |
589 |
}); |
809 |
}); |
590 |
CalcQtyToReceive(); |
810 |
$("input[name='items_to_receive']:lt("+val+")").each(function () { |
591 |
$("#quantity").keyup(function() { |
811 |
$(this).prop('checked', true).change(); |
592 |
var qty = parseInt($("#quantity").val()); |
|
|
593 |
var qtyto = parseInt($("#quantity_to_receive").val()); |
594 |
if(qty > qtyto) { |
595 |
$("#qtyrecerror").show(); |
596 |
} else { |
597 |
$("#qtyrecerror").hide(); |
598 |
} |
599 |
CheckNItems($(this).val()); |
600 |
}); |
812 |
}); |
601 |
[% END %] |
813 |
}); |
|
|
814 |
|
815 |
$("#order_edit").on("change", "input[name='items_to_receive']", function() { |
816 |
var qty = $("input[name='items_to_receive']:checked").length; |
817 |
$("#quantity").val(qty); |
818 |
var row = $("#order_edit").data('row'); |
819 |
row.quantity_received = qty; |
820 |
}) |
821 |
|
822 |
$("#order_edit").on("change", "#tax_rate", function() { |
823 |
var val = $(this).val(); |
824 |
if(val === null) $(this).val($('option:first-child', this).attr('value')); |
825 |
val = $(this).val(); |
826 |
var row = $("#order_edit").data('row'); |
827 |
var effective_create_items = row.basket.create_items || AcqCreateItem; |
828 |
if(effective_create_items == 'receiving') { |
829 |
row.tax_rate_on_receiving = val; |
830 |
} else { |
831 |
row.tax_rate_on_ordering = val; |
832 |
} |
833 |
|
834 |
}); |
602 |
|
835 |
|
603 |
$("input[name='change_currency']").on("change", function(){ |
836 |
$("#order_edit").on("change", "#unitprice", function() { |
|
|
837 |
var val = $(this).val(); |
838 |
var row = $("#order_edit").data('row'); |
839 |
if(invoiceincgst == "1") { |
840 |
row.unit_price_tax_included = val; |
841 |
} else { |
842 |
row.unit_price_tax_excluded = val; |
843 |
} |
844 |
|
845 |
}); |
846 |
|
847 |
$("#order_edit").on("change", "input[name='change_currency']", function(){ |
604 |
if ( $(this).is(":checked") ) { |
848 |
if ( $(this).is(":checked") ) { |
605 |
$("#select_currency").show(); |
849 |
$("#select_currency").show(); |
606 |
$("#unitprice").prop("readonly", "true"); |
850 |
$("#unitprice").prop("readonly", "true"); |
607 |
} else { |
851 |
} else { |
608 |
$("#select_currency").hide(); |
852 |
$("#select_currency").hide(); |
609 |
$("#invoice_unitprice").val(""); // Empty to not store the values |
|
|
610 |
$("#invoice_currency").val(""); |
611 |
$("#unitprice").prop("readonly", ""); |
853 |
$("#unitprice").prop("readonly", ""); |
612 |
} |
854 |
} |
613 |
}); |
855 |
}); |
614 |
|
856 |
|
615 |
[% IF order.invoice_unitprice %] |
857 |
function _update_unitprice() { |
616 |
$("input[name='change_currency']").click(); |
858 |
var rate = Number($("select[name='currency'] option:selected").val()); |
617 |
[% ELSE %] |
859 |
var unitprice = $("#unitprice_currency").val(); |
618 |
$("input[name='change_currency']").trigger('change'); |
|
|
619 |
[% END %] |
620 |
|
621 |
function update_unitprice() { |
622 |
var rate = Number($("select[name='invoice_currency'] option:selected").data('rate')); |
623 |
var unitprice = $("#invoice_unitprice").val(); |
624 |
var new_unitprice = Number( unitprice * rate ).toFixed(2); |
860 |
var new_unitprice = Number( unitprice * rate ).toFixed(2); |
625 |
$("#unitprice").val(new_unitprice); |
861 |
$("#unitprice").val(new_unitprice).change(); |
626 |
} |
862 |
} |
627 |
$("select[name='invoice_currency']").on("change", function(){update_unitprice()} ); |
863 |
$("#order_edit").on("change", "select[name='currency']", _update_unitprice ); |
628 |
$("#invoice_unitprice").on("change", function(){update_unitprice()} ); |
864 |
$("#order_edit").on("change", "#unitprice_currency", _update_unitprice ); |
629 |
|
865 |
|
630 |
[% IF other_reason %] |
866 |
$("#order_edit").on("change", "#replacementprice", function() { |
631 |
$(".select-reason").hide(); |
867 |
var val = $(this).val(); |
632 |
$(".select-reason").find("option[value='other']").attr("selected","selected"); |
868 |
var row = $("#order_edit").data('row'); |
633 |
$("#other_reason").show(); |
869 |
row.replacement_price = val; |
634 |
[% ELSE %] |
870 |
}); |
635 |
$("#other_reason").hide(); |
871 |
|
636 |
[% END %] |
872 |
$("#order_edit").on("change", "#order_internalnote", function() { |
637 |
$(".select-reason").change(function(){ |
873 |
var val = $(this).val(); |
638 |
if($(this).val() == "other"){ |
874 |
var row = $("#order_edit").data('row'); |
639 |
$(this).hide(); |
875 |
row.internal_note = val; |
640 |
$("#other_reason").show(); |
876 |
|
|
|
877 |
}); |
878 |
|
879 |
var keep_row = function() { |
880 |
var row = $("#order_edit").data('row'); |
881 |
var kept = $("#order_edit").data('kept')||{}; |
882 |
if($('#items_list tbody tr').length) { |
883 |
row.items = []; |
884 |
$('#items_list tbody tr').each(function() { |
885 |
var item = {}; |
886 |
$('#'+$(this).attr('idblock')).find('*[name=kohafield]').each(function() { |
887 |
var kf = $(this).val(); |
888 |
var obj = {}; |
889 |
$(this).parent().find('*[name]').each(function() { |
890 |
obj[$(this).prop('name')] = $(this).val(); |
891 |
}); |
892 |
item[kf] = obj; |
893 |
}); |
894 |
row.items.push(item); |
895 |
}); |
896 |
} |
897 |
kept[row.order_id] = row; |
898 |
$("#order_edit").data('kept', kept); |
899 |
}; |
900 |
|
901 |
var save_row = function() { |
902 |
keep_row(); |
903 |
var saved = $("#order_edit").data('saved')||{}; |
904 |
var kept = $("#order_edit").data('kept'); |
905 |
var saved_rows = $.extend(saved, kept); |
906 |
$("#order_edit").data('saved', saved_rows); |
907 |
api.draw(); |
908 |
return saved_rows; |
909 |
} |
910 |
|
911 |
var set_modal_buttons = function() { |
912 |
var n = $("#order_edit").data('n'); |
913 |
var info = api.page.info(); |
914 |
|
915 |
$('.modal-prev').prop('disabled', info.page == 0 && n == 0); |
916 |
$('.modal-next').prop('disabled', info.pages - 1 == info.page && info.end - info.start - 1 == n); |
917 |
}; |
918 |
|
919 |
var show_subs = function(row) { |
920 |
//$("#child_orders").show(); |
921 |
var had_rows = false; |
922 |
var base_query = { "subscription_id": row.subscription_id, "parent_order_id": row.order_id, "order_id": {"!=": row.order_id}}; |
923 |
var pending_orders_url = "/api/v1/acquisitions/orders"; |
924 |
var options = { |
925 |
"ajax": { |
926 |
"url": pending_orders_url + "?q=" + encodeURI(JSON.stringify(base_query)) |
927 |
}, |
928 |
"header_filter": true, |
929 |
"embed": [ |
930 |
"invoice", |
931 |
"basket" |
932 |
], |
933 |
"order": [[1, 'asc']], |
934 |
'dom': 'C<"top pager"ilpfB>tr<"bottom pager"ip>', |
935 |
"columns": [ |
936 |
{ |
937 |
"searchable": false, |
938 |
"orderable": false, |
939 |
"data": function(row, type, val, meta) { |
940 |
if(row.invoice) { |
941 |
if(CAN_user_acquisition) { |
942 |
return '<a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid='+row.invoice_id+'" title="Invoice detail page">'+row.invoice.invoice_number+"</a>"; |
943 |
} |
944 |
return row.invoice.invoice_number; |
945 |
} |
946 |
} |
947 |
}, |
948 |
{ |
949 |
"data": "order_id", |
950 |
"searchable": false, |
951 |
"orderable": false |
952 |
}, |
953 |
{ |
954 |
"searchable": false, |
955 |
"orderable": false, |
956 |
"data": "basket.creation_date", |
957 |
"render": function(data, type, row, meta) { |
958 |
return $date(row.basket.creation_date); |
959 |
} |
960 |
}, |
961 |
{ |
962 |
"searchable": false, |
963 |
"orderable": false, |
964 |
"data": function(row, type, val, meta) { |
965 |
return $date(row.date_received); |
966 |
} |
967 |
}, |
968 |
{ |
969 |
"searchable": false, |
970 |
"orderable": false, |
971 |
"data": function(row, type, val, meta) { |
972 |
return row.quantity_received; |
973 |
} |
974 |
}, |
975 |
{ |
976 |
"searchable": false, |
977 |
"orderable": true, |
978 |
"data": function(row, type, val, meta) { |
979 |
if(!row.status) return; |
980 |
var first_letter = row.status[0].toUpperCase(); |
981 |
return first_letter+row.status.substr(1).toLowerCase(); |
982 |
} |
983 |
}, |
984 |
{ |
985 |
"searchable": false, |
986 |
"orderable": false, |
987 |
"data": function(row, type, val, meta) { |
988 |
if(!row.date_received) return; |
989 |
return Number(row.unit_price_tax_excluded * row.quantity_received).format_price()+' / '+Number(row.unit_price_tax_included * row.quantity_received).format_price() |
990 |
} |
991 |
}, |
992 |
{ |
993 |
"searchable": false, |
994 |
"orderable": false, |
995 |
"data": function(row, type, val, meta) { |
996 |
return row.internal_note; |
997 |
} |
998 |
} |
999 |
] |
1000 |
}; |
1001 |
var child_orders_table = $("#child_orders_table").api(options); |
1002 |
var child_api = child_orders_table.api(); |
1003 |
child_api.on('preDraw', function() { |
1004 |
if(!child_api.data().length && !had_rows) return; |
1005 |
$("#history-panel").show(); |
1006 |
had_rows = true; |
1007 |
}); |
1008 |
}; |
1009 |
|
1010 |
var set_editor = function() { |
1011 |
var modal = $("#order_edit"); |
1012 |
var row = modal.data('row'); |
1013 |
var origrec = $("#order_edit").data('origrec')||{}; |
1014 |
if(!origrec.hasOwnProperty(row.order_id)) { |
1015 |
origrec[row.order_id] = row.quantity_received; |
1016 |
$("#order_edit").data('origrec', origrec); |
1017 |
} |
1018 |
if(row.subscription_id) { |
1019 |
row.quantity_received = row.quantity; |
1020 |
} |
1021 |
var keep = $("#order_edit").data('kept'); |
1022 |
if(keep && keep[row.order_id]) { |
1023 |
row = keep[row.order_id]; |
1024 |
modal.data('row', row); |
1025 |
} |
1026 |
$('input, select, textarea', '.modal-body').val(null) |
1027 |
modal.find(".modal-title").text(MOD_TITLE.format(row.biblio.title)); |
1028 |
["title", "author", "copyright_date", "isbn", "series_title"].forEach(function(key){ |
1029 |
var o = modal.find(".modal-body #biblio_"+key); |
1030 |
if(row.biblio[key] !== null) { |
1031 |
o.parent().show(); |
1032 |
o.html(row.biblio[key]); |
1033 |
} else { |
1034 |
o.parent().hide(); |
1035 |
} |
1036 |
}); |
1037 |
if(row.biblio.suggestions.length) { |
1038 |
$("#suggestion_fieldset").show(); |
1039 |
if(row.biblio.suggestions[0].suggester) { |
1040 |
$("#biblio_suggestion_suggester").parent().show(); |
1041 |
$("#biblio_suggestion_suggester") |
1042 |
.html( |
1043 |
[row.biblio.suggestions[0].suggester.surname, row.biblio.suggestions[0].suggester.firstname] |
1044 |
.filter(function(name){ |
1045 |
return name |
1046 |
}) |
1047 |
.join(', ')+' (<a href="http://localhost:8081/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='+row.biblio.suggestions[0].suggestionid+'&op=show">'+SUGGESTION.format(row.biblio.suggestions[0].suggestionid)+'</a>)' |
1048 |
); |
1049 |
} else { |
1050 |
$("#biblio_suggestion_suggester").parent().hide(); |
1051 |
} |
1052 |
if(row.biblio.suggestions[0].reason) { |
1053 |
$("#suggestion_reason").show(); |
1054 |
if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) { |
1055 |
$("#other_reason a").click(); |
1056 |
$("#reason").val(row.biblio.suggestions[0].reason); |
1057 |
$("#select-other_reason").val(null); |
1058 |
} else { |
1059 |
$("#reason").val("other").change(); |
1060 |
$("#select-other_reason").val(row.biblio.suggestions[0].reason); |
1061 |
} |
1062 |
|
1063 |
} else { |
1064 |
$("#suggestion_reason").hide(); |
1065 |
} |
1066 |
} else { |
1067 |
$("#suggestion_fieldset").hide(); |
1068 |
} |
1069 |
|
1070 |
var effective_create_items = row.basket.create_items || AcqCreateItem; |
1071 |
$("#datereceived").val(row.date_received||$date(new Date().toISOString())).change(); |
1072 |
$("#bookfund option[value='']").html(FUND_KEEP.format(row.fund.budget.budget_period_description, row.fund.name)); |
1073 |
if(row.fund_id != row.fund.fund_id) { |
1074 |
$("#bookfund").val(row.fund_id); |
1075 |
} |
1076 |
$("#current-fund").html(FUNC_CUR.format(row.fund.budget.budget_period_description, row.fund.name)); |
1077 |
$("#creator").html([row.creator.surname, row.creator.firstname].filter(function(name){return name}).join(', ')+" ("+row.creator.patron_id+')') |
1078 |
$("#quantity_to_receive").val(row.quantity).prop('readonly', !row.subscription_id); |
1079 |
$("#quantity").val(row.quantity_received).prop('readonly', !row.subscription_id && effective_create_items == 'receiving'); |
1080 |
$('#qtyrecerror').hide(); |
1081 |
var tax_rate = row.tax_rate_on_receiving || row.tax_rate_on_ordering; |
1082 |
$("#tax_rate").val(tax_rate).change(); |
1083 |
var rrp_txt; |
1084 |
var ecost_txt; |
1085 |
if(invoiceincgst == "1") { |
1086 |
rrp_txt = Number(row.rrp_tax_included).format_price()+'<span class="hint">'+ADJ_TAX_INC.format(active_currency)+"</span>"; |
1087 |
ecost_txt = Number(row.ecost_tax_included).format_price()+'<span class="hint">'+TAX_INC+"</span>"; |
1088 |
$("#unitprice").val(row.unit_price_tax_included); |
1089 |
$("#unitprice_hint").html(TAX_INC); |
1090 |
} else { |
1091 |
rrp_txt = Number(row.rrp_tax_excluded).format_price()+'<span class="hint">'+ADJ_TAX_EXC.format(active_currency)+"</span>"; |
1092 |
ecost_txt = Number(row.ecost_tax_excluded).format_price()+'<span class="hint">'+TAX_EXC+"</span>"; |
1093 |
$("#unitprice").val(row.unit_price_tax_excluded); |
1094 |
$("#unitprice_hint").html(TAX_EXC); |
1095 |
} |
1096 |
$("#rrp").html(rrp_txt); |
1097 |
$("#replacementprice").val(row.replacement_price); |
1098 |
$("#ecost").html(ecost_txt); |
1099 |
$("#order_internalnote").val(row.internal_note); |
1100 |
if(row.vendor_note) { |
1101 |
$("#order_vendornote").html(row.vendor_note); |
1102 |
$("#order_vendornote").parent().show(); |
1103 |
} else { |
1104 |
$("#order_vendornote").parent().hide(); |
1105 |
} |
1106 |
|
1107 |
|
1108 |
$("#history-panel").hide(); |
1109 |
|
1110 |
$('#items_list tbody tr, #outeritemblock > *, #acq-create-ordering tbody tr').remove(); |
1111 |
$('#items_list').hide(); |
1112 |
if(row.subscription_id) { |
1113 |
$('#modal-order-main #items-panel').removeClass('show').addClass('hide'); |
1114 |
$('#modal-order-main #history-panel').removeClass('hide').addClass('show'); |
1115 |
/*$('#modal-order-main').tabs("disable", "#items-panel"); |
1116 |
$('#modal-order-main').tabs("enable", "#history-panel"); |
1117 |
if($('#modal-order-main').tabs( "option", "active" ) == 3) { |
1118 |
$('#modal-order-main').tabs( "option", "active", 0); |
1119 |
}*/ |
1120 |
} else { |
1121 |
$('#modal-order-main #history-panel').removeClass('show').addClass('hide'); |
1122 |
$('#modal-order-main #items-panel').removeClass('hide').addClass('show'); |
1123 |
/*$('#modal-order-main').tabs("enable", "#items-panel"); |
1124 |
$('#modal-order-main').tabs("disable", "#history-panel"); |
1125 |
if($('#modal-order-main').tabs( "option", "active" ) == 2) { |
1126 |
$('#modal-order-main').tabs( "option", "active", 0); |
1127 |
}*/ |
1128 |
if(effective_create_items == 'receiving') { |
1129 |
$("#acq-create-receiving").show(); |
1130 |
$("#acq-create-ordering").hide(); |
1131 |
if(row.items && row.items.length) { |
1132 |
row.items.forEach(function(item, index) { |
1133 |
cloneItemBlock(index, '[% UniqueItemFields | html %]', function(block_id) { |
1134 |
var block = $('#'+block_id).hide(); |
1135 |
Object.keys(item).forEach(function(key) { |
1136 |
block |
1137 |
.find('*[name=kohafield][value="'+key+'"]') |
1138 |
.parent() |
1139 |
.find('*[name=field_value]') |
1140 |
.val(item[key].field_value); |
1141 |
}); |
1142 |
addItemInList(block_id, '[% UniqueItemFields | html %]'); |
1143 |
block.find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM ) ); |
1144 |
block.find("input[name='buttonPlusMulti']").remove(); |
1145 |
block.find("input[name='multiValue']").remove(); |
1146 |
}); |
1147 |
}); |
1148 |
} |
1149 |
cloneItemBlock((row.items && row.items.length) || 0, '[% UniqueItemFields | html %]'); |
1150 |
} else if (effective_create_items == 'ordering') { |
1151 |
$("#acq-create-receiving").hide(); |
1152 |
$("#acq-create-ordering").show(); |
1153 |
if(row.items.length) { |
1154 |
$("#acq-create-ordering tbody").append( |
1155 |
row.items.map(function(item) { |
1156 |
var tr = $('<tr id="item_'+item.item_id+'"/>'); |
1157 |
_build_item(item, tr); |
1158 |
return tr; |
1159 |
}) |
1160 |
); |
1161 |
} |
1162 |
} else { |
1163 |
$('#modal-order-main #items-panel').removeClass('show').addClass('hide'); |
1164 |
/* |
1165 |
if($('#modal-order-main').tabs( "option", "active" ) == 3) { |
1166 |
$('#modal-order-main').tabs( "option", "active", 0); |
1167 |
} |
1168 |
$('#modal-order-main').tabs("disable", "#items-panel"); |
1169 |
*/ |
1170 |
} |
1171 |
} |
1172 |
$("#select_currency").hide(); |
1173 |
$("#unitprice").prop("readonly", ""); |
1174 |
$("input[name='change_currency']").prop('checked', false); |
1175 |
set_modal_buttons(); |
1176 |
}; |
1177 |
|
1178 |
$('.modal-prev').click(function() { |
1179 |
var modal = $("#order_edit"); |
1180 |
keep_row(); |
1181 |
var n = modal.data('n'); |
1182 |
if(n > 0) { |
1183 |
n--; |
1184 |
modal.data('row', JSON.parse(JSON.stringify(api.row(n).data()))); |
1185 |
modal.data('n', n); |
1186 |
set_editor(); |
1187 |
} else { |
1188 |
$('.modal-next, .modal-prev').prop('disabled', true); |
1189 |
orders_table.one('draw.dt', function() { |
1190 |
var info = api.page.info(); |
1191 |
n = info.end - info.start - 1; |
1192 |
modal.data('row', JSON.parse(JSON.stringify(api.row(n).data()))); |
1193 |
modal.data('n', n); |
1194 |
set_editor(); |
1195 |
}); |
1196 |
api.page('previous').draw( 'page' ); |
641 |
} |
1197 |
} |
642 |
}); |
1198 |
}); |
643 |
$("a[href*=back]").click(function(){ |
1199 |
|
644 |
$(".select-reason").show().find("option[value='']").attr("selected","selected"); |
1200 |
$('.modal-next').click(function() { |
645 |
$("#other_reason").hide(); |
1201 |
var modal = $("#order_edit"); |
|
|
1202 |
keep_row(); |
1203 |
var n = modal.data('n'); |
1204 |
var info = api.page.info(); |
1205 |
if(n < info.end - info.start - 1) { |
1206 |
n++; |
1207 |
modal.data('row', JSON.parse(JSON.stringify(api.row(n).data()))); |
1208 |
modal.data('n', n); |
1209 |
set_editor(); |
1210 |
} else { |
1211 |
$('.modal-next, .modal-prev').prop('disabled', true); |
1212 |
orders_table.one('draw.dt', function() { |
1213 |
var info = api.page.info(); |
1214 |
n = 0; |
1215 |
modal.data('row', JSON.parse(JSON.stringify(api.row(n).data()))); |
1216 |
modal.data('n', n); |
1217 |
set_editor(); |
1218 |
}); |
1219 |
api.page('next').draw( 'page' ); |
1220 |
} |
1221 |
}); |
1222 |
|
1223 |
$('.modal-save').click(function() { |
1224 |
var saved_rows = save_row(); |
1225 |
if(Object.keys(saved_rows).length) $('.save').prop('disabled', false); |
1226 |
$("#order_edit").modal('hide'); |
1227 |
}) |
1228 |
|
1229 |
/*$('#modal-order-main').tabs({ |
1230 |
activate: function(event, ui) { |
1231 |
var active = ui.newPanel.attr('id') |
1232 |
if(active == 'history-panel') { |
1233 |
show_subs($("#order_edit").data('row')); |
1234 |
} |
1235 |
} |
1236 |
});*/ |
1237 |
|
1238 |
$("#order_edit").on("show.bs.modal", function (event) { |
1239 |
var anchor = $(event.relatedTarget); |
1240 |
var n = anchor.data("row"); |
1241 |
var row = api.row(n).data(); |
1242 |
|
1243 |
var modal = $(this); |
1244 |
modal.data('row', JSON.parse(JSON.stringify(row))); |
1245 |
modal.data('n', n); |
1246 |
modal.data('keep', modal.data('saved')||{}); |
1247 |
//$('#modal-order-main').tabs("option", "active", 0); |
1248 |
set_editor(); |
646 |
}); |
1249 |
}); |
647 |
|
1250 |
|
|
|
1251 |
$("#order_edit").on("hide.bs.modal", function() { |
1252 |
$("#child_orders_table").DataTable().off('preDraw').destroy(); |
1253 |
}); |
648 |
}); |
1254 |
}); |
649 |
</script> |
1255 |
</script> |
650 |
[% END %] |
1256 |
[% END %] |