From: ethem Date: Thu, 31 Aug 2006 07:11:31 +0000 (+0000) Subject: Added Echeck UI validation. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=fde7c9dfc5450f896b2959a13f94065eedabe275;p=moodle.git Added Echeck UI validation. --- diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index b3ff236994..2b1a36bf41 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -222,7 +222,7 @@ class enrolment_plugin_authorize $message = ''; $an_review = !empty($CFG->an_review); $action = $an_review ? AN_ACTION_AUTH_ONLY : AN_ACTION_AUTH_CAPTURE; - $success = authorize_action($order, $message, $extra, $action, $form->cctype); + $success = authorize_action($order, $message, $extra, $action, AN_METHOD_CC, $form->cctype); if (!$success) { enrolment_plugin_authorize::email_to_admin($message, $order); $this->authorizeerrors['header'] = $message; @@ -401,6 +401,33 @@ class enrolment_plugin_authorize global $CFG; require_once('abaval.php'); + if (empty($form->abacode) || !is_numeric($form->abacode)) { + $this->authorizeerrors['abacode'] = get_string('missingaba', 'enrol_authorize'); + } + elseif (!ABAVal($form->abacode)) { + $this->authorizeerrors['abacode'] = get_string('invalidaba', 'enrol_authorize'); + } + + if (empty($form->accnum) || !is_numeric($form->accnum)) { + $this->authorizeerrors['accnum'] = get_string('invalidaccnum', 'enrol_authorize'); + } + + if (empty($form->acctype) || !in_array($form->acctype, array('CHECKING','BUSINESSCHECKING','SAVINGS'))) { + $this->authorizeerrors['acctype'] = get_string('invalidacctype', 'enrol_authorize'); + } + + if (empty($form->bankname)) { + $this->authorizeerrors['bankname'] = get_string('missingbankname', 'enrol_authorize'); + } + + if (empty($form->firstname) || empty($form->lastname)) { + $this->authorizeerrors['firstlast'] = get_string('missingfullname'); + } + + if (!empty($this->authorizeerrors)) { + $this->authorizeerrors['header'] = get_string('someerrorswerefound'); + return false; + } return true; } @@ -810,7 +837,7 @@ class enrolment_plugin_authorize foreach ($orders as $order) { $message = ''; $extra = NULL; - $success = authorize_action($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE); + $success = authorize_action($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE, AN_METHOD_CC); if ($success) { $timestart = $timeend = 0; if ($order->enrolperiod) { diff --git a/enrol/authorize/locallib.php b/enrol/authorize/locallib.php index 58724d6d30..a923dffa92 100644 --- a/enrol/authorize/locallib.php +++ b/enrol/authorize/locallib.php @@ -228,7 +228,7 @@ function authorize_print_order_details($orderno) else { $message = ''; $extra = NULL; - $success = authorize_action($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE); + $success = authorize_action($order, $message, $extra, AN_ACTION_PRIOR_AUTH_CAPTURE, AN_METHOD_CC); if (!$success) { $table->data[] = array("$strs->error:", $message); }