Lines 137-143
$(document).ready(function() {
Link Here
|
137 |
|
137 |
|
138 |
var itemnumber = $(this).val(); |
138 |
var itemnumber = $(this).val(); |
139 |
|
139 |
|
140 |
$(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); |
140 |
var can_renew = true; |
|
|
141 |
|
142 |
if( parseFloat(fines) > parseFloat(amountlimit) ) { |
143 |
var result = confirm(MSG_CONFRIM_RENEW); |
144 |
if(result){ |
145 |
can_renew = true; |
146 |
}else{ |
147 |
can_renew = false; |
148 |
} |
149 |
} |
141 |
|
150 |
|
142 |
var params = { |
151 |
var params = { |
143 |
itemnumber: itemnumber, |
152 |
itemnumber: itemnumber, |
Lines 155-188
$(document).ready(function() {
Link Here
|
155 |
params.date_due = dueDate |
164 |
params.date_due = dueDate |
156 |
} |
165 |
} |
157 |
|
166 |
|
158 |
$.post( "/cgi-bin/koha/svc/renew", params, function( data ) { |
167 |
if(can_renew) { |
159 |
var id = "#renew_" + data.itemnumber; |
168 |
$(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); |
160 |
|
169 |
renew(params); |
161 |
var content = ""; |
170 |
} |
162 |
if ( data.renew_okay ) { |
|
|
163 |
content = CIRCULATION_RENEWED_DUE + " " + data.date_due; |
164 |
$('#date_due_' + data.itemnumber).replaceWith( data.date_due ); |
165 |
} else { |
166 |
content = CIRCULATION_RENEW_FAILED + " "; |
167 |
if ( data.error == "no_checkout" ) { |
168 |
content += NOT_CHECKED_OUT; |
169 |
} else if ( data.error == "too_many" ) { |
170 |
content += TOO_MANY_RENEWALS; |
171 |
} else if ( data.error == "on_reserve" ) { |
172 |
content += ON_RESERVE; |
173 |
} else if ( data.error == "restriction" ) { |
174 |
content += NOT_RENEWABLE_RESTRICTION; |
175 |
} else if ( data.error == "overdue" ) { |
176 |
content += NOT_RENEWABLE_OVERDUE; |
177 |
} else if ( data.error ) { |
178 |
content += data.error; |
179 |
} else { |
180 |
content += REASON_UNKNOWN; |
181 |
} |
182 |
} |
183 |
|
184 |
$(id).replaceWith( content ); |
185 |
}, "json") |
186 |
}); |
171 |
}); |
187 |
|
172 |
|
188 |
// Refocus on barcode field if it exists |
173 |
// Refocus on barcode field if it exists |
Lines 194-199
$(document).ready(function() {
Link Here
|
194 |
return false; |
179 |
return false; |
195 |
}); |
180 |
}); |
196 |
|
181 |
|
|
|
182 |
function renew(params){ |
183 |
$.post( "/cgi-bin/koha/svc/renew", params, function( data ) { |
184 |
var id = "#renew_" + data.itemnumber; |
185 |
|
186 |
var content = ""; |
187 |
if ( data.renew_okay ) { |
188 |
content = CIRCULATION_RENEWED_DUE + " " + data.date_due; |
189 |
$('#date_due_' + data.itemnumber).replaceWith( data.date_due ); |
190 |
} else { |
191 |
content = CIRCULATION_RENEW_FAILED + " "; |
192 |
if ( data.error == "no_checkout" ) { |
193 |
content += NOT_CHECKED_OUT; |
194 |
} else if ( data.error == "too_many" ) { |
195 |
content += TOO_MANY_RENEWALS; |
196 |
} else if ( data.error == "on_reserve" ) { |
197 |
content += ON_RESERVE; |
198 |
} else if ( data.error == "restriction" ) { |
199 |
content += NOT_RENEWABLE_RESTRICTION; |
200 |
} else if ( data.error == "overdue" ) { |
201 |
content += NOT_RENEWABLE_OVERDUE; |
202 |
} else if ( data.error ) { |
203 |
content += data.error; |
204 |
} else { |
205 |
content += REASON_UNKNOWN; |
206 |
} |
207 |
} |
208 |
|
209 |
$(id).replaceWith( content ); |
210 |
}, "json") |
211 |
} |
212 |
|
197 |
$("#RenewAll").on("click",function(){ |
213 |
$("#RenewAll").on("click",function(){ |
198 |
$("#CheckAllRenewals").click(); |
214 |
$("#CheckAllRenewals").click(); |
199 |
$("#UncheckAllCheckins").click(); |
215 |
$("#UncheckAllCheckins").click(); |
200 |
- |
|
|