Lines 641-647
$(document).ready(function() {
Link Here
|
641 |
|
641 |
|
642 |
var itemnumber = $(this).val(); |
642 |
var itemnumber = $(this).val(); |
643 |
|
643 |
|
644 |
$(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); |
644 |
var can_renew = true; |
|
|
645 |
|
646 |
if( parseFloat(fines) > parseFloat(amountlimit) ) { |
647 |
var result = confirm(MSG_CONFRIM_RENEW); |
648 |
if(result){ |
649 |
can_renew = true; |
650 |
}else{ |
651 |
can_renew = false; |
652 |
} |
653 |
} |
645 |
|
654 |
|
646 |
var params = { |
655 |
var params = { |
647 |
itemnumber: itemnumber, |
656 |
itemnumber: itemnumber, |
Lines 704-709
$(document).ready(function() {
Link Here
|
704 |
dataType: "json", |
713 |
dataType: "json", |
705 |
async: false, |
714 |
async: false, |
706 |
}); |
715 |
}); |
|
|
716 |
|
717 |
if(can_renew) { |
718 |
$(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); |
719 |
renew(params); |
720 |
} |
707 |
}); |
721 |
}); |
708 |
|
722 |
|
709 |
// Refocus on barcode field if it exists |
723 |
// Refocus on barcode field if it exists |
Lines 718-723
$(document).ready(function() {
Link Here
|
718 |
return false; |
732 |
return false; |
719 |
}); |
733 |
}); |
720 |
|
734 |
|
|
|
735 |
function renew(params){ |
736 |
$.post({ |
737 |
url: "/cgi-bin/koha/svc/renew", |
738 |
data: params, |
739 |
success: function( data ) { |
740 |
var id = "#renew_" + data.itemnumber; |
741 |
|
742 |
var content = ""; |
743 |
if ( data.renew_okay ) { |
744 |
content = __("Renewed, due:") + " " + data.date_due; |
745 |
$('#date_due_' + data.itemnumber).replaceWith( data.date_due ); |
746 |
} else { |
747 |
content = __("Renew failed:") + " "; |
748 |
if ( data.error == "no_checkout" ) { |
749 |
content += __("not checked out"); |
750 |
} else if ( data.error == "too_many" ) { |
751 |
content += __("too many renewals"); |
752 |
} else if ( data.error == "too_unseen" ) { |
753 |
content += __("too many consecutive renewals without being seen by the library"); |
754 |
} else if ( data.error == "on_reserve" ) { |
755 |
content += __("on hold"); |
756 |
} else if ( data.error == "restriction" ) { |
757 |
content += __("Not allowed: patron restricted"); |
758 |
} else if ( data.error == "overdue" ) { |
759 |
content += __("Not allowed: overdue"); |
760 |
} else if ( data.error ) { |
761 |
content += data.error; |
762 |
} else { |
763 |
content += __("reason unknown"); |
764 |
} |
765 |
} |
766 |
|
767 |
$(id).replaceWith( content ); |
768 |
}, |
769 |
dataType: "json", |
770 |
async: false, |
771 |
}); |
772 |
} |
773 |
|
721 |
$("#RenewAll").on("click",function(){ |
774 |
$("#RenewAll").on("click",function(){ |
722 |
$("#CheckAllRenewals").click(); |
775 |
$("#CheckAllRenewals").click(); |
723 |
$("#UncheckAllCheckins").click(); |
776 |
$("#UncheckAllCheckins").click(); |
724 |
- |
|
|