mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
MDL-69166 enrol_fee: Show a warning when no currency is supported
This commit is contained in:
parent
22a949196d
commit
3c87455f4b
@ -26,6 +26,16 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
|
||||
$currencies = enrol_get_plugin('fee')->get_possible_currencies();
|
||||
|
||||
if (empty($currencies)) {
|
||||
$notify = new \core\output\notification(
|
||||
get_string('nocurrencysupported', 'core_payment'),
|
||||
\core\output\notification::NOTIFY_WARNING
|
||||
);
|
||||
$settings->add(new admin_setting_heading('enrol_fee_nocurrency', '', $OUTPUT->render($notify)));
|
||||
}
|
||||
|
||||
$settings->add(new admin_setting_heading('enrol_fee_settings', '', get_string('pluginname_desc', 'enrol_fee')));
|
||||
|
||||
// Note: let's reuse the ext sync constants and strings here, internally it is very similar,
|
||||
@ -36,11 +46,11 @@ if ($ADMIN->fulltree) {
|
||||
ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'),
|
||||
);
|
||||
$settings->add(new admin_setting_configselect(
|
||||
'enrol_fee/expiredaction',
|
||||
get_string('expiredaction', 'enrol_fee'),
|
||||
get_string('expiredaction_help', 'enrol_fee'),
|
||||
ENROL_EXT_REMOVED_SUSPENDNOROLES,
|
||||
$options));
|
||||
'enrol_fee/expiredaction',
|
||||
get_string('expiredaction', 'enrol_fee'),
|
||||
get_string('expiredaction_help', 'enrol_fee'),
|
||||
ENROL_EXT_REMOVED_SUSPENDNOROLES,
|
||||
$options));
|
||||
|
||||
$settings->add(new admin_setting_heading('enrol_fee_defaults',
|
||||
get_string('enrolinstancedefaults', 'admin'), get_string('enrolinstancedefaults_desc', 'admin')));
|
||||
@ -50,10 +60,11 @@ if ($ADMIN->fulltree) {
|
||||
$settings->add(new admin_setting_configselect('enrol_fee/status',
|
||||
get_string('status', 'enrol_fee'), get_string('status_desc', 'enrol_fee'), ENROL_INSTANCE_DISABLED, $options));
|
||||
|
||||
$settings->add(new admin_setting_configtext('enrol_fee/cost', get_string('cost', 'enrol_fee'), '', 0, PARAM_FLOAT, 4));
|
||||
|
||||
$currencies = enrol_get_plugin('fee')->get_possible_currencies();
|
||||
$settings->add(new admin_setting_configselect('enrol_fee/currency', get_string('currency', 'enrol_fee'), '', '', $currencies));
|
||||
if (!empty($currencies)) {
|
||||
$settings->add(new admin_setting_configtext('enrol_fee/cost', get_string('cost', 'enrol_fee'), '', 0, PARAM_FLOAT, 4));
|
||||
$settings->add(new admin_setting_configselect('enrol_fee/currency', get_string('currency', 'enrol_fee'), '', '',
|
||||
$currencies));
|
||||
}
|
||||
|
||||
if (!during_initial_install()) {
|
||||
$options = get_default_enrol_roles(context_system::instance());
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
$string['callbacknotimplemented'] = 'The callback is not implemented for component {$a}.';
|
||||
$string['feeincludesurcharge'] = '{$a->fee} (includes {$a->surcharge}% surcharge for using this payment type)';
|
||||
$string['nocurrencysupported'] = 'No payment in any currency is supported. Please make sure that at least one payment gateway is enabled.';
|
||||
$string['nogateway'] = 'There is no payment gateway that can be used.';
|
||||
$string['nogatewayselected'] = 'You first need to select a payment gateway.';
|
||||
$string['selectpaymenttype'] = 'Select payment type';
|
||||
|
Loading…
x
Reference in New Issue
Block a user