BuyCourses: Show link when subscription is done - refs BT#14835

pull/2715/head
Angel Fernando Quiroz Campos 6 years ago
parent 5dd524f6ac
commit 274eb20eb2
  1. 2
      plugin/buycourses/lang/brazilian.php
  2. 2
      plugin/buycourses/lang/dutch.php
  3. 2
      plugin/buycourses/lang/english.php
  4. 2
      plugin/buycourses/lang/french.php
  5. 2
      plugin/buycourses/lang/spanish.php
  6. 31
      plugin/buycourses/src/buy_course_plugin.class.php
  7. 5
      plugin/buycourses/src/buycourses.ajax.php
  8. 5
      plugin/buycourses/src/sales_report.php
  9. 18
      plugin/buycourses/src/success.php

@ -47,7 +47,7 @@ $strings['CancelOrder'] = "Anular ordem";
$strings['BankAccountInformation'] = "Detalhes da conta bancária"; $strings['BankAccountInformation'] = "Detalhes da conta bancária";
$strings['BankAccount'] = "Contas bancárias"; $strings['BankAccount'] = "Contas bancárias";
$strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Uma vez confirmada, você receberá um e-mail com os dados bancários e uma referência de ordem."; $strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Uma vez confirmada, você receberá um e-mail com os dados bancários e uma referência de ordem.";
$strings['SubscriptionToCourseXSuccessful'] = "Sua inscrição para \"%s\ foi concluída com sucesso."; $strings['SubscriptionToCourseXSuccessful'] = "Sua inscrição para <a href=\"%s\"><strong>\"%s\"</strong></a> foi concluída com sucesso.";
$strings['OrderCanceled'] = "Ordem cancelada"; $strings['OrderCanceled'] = "Ordem cancelada";
$strings['OrderStatus'] = "Status do pedido"; $strings['OrderStatus'] = "Status do pedido";
$strings['SearchByStatus'] = "Pesquisar por estado"; $strings['SearchByStatus'] = "Pesquisar por estado";

@ -82,7 +82,7 @@ $strings['CancelOrder'] = "Annuleer order";
$strings['BankAccountInformation'] = "Bankgegevens"; $strings['BankAccountInformation'] = "Bankgegevens";
$strings['BankAccount'] = "Bankrekening"; $strings['BankAccount'] = "Bankrekening";
$strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Eenmaal bevestigd, ontvangt u een e-mail met de bankgegevens en een orderreferentie."; $strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Eenmaal bevestigd, ontvangt u een e-mail met de bankgegevens en een orderreferentie.";
$strings['SubscriptionToCourseXSuccessful'] = "Uw aankoop op \"%s \" werd met succes afgerond."; $strings['SubscriptionToCourseXSuccessful'] = "Uw aankoop op <a href=\"%s\"><strong>\"%s\"</strong></a> werd met succes afgerond.";
$strings['OrderCanceled'] = "Order geannuleerd"; $strings['OrderCanceled'] = "Order geannuleerd";
$strings['OrderStatus'] = "Bestelstatus"; $strings['OrderStatus'] = "Bestelstatus";
$strings['PayoutStatus'] = "Betalingsstatus"; $strings['PayoutStatus'] = "Betalingsstatus";

@ -82,7 +82,7 @@ $strings['CancelOrder'] = "Cancel order";
$strings['BankAccountInformation'] = "Bank account details"; $strings['BankAccountInformation'] = "Bank account details";
$strings['BankAccount'] = "Bank account"; $strings['BankAccount'] = "Bank account";
$strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Once confirmed, you will receive an e-mail with the bank details and an order reference."; $strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Once confirmed, you will receive an e-mail with the bank details and an order reference.";
$strings['SubscriptionToCourseXSuccessful'] = "Your subscription to \"%s\" was completed successfully."; $strings['SubscriptionToCourseXSuccessful'] = "Your subscription to <a href=\"%s\"><strong>\"%s\"</strong></a> was completed successfully.";
$strings['OrderCanceled'] = "Order canceled"; $strings['OrderCanceled'] = "Order canceled";
$strings['OrderStatus'] = "Order status"; $strings['OrderStatus'] = "Order status";
$strings['PayoutStatus'] = "Payment status"; $strings['PayoutStatus'] = "Payment status";

@ -82,7 +82,7 @@ $strings['CancelOrder'] = "Annuler la commande";
$strings['BankAccountInformation'] = "Détails du compte bancaire"; $strings['BankAccountInformation'] = "Détails du compte bancaire";
$strings['BankAccount'] = "Compte bancaire"; $strings['BankAccount'] = "Compte bancaire";
$strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Une fois confirmée, vous recevrez un e-mail avec les données bancaires et la référence de la commande"; $strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Une fois confirmée, vous recevrez un e-mail avec les données bancaires et la référence de la commande";
$strings['SubscriptionToCourseXSuccessful'] = "Votre inscription au \"%s\" est terminée."; $strings['SubscriptionToCourseXSuccessful'] = "Votre inscription au <a href=\"%s\"><strong>\"%s\"</strong></a> est terminée.";
$strings['OrderCanceled'] = "Commande annulée"; $strings['OrderCanceled'] = "Commande annulée";
$strings['OrderStatus'] = "Statut de commande"; $strings['OrderStatus'] = "Statut de commande";
$strings['PayoutStatus'] = "État du paiement"; $strings['PayoutStatus'] = "État du paiement";

@ -83,7 +83,7 @@ $strings['CancelOrder'] = "Cancelar Orden";
$strings['BankAccountInformation'] = "Información de la Cuenta Bancaria"; $strings['BankAccountInformation'] = "Información de la Cuenta Bancaria";
$strings['BankAccount'] = "Cuenta Bancaria"; $strings['BankAccount'] = "Cuenta Bancaria";
$strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Una vez confirmado, recibira un e-mail con los datos bancarios y una referencia del pedido."; $strings['OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Una vez confirmado, recibira un e-mail con los datos bancarios y una referencia del pedido.";
$strings['SubscriptionToCourseXSuccessful'] = "Tu subscripción a \"%s\" se realizó correctamente."; $strings['SubscriptionToCourseXSuccessful'] = "<p class=\"lead\">Tu subscripción a <a href=\"%s\"><strong>\"%s\"</strong></a> se realizó correctamente.</p>";
$strings['OrderCanceled'] = "Pedido cancelado"; $strings['OrderCanceled'] = "Pedido cancelado";
$strings['OrderStatus'] = "Estado del pedido"; $strings['OrderStatus'] = "Estado del pedido";
$strings['PayoutStatus'] = "Estado del pago"; $strings['PayoutStatus'] = "Estado del pago";

@ -2542,4 +2542,35 @@ class BuyCoursesPlugin extends Plugin
['id = ?' => (int) $serviceSaleId] ['id = ?' => (int) $serviceSaleId]
); );
} }
/**
* @param array $saleInfo
*
* @return string
*/
public function getSubscriptionSuccessMessage(array $saleInfo)
{
switch ($saleInfo['product_type']) {
case self::PRODUCT_TYPE_COURSE:
$courseInfo = api_get_course_info_by_id($saleInfo['product_id']);
$url = api_get_course_url($courseInfo['code']);
break;
case self::PRODUCT_TYPE_SESSION:
$sessionId = (int) $saleInfo['product_id'];
$url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionId;
break;
default:
$url = '#';
}
return Display::return_message(
sprintf(
$this->get_lang('SubscriptionToCourseXSuccessful'),
$url,
$saleInfo['product_name']
),
'success',
false
);
}
} }

@ -328,10 +328,7 @@ switch ($action) {
if ($saleIsCompleted) { if ($saleIsCompleted) {
Display::addFlash( Display::addFlash(
Display::return_message( $plugin->getSubscriptionSuccessMessage($sale)
sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $sale['product_name']),
'success'
)
); );
} }
} }

@ -33,10 +33,7 @@ if (isset($_GET['order'])) {
$plugin->completeSale($sale['id']); $plugin->completeSale($sale['id']);
$plugin->storePayouts($sale['id']); $plugin->storePayouts($sale['id']);
Display::addFlash( Display::addFlash(
Display::return_message( $plugin->getSubscriptionSuccessMessage($sale)
sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $sale['product_name']),
'success'
)
); );
$urlToRedirect .= http_build_query([ $urlToRedirect .= http_build_query([

@ -83,23 +83,9 @@ if ($form->validate()) {
switch ($confirmPayments['PAYMENTINFO_0_PAYMENTSTATUS']) { switch ($confirmPayments['PAYMENTINFO_0_PAYMENTSTATUS']) {
case 'Completed': case 'Completed':
$saleIsCompleted = $plugin->completeSale($sale['id']); $saleIsCompleted = $plugin->completeSale($sale['id']);
if ($saleIsCompleted && $buyingSession) { if ($saleIsCompleted) {
Display::addFlash( Display::addFlash(
Display::return_message( $plugin->getSubscriptionSuccessMessage($sale)
sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $session['name']),
'success'
)
);
$plugin->storePayouts($sale['id']);
break;
}
if ($saleIsCompleted && $buyingCourse) {
Display::addFlash(
Display::return_message(
sprintf($plugin->get_lang('SubscriptionToCourseXSuccessful'), $course['title']),
'success'
)
); );
$plugin->storePayouts($sale['id']); $plugin->storePayouts($sale['id']);
break; break;

Loading…
Cancel
Save