Skip to content

Commit

Permalink
MDL-69166 enrol_fee: Prevent adding instance if no currency is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed Oct 27, 2020
1 parent d5958c4 commit 22a9491
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions enrol/fee/classes/plugin.php
Expand Up @@ -105,6 +105,10 @@ public function show_enrolme_link(stdClass $instance) {
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;
}
Expand Down

0 comments on commit 22a9491

Please sign in to comment.