diff --git a/enrol/authorize/config.html b/enrol/authorize/config.html
index 0e2f2c0777c..ab7cb8fc4f9 100755
--- a/enrol/authorize/config.html
+++ b/enrol/authorize/config.html
@@ -21,8 +21,13 @@ if (isset($CFG->an_cutoff)) {
$frm->an_cutoff_hour = intval($CFG->an_cutoff) / 60;
$frm->an_cutoff_min = intval($CFG->an_cutoff) % 60;
}
+
if (!isset($frm->an_cutoff_hour)) $frm->an_cutoff_hour = '0';
if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
+if (!isset($frm->acceptccs)) {
+ $frm->acceptccs = array_keys(get_list_of_creditcards());
+ $CFG->an_acceptccs = implode(',', $frm->acceptccs);
+}
?>
@@ -95,6 +100,20 @@ if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
|
+
+ | an_acceptccs: |
+ $val) {
+ echo 'an_acceptccs, $key) !== false) {
+ echo ' checked="checked"';
+ }
+ echo " /> $val \n";
+ }
+ ?> |
+ |
+
+
|
diff --git a/enrol/authorize/enrol.html b/enrol/authorize/enrol.html
index 134e5a8cc5d..5dabac75443 100755
--- a/enrol/authorize/enrol.html
+++ b/enrol/authorize/enrol.html
@@ -59,12 +59,7 @@ $usercountry = empty($form->cccountry) ? $USER->country : $form->cccountry;
| : |
'Master Card', 'vis' => 'Visa', 'amx' => 'American Express',
- 'dsc' => 'Discover', 'dnc' => 'Diners Club', 'jcb' => 'JCB',
- 'swi' => 'Switch', 'dlt' => 'Delta', 'enr' => 'EnRoute'
- );
- choose_from_menu($CCTYPES, 'cctype', $form->cctype);
+ choose_from_menu(get_list_of_creditcards(), 'cctype', $form->cctype);
if (!empty($this->ccerrors['cctype'])) { formerr($this->ccerrors['cctype']); }
?>
|
diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php
index d0e034a159a..9458b0a2500 100755
--- a/enrol/authorize/enrol.php
+++ b/enrol/authorize/enrol.php
@@ -3,6 +3,46 @@
require_once $CFG->dirroot.'/enrol/enrol.class.php';
require_once $CFG->dirroot.'/enrol/authorize/const.php';
+/**
+ * get_list_of_creditcards
+ *
+ * @param bool $getall
+ * @return array
+ */
+function get_list_of_creditcards($getall = false)
+{
+ global $CFG;
+ static $alltypes = array();
+
+ if (empty($alltypes)) {
+ $alltypes = array(
+ 'mcd' => 'Master Card',
+ 'vis' => 'Visa',
+ 'amx' => 'American Express',
+ 'dsc' => 'Discover',
+ 'dnc' => 'Diners Club',
+ 'jcb' => 'JCB',
+ 'swi' => 'Switch',
+ 'dlt' => 'Delta',
+ 'enr' => 'EnRoute'
+ );
+ }
+
+ if ($getall || empty($CFG->an_acceptccs)) {
+ return $alltypes;
+ }
+
+ $ret = array();
+ $ccs = explode(',', $CFG->an_acceptccs);
+ $intersects = array_intersect(array_keys($alltypes), $ccs);
+
+ foreach ($intersects as $key) {
+ $ret[$key] = $alltypes[$key];
+ }
+
+ return $ret;
+}
+
/**
* enrolment_plugin_authorize
*
@@ -464,6 +504,9 @@ class enrolment_plugin_authorize
set_config('enrol_mailteachers', optional_param('enrol_mailteachers', ''));
set_config('enrol_mailadmins', optional_param('enrol_mailadmins', ''));
+ $acceptccs = optional_param('acceptccs', array_keys(get_list_of_creditcards()));
+ set_config('an_acceptccs', implode(',', $acceptccs));
+
// optional authorize.net settings
set_config('an_avs', optional_param('an_avs', ''));
set_config('an_test', optional_param('an_test', ''));