Bug 2542: Validate the amount of a manual invoice/create
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 18 Mar 2015 15:49:52 +0000 (16:49 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Wed, 8 Apr 2015 17:48:12 +0000 (14:48 -0300)
If a manual invoice/credit amount is not correctly set, it should not be
accepted.

Test plan:
Try to create a manual invoice and a manual credit with an amount containing
something else than numbers.
It should not be possible.

Followed test plan. Patch behaves OK, including that negative values are not allowed.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt

index 13500ab..a17764d 100644 (file)
@@ -45,7 +45,7 @@ $(document).ready(function(){
        <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
        <li><label for="desc">Description: </label><input type="text" name="desc" size="50" id="desc" /></li>
     <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
-       <li><label for="amount">Amount: </label><input type="text" name="amount" id="amount" /> Example: 5.00</li>
+    <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="0" step="any" min="0" /> Example: 5.00</li>
 </ol></fieldset>
 
 <fieldset class="action"><input type="submit" name="add" value="Add credit" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
index 445fffe..520eb2d 100644 (file)
@@ -69,7 +69,7 @@ type_fees['[% invoice_types_loo.authorised_value %]'] = "[% invoice_types_loo.li
        <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
        <li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li>
     <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" /></li>
-       <li><label for="amount">Amount: </label><input type="text" name="amount" id="amount" /> Example: 5.00</li>
+    <li><label for="amount">Amount: </label><input type="number" name="amount" id="amount" required="required" value="0" step="any" min="0" /> Example: 5.00</li>
        </ol></fieldset>
 <fieldset class="action"><input type="submit" name="add" value="Save" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset>
 </form>