mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Show correct string;
Credit card method: Name on card ECheck: Account owner
This commit is contained in:
parent
3c07bc5a32
commit
3c167c58c1
1 changed files with 11 additions and 14 deletions
|
@ -26,10 +26,12 @@ class authorize_enrol_form extends moodleform
|
||||||
$mform->addElement('hidden', 'paymentmethod', $paymentmethod);
|
$mform->addElement('hidden', 'paymentmethod', $paymentmethod);
|
||||||
$mform->setType('paymentmethod', PARAM_ALPHA);
|
$mform->setType('paymentmethod', PARAM_ALPHA);
|
||||||
|
|
||||||
|
$firstlastnamestr = (AN_METHOD_CC == $paymentmethod) ?
|
||||||
|
get_string('nameoncard', 'enrol_authorize') : get_string('echeckfirslasttname', 'enrol_authorize');
|
||||||
$firstlastnamegrp = array();
|
$firstlastnamegrp = array();
|
||||||
$firstlastnamegrp[] = &MoodleQuickForm::createElement('text', 'firstname', '', 'size="10"');
|
$firstlastnamegrp[] = &MoodleQuickForm::createElement('text', 'firstname', '', 'size="10"');
|
||||||
$firstlastnamegrp[] = &MoodleQuickForm::createElement('text', 'lastname', '', 'size="10"');
|
$firstlastnamegrp[] = &MoodleQuickForm::createElement('text', 'lastname', '', 'size="10"');
|
||||||
$mform->addGroup($firstlastnamegrp, 'firstlastgrp', get_string('nameoncard', 'enrol_authorize'), ' ', false);
|
$mform->addGroup($firstlastnamegrp, 'firstlastgrp', $firstlastnamestr, ' ', false);
|
||||||
$firstlastnamegrprules = array();
|
$firstlastnamegrprules = array();
|
||||||
$firstlastnamegrprules['firstname'][] = array(get_string('missingfirstname'), 'required', null, 'client');
|
$firstlastnamegrprules['firstname'][] = array(get_string('missingfirstname'), 'required', null, 'client');
|
||||||
$firstlastnamegrprules['lastname'][] = array(get_string('missinglastname'), 'required', null, 'client');
|
$firstlastnamegrprules['lastname'][] = array(get_string('missinglastname'), 'required', null, 'client');
|
||||||
|
@ -175,46 +177,41 @@ class authorize_enrol_form extends moodleform
|
||||||
{
|
{
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
$err = array();
|
$errors = array();
|
||||||
|
|
||||||
if (AN_METHOD_CC == $data['paymentmethod'])
|
if (AN_METHOD_CC == $data['paymentmethod'])
|
||||||
{
|
{
|
||||||
if (!in_array($data['cctype'], array_keys(get_list_of_creditcards()))) {
|
if (!in_array($data['cctype'], array_keys(get_list_of_creditcards()))) {
|
||||||
$err['cctype'] = get_string('missingcctype', 'enrol_authorize');
|
$errors['cctype'] = get_string('missingcctype', 'enrol_authorize');
|
||||||
}
|
}
|
||||||
|
|
||||||
$expdate = sprintf("%02d", intval($data['ccexpiremm'])) . $data['ccexpireyyyy'];
|
$expdate = sprintf("%02d", intval($data['ccexpiremm'])) . $data['ccexpireyyyy'];
|
||||||
$validcc = CCVal($data['cc'], $data['cctype'], $expdate);
|
$validcc = CCVal($data['cc'], $data['cctype'], $expdate);
|
||||||
if (!$validcc) {
|
if (!$validcc) {
|
||||||
if ($validcc === 0) {
|
if ($validcc === 0) {
|
||||||
$err['ccexpiregrp'] = get_string('ccexpired', 'enrol_authorize');
|
$errors['ccexpiregrp'] = get_string('ccexpired', 'enrol_authorize');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$err['cc'] = get_string('ccinvalid', 'enrol_authorize');
|
$errors['cc'] = get_string('ccinvalid', 'enrol_authorize');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($CFG->an_authcode) && !empty($data['haveauth']) && empty($data['ccauthcode'])) {
|
if (!empty($CFG->an_authcode) && !empty($data['haveauth']) && empty($data['ccauthcode'])) {
|
||||||
$err['ccauthgrp'] = get_string('missingccauthcode', 'enrol_authorize');
|
$errors['ccauthgrp'] = get_string('missingccauthcode', 'enrol_authorize');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (AN_METHOD_ECHECK == $data['paymentmethod'])
|
elseif (AN_METHOD_ECHECK == $data['paymentmethod'])
|
||||||
{
|
{
|
||||||
if (!ABAVal($data['abacode'])) {
|
if (!ABAVal($data['abacode'])) {
|
||||||
$err['abacode'] = get_string('invalidaba', 'enrol_authorize');
|
$errors['abacode'] = get_string('invalidaba', 'enrol_authorize');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($data['acctype'], get_list_of_bank_account_types())) {
|
if (!in_array($data['acctype'], get_list_of_bank_account_types())) {
|
||||||
$err['acctype'] = get_string('invalidacctype', 'enrol_authorize');
|
$errors['acctype'] = get_string('invalidacctype', 'enrol_authorize');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($err)) {
|
return (empty($errors) ? true : $errors);
|
||||||
$err['header'] = get_string('someerrorswerefound');
|
|
||||||
return $err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue