Browse Source

Bug 9943: activate "Pay selected" button only when at least one fine is selected

If you select no fines but click the "pay selected" button the resulting
screen offers to let you pay against all fines, which is confusing. To
simplify things this patch disables the "pay selected" button if no
lines are selected.

To test, apply the patch and find a patron with outstanding fines. From
the "pay fines" page (members/pay.pl) try selecting and deselecting
checkboxes and using the "select all" and "clear all" links. When no
item is selected the "Pay selected" button should become disabled.
Confirm that the form submits correctly when one or more fines is
selected.

Signed-off-by: Melia Meggs <melia@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works nicely in my tests.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
new/bootstrap-opac
Owen Leonard 11 years ago
committed by Galen Charlton
parent
commit
6434f9264a
  1. 31
      koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt

31
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt

@ -4,6 +4,15 @@
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<script type= "text/javascript">
//<![CDATA[
function enableCheckboxActions(){
// Enable/disable controls if checkboxes are checked
var checkedBoxes = $("input.cb:checked");
if ($(checkedBoxes).size()) {
$("#payselected").prop("disabled",false);
} else {
$("#payselected").prop("disabled",true);
}
}
$(document).ready(function(){
$('#pay-fines-form').preventDoubleFormSubmit();
$("#woall").click(function(event){
@ -12,8 +21,20 @@
event.preventDefault();
}
});
$('#CheckAll').click(function(){ $("#finest").checkCheckboxes(); return false;});
$('#CheckNone').click(function(){ $("#finest").unCheckCheckboxes(); return false;});
$('#CheckAll').click(function(){
$("#finest").checkCheckboxes();
enableCheckboxActions();
return false;
});
$('#CheckNone').click(function(){
$("#finest").unCheckCheckboxes();
enableCheckboxActions();
return false;
});
$(".cb").change(function(){
enableCheckboxActions();
});
enableCheckboxActions();
});
//]]>
</script>
@ -71,7 +92,7 @@
<tr>
<td>
[% IF ( line.amountoutstanding > 0 ) %]
<input type="checkbox" checked="checked" name="incl_par_[% line.accountno %]" />
<input class="cb" type="checkbox" checked="checked" name="incl_par_[% line.accountno %]" />
[% END %]
</td>
<td>
@ -111,9 +132,9 @@
</tbody>
</table>
<fieldset class="action">
<input type="submit" name="paycollect" value="Pay amount" class="submit" />
<input type="submit" id="paycollect" name="paycollect" value="Pay amount" class="submit" />
<input type="submit" name="woall" id="woall" value="Write off all" class="submit" />
<input type="submit" name="payselected" value="Pay selected" class="submit" />
<input type="submit" id="payselected" name="payselected" value="Pay selected" class="submit" />
<a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
</fieldset>
</form>

Loading…
Cancel
Save