Bug 37524: Do not attempt to renew check outs if there is nothing to renew
If patrons loans are not renewable and one hits "Renew all" button in patrons "Check out" page, Koha is redirected to "Export data" tool. This happens because when there is nothing to renew call to function renew_all produces error: "Uncaught TypeError: renew_all(...) is undefined". This patch prevents call to this function and adds alert to inform user that there are no items to be renewed. To reproduce: 1. Find patron with check outs which renewals count has hit the maximum limit of renewals. 2. Press "Renew all" button. => Koha is redirected to "Export data" tool. 3. Apply this patch. 4. Try to renew check outs again. => Alert pop up is displayed. Sponsored-by: Koha-Suomi Oy Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
6bcc82815d
commit
45e7bdaff7
1 changed files with 17 additions and 12 deletions
|
@ -740,6 +740,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
let item_ids = $(".renew:checked:visible").map((i, c) => c.value);
|
let item_ids = $(".renew:checked:visible").map((i, c) => c.value);
|
||||||
|
|
||||||
|
if( item_ids.length > 0 ){
|
||||||
renew_all(item_ids, renew).then(() => {
|
renew_all(item_ids, renew).then(() => {
|
||||||
// Refocus on barcode field if it exists
|
// Refocus on barcode field if it exists
|
||||||
if ( $("#barcode").length ) {
|
if ( $("#barcode").length ) {
|
||||||
|
@ -754,6 +755,10 @@ $(document).ready(function() {
|
||||||
|
|
||||||
// Prevent form submit
|
// Prevent form submit
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
alert(_("There are no items to be renewed."));
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#RenewAll").on("click",function(){
|
$("#RenewAll").on("click",function(){
|
||||||
|
|
Loading…
Reference in a new issue