Add custom text in order confirmation message

pull/3669/head
Nosolored 5 years ago
parent 02ed0a606c
commit b3fa8404a6
  1. 1
      plugin/buycourses/lang/english.php
  2. 1
      plugin/buycourses/lang/spanish.php
  3. 42
      plugin/buycourses/src/buy_course_plugin.class.php
  4. 25
      plugin/buycourses/src/paymentsetup.php
  5. 2
      plugin/buycourses/src/process_confirm.php
  6. 1
      plugin/buycourses/view/message_transfer.tpl
  7. 3
      plugin/buycourses/view/paymentsetup.tpl

@ -205,3 +205,4 @@ $strings['kc'] = "Secret encryption key";
$strings['url_redsys'] = "Redsys connection URL"; $strings['url_redsys'] = "Redsys connection URL";
$strings['url_redsys_sandbox'] = "Redsys connection URL (Sandbox)"; $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 fields of the form with the information provided by the Redsys POS Technical Support:";
$strings['InfoEmailExtra'] = "Email extra info ";

@ -226,3 +226,4 @@ $strings['kc'] = "Clave secreta de encriptación";
$strings['url_redsys'] = "URL conexión Redsys"; $strings['url_redsys'] = "URL conexión Redsys";
$strings['url_redsys_sandbox'] = "URL conexión Redsys (Pruebas)"; $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['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";

@ -206,6 +206,17 @@ class BuyCoursesPlugin extends Plugin
echo Display::return_message($this->get_lang('ErrorUpdateFieldDB'), 'warning'); echo Display::return_message($this->get_lang('ErrorUpdateFieldDB'), 'warning');
} }
} }
$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; $table = self::TABLE_ITEM;
$sql = "SHOW COLUMNS FROM $table WHERE Field = 'tax_perc'"; $sql = "SHOW COLUMNS FROM $table WHERE Field = 'tax_perc'";
@ -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. * Get a list of transfer accounts.
* *

@ -338,6 +338,30 @@ $transferForm->addButtonCreate(get_lang('Add'));
$transferAccounts = $plugin->getTransferAccounts(); $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 // Culqi main configuration
$culqiForm = new FormValidator('culqi_config'); $culqiForm = new FormValidator('culqi_config');
@ -384,6 +408,7 @@ $tpl->assign('global_config_form', $globalSettingForm->returnForm());
$tpl->assign('paypal_form', $paypalForm->returnForm()); $tpl->assign('paypal_form', $paypalForm->returnForm());
$tpl->assign('commission_form', $commissionForm->returnForm()); $tpl->assign('commission_form', $commissionForm->returnForm());
$tpl->assign('transfer_form', $transferForm->returnForm()); $tpl->assign('transfer_form', $transferForm->returnForm());
$tpl->assign('transfer_info_form', $transferInfoForm->returnForm());
$tpl->assign('culqi_form', $culqiForm->returnForm()); $tpl->assign('culqi_form', $culqiForm->returnForm());
$tpl->assign('transfer_accounts', $transferAccounts); $tpl->assign('transfer_accounts', $transferAccounts);
$tpl->assign('paypal_enable', $paypalEnable); $tpl->assign('paypal_enable', $paypalEnable);

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

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

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

Loading…
Cancel
Save