[Koha-cvs] koha/koha-tmpl/intranet-tmpl/ccfls/en/members p... [dev_week]

Kyle Hall kyle.m.hall at gmail.com
Fri Nov 2 14:13:17 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Kyle Hall <kylemhall>	07/11/02 13:13:17

Modified files:
	koha-tmpl/intranet-tmpl/ccfls/en/members: pay.tmpl 

Log message:
	Added warning to fines payment of the payment is larger than the total due, or if the payment amount has no decimal point.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/members/pay.tmpl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.1.2.10&r2=1.1.2.1.2.11

Patches:
Index: pay.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/ccfls/en/members/Attic/pay.tmpl,v
retrieving revision 1.1.2.1.2.10
retrieving revision 1.1.2.1.2.11
diff -u -b -r1.1.2.1.2.10 -r1.1.2.1.2.11
--- pay.tmpl	25 Jul 2007 16:30:49 -0000	1.1.2.1.2.10
+++ pay.tmpl	2 Nov 2007 13:13:17 -0000	1.1.2.1.2.11
@@ -73,15 +73,14 @@
 
 <!-- Added by Kyle Hall, Allows payment by amount -->
 <div id="main">
-  <form class="inline" action="/cgi-bin/koha/pay_by_amount.pl" method="post">
+  <form class="inline" action="/cgi-bin/koha/pay_by_amount.pl" method="post" onsubmit="return checkField()">
     <input type="hidden" name="bornum" value="<!-- TMPL_VAR name="bornum" -->" />
     <div class="table">
       <table>
         <caption>Pay Fines By Amount</caption>
 	<tr>
 	  <td>
-	    Amount to be paid: <strong>$</strong><input id="payByAmountTotal" type="text" name="total" onkeypress="NOatmField(this.id)"/>
-<!-- <i>Note: Decimal will be added automatically. You do not need to enter it by hand.</i> -->
+	    Amount to be paid: <strong>$</strong><input id="payByAmountTotal" type="text" name="total" />
           </td>
         <tr>
       </table>
@@ -92,34 +91,33 @@
 
 
 <script type="text/javascript">
-function atmField(x){
+function checkField(){
 
-var input = document.getElementById(x).value
-
-if (input.length > 0) {
-	var numbers = "";
-	for(var i = 0; i < input.length; i++) {
-		var umChar = input.charAt(i);
-		if ( ! isNaN(umChar) ) {
-			numbers += umChar;
+        var payByAmountTotal = document.getElementById("payByAmountTotal");
+        if ( payByAmountTotal.value > <!-- TMPL_VAR name="total" --> ) {
+                if ( confirm("You are trying to make a payment larger then the total amount due. Are you sure you want to do this?") ) {
+                        return true;
+                } else {
+                        payByAmountTotal.value = '';
+                        payByAmountTotal.focus();
+                        payByAmountTotal.select();
+                        return false;
 		}
 	}
-	var output = "";
-	var n = numbers.length - 2;
 	
-	var i = 0;
-	while(i < input.length + 1) {
-		if(i == n) {
-			output += numbers.charAt(i) + '.';
+        if ( payByAmountTotal.value.indexOf('.') < 0 ) {
+                if ( confirm("The amount you've entered has no '.' Are you sure you want to do this?") ) {
+                        return true;
 		} else {
-			output += numbers.charAt(i)
+                        payByAmountTotal.value = '';
+                        payByAmountTotal.focus();
+                        payByAmountTotal.select();
+
+                        return false;
 		}
-		i++;
 	}
 
-	document.getElementById(x).value = output;
-
-	}
+        return true;
 }
 </script>
 





More information about the Koha-cvs mailing list