prevent payment when CC expire year/month is in the past
authorberick <berick@esilibrary.com>
Tue, 29 Mar 2011 20:56:37 +0000 (16:56 -0400)
committerberick <berick@esilibrary.com>
Tue, 29 Mar 2011 20:56:37 +0000 (16:56 -0400)
Open-ILS/web/opac/skin/kcls/js/myopac.js

index 95e56e2..52344e8 100644 (file)
@@ -1694,6 +1694,20 @@ function drawPayFinesPage(patron, total, xacts, onPaymentSubmit) {
     if(!payFinesDrawn) {
                dojo.connect(oilsSelfckCCSubmit, 'onClick',
           function() {
+
+            var year = oilsSelfckCCYear.attr('value');
+            var month = oilsSelfckCCMonth.attr('value');
+
+            var today = new Date();
+            today = new Date(today.getFullYear(), today.getMonth()); // truncate the date & time;
+            var expire = new Date(year, Number(month)-1); 
+
+            if(!year || !month || expire < today) {
+                alert('Credit Card expire date is invalid or in the past.');
+                oilsSelfckCCMonth.domNode.focus();
+                return;
+            }
+
             hideMe($('pay_fines_now'));
             unHideMe($('pay_fines_confirm'));