Some cleanup: Removed enrolment_plugin_authorize->authorizeerror; because, new forms lib handles all errors.

This commit is contained in:
ethem 2006-11-17 08:49:08 +00:00
parent 4df4b15524
commit 8dfaffacfb

View file

@ -9,13 +9,6 @@ require_once($CFG->dirroot.'/enrol/authorize/localfuncs.php');
*/ */
class enrolment_plugin_authorize class enrolment_plugin_authorize
{ {
/**
* Error message after connected authorize.net.
*
* @var string
* @access public
*/
var $authorizeerror;
/** /**
* Cron log. * Cron log.
@ -81,23 +74,23 @@ class enrolment_plugin_authorize
} }
else { else {
require_once($CFG->dirroot.'/enrol/authorize/enrol_form.php'); require_once($CFG->dirroot.'/enrol/authorize/enrol_form.php');
$authorize_enrol = new authorize_enrol_form('enrol.php'); $frmenrol = new authorize_enrol_form('enrol.php');
if ($authorize_enrol->data_submitted() && if ($frmenrol->data_submitted()) {
(AN_METHOD_CC == $form->paymentmethod || AN_METHOD_ECHECK == $form->paymentmethod)) { $authorizeerror = '';
switch ($form->paymentmethod) { switch ($form->paymentmethod) {
case AN_METHOD_CC: case AN_METHOD_CC:
$this->cc_submit($form, $course); $authorizeerror = $this->cc_submit($form, $course);
break; break;
case AN_METHOD_ECHECK: case AN_METHOD_ECHECK:
$this->echeck_submit($form, $course); $authorizeerror = $this->echeck_submit($form, $course);
break; break;
} }
if (!empty($this->authorizeerror)) { if (!empty($authorizeerror)) {
error($this->authorizeerror); error($authorizeerror);
} }
} }
$authorize_enrol->display(); $frmenrol->display();
} }
print_simple_box_end(); print_simple_box_end();
@ -168,8 +161,7 @@ class enrolment_plugin_authorize
$order->id = insert_record("enrol_authorize", $order); $order->id = insert_record("enrol_authorize", $order);
if (!$order->id) { if (!$order->id) {
email_to_admin("Error while trying to insert new data", $order); email_to_admin("Error while trying to insert new data", $order);
$this->authorizeerror = "Insert record error. Admin has been notified!"; return "Insert record error. Admin has been notified!";
return;
} }
$extra = new stdClass(); $extra = new stdClass();
@ -211,8 +203,7 @@ class enrolment_plugin_authorize
$message = ''; $message = '';
if (AN_APPROVED != authorize_action($order, $message, $extra, $action, $form->cctype)) { if (AN_APPROVED != authorize_action($order, $message, $extra, $action, $form->cctype)) {
email_to_admin($message, $order); email_to_admin($message, $order);
$this->authorizeerror = $message; return $message;
return;
} }
$SESSION->ccpaid = 1; // security check: don't duplicate payment $SESSION->ccpaid = 1; // security check: don't duplicate payment
@ -331,8 +322,7 @@ class enrolment_plugin_authorize
$order->id = insert_record("enrol_authorize", $order); $order->id = insert_record("enrol_authorize", $order);
if (!$order->id) { if (!$order->id) {
email_to_admin("Error while trying to insert new data", $order); email_to_admin("Error while trying to insert new data", $order);
$this->authorizeerror = "Insert record error. Admin has been notified!"; return "Insert record error. Admin has been notified!";
return;
} }
$extra = new stdClass(); $extra = new stdClass();
@ -364,8 +354,7 @@ class enrolment_plugin_authorize
$message = ''; $message = '';
if (AN_REVIEW != authorize_action($order, $message, $extra, AN_ACTION_AUTH_CAPTURE)) { if (AN_REVIEW != authorize_action($order, $message, $extra, AN_ACTION_AUTH_CAPTURE)) {
email_to_admin($message, $order); email_to_admin($message, $order);
$this->authorizeerror = $message; return $message;
return;
} }
$SESSION->ccpaid = 1; // security check: don't duplicate payment $SESSION->ccpaid = 1; // security check: don't duplicate payment