BuyCourses: Add message to configure currency

pull/2990/head
Angel Fernando Quiroz Campos 6 years ago
parent a2d2d022e4
commit 5c4a877e52
  1. 2
      plugin/buycourses/lang/english.php
  2. 1
      plugin/buycourses/lang/spanish.php
  3. 14
      plugin/buycourses/src/configure_course.php

@ -142,7 +142,7 @@ $strings['XIsOnlyPaymentMethodAvailable'] = '%s is the only payment method avail
$strings['hide_free_text'] = "Hide 'Free' text"; $strings['hide_free_text'] = "Hide 'Free' text";
$strings['culqi_enable'] = "Enable culqi"; $strings['culqi_enable'] = "Enable culqi";
$strings['include_services'] = "Include services"; $strings['include_services'] = "Include services";
$strings['CurrencyIsNotConfigured'] = "Please, configure a currency before continuing.";
$strings['Services'] = "Services"; $strings['Services'] = "Services";
$strings['ServiceName'] = "Service name"; $strings['ServiceName'] = "Service name";
$strings['AppliesTo'] = "Applies to"; $strings['AppliesTo'] = "Applies to";

@ -209,3 +209,4 @@ $strings['PurchaseDetailsIntro'] = "Detalles de la comprar";
$strings['PurchaseDetailsEnd'] = "Atentamente"; $strings['PurchaseDetailsEnd'] = "Atentamente";
$strings['ProductName'] = "Nombre producto"; $strings['ProductName'] = "Nombre producto";
$strings['BankAccountIntro'] = "Información cuentas bancarias"; $strings['BankAccountIntro'] = "Información cuentas bancarias";
$strings['CurrencyIsNotConfigured'] = "Por favor, confogure una moneda antes de continuar.";

@ -36,6 +36,13 @@ $entityManager = Database::getManager();
$userRepo = UserManager::getRepository(); $userRepo = UserManager::getRepository();
$currency = $plugin->getSelectedCurrency(); $currency = $plugin->getSelectedCurrency();
if (empty($currency)) {
Display::addFlash(
Display::return_message($plugin->get_lang('CurrencyIsNotConfigured'), 'error')
);
}
$currencyIso = null; $currencyIso = null;
if ($editingCourse) { if ($editingCourse) {
@ -254,7 +261,12 @@ if ($commissionsEnable === 'true') {
$form->addHidden('t', null); $form->addHidden('t', null);
$form->addHidden('i', 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']); $form->freeze(['product_type', 'name']);
if ($form->validate()) { if ($form->validate()) {

Loading…
Cancel
Save