Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/3683/head
Julio Montoya 5 years ago
commit 9bc580fc86
  1. 30
      main/inc/lib/myspace.lib.php
  2. 13
      plugin/buycourses/CHANGELOG.md
  3. 33
      plugin/buycourses/README.md
  4. 12
      plugin/buycourses/database.php
  5. 39
      plugin/buycourses/lang/english.php
  6. 1
      plugin/buycourses/lang/french.php
  7. 88
      plugin/buycourses/lang/spanish.php
  8. 42
      plugin/buycourses/src/buy_course_plugin.class.php
  9. 25
      plugin/buycourses/src/paymentsetup.php
  10. 2
      plugin/buycourses/src/process_confirm.php
  11. 1
      plugin/buycourses/view/message_transfer.tpl
  12. 3
      plugin/buycourses/view/paymentsetup.tpl

@ -1522,7 +1522,7 @@ class MySpace
$table .= "<td>$title</td>";
}
$table .= "<td>$price</td>";
$registeredUsers = self::getCompanyLearnpathSubscription($startDate, $endDate, $lpitem['lp_id']);
$registeredUsers = self::getCompanyLearnpathSubscription($startDate, $endDate, $lpitem['lp_id'], true);
$studenRegister = count($registeredUsers);
$table .= "<td>$studenRegister</td>";
$facturar = ($studenRegister * $price);
@ -1537,8 +1537,8 @@ class MySpace
"</a>".
"<div id='$hiddenField' class='hidden'>";
for ($i = 0; $i < $studenRegister; $i++) {
$tempStudent = api_get_user_info($registeredUsers[$i]);
$table .= $tempStudent['complete_name']."<br>";
$tempStudent = api_get_user_info($registeredUsers[$i]['id']);
$table .= $tempStudent['complete_name']." (".$registeredUsers[$i]['company'].")<br>";
}
$index++;
$table .= "</div>".
@ -1632,7 +1632,7 @@ class MySpace
$csv_row[] = $autor['complete_name'];
$csv_row[] = $title;
$csv_row[] = $price;
$registeredUsers = self::getCompanyLearnpathSubscription($startDate, $endDate, $lpitem['lp_id']);
$registeredUsers = self::getCompanyLearnpathSubscription($startDate, $endDate, $lpitem['lp_id'], true);
$studenRegister = count($registeredUsers);
$csv_row[] = $studenRegister;
$facturar = ($studenRegister * $price);
@ -1641,8 +1641,8 @@ class MySpace
if ($studenRegister != 0) {
$studentsName = '';
for ($i = 0; $i < $studenRegister; $i++) {
$tempStudent = api_get_user_info($registeredUsers[$i]);
$studentsName .= $tempStudent['complete_name']." / ";
$tempStudent = api_get_user_info($registeredUsers[$i]['id']);
$studentsName .= $tempStudent['complete_name']." (".$registeredUsers[$i]['company'].") / ";
$totalStudent++;
}
@ -3986,11 +3986,16 @@ class MySpace
* @param string|null $startDate
* @param string|null $endDate
* @param int $lpId
* @param bool $whitCompany
*
* @return array
*/
protected static function getCompanyLearnpathSubscription($startDate = null, $endDate = null, $lpId = 0)
{
protected static function getCompanyLearnpathSubscription(
$startDate = null,
$endDate = null,
$lpId = 0,
$whitCompany = false
) {
$tblItemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY);
$tblLp = Database::get_course_table(TABLE_LP_MAIN);
$tblExtraField = Database::get_main_table(TABLE_EXTRA_FIELD);
@ -4091,7 +4096,14 @@ class MySpace
}
// $lpId = $row['ref'];
if ($lpId != 0 && $studentId != 0) {
$companys[] = $studentId;
if ($whitCompany == true) {
$companys[] = [
'id' => $studentId,
'company' => $company,
];
} else {
$companys[] = $studentId;
}
} else {
$companys[$company][] = $studentId;
$companys[$company] = array_unique($companys[$company]);

@ -1,3 +1,12 @@
v6.0 - 2020-11-29
====
Added support for purchase instructions e-mail customization (although this
does not support multiple languages at the moment).
This requires changes to the DB tables:
```sql
ALTER TABLE plugin_buycourses_global_config ADD COLUMN info_email_extra TEXT;
```
v5.0 - 2019-02-06
====
@ -11,8 +20,8 @@ The file update.php must be executed to update the structure of the tables
v4.0 - 2017-04-25
====
This version includes the Culqi payment gateway and introduces an additional
option to show the Buy Courses tab to anonymous users.
This version includes the Culqi payment gateway v1.0 (now expired) and introduces
an additional option to show the Buy Courses tab to anonymous users.
To enable these features, if you have already installed this plugin on your
portal prior to this version, you will need to add the corresponding settings

@ -1,13 +1,32 @@
Buy Courses plugin for Chamilo LMS
=======================================
Users can access the purchases catalog to buy courses or sessions (since v2 of this plugin)
enabled for sale.
Buy Courses (course sales) plugin
=================================
This plugin transforms your Chamilo installation in an online shop by adding a catalogue
of courses and sessions that you have previously configured for sales.
If the user is not registered or logged in, he/she will be requested to register/login
before he/she can resume buying items.
Once the course or session is chosen, shows available payment types (currently only PayPal works)
Once the course or session is chosen, the plugin displays the available payment methods
and lets the user proceed with the purchase.
Currently, the plugin allows users to pay through:
- PayPal (requires a merchant account on PayPal at configuration time)
- Bank payments (requires manual confirmation of payments' reception)
- RedSys payments (Spanish payment gateway) (requires the download of an external file)
Finally, the user receives an e-mail confirming the purchase and him/her is can access to the
course/session.
The user receives an e-mail confirming the purchase and she/he can immediately
access to the course or session.
We recommend using sessions as this gives you more time-related availability options
(in the session configuration).
Updates
=========
You must load the update.php script for installations that were in
production before updating the code, as it will update the database structure to
enable new features.
Please note that updating Chamilo does *NOT* automatically update the plugins
structure.
You can find a history of changes in the [CHANGELOG.md file](./CHANGELOG.md)

@ -379,9 +379,21 @@ if (false === $sm->tablesExist(BuyCoursesPlugin::TABLE_GLOBAL_CONFIG)) {
$globalTable->addColumn('next_number_invoice', \Doctrine\DBAL\Types\Type::INTEGER);
$globalTable->addColumn('invoice_series', \Doctrine\DBAL\Types\Type::STRING);
$globalTable->addColumn('sale_email', \Doctrine\DBAL\Types\Type::STRING);
$globalTable->addColumn('info_email_extra', \Doctrine\DBAL\Types\Type::TEXT);
$globalTable->setPrimaryKey(['id']);
}
$settingsTable = BuyCoursesPlugin::TABLE_GLOBAL_CONFIG;
$sql = "SHOW COLUMNS FROM $settingsTable WHERE Field = 'info_email_extra'";
$res = Database::query($sql);
if (Database::num_rows($res) === 0) {
$sql = "ALTER TABLE $settingsTable ADD (info_email_extra TEXT NOT NULL)";
$res = Database::query($sql);
if (!$res) {
echo Display::return_message($this->get_lang('ErrorUpdateFieldDB'), 'warning');
}
}
if (false === $sm->tablesExist(BuyCoursesPlugin::TABLE_INVOICE)) {
$invoiceTable = $pluginSchema->createTable(BuyCoursesPlugin::TABLE_INVOICE);
$invoiceTable->addColumn(

@ -145,14 +145,14 @@ $strings['culqi_enable'] = "Enable culqi";
$strings['include_services'] = "Include services";
$strings['CurrencyIsNotConfigured'] = "Please, configure a currency before continuing.";
$strings['Services'] = "Services";
$strings['Service'] = "Service";
$strings['NewService'] = "New service";
$strings['ServiceName'] = "Service name";
$strings['AppliesTo'] = "Applies to";
$strings['ServiceInformation'] = "Service information";
$strings['ListOfServicesOnSale'] = "List of services on sale";
$strings['GlobalConfig'] = "Global configuration";
$strings['WriteHereTheTermsAndConditionsOfYourECommerce'] = "Write here the terms and conditions of your e-commerce";
$strings['NewService'] = "New service";
$strings['Service'] = "Service";
$strings['ServiceInformation'] = "Service information";
$strings['EditService'] = "Edit service";
$strings['DeleteThisService'] = "Delete this service";
$strings['IConfirmIReadAndAcceptTermsAndCondition'] = "I confirm I read and accept the terms and conditions";
@ -193,6 +193,36 @@ $strings['use_currency_symbol'] = "Use currency symbol";
$strings['ExportReport'] = "Export Sales Report";
$strings['OrderTime'] = "Order time";
$strings['SelectDateRange'] = "Select a <strong>start date</strong> and <strong>end date</strong> for the report";
$strings['ServiceAdded'] = "Service added";
$strings['ServiceEdited'] = "Service updated";
$strings['ListOfServicesOnSale'] = "List of services for sale";
$strings['AdditionalInfo'] = "Additional information";
$strings['culqi_enable'] = "Enable Culqi";
$strings['CulqiConfig'] = "Culqi configuration:";
$strings['InfoCulqiCredentials'] = "To obtain your credentials, you will need to create an account on Culqi and enter the development mode, copy the merchant code in your dashboard, then enter the API Keys section and copy the corresponding key to paste it here.";
$strings['CommerceCode'] = "Merchant code";
$strings['NoTermsAndConditionsProvided'] = "No defined terms and conditions";
$strings['GlobalConfig'] = "Global configuration:";
$strings['MyServices'] = "My services";
$strings['SalePrice'] = "Sale price";
$strings['YouNeedToBeRegisteredInAtLeastOneCourse'] = "You need to be registered in at least one course";
$strings['YouNeedToBeRegisteredInAtLeastOneSession'] = "You need to be registered in at least one session";
$strings['IfYouWantToGetTheCertificateAndOrSkillsAsociatedToThisCourseYouNeedToBuyTheCertificateServiceYouCanGoToServiceCatalogClickingHere'] = "To obtain the certificate and/or the skills associated to this course, you need to buy the <b> Certificate </b> service. Go to the services catalogue to buy it by clicking <a target='_blank' href='%s'>here</a>";
$strings['ServiceDeleted'] = 'Service deleted';
$strings['YourCoursesNeedAtLeastOneLearningPath'] = 'The courses to which you are subscribed need at least one learning path that contains a final certificate item';
$strings['GlobalTaxPerc'] = "Global tax rate";
$strings['GlobalTaxPercDescription'] = "Default tax rate that will be used unless there is a specific tax rate for the course, session or service.";
$strings['TaxPerc'] = "Tax rate";
$strings['TaxPercDescription'] = "If left blank, the global tax rate will be used.";
$strings['ByDefault'] = "by default (global value)";
$strings['OnlyCourses'] = "Only courses";
$strings['OnlySessions'] = "Only sessions";
$strings['OnlyServices'] = "Only services";
$strings['TaxAppliesTo'] = "Tax applied to";
$strings['AllCoursesSessionsAndServices'] = "All (courses, sessions and services)";
$strings['TaxNameCustom'] = "Tax name";
$strings['TaxNameExamples'] = "VAT, IVA, IGV, TVA, IV ...";
$strings['ErrorUpdateFieldDB'] = "Error updating the database fields";
$strings['tpv_redsys_enable'] = "Enable RedSys POS";
$strings['tpv_redsys_enable_help'] = "In order to use the RedSys POS payment method, it is necessary to download the \"REST INTEGRATION - PHP API \" files at the following link <a href='https://pagosonline.redsys.es/descargas.html'>web de RedSys</a> and locate the file <strong>apiRedSys.php</strong> in the <em>plugin/buycourses/resources</em> directory.";
$strings['NotFindRedsysFile'] = "The <strong>apiRedsys.php</strong> file cannot be found in <em>plugin/buycourses/resources</em> directory";
@ -204,4 +234,5 @@ $strings['DS_MERCHANT_CURRENCY'] = "Terminal currency";
$strings['kc'] = "Secret encryption key";
$strings['url_redsys'] = "Redsys connection URL";
$strings['url_redsys_sandbox'] = "Redsys connection URL (Sandbox)";
$strings['InfoTpvRedsysApiCredentials'] = "You must complete the following fields of the form with the information provided by the Redsys POS Technical Support:";
$strings['InfoTpvRedsysApiCredentials'] = "You must complete the following form fields with the information provided by the Redsys POS Technical Support:";
$strings['InfoEmailExtra'] = "Extra info in payment e-mail";

@ -163,3 +163,4 @@ $strings['Names'] = "Nom";
$strings['ExportReport'] = "Export du rapport des ventes";
$strings['OrderTime'] = "Heure de commande";
$strings['SelectDateRange'] = "Sélectionnez une date de début et une date de fin pour le rapport";
$strings['InfoEmailExtra'] = "Informations additionnelles dans l'e-mail de paiement";

@ -137,45 +137,79 @@ $strings['ByEmail'] = "Por email";
$strings['PaymentMethod'] = "Método de pago";
$strings['SWIFT'] = "Código SWIFT";
$strings['SWIFT_help'] = "Formato estándar de los Códigos de Identificación Bancaria (BIC) que sirve como identificador único para un banco o institución financiera.";
$strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = "Seleccione su método de pago preferido antes de confirmar su pedido";
$strings['NoPaymentOptionAvailable'] = 'No hay opción de pago disponible. Por favor reporte este problema al administrador.';
$strings['XIsOnlyPaymentMethodAvailable'] = '%s es la única opción de pago disponible para esta compra.';
$strings['hide_free_text'] = "Esconder texto 'Gratis'";
$strings['culqi_enable'] = "Activar culqi";
$strings['include_services'] = "Incluir Servicios";
$strings['CurrencyIsNotConfigured'] = "Configure una moneda antes de seguir.";
$strings['Services'] = "Servicios";
$strings['Service'] = "Servicio";
$strings['NewService'] = "Nuevo servicio";
$strings['ServiceName'] = "Nombre de servicio";
$strings['AppliesTo'] = "Aplicado a";
$strings['ServiceInformation'] = "Información del servicio";
$strings['ListOfServicesOnSale'] = "Lista de servicios en venta";
$strings['GlobalConfig'] = "Configuración global";
$strings['WriteHereTheTermsAndConditionsOfYourECommerce'] = "Escriba aquí los términos y condiciones de su portal e-commerce";
$strings['EditService'] = "Editar servicio";
$strings['DeleteThisService'] = "Borrar servicio";
$strings['IConfirmIReadAndAcceptTermsAndCondition'] = "He leído y acepto los términos y condiciones";
$strings['PleaseSelectTheCorrectInfoToApplyTheService'] = "Porfavor Seleccione la información correcta para aplicar el servicio";
$strings['SaleStatusCancelled'] = "Venta anulada";
$strings['ServiceSaleInfo'] = "Información del servicio";
$strings['ServiceId'] = "Id de servicio";
$strings['BoughtBy'] = "Comprado por";
$strings['PurchaserUser'] = "Usuario comprador";
$strings['Pending'] = "Pendiente";
$strings['Names'] = "Nombres";
$strings['SellerName'] = "Nombre vendedor";
$strings['SellerId'] = "Identificador vendedor";
$strings['SellerAddress'] = "Dirección vendedor";
$strings['SellerEmail'] = "E-mail vendedor";
$strings['NextNumberInvoice'] = "Número siguiente factura";
$strings['NextNumberInvoiceDescription'] = "Número de la siguiente factura asignado de forma manual";
$strings['InvoiceSeries'] = "Serie factura";
$strings['InvoiceSeriesDescription'] = "Parámetro opcional: Ejemplo de numeración factura &lt;serie&gt;&lt;año&gt;/&lt;número&gt;";
$strings['InvoiceView'] = "Ver factura";
$strings['NoInvoiceEnable'] = "No está habilitado el bloque de facturación";
$strings['Company'] = "Empresa";
$strings['VAT'] = "CIF";
$strings['Address'] = "Dirección";
$strings['InvoiceNumber'] = "Num. factura";
$strings['InvoiceDate'] = "Fecha de emisión";
$strings['Invoice'] = "Factura";
$strings['SaleEmail'] = "E-mail de ventas";
$strings['PurchaseDetailsIntro'] = "Detalles de la comprar";
$strings['PurchaseDetailsEnd'] = "Atentamente";
$strings['ProductName'] = "Nombre producto";
$strings['BankAccountIntro'] = "Información cuentas bancarias";
$strings['AdditionalInfoRequired'] = 'Se requiere que se elija la información adicional antes de proceder';
$strings['SubscriptionToServiceXSuccessful'] = "La subscripción al servicio %s ha sido satisfactoria";
$strings['ClickHereToFinish'] = "De clic aquí para terminar";
$strings['OrderCancelled'] = "Pedido anulado";
$strings['use_currency_symbol'] = "Usar símbolo de la moneda";
$strings['ExportReport'] = "Exportar reporte de ventas";
$strings['OrderTime'] = "Fecha del pedido";
$strings['SelectDateRange'] = "Seleccione una <strong>fecha de inicio</strong> y una <strong>fecha de fin</strong> para el reporte";
$strings['ServiceAdded'] = "Servicio agregado";
$strings['ServiceEdited'] = "Servicio editado";
$strings['ServiceSaleInfo'] = "Información del servicio";
$strings['ListOfServicesOnSale'] = "Lista de servicios a la venta";
$strings['AdditionalInfo'] = "Información adicional";
$strings['PleaseSelectTheCorrectInfoToApplyTheService'] = "Porfavor Seleccione la información correcta para aplicar el servicio";
$strings['SubscriptionToServiceXSuccessful'] = "La subscripción al servicio %s ha sido satisfactoria";
$strings['culqi_enable'] = "Habilitar Culqi";
$strings['CulqiConfig'] = "Configuración de CULQI:";
$strings['InfoCulqiCredentials'] = "Para obtener las credenciales es necesario crearse una cuenta en Culqi e ingresar en modo desarrollo, copiar el código de comercio que se encuentra en su panel de control, luego ingresar al apartado de API Keys y generar la Key correspondiente para copiarla aquí";
$strings['CommerceCode'] = "Codigo de comercio";
$strings['IConfirmIReadAndAcceptTermsAndCondition'] = "He leído y aceptado los terminos y condiciones del servicio";
$strings['NoTermsAndConditionsProvided'] = "Terminos y condiciones no establecidos";
$strings['GlobalConfig'] = "Configuración global:";
$strings['WriteHereTheTermsAndConditionsOfYourECommerce'] = "Escriba aquí los terminos y condiciones para su tienda virtual";
$strings['PleaseSelectThePaymentMethodBeforeConfirmYourOrder'] = "Por favor seleccione el método de pago de su preferencia antes de confirmar su orden";
$strings['MyServices'] = "Mis servicios";
$strings['ServiceId'] = "Id de servicio";
$strings['BoughtBy'] = "Comprado por";
$strings['PurchaserUser'] = "Usuario comprador";
$strings['SalePrice'] = "Precio de venta";
$strings['Pending'] = "Pendiente";
$strings['YouNeedToBeRegisteredInAtLeastOneCourse'] = "Necesitas estar registrado en al menos un curso";
$strings['YouNeedToBeRegisteredInAtLeastOneSession'] = "Necesitas estar registrado en al menos una sesión";
$strings['IfYouWantToGetTheCertificateAndOrSkillsAsociatedToThisCourseYouNeedToBuyTheCertificateServiceYouCanGoToServiceCatalogClickingHere'] = "Si quieres obtener el certificado y/o las competencias asociadas a este curso, necesitas comprar el servicio de <b> Certificado </b>, puedes ir al catálogo de servicios para comprarlo haciendo click <a target='_blank' href='%s'>AQUÍ</a>";
$strings['AdditionalInfoRequired'] = 'Se requiere que se elija la información adicional antes de proceder';
$strings['ServiceDeleted'] = 'Servicio eliminado';
$strings['DeleteThisService'] = 'Eliminar este servicio';
$strings['YourCoursesNeedAtLeastOneLearningPath'] = 'Los cursos en los que estás registrado necesitan tener al menos una lección que contenga un item de cerficado final';
$strings['NoPaymentOptionAvailable'] = 'No existen opciones de pago. Por favor reporte este problema al administrador.';
$strings['XIsOnlyPaymentMethodAvailable'] = '%s es el único método de pago disponible para esta compra.';
$strings['GlobalTaxPerc'] = "Porcentaje del impuesto global";
$strings['GlobalTaxPercDescription'] = "Porcentaje por defecto que se usará, excepto si existe un impuesto específico en el curso, sesión o servicio.";
$strings['TaxPerc'] = "Porcentaje del impuesto";
@ -189,31 +223,6 @@ $strings['AllCoursesSessionsAndServices'] = "Todos (Cursos, sesiones y servicios
$strings['TaxNameCustom'] = "Nombre del impuesto";
$strings['TaxNameExamples'] = "VAT, IVA, IGV, TVA, IV ...";
$strings['ErrorUpdateFieldDB'] = "Error al actualizar los campos de la base de datos";
$strings['SellerName'] = "Nombre vendedor";
$strings['SellerId'] = "Identificador vendedor";
$strings['SellerAddress'] = "Dirección vendedor";
$strings['SellerEmail'] = "E-mail vendedor";
$strings['NextNumberInvoice'] = "Número siguiente factura";
$strings['NextNumberInvoiceDescription'] = "Número de la siguiente factura asignado de forma manual";
$strings['InvoiceSeries'] = "Serie factura";
$strings['InvoiceSeriesDescription'] = "Parámetro opcional: Ejemplo de numeración factura &lt;serie&gt;&lt;año&gt;/&lt;número&gt;";
$strings['InvoiceView'] = "Ver factura";
$strings['NoInvoiceEnable'] = "No está habilitado el bloque de facturación";
$strings['Company'] = "Empresa";
$strings['VAT'] = "CIF";
$strings['Address'] = "Dirección";
$strings['InvoiceNumber'] = "Num. factura";
$strings['InvoiceDate'] = "Fecha de emisión";
$strings['Invoice'] = "Factura";
$strings['SaleEmail'] = "E-mail de ventas";
$strings['PurchaseDetailsIntro'] = "Detalles de la comprar";
$strings['PurchaseDetailsEnd'] = "Atentamente";
$strings['ProductName'] = "Nombre producto";
$strings['BankAccountIntro'] = "Información cuentas bancarias";
$strings['CurrencyIsNotConfigured'] = "Por favor, configure una moneda antes de continuar.";
$strings['ExportReport'] = "Exportar reporte de ventas";
$strings['OrderTime'] = "Hora de pedido";
$strings['SelectDateRange'] = "Seleccione una <strong>fecha de inicio</strong> y <strong>fecha de fin</strong> para el reporte";
$strings['tpv_redsys_enable'] = "Habilitar TPV RedSys";
$strings['tpv_redsys_enable_help'] = "Para poder utilizar la modalidad de pago del TPV de RedSys es necesario descargar los ficheros de \"INTEGRACIÓN REST - API PHP\" en el siguiente enlace <a href='https://pagosonline.redsys.es/descargas.html'>web de RedSys</a> y ubicar el fichero el fichero <strong>apiRedSys.php</strong> en el directorio <em>plugin/buycourses/resources</em>.";
$strings['NotFindRedsysFile'] = "No se encuentra en el directorio <em>plugin/buycourses/resources</em> el fichero <strong>apiRedsys.php</strong>";
@ -226,3 +235,4 @@ $strings['kc'] = "Clave secreta de encriptación";
$strings['url_redsys'] = "URL conexión Redsys";
$strings['url_redsys_sandbox'] = "URL conexión Redsys (Pruebas)";
$strings['InfoTpvRedsysApiCredentials'] = "Deberá completar los siguientes campos del formulario con la información que les facilite el Soporte Técnico del TPV Redsys:";
$strings['InfoEmailExtra'] = "Información extra en e-mail";

@ -207,6 +207,17 @@ class BuyCoursesPlugin extends Plugin
}
}
$sql = "SHOW COLUMNS FROM $table WHERE Field = 'info_email_extra'";
$res = Database::query($sql);
if (Database::num_rows($res) === 0) {
$sql = "ALTER TABLE $table ADD (info_email_extra TEXT NOT NULL)";
$res = Database::query($sql);
if (!$res) {
echo Display::return_message($this->get_lang('ErrorUpdateFieldDB'), 'warning');
}
}
$table = self::TABLE_ITEM;
$sql = "SHOW COLUMNS FROM $table WHERE Field = 'tax_perc'";
$res = Database::query($sql);
@ -538,6 +549,37 @@ class BuyCoursesPlugin extends Plugin
);
}
/**
* Save email message information in transfer.
*
* @param array $params The transfer message
*
* @return int Rows affected. Otherwise return false
*/
public function saveTransferInfoEmail($params)
{
return Database::update(
Database::get_main_table(self::TABLE_GLOBAL_CONFIG),
['info_email_extra' => $params['tinfo_email_extra']],
['id = ?' => 1]
);
}
/**
* Gets message information for transfer email.
*
* @return array
*/
public function getTransferInfoExtra()
{
return Database::select(
'info_email_extra AS tinfo_email_extra',
Database::get_main_table(self::TABLE_GLOBAL_CONFIG),
['id = ?' => 1],
'first'
);
}
/**
* Get a list of transfer accounts.
*

@ -338,6 +338,30 @@ $transferForm->addButtonCreate(get_lang('Add'));
$transferAccounts = $plugin->getTransferAccounts();
$transferInfoForm = new FormValidator('transfer_info');
if ($transferInfoForm->validate()) {
$transferInfoFormValues = $transferInfoForm->getSubmitValues();
$plugin->saveTransferInfoEmail($transferInfoFormValues);
Display::addFlash(
Display::return_message(get_lang('Saved'), 'success')
);
header('Location:'.api_get_self());
exit;
}
$transferInfoForm->addHtmlEditor(
'tinfo_email_extra',
$plugin->get_lang('InfoEmailExtra'),
false,
false,
['ToolbarSet' => 'Minimal']
);
$transferInfoForm->addButtonCreate(get_lang('Save'));
$transferInfoForm->setDefaults($plugin->getTransferInfoExtra());
// Culqi main configuration
$culqiForm = new FormValidator('culqi_config');
@ -384,6 +408,7 @@ $tpl->assign('global_config_form', $globalSettingForm->returnForm());
$tpl->assign('paypal_form', $paypalForm->returnForm());
$tpl->assign('commission_form', $commissionForm->returnForm());
$tpl->assign('transfer_form', $transferForm->returnForm());
$tpl->assign('transfer_info_form', $transferInfoForm->returnForm());
$tpl->assign('culqi_form', $culqiForm->returnForm());
$tpl->assign('transfer_accounts', $transferAccounts);
$tpl->assign('paypal_enable', $paypalEnable);

@ -104,6 +104,7 @@ switch ($sale['payment_type']) {
}
$transferAccounts = $plugin->getTransferAccounts();
$infoEmailExtra = $plugin->getTransferInfoExtra()['tinfo_email_extra'];
$form = new FormValidator(
'success',
@ -139,6 +140,7 @@ switch ($sale['payment_type']) {
]
);
$messageTemplate->assign('transfer_accounts', $transferAccounts);
$messageTemplate->assign('info_email_extra', $infoEmailExtra);
MessageManager::send_message_simple(
$userInfo['user_id'],

@ -32,5 +32,6 @@
{% endfor %}
</tbody>
</table>
<p>{{ info_email_extra }}</p>
<p>{{ 'PurchaseDetailsEnd'|get_plugin_lang('BuyCoursesPlugin') }}</p>
</div>

@ -113,6 +113,9 @@
</table>
</div>
</div>
<div class="col-md-12">
{{ transfer_info_form }}
</div>
</div>
</div>
</div>

Loading…
Cancel
Save