diff --git a/plugin/buycourses/lang/english.php b/plugin/buycourses/lang/english.php index fe0f010939..bdfd7de54a 100644 --- a/plugin/buycourses/lang/english.php +++ b/plugin/buycourses/lang/english.php @@ -142,7 +142,7 @@ $strings['XIsOnlyPaymentMethodAvailable'] = '%s is the only payment method avail $strings['hide_free_text'] = "Hide 'Free' text"; $strings['culqi_enable'] = "Enable culqi"; $strings['include_services'] = "Include services"; - +$strings['CurrencyIsNotConfigured'] = "Please, configure a currency before continuing."; $strings['Services'] = "Services"; $strings['ServiceName'] = "Service name"; $strings['AppliesTo'] = "Applies to"; diff --git a/plugin/buycourses/lang/spanish.php b/plugin/buycourses/lang/spanish.php index 9b5c9e4f7c..8943deeb78 100644 --- a/plugin/buycourses/lang/spanish.php +++ b/plugin/buycourses/lang/spanish.php @@ -209,3 +209,4 @@ $strings['PurchaseDetailsIntro'] = "Detalles de la comprar"; $strings['PurchaseDetailsEnd'] = "Atentamente"; $strings['ProductName'] = "Nombre producto"; $strings['BankAccountIntro'] = "Información cuentas bancarias"; +$strings['CurrencyIsNotConfigured'] = "Por favor, confogure una moneda antes de continuar."; diff --git a/plugin/buycourses/src/configure_course.php b/plugin/buycourses/src/configure_course.php index 1c5885b5ac..e0b47d47cf 100644 --- a/plugin/buycourses/src/configure_course.php +++ b/plugin/buycourses/src/configure_course.php @@ -36,6 +36,13 @@ $entityManager = Database::getManager(); $userRepo = UserManager::getRepository(); $currency = $plugin->getSelectedCurrency(); + +if (empty($currency)) { + Display::addFlash( + Display::return_message($plugin->get_lang('CurrencyIsNotConfigured'), 'error') + ); +} + $currencyIso = null; if ($editingCourse) { @@ -254,7 +261,12 @@ if ($commissionsEnable === 'true') { $form->addHidden('t', null); $form->addHidden('i', null); -$form->addButtonSave(get_lang('Save')); +$button = $form->addButtonSave(get_lang('Save')); + +if (empty($currency)) { + $button->setAttribute('disabled'); +} + $form->freeze(['product_type', 'name']); if ($form->validate()) {