|
@@ -4,9 +4,6 @@
|
|
* Process payments for the Buy Courses plugin
|
|
* Process payments for the Buy Courses plugin
|
|
* @package chamilo.plugin.buycourses
|
|
* @package chamilo.plugin.buycourses
|
|
*/
|
|
*/
|
|
-/**
|
|
|
|
- * Initialization
|
|
|
|
- */
|
|
|
|
|
|
|
|
$cidReset = true;
|
|
$cidReset = true;
|
|
|
|
|
|
@@ -48,7 +45,7 @@ $form = new FormValidator('confirm_sale');
|
|
|
|
|
|
if ($form->validate()) {
|
|
if ($form->validate()) {
|
|
$formValues = $form->getSubmitValues();
|
|
$formValues = $form->getSubmitValues();
|
|
-
|
|
|
|
|
|
+
|
|
if (!$formValues['payment_type']) {
|
|
if (!$formValues['payment_type']) {
|
|
Display::addFlash(
|
|
Display::addFlash(
|
|
Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false)
|
|
Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false)
|
|
@@ -64,8 +61,13 @@ if ($form->validate()) {
|
|
header('Location:'.api_get_self().'?'.$queryString);
|
|
header('Location:'.api_get_self().'?'.$queryString);
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
-
|
|
|
|
- $serviceSaleId = $plugin->registerServiceSale($serviceId, $formValues['payment_type'], $formValues['info_select'], $formValues['enable_trial']);
|
|
|
|
|
|
+
|
|
|
|
+ $serviceSaleId = $plugin->registerServiceSale(
|
|
|
|
+ $serviceId,
|
|
|
|
+ $formValues['payment_type'],
|
|
|
|
+ $formValues['info_select'],
|
|
|
|
+ $formValues['enable_trial']
|
|
|
|
+ );
|
|
|
|
|
|
if ($serviceSaleId !== false) {
|
|
if ($serviceSaleId !== false) {
|
|
$_SESSION['bc_service_sale_id'] = $serviceSaleId;
|
|
$_SESSION['bc_service_sale_id'] = $serviceSaleId;
|
|
@@ -94,7 +96,12 @@ $form->addHeader('');
|
|
$form->addRadio('payment_type', null, $paymentTypesOptions);
|
|
$form->addRadio('payment_type', null, $paymentTypesOptions);
|
|
$form->addHtml('<h3 class="panel-heading">'.$plugin->get_lang('AdditionalInfo').'</h3>');
|
|
$form->addHtml('<h3 class="panel-heading">'.$plugin->get_lang('AdditionalInfo').'</h3>');
|
|
$form->addHeader('');
|
|
$form->addHeader('');
|
|
-$form->addHtml(Display::return_message($plugin->get_lang('PleaseSelectTheCorrectInfoToApplyTheService'), 'info'));
|
|
|
|
|
|
+$form->addHtml(
|
|
|
|
+ Display::return_message(
|
|
|
|
+ $plugin->get_lang('PleaseSelectTheCorrectInfoToApplyTheService'),
|
|
|
|
+ 'info'
|
|
|
|
+ )
|
|
|
|
+);
|
|
$selectOptions = [
|
|
$selectOptions = [
|
|
0 => get_lang('None')
|
|
0 => get_lang('None')
|
|
];
|
|
];
|
|
@@ -145,7 +152,6 @@ if ($typeUser) {
|
|
// Now get all the courses lp's
|
|
// Now get all the courses lp's
|
|
$thisLpList = $em->getRepository('ChamiloCourseBundle:CLp')->findBy(['cId' => $course->getCourse()->getId()]);
|
|
$thisLpList = $em->getRepository('ChamiloCourseBundle:CLp')->findBy(['cId' => $course->getCourse()->getId()]);
|
|
foreach ($thisLpList as $lp) {
|
|
foreach ($thisLpList as $lp) {
|
|
-
|
|
|
|
$courseLpList[$lp->getCId()] = $lp->getName().' ('.$course->getCourse()->getTitle().')'; ;
|
|
$courseLpList[$lp->getCId()] = $lp->getName().' ('.$course->getCourse()->getTitle().')'; ;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -190,10 +196,8 @@ if ($typeUser) {
|
|
$form->addHtml(Display::return_message($plugin->get_lang('YourCoursesNeedAtLeastOneLearningPath'), 'error'));
|
|
$form->addHtml(Display::return_message($plugin->get_lang('YourCoursesNeedAtLeastOneLearningPath'), 'error'));
|
|
}
|
|
}
|
|
$form->addSelect('info_select', get_lang('LearningPath'), $selectOptions);
|
|
$form->addSelect('info_select', get_lang('LearningPath'), $selectOptions);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
$form->addHidden('t', intval($_GET['t']));
|
|
$form->addHidden('t', intval($_GET['t']));
|
|
$form->addHidden('i', intval($_GET['i']));
|
|
$form->addHidden('i', intval($_GET['i']));
|
|
|
|
|
|
@@ -201,17 +205,16 @@ $form->addButton('submit', $plugin->get_lang('ConfirmOrder'), 'check', 'success'
|
|
|
|
|
|
// View
|
|
// View
|
|
$templateName = $plugin->get_lang('PaymentMethods');
|
|
$templateName = $plugin->get_lang('PaymentMethods');
|
|
-$interbreadcrumb[] = array("url" => "service_catalog.php", "name" => $plugin->get_lang('ListOfServicesOnSale'));
|
|
|
|
|
|
+$interbreadcrumb[] = array(
|
|
|
|
+ "url" => "service_catalog.php",
|
|
|
|
+ "name" => $plugin->get_lang('ListOfServicesOnSale'),
|
|
|
|
+);
|
|
|
|
|
|
$tpl = new Template($templateName);
|
|
$tpl = new Template($templateName);
|
|
-
|
|
|
|
$tpl->assign('buying_service', true);
|
|
$tpl->assign('buying_service', true);
|
|
$tpl->assign('service', $serviceInfo);
|
|
$tpl->assign('service', $serviceInfo);
|
|
$tpl->assign('user', api_get_user_info());
|
|
$tpl->assign('user', api_get_user_info());
|
|
$tpl->assign('form', $form->returnForm());
|
|
$tpl->assign('form', $form->returnForm());
|
|
-
|
|
|
|
-
|
|
|
|
$content = $tpl->fetch('buycourses/view/process.tpl');
|
|
$content = $tpl->fetch('buycourses/view/process.tpl');
|
|
-
|
|
|
|
$tpl->assign('content', $content);
|
|
$tpl->assign('content', $content);
|
|
$tpl->display_one_col_template();
|
|
$tpl->display_one_col_template();
|