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