MDL-69166 enrol_fee: Prevent adding instance if no currency is supported

This commit is contained in:
Shamim Rezaie
2020-10-27 15:44:59 +11:00
parent 0cf4bb2afc
commit c9271eba7c
+4
View File
@@ -105,6 +105,10 @@ class enrol_fee_plugin extends enrol_plugin {
public function can_add_instance($courseid) {
$context = context_course::instance($courseid, MUST_EXIST);
if (empty(\core_payment\helper::get_supported_currencies())) {
return false;
}
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/fee:config', $context)) {
return false;
}