Lines 152-158
$(document).ready(function() {
Link Here
|
152 |
|
152 |
|
153 |
var itemnumber = $(this).val(); |
153 |
var itemnumber = $(this).val(); |
154 |
|
154 |
|
155 |
$(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); |
155 |
var can_renew = true; |
|
|
156 |
|
157 |
if( parseFloat(fines) > parseFloat(amountlimit) ) { |
158 |
var result = confirm(MSG_CONFRIM_RENEW); |
159 |
if(result){ |
160 |
can_renew = true; |
161 |
}else{ |
162 |
can_renew = false; |
163 |
} |
164 |
} |
156 |
|
165 |
|
157 |
var params = { |
166 |
var params = { |
158 |
itemnumber: itemnumber, |
167 |
itemnumber: itemnumber, |
Lines 176-217
$(document).ready(function() {
Link Here
|
176 |
params.date_due = dueDate |
185 |
params.date_due = dueDate |
177 |
} |
186 |
} |
178 |
|
187 |
|
179 |
$.post({ |
188 |
if(can_renew) { |
180 |
url: "/cgi-bin/koha/svc/renew", |
189 |
$(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); |
181 |
data: params, |
190 |
renew(params); |
182 |
success: function( data ) { |
191 |
} |
183 |
var id = "#renew_" + data.itemnumber; |
|
|
184 |
|
185 |
var content = ""; |
186 |
if ( data.renew_okay ) { |
187 |
content = __("Renewed, due:") + " " + data.date_due; |
188 |
$('#date_due_' + data.itemnumber).replaceWith( data.date_due ); |
189 |
} else { |
190 |
content = __("Renew failed:") + " "; |
191 |
if ( data.error == "no_checkout" ) { |
192 |
content += __("not checked out"); |
193 |
} else if ( data.error == "too_many" ) { |
194 |
content += __("too many renewals"); |
195 |
} else if ( data.error == "too_unseen" ) { |
196 |
content += __("too many consecutive renewals without being seen by the library"); |
197 |
} else if ( data.error == "on_reserve" ) { |
198 |
content += __("on hold"); |
199 |
} else if ( data.error == "restriction" ) { |
200 |
content += __("Not allowed: patron restricted"); |
201 |
} else if ( data.error == "overdue" ) { |
202 |
content += __("Not allowed: overdue"); |
203 |
} else if ( data.error ) { |
204 |
content += data.error; |
205 |
} else { |
206 |
content += __("reason unknown"); |
207 |
} |
208 |
} |
209 |
|
210 |
$(id).replaceWith( content ); |
211 |
}, |
212 |
dataType: "json", |
213 |
async: false, |
214 |
}); |
215 |
}); |
192 |
}); |
216 |
|
193 |
|
217 |
// Refocus on barcode field if it exists |
194 |
// Refocus on barcode field if it exists |
Lines 223-228
$(document).ready(function() {
Link Here
|
223 |
return false; |
200 |
return false; |
224 |
}); |
201 |
}); |
225 |
|
202 |
|
|
|
203 |
function renew(params){ |
204 |
$.post({ |
205 |
url: "/cgi-bin/koha/svc/renew", |
206 |
data: params, |
207 |
success: function( data ) { |
208 |
var id = "#renew_" + data.itemnumber; |
209 |
|
210 |
var content = ""; |
211 |
if ( data.renew_okay ) { |
212 |
content = __("Renewed, due:") + " " + data.date_due; |
213 |
$('#date_due_' + data.itemnumber).replaceWith( data.date_due ); |
214 |
} else { |
215 |
content = __("Renew failed:") + " "; |
216 |
if ( data.error == "no_checkout" ) { |
217 |
content += __("not checked out"); |
218 |
} else if ( data.error == "too_many" ) { |
219 |
content += __("too many renewals"); |
220 |
} else if ( data.error == "too_unseen" ) { |
221 |
content += __("too many consecutive renewals without being seen by the library"); |
222 |
} else if ( data.error == "on_reserve" ) { |
223 |
content += __("on hold"); |
224 |
} else if ( data.error == "restriction" ) { |
225 |
content += __("Not allowed: patron restricted"); |
226 |
} else if ( data.error == "overdue" ) { |
227 |
content += __("Not allowed: overdue"); |
228 |
} else if ( data.error ) { |
229 |
content += data.error; |
230 |
} else { |
231 |
content += __("reason unknown"); |
232 |
} |
233 |
} |
234 |
|
235 |
$(id).replaceWith( content ); |
236 |
}, |
237 |
dataType: "json", |
238 |
async: false, |
239 |
}); |
240 |
} |
241 |
|
226 |
$("#RenewAll").on("click",function(){ |
242 |
$("#RenewAll").on("click",function(){ |
227 |
$("#CheckAllRenewals").click(); |
243 |
$("#CheckAllRenewals").click(); |
228 |
$("#UncheckAllCheckins").click(); |
244 |
$("#UncheckAllCheckins").click(); |
229 |
- |
|
|