WIP: buy courses - add currency symbol see BT#16054

pull/2999/head
Julio Montoya 6 years ago
parent aaa82d3e1f
commit 3b7dfd60f5
  1. 3
      main/lp/lp_final_item.php
  2. 2
      main/session/session_edit.php
  3. 1
      plugin/buycourses/lang/english.php
  4. 277
      plugin/buycourses/src/buy_course_plugin.class.php
  5. 44
      plugin/buycourses/src/buycourses.ajax.php
  6. 11
      plugin/buycourses/src/configure_course.php
  7. 31
      plugin/buycourses/src/invoice.php
  8. 8
      plugin/buycourses/src/paymentsetup.php
  9. 2
      plugin/buycourses/src/process.php
  10. 38
      plugin/buycourses/src/sales_report.php
  11. 6
      plugin/buycourses/src/service_panel.php
  12. 2
      plugin/buycourses/src/service_process_confirm.php
  13. 23
      plugin/buycourses/src/service_sales_report.php
  14. 6
      plugin/buycourses/view/catalog.tpl
  15. 18
      plugin/buycourses/view/list.tpl
  16. 6
      plugin/buycourses/view/payout_report.tpl
  17. 4
      plugin/buycourses/view/paypal_payout.tpl
  18. 61
      plugin/buycourses/view/process.tpl
  19. 13
      plugin/buycourses/view/process_confirm.tpl
  20. 8
      plugin/buycourses/view/sales_report.tpl
  21. 6
      plugin/buycourses/view/service_panel.tpl
  22. 38
      plugin/buycourses/view/service_process.tpl
  23. 12
      plugin/buycourses/view/service_sales_report.tpl

@ -36,8 +36,7 @@ $plugin = BuyCoursesPlugin::create();
$checker = $plugin->isEnabled() && $plugin->get('include_services');
if ($checker) {
$userServiceSale = $plugin->getServiceSale(
null,
$userServiceSale = $plugin->getServiceSales(
$userId,
BuyCoursesPlugin::SERVICE_STATUS_COMPLETED,
BuyCoursesPlugin::SERVICE_TYPE_LP_FINAL_ITEM,

@ -81,8 +81,6 @@ if (api_is_multiple_url_enabled()) {
$result = Database::query($sql);
$coaches = Database::store_result($result);
$thisYear = date('Y');
$coachesOption = [
'' => '----- '.get_lang('None').' -----',
];

@ -188,3 +188,4 @@ $strings['AdditionalInfoRequired'] = 'More information needed';
$strings['SubscriptionToServiceXSuccessful'] = "Subscription to service %s completed.";
$strings['ClickHereToFinish'] = "Click here to finish";
$strings['OrderCancelled'] = "Order cancelled";
$strings['use_currency_symbol'] = "Use currency symbol";

@ -56,7 +56,7 @@ class BuyCoursesPlugin extends Plugin
const TAX_APPLIES_TO_ONLY_COURSE = 2;
const TAX_APPLIES_TO_ONLY_SESSION = 3;
const TAX_APPLIES_TO_ONLY_SERVICES = 4;
const PAGINATION_PAGE_SIZE = 2;
const PAGINATION_PAGE_SIZE = 5;
public $isAdminPlugin = true;
@ -89,6 +89,7 @@ class BuyCoursesPlugin extends Plugin
'hide_free_text' => 'boolean',
'invoicing_enable' => 'boolean',
'tax_enable' => 'boolean',
'use_currency_symbol' => 'boolean',
]
);
}
@ -673,8 +674,7 @@ class BuyCoursesPlugin extends Plugin
'title' => $course->getTitle(),
'code' => $course->getCode(),
'course_img' => null,
'price' => $item['total_price'],
'currency' => $item['iso_code'],
'item' => $item,
'teachers' => [],
'enrolled' => $this->getUserStatusForCourse(api_get_user_id(), $course),
];
@ -698,6 +698,31 @@ class BuyCoursesPlugin extends Plugin
return $courseCatalog;
}
/**
* @param $price
* @param $isoCode
*
* @return string
*/
public function getPriceWithCurrencyFromIsoCode($price, $isoCode)
{
$useSymbol = $this->get('use_currency_symbol') === 'true';
$result = $isoCode.' '.$price;
if ($useSymbol) {
if ($isoCode === 'BRL') {
$symbol = 'R$';
} else {
$symbol = Symfony\Component\Intl\Intl::getCurrencyBundle()->getCurrencySymbol($isoCode);
}
$result = $symbol.' '.$price;
}
return $result;
}
/**
* Get course info.
*
@ -742,13 +767,9 @@ class BuyCoursesPlugin extends Plugin
'code' => $course->getCode(),
'visual_code' => $course->getVisualCode(),
'teachers' => [],
'price' => $item['total_price_formatted'],
'price_without_tax' => $item['price_formatted'],
'tax_amount' => $item['tax_amount_formatted'],
'tax_perc' => $item['tax_perc_show'],
'item' => $item,
'tax_name' => $globalParameters['tax_name'],
'tax_enable' => $this->checkTaxEnabledInProduct(self::TAX_APPLIES_TO_ONLY_COURSE),
'currency' => $item['iso_code'],
'course_img' => null,
];
@ -815,16 +836,12 @@ class BuyCoursesPlugin extends Plugin
'description' => $session->getDescription(),
'dates' => $sessionDates,
'courses' => [],
'price' => $item['total_price_formatted'],
'price_without_tax' => $item['price_formatted'],
'tax_amount' => $item['tax_amount_formatted'],
'tax_perc' => $item['tax_perc_show'],
'tax_name' => $globalParameters['tax_name'],
'tax_enable' => $this->checkTaxEnabledInProduct(self::TAX_APPLIES_TO_ONLY_SESSION),
'currency' => $item['iso_code'],
'image' => null,
'nbrCourses' => $session->getNbrCourses(),
'nbrUsers' => $session->getNbrUsers(),
'item' => $item
];
$fieldValue = new ExtraFieldValue('session');
@ -888,6 +905,7 @@ class BuyCoursesPlugin extends Plugin
return false;
}
$productName = '';
if ($item['product_type'] == self::PRODUCT_TYPE_COURSE) {
$course = $entityManager->find('ChamiloCoreBundle:Course', $item['product_id']);
@ -1014,31 +1032,15 @@ class BuyCoursesPlugin extends Plugin
*/
public function getDataSaleInvoice($saleId, $isService)
{
$sale = [];
if ($isService) {
$sale = $this->getServiceSale($saleId);
$sale['reference'] = $sale['reference'];
$sale['product_name'] = $sale['service']['name'];
$sale['payment_type'] = $sale['payment_type'];
$sale['user_id'] = $sale['buyer']['id'];
// $data['price'] = $sale['price'];
//$data['price_without_tax'] = $sale['price_without_tax'];
//$data['tax_perc'] = $sale['tax_perc'];
//$data['tax_amount'] = $sale['tax_amount'];
//$data['currency_id'] = $sale['currency_id'];
$sale['date'] = $sale['buy_date'];
} else {
$sale = $this->getSale($saleId);
//$data['reference'] = $sale['reference'];
//$data['product_name'] = $sale['product_name'];
//$data['payment_type'] = $sale['payment_type'];
//$data['user_id'] = $sale['user_id'];
//$data['price'] = $sale['price'];
//$data['price_without_tax'] = $sale['price_without_tax'];
//$data['tax_perc'] = $sale['tax_perc'];
//$data['tax_amount'] = $sale['tax_amount'];
//$data['currency_id'] = $sale['currency_id'];
//$data['date'] = $sale['date'];
}
return $sale;
@ -1073,7 +1075,7 @@ class BuyCoursesPlugin extends Plugin
* @param int $saleId The sale id
* @param int $isService Check if a service
*
* @return array The invoice numbers
* @return string
*/
public function getNumInvoice($saleId, $isService)
{
@ -1380,7 +1382,7 @@ class BuyCoursesPlugin extends Plugin
public function generateReference($userId, $productType, $productId)
{
return vsprintf(
"%d-%d-%d-%s",
'%d-%d-%d-%s',
[$userId, $productType, $productId, self::randomText()]
);
}
@ -1792,7 +1794,7 @@ class BuyCoursesPlugin extends Plugin
$extraFieldValues = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
$paypalExtraField = Database::select(
"*",
'*',
$extraFieldTable,
[
'where' => ['variable = ?' => 'paypal'],
@ -1806,7 +1808,7 @@ class BuyCoursesPlugin extends Plugin
$paypalFieldId = $paypalExtraField['id'];
$paypalAccount = Database::select(
"value",
'value',
$extraFieldValues,
[
'where' => ['field_id = ? AND item_id = ?' => [(int) $paypalFieldId, (int) $userId]],
@ -2038,18 +2040,33 @@ class BuyCoursesPlugin extends Plugin
$product['tax_amount'] = 0;
$precision = 2;
if ($this->checkTaxEnabledInProduct($productType)) {
$globalParameters = $this->getGlobalParameters();
$globalTaxPerc = $globalParameters['global_tax_perc'];
$taxPerc = is_null($product['tax_perc']) ? $globalTaxPerc : $product['tax_perc'];
if (is_null($product['tax_perc'])) {
$globalParameters = $this->getGlobalParameters();
$globalTaxPerc = $globalParameters['global_tax_perc'];
$taxPerc = $globalTaxPerc;
} else {
$taxPerc = $product['tax_perc'];
}
//$taxPerc = is_null($product['tax_perc']) ? $globalTaxPerc : $product['tax_perc'];
$taxAmount = round($priceWithoutTax * $taxPerc / 100, $precision);
$product['tax_amount'] = $taxAmount;
$priceWithTax = $priceWithoutTax + $taxAmount;
$product['total_price'] = $priceWithTax;
}
$product['tax_perc_show'] = $taxPerc;
$product['total_price_formatted'] = number_format($product['total_price'], $precision);
$product['price_formatted'] = number_format($product['price'], $precision);
$product['price_formatted'] = $this->getPriceWithCurrencyFromIsoCode(
number_format($product['price'], $precision),
$product['iso_code']
);
$product['tax_amount_formatted'] = number_format($product['tax_amount'], $precision);
$product['total_price_formatted'] = $this->getPriceWithCurrencyFromIsoCode(
number_format($product['total_price'], $precision),
$product['iso_code']
);
}
/**
@ -2079,12 +2096,11 @@ class BuyCoursesPlugin extends Plugin
$showData
);
$service['iso_code'] = $isoCode;
$globalParameters = $this->getGlobalParameters();
$this->setPriceSettings($service, self::TAX_APPLIES_TO_ONLY_SERVICES);
$service['price_with_tax'] = $service['total_price_formatted'];
$service['price_without_tax'] = $service['price_formatted'];
$service['tax_name'] = $globalParameters['tax_name'];
$service['tax_enable'] = $this->checkTaxEnabledInProduct(self::TAX_APPLIES_TO_ONLY_SERVICES);
$service['owner_name'] = api_get_person_name($service['firstname'], $service['lastname']);
@ -2144,55 +2160,44 @@ class BuyCoursesPlugin extends Plugin
/**
* List services sales.
*
* @param int $id service id
* @param int $buyerId buyer id
* @param int $status status
* @param int $nodeType The node Type ( User = 1 , Course = 2 , Session = 3 )
* @param int $nodeId the nodeId
* @param bool $hot enable hot services
*
* @return array
*/
public function getServiceSale(
$id = 0,
public function getServiceSales(
$buyerId = 0,
$status = 0,
$nodeType = 0,
$nodeId = 0,
$hot = false
$nodeId = 0
) {
$servicesTable = Database::get_main_table(self::TABLE_SERVICES);
$servicesSaleTable = Database::get_main_table(self::TABLE_SERVICES_SALE);
$conditions = null;
$showData = 'all';
$groupBy = '';
$id = (int) $id;
$buyerId = (int) $buyerId;
$status = (int) $status;
$nodeType = (int) $nodeType;
$nodeId = (int) $nodeId;
if (!empty($id)) {
$conditions = ['WHERE' => ['ss.id = ?' => $id]];
$showData = 'first';
}
$defaultOrder = 'ss.id ASC';
if (!empty($buyerId)) {
$conditions = ['WHERE' => ['ss.buyer_id = ?' => $buyerId], 'ORDER' => 'id ASC'];
$conditions = ['WHERE' => ['ss.buyer_id = ?' => $buyerId], 'ORDER' => $defaultOrder];
}
if (is_numeric($status) && empty($id)) {
$conditions = ['WHERE' => ['ss.status = ?' => $status], 'ORDER' => 'id ASC'];
if (is_numeric($status)) {
$conditions = ['WHERE' => ['ss.status = ?' => $status], 'ORDER' => $defaultOrder];
}
if ($id && $buyerId) {
$conditions = ['WHERE' => ['ss.id = ? AND ss.buyer_id = ?' => [$id, $buyerId]], 'ORDER' => 'id ASC'];
if ($buyerId) {
$conditions = ['WHERE' => ['ss.buyer_id = ?' => [$buyerId]], 'ORDER' => $defaultOrder];
}
if ($nodeType && $nodeId) {
$conditions = [
'WHERE' => ['ss.node_type = ? AND ss.node_id = ?' => [$nodeType, $nodeId]], 'ORDER' => 'id ASC',
'WHERE' => ['ss.node_type = ? AND ss.node_id = ?' => [$nodeType, $nodeId]],
'ORDER' => $defaultOrder,
];
}
@ -2206,101 +2211,79 @@ class BuyCoursesPlugin extends Plugin
$status,
],
],
'ORDER' => 'id ASC',
'ORDER' => 'ss.service_id ASC',
];
}
if ($hot) {
$hot = 'count(ss.service_id) as hot, ';
$conditions = ['ORDER' => 'hot DESC', 'LIMIT' => '6'];
$groupBy = 'GROUP BY ss.service_id';
'clean_teacher_files.php';
}
$servicesTable = Database::get_main_table(self::TABLE_SERVICES);
$servicesSaleTable = Database::get_main_table(self::TABLE_SERVICES_SALE);
$innerJoins = "INNER JOIN $servicesTable s ON ss.service_id = s.id $groupBy";
$currency = $this->getSelectedCurrency();
$isoCode = $currency['iso_code'];
$return = Database::select(
"ss.*, s.name, s.description, s.price as service_price, s.duration_days, s.applies_to, s.owner_id, s.visibility, s.image, $hot '$isoCode' as currency",
'DISTINCT ss.id ',
"$servicesSaleTable ss $innerJoins",
$conditions,
$showData
$conditions
//, "all", null, true
);
$servicesSale = [];
if ($id) {
$owner = api_get_user_info($return['owner_id']);
$buyer = api_get_user_info($return['buyer_id']);
$servicesSale['id'] = $return['id'];
$servicesSale['service']['id'] = $return['service_id'];
$servicesSale['service']['name'] = $return['name'];
$servicesSale['service']['description'] = $return['description'];
$servicesSale['service']['price'] = $return['service_price'];
$servicesSale['service']['currency'] = $return['currency'];
$servicesSale['service']['duration_days'] = $return['duration_days'];
$servicesSale['service']['applies_to'] = $return['applies_to'];
$servicesSale['service']['owner']['id'] = $return['owner_id'];
$servicesSale['service']['owner']['name'] = api_get_person_name($owner['firstname'], $owner['lastname']);
$servicesSale['service']['visibility'] = $return['visibility'];
$servicesSale['service']['image'] = $return['image'];
$servicesSale['reference'] = $return['reference'];
$servicesSale['currency_id'] = $return['currency_id'];
$servicesSale['currency'] = $return['currency'];
$servicesSale['price'] = $return['price'];
$servicesSale['price_without_tax'] = $return['price_without_tax'];
$servicesSale['tax_perc'] = $return['tax_perc'];
$servicesSale['tax_amount'] = $return['tax_amount'];
$servicesSale['node_type'] = $return['node_type'];
$servicesSale['node_id'] = $return['node_id'];
$servicesSale['buyer']['id'] = $buyer['user_id'];
$servicesSale['buyer']['name'] = api_get_person_name($buyer['firstname'], $buyer['lastname']);
$servicesSale['buyer']['username'] = $buyer['username'];
$servicesSale['buy_date'] = $return['buy_date'];
$servicesSale['date_start'] = $return['date_start'];
$servicesSale['date_end'] = $return['date_end'];
$servicesSale['status'] = $return['status'];
$servicesSale['payment_type'] = $return['payment_type'];
$servicesSale['invoice'] = $return['invoice'];
return $servicesSale;
$list = [];
foreach ($return as $service) {
$list[] = $this->getServiceSale($service['id']);
}
foreach ($return as $index => $service) {
$owner = api_get_user_info($service['owner_id']);
$buyer = api_get_user_info($service['buyer_id']);
$servicesSale[$index]['id'] = $service['id'];
$servicesSale[$index]['service']['id'] = $service['service_id'];
$servicesSale[$index]['service']['name'] = $service['name'];
$servicesSale[$index]['service']['description'] = $service['description'];
$servicesSale[$index]['service']['price'] = $service['service_price'];
$servicesSale[$index]['service']['duration_days'] = $service['duration_days'];
$servicesSale[$index]['service']['applies_to'] = $service['applies_to'];
$servicesSale[$index]['service']['owner']['id'] = $service['owner_id'];
$servicesSale[$index]['service']['owner']['name'] = api_get_person_name(
$owner['firstname'],
$owner['lastname']
);
$servicesSale[$index]['service']['visibility'] = $service['visibility'];
$servicesSale[$index]['service']['image'] = $service['image'];
$servicesSale[$index]['reference'] = $service['reference'];
$servicesSale[$index]['currency_id'] = $service['currency_id'];
$servicesSale[$index]['currency'] = $service['currency'];
$servicesSale[$index]['price'] = $service['price'];
$servicesSale[$index]['node_type'] = $service['node_type'];
$servicesSale[$index]['node_id'] = $service['node_id'];
$servicesSale[$index]['buyer']['id'] = $service['buyer_id'];
$servicesSale[$index]['buyer']['name'] = api_get_person_name($buyer['firstname'], $buyer['lastname']);
$servicesSale[$index]['buyer']['username'] = $buyer['username'];
$servicesSale[$index]['buy_date'] = $service['buy_date'];
$servicesSale[$index]['date_start'] = $service['date_start'];
$servicesSale[$index]['date_end'] = $service['date_end'];
$servicesSale[$index]['status'] = $service['status'];
$servicesSale[$index]['payment_type'] = $service['payment_type'];
$servicesSale[$index]['invoice'] = $service['invoice'];
return $list;
}
/**
* @param int $id service sale id
*
* @return array
*/
public function getServiceSale($id)
{
$servicesTable = Database::get_main_table(self::TABLE_SERVICES);
$servicesSaleTable = Database::get_main_table(self::TABLE_SERVICES_SALE);
if (empty($id)) {
return [];
}
$conditions = ['WHERE' => ['ss.id = ?' => $id]];
$innerJoins = "INNER JOIN $servicesTable s ON ss.service_id = s.id ";
$currency = $this->getSelectedCurrency();
$isoCode = $currency['iso_code'];
$servicesSale = Database::select(
'ss.*, s.name, s.description, s.price as service_price, s.duration_days, s.applies_to, s.owner_id, s.visibility, s.image',
"$servicesSaleTable ss $innerJoins",
$conditions,
'first'
);
$owner = api_get_user_info($servicesSale['owner_id']);
$buyer = api_get_user_info($servicesSale['buyer_id']);
$servicesSale['service']['id'] = $servicesSale['service_id'];
$servicesSale['service']['name'] = $servicesSale['name'];
$servicesSale['service']['description'] = $servicesSale['description'];
$servicesSale['service']['price'] = $servicesSale['service_price'];
$servicesSale['service']['currency'] = $isoCode;
$servicesSale['service']['total_price'] = $this->getPriceWithCurrencyFromIsoCode(
$servicesSale['price'],
$isoCode
);
$servicesSale['service']['duration_days'] = $servicesSale['duration_days'];
$servicesSale['service']['applies_to'] = $servicesSale['applies_to'];
$servicesSale['service']['owner']['id'] = $servicesSale['owner_id'];
$servicesSale['service']['owner']['name'] = api_get_person_name($owner['firstname'], $owner['lastname']);
$servicesSale['service']['visibility'] = $servicesSale['visibility'];
$servicesSale['service']['image'] = $servicesSale['image'];
$servicesSale['item'] = $this->getService($servicesSale['service_id']);
$servicesSale['buyer']['id'] = $buyer['user_id'];
$servicesSale['buyer']['name'] = api_get_person_name($buyer['firstname'], $buyer['lastname']);
$servicesSale['buyer']['username'] = $buyer['username'];
return $servicesSale;
}
@ -2411,11 +2394,10 @@ class BuyCoursesPlugin extends Plugin
* @param int $serviceId The service ID
* @param int $paymentType The payment type
* @param int $infoSelect The ID for Service Type
* @param int $trial trial mode
*
* @return bool
*/
public function registerServiceSale($serviceId, $paymentType, $infoSelect, $trial = null)
public function registerServiceSale($serviceId, $paymentType, $infoSelect)
{
if (!in_array(
$paymentType,
@ -2436,10 +2418,11 @@ class BuyCoursesPlugin extends Plugin
$price = $service['price'];
$priceWithoutTax = null;
$taxPerc = null;
$taxEnable = $this->get('tax_enable') === 'true';
$globalParameters = $this->getGlobalParameters();
$taxAppliesTo = $globalParameters['tax_applies_to'];
$taxAmount = 0;
if ($taxEnable &&
($taxAppliesTo == self::TAX_APPLIES_TO_ALL || $taxAppliesTo == self::TAX_APPLIES_TO_ONLY_SERVICES)
) {

@ -31,15 +31,13 @@ switch ($action) {
break;
}
$userId = isset($_POST['id']) ? intval($_POST['id']) : '';
$userId = isset($_POST['id']) ? (int) $_POST['id'] : '';
$isUserHavePaypalAccount = $plugin->verifyPaypalAccountByBeneficiary($userId);
if ($isUserHavePaypalAccount) {
echo '';
} else {
echo '<b style="color: red; font-size: 70%;">* '.$plugin->get_lang('NoPayPalAccountDetected').'</b>';
}
break;
case 'saleInfo':
if (api_is_anonymous()) {
@ -249,9 +247,7 @@ switch ($action) {
false
);
}
break;
case 'cancelPayout':
if (api_is_anonymous()) {
break;
@ -278,16 +274,14 @@ switch ($action) {
if (!$tokenId || !$saleId) {
break;
}
$sale = $plugin->getSale($saleId);
if (!$sale) {
break;
}
require_once "Requests.php";
require_once 'Requests.php';
Requests::register_autoloader();
require_once "culqi.php";
require_once 'culqi.php';
$culqiParams = $plugin->getCulqiParams();
@ -374,10 +368,9 @@ switch ($action) {
break;
}
require_once "Requests.php";
require_once 'Requests.php';
Requests::register_autoloader();
require_once "culqi.php";
require_once 'culqi.php';
$culqiParams = $plugin->getCulqiParams();
// API Key y autenticación
@ -451,7 +444,7 @@ switch ($action) {
}
break;
case 'service_sale_info':
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
$serviceSale = $plugin->getServiceSale($id);
$isAdmin = api_is_platform_admin();
if (!$serviceSale) {
@ -464,7 +457,6 @@ switch ($action) {
$html .= "<br />";
$html .= "<legend>{$plugin->get_lang('ServiceInformation')}</legend>";
$html .= "<ul>";
$html .= "<li><b>{$plugin->get_lang('ServiceId')}:</b> {$serviceSale['id']}</li> ";
$html .= "<li><b>{$plugin->get_lang('ServiceName')}:</b> {$serviceSale['service']['name']}</li> ";
$html .= "<li><b>{$plugin->get_lang('Description')}:</b> {$serviceSale['service']['description']}</li> ";
$nodeType = $serviceSale['node_type'];
@ -496,23 +488,13 @@ switch ($action) {
}
}
}
//$html .= "<li><b>{$plugin->get_lang('AppliesTo')}:</b> $nodeType</li> ";
// $html .= "<li><b>{$plugin->get_lang('Price')}:</b> {$serviceSale['service']['price']} {$serviceSale['currency']}</li> ";
//$duration = $serviceSale['service']['duration_days'].' '.$plugin->get_lang('Days');
$html .= "</ul>";
$html .= "<legend>{$plugin->get_lang('SaleInfo')}</legend>";
$html .= "<ul>";
$html .= "<li><b>{$plugin->get_lang('BoughtBy')}:</b> {$serviceSale['buyer']['name']}</li> ";
$html .= "<li><b>{$plugin->get_lang('PurchaserUser')}:</b> {$serviceSale['buyer']['username']}</li> ";
$taxEnable = $plugin->get('tax_enable') === 'true';
if ($taxEnable) {
//$html .= "<li><b>{$plugin->get_lang('Price')}:</b> {$serviceSale['price_without_tax']} {$serviceSale['currency']}</li> ";
//$html .= "<li><b>{$plugin->get_lang('Price')}:</b> {$serviceSale['tax_amount']} {$serviceSale['currency']}</li> ";
}
$html .= "<li><b>{$plugin->get_lang('Total')}:</b> {$serviceSale['price']} {$serviceSale['currency']}</li> ";
//$html .= "<li><b>{$plugin->get_lang('SalePrice')}:</b> {$serviceSale['price_without_tax']} {$serviceSale['currency']}</li> ";
$html .= "<li><b>{$plugin->get_lang('Total')}:</b> {$serviceSale['service']['total_price']}</li> ";
$orderDate = api_format_date($serviceSale['buy_date'], DATE_FORMAT_LONG);
$html .= "<li><b>{$plugin->get_lang('OrderDate')}:</b> $orderDate</li> ";
$paymentType = $serviceSale['payment_type'];
@ -528,7 +510,6 @@ switch ($action) {
}
}
$html .= "<li><b>{$plugin->get_lang('PaymentMethod')}:</b> $paymentType</li> ";
//$html .= "<li><b>$nodeType:</b> $nodeName</li> ";
$status = $serviceSale['status'];
$buttons = '';
if ($status == BuyCoursesPlugin::SERVICE_STATUS_COMPLETED) {
@ -581,11 +562,10 @@ switch ($action) {
echo $html;
break;
case 'service_sale_confirm':
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
$serviceSale = $plugin->getServiceSale($id);
$response = $plugin->completeServiceSale($id);
$html = "";
$html .= "<div class='text-center'>";
$html = "<div class='text-center'>";
if ($response) {
$html .= Display::return_message(
@ -606,9 +586,7 @@ switch ($action) {
echo $html;
break;
case 'service_sale_cancel':
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$serviceSale = $plugin->getServiceSale($id);
$id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
$response = $plugin->cancelServiceSale($id);
$html = '';
$html .= "<div class='text-center'>";

@ -25,7 +25,6 @@ $commissionsEnable = $plugin->get('commissions_enable');
if ($commissionsEnable == 'true') {
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH)
.'buycourses/resources/js/commissions.js"></script>';
$defaultCommissions = [];
$commissions = '';
}
@ -263,7 +262,9 @@ $form->freeze(['product_type', 'name']);
if ($form->validate()) {
$formValues = $form->exportValues();
$id = $formValues['id'];
$productItem = $plugin->getItemByProduct($id, $formValues['type']);
$type = $formValues['type'];
$productItem = $plugin->getItemByProduct($id, $type);
if (isset($formValues['visible'])) {
$taxPerc = $formValues['tax_perc'] != '' ? (int) $formValues['tax_perc'] : null;
if (!empty($productItem)) {
@ -272,13 +273,13 @@ if ($form->validate()) {
'price' => floatval($formValues['price']),
'tax_perc' => $taxPerc,
],
$formValues['i'],
$formValues['t']
$id,
$type
);
} else {
$itemId = $plugin->registerItem([
'currency_id' => (int) $currency['id'],
'product_type' => $formValues['type'],
'product_type' => $type,
'product_id' => $id,
'price' => floatval($_POST['price']),
'tax_perc' => $taxPerc,

@ -97,34 +97,47 @@ $row = [
$infoSale['reference'],
$infoSale['product_name'],
];
//var_dump($infoSale);exit;
$isoCode = $plugin->getCurrency($infoSale['currency_id'])['iso_code'];
if ($taxEnable) {
$row[] = $plugin->getCurrency($infoSale['currency_id'])['iso_code'].' '.$infoSale['price_without_tax'];
$row[] = $plugin->getCurrency($infoSale['currency_id'])['iso_code'].
' '.$infoSale['tax_amount'].
' ('.(int) $infoSale['tax_perc'].'%)';
$row[] = $plugin->getPriceWithCurrencyFromIsoCode($infoSale['price_without_tax'], $isoCode);
$row[] = $plugin->getPriceWithCurrencyFromIsoCode($infoSale['tax_amount'], $isoCode).' ('.(int) $infoSale['tax_perc'].'%)';
}
$row[] = $plugin->getCurrency($infoSale['currency_id'])['iso_code'].' '.$infoSale['price'];
$totalPrice = $plugin->getPriceWithCurrencyFromIsoCode(
$infoSale['price'],
$plugin->getCurrency($infoSale['currency_id'])['iso_code']
);
$row[] = $totalPrice;
$data[] = $row;
$totalPrice = $plugin->getPriceWithCurrencyFromIsoCode(
$infoSale['price'],
$plugin->getCurrency($infoSale['currency_id'])['iso_code']
);
if ($taxEnable) {
$row = [
'',
'',
'',
$plugin->get_lang('TotalPayout'),
$plugin->getCurrency($infoSale['currency_id'])['iso_code'].' '.$infoSale['price'],
$totalPrice,
];
} else {
$row = [
'',
$plugin->get_lang('TotalPayout'),
$plugin->getCurrency($infoSale['currency_id'])['iso_code'].' '.$infoSale['price'],
$totalPrice,
];
}
$data[] = $row;
$attr = [];
$attr['class'] = "table data_table";
$attr['width'] = "100%";
$attr['class'] = 'table data_table';
$attr['width'] = '100%';
$htmlText .= Display::table($header, $data, $attr);
$htmlText .= '</body></html>';

@ -69,7 +69,6 @@ foreach ($currencies as $currency) {
]
);
$currencyValue = $currency['id'];
$currencySelect->addOption($currencyText, $currencyValue);
if ($currency['status']) {
@ -79,9 +78,10 @@ foreach ($currencies as $currency) {
$globalSettingForm->addTextarea(
'terms_and_conditions',
[get_lang('TermsAndConditions'),
$plugin->get_lang('WriteHereTheTermsAndConditionsOfYourECommerce'), ],
[]
[
get_lang('TermsAndConditions'),
$plugin->get_lang('WriteHereTheTermsAndConditionsOfYourECommerce'),
]
);
$globalSettingForm->addElement(

@ -112,7 +112,7 @@ $form->addButton('submit', $plugin->get_lang('ConfirmOrder'), 'check', 'success'
// View
$templateName = $plugin->get_lang('PaymentMethods');
$interbreadcrumb[] = ['url' => "course_catalog.php", 'name' => $plugin->get_lang('CourseListOnSale')];
$interbreadcrumb[] = ['url' => 'course_catalog.php', 'name' => $plugin->get_lang('CourseListOnSale')];
$tpl = new Template($templateName);
$tpl->assign('buying_course', $buyingCourse);

@ -6,7 +6,7 @@
*
* @package chamilo.plugin.buycourses
*/
//Initialization
$cidReset = true;
require_once '../config.php';
@ -114,35 +114,19 @@ switch ($selectedFilterType) {
break;
}
$saleList = [];
foreach ($sales as $sale) {
$saleList[] = [
'id' => $sale['id'],
'reference' => $sale['reference'],
'status' => $sale['status'],
'date' => api_convert_and_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H),
'currency' => $sale['iso_code'],
'price' => $sale['price'],
'product_name' => $sale['product_name'],
'product_type' => $productTypes[$sale['product_type']],
'complete_user_name' => api_get_person_name($sale['firstname'], $sale['lastname']),
'payment_type' => $paymentTypes[$sale['payment_type']],
'invoice' => $sale['invoice'],
'num_invoice' => $plugin->getNumInvoice($sale['id'], 0),
];
foreach ($sales as &$sale) {
$sale['product_type'] = $productTypes[$sale['product_type']];
$sale['payment_type'] = $paymentTypes[$sale['payment_type']];
$sale['complete_user_name'] = api_get_person_name($sale['firstname'], $sale['lastname']);
$sale['num_invoice'] = $plugin->getNumInvoice($sale['id'], 0);
$sale['total_price'] = $plugin->getPriceWithCurrencyFromIsoCode($sale['price'], $sale['iso_code']);
}
//View
$interbreadcrumb[] = ['url' => '../index.php', 'name' => $plugin->get_lang('plugin_title')];
$templateName = $plugin->get_lang('SalesReport');
$template = new Template($templateName);
$toolbar = "";
if ($paypalEnable == "true" && $commissionsEnable == "true") {
$toolbar = '';
if ($paypalEnable === 'true' && $commissionsEnable === 'true') {
$toolbar .= Display::toolbarButton(
$plugin->get_lang('PaypalPayoutCommissions'),
api_get_path(WEB_PLUGIN_PATH).'buycourses/src/paypal_payout.php',
@ -157,7 +141,7 @@ if ($paypalEnable == "true" && $commissionsEnable == "true") {
);
}
if ($commissionsEnable == "true") {
if ($commissionsEnable === 'true') {
$toolbar .= Display::toolbarButton(
$plugin->get_lang('PayoutReport'),
api_get_path(WEB_PLUGIN_PATH).'buycourses/src/payout_report.php',
@ -175,7 +159,7 @@ $template->assign('form', $form->returnForm());
$template->assign('selected_sale', $selectedSale);
$template->assign('selected_status', $selectedStatus);
$template->assign('services_are_included', $includeServices);
$template->assign('sale_list', $saleList);
$template->assign('sale_list', $sales);
$template->assign('sale_status_canceled', BuyCoursesPlugin::SALE_STATUS_CANCELED);
$template->assign('sale_status_pending', BuyCoursesPlugin::SALE_STATUS_PENDING);
$template->assign('sale_status_completed', BuyCoursesPlugin::SALE_STATUS_COMPLETED);

@ -17,16 +17,12 @@ $userInfo = api_get_user_info();
if (!$userInfo) {
api_not_allowed(true);
}
$em = Database::getManager();
$paymentTypes = $plugin->getPaymentTypes();
$serviceTypes = $plugin->getServiceTypes();
$serviceSaleStatuses['status_cancelled'] = BuyCoursesPlugin::SERVICE_STATUS_CANCELLED;
$serviceSaleStatuses['status_pending'] = BuyCoursesPlugin::SERVICE_STATUS_PENDING;
$serviceSaleStatuses['status_completed'] = BuyCoursesPlugin::SERVICE_STATUS_COMPLETED;
$serviceSales = $plugin->getServiceSale(null, $userInfo['user_id']);
$serviceSales = $plugin->getServiceSales($userInfo['user_id']);
$saleList = [];
foreach ($serviceSales as $sale) {

@ -214,6 +214,7 @@ switch ($serviceSale['payment_type']) {
$template->assign('buying_service', $serviceSale);
$template->assign('user', $userInfo);
$template->assign('service', $serviceSale['service']);
$template->assign('service_item', $serviceSale['item']);
$template->assign('transfer_accounts', $transferAccounts);
$template->assign('form', $form->returnForm());
@ -282,6 +283,7 @@ switch ($serviceSale['payment_type']) {
$template->assign('buying_service', $serviceSale);
$template->assign('user', $userInfo);
$template->assign('service', $serviceSale['service']);
$template->assign('service_item', $serviceSale['item']);
$template->assign('form', $form->returnForm());
$template->assign('is_culqi_payment', true);
$template->assign('culqi_params', $culqiParams = $plugin->getCulqiParams());

@ -34,26 +34,7 @@ $form->addSelect('status', $plugin->get_lang('OrderStatus'), $saleStatuses, ['co
$form->addText('user', get_lang('User'), false, ['cols-size' => [0, 0, 0]]);
$form->addButtonSearch(get_lang('Search'), 'search');
$servicesSales = $plugin->getServiceSale(null, null, $selectedStatus);
$serviceSaleList = [];
foreach ($servicesSales as $sale) {
$serviceSaleList[] = [
'id' => $sale['id'],
'reference' => $sale['reference'],
'status' => $sale['status'],
'date' => api_convert_and_format_date($sale['buy_date'], DATE_TIME_FORMAT_LONG_24H),
'currency' => $sale['currency'],
'price' => $sale['price'],
'service_type' => $sale['service']['applies_to'],
'service_name' => $sale['service']['name'],
'complete_user_name' => $sale['buyer']['name'],
'invoice' => $sale['invoice'],
'num_invoice' => $plugin->getNumInvoice($sale['id'], 1),
];
}
//View
$servicesSales = $plugin->getServiceSales( null, $selectedStatus);
$interbreadcrumb[] = ['url' => '../index.php', 'name' => $plugin->get_lang('plugin_title')];
$templateName = $plugin->get_lang('SalesReport');
@ -92,7 +73,7 @@ if ($commissionsEnable == 'true') {
$template->assign('form', $form->returnForm());
$template->assign('showing_services', true);
$template->assign('services_are_included', $includeServices);
$template->assign('sale_list', $serviceSaleList);
$template->assign('sale_list', $servicesSales);
$template->assign('sale_status_cancelled', BuyCoursesPlugin::SERVICE_STATUS_CANCELLED);
$template->assign('sale_status_pending', BuyCoursesPlugin::SERVICE_STATUS_PENDING);
$template->assign('sale_status_completed', BuyCoursesPlugin::SERVICE_STATUS_COMPLETED);

@ -47,7 +47,7 @@
</ul>
<p class="text-right">
<span class="label label-primary">
{{ course.currency }} {{ course.price }}
{{ course.item.total_price_formatted }}
</span>
</p>
{% if course.enrolled == "YES" %}
@ -93,7 +93,7 @@
<p><em class="fa fa-calendar fa-fw"></em> {{ session.dates.display }}</p>
<p class="text-right">
<span class="label label-primary">
{{ session.currency }} {{ session.price }}
{{ session.item.total_price_formatted }}
</span>
</p>
<ul class="list-unstyled">
@ -177,7 +177,7 @@
</ul>
<p class="text-right">
<span class="label label-primary">
{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.total_price_formatted }}
{{ service.total_price_formatted }}
</span>
</p>
<div class="toolbar">

@ -75,15 +75,11 @@
{% endif %}
</td>
<td width="200" class="text-right">
{{ "#{item.buyCourseData.price} #{item.buyCourseData.currency ?: item.buyCourseData.currency}" }}
{{ item.buyCourseData.price_formatted }}
</td>
{% if tax_enable and (tax_applies_to == 1 or tax_applies_to == 2) %}
<td class="text-center">
{% if item.tax_perc is null %}
{{ global_tax_perc }} %
{% else %}
{{ item.buyCourseData.tax_perc }} %
{% endif %}
{{ item.buyCourseData.tax_perc_show }} %
</td>
{% endif %}
<td class="text-right">
@ -137,15 +133,11 @@
{% endif %}
</td>
<td class="text-right" width="200">
{{ "#{item.buyCourseData.price} #{tem.currency ?: item.buyCourseData.currency}" }}
{{ item.buyCourseData.price_formatted }}
</td>
{% if tax_enable and (tax_applies_to == 1 or tax_applies_to == 3) %}
<td class="text-center">
{% if item.buyCourseData.tax_perc is null %}
{{ global_tax_perc }} %
{% else %}
{{ item.buyCourseData.tax_perc }} %
{% endif %}
{{ item.buyCourseData.tax_perc_show }} %
</td>
{% endif %}
<td class="text-right">
@ -213,7 +205,7 @@
{{ item.owner_name }}
</td>
<td class="text-right" width="200">
{{ "#{item.price} #{tem.currency ?: item.currency}" }}
{{ item.price_formatted }}
</td>
{% if tax_enable and (tax_applies_to == 1 or tax_applies_to == 4) %}
<td class="text-center">

@ -65,12 +65,12 @@
<div>
<button id="stats" type="button" class="btn btn-primary fa fa-line-chart" data-toggle="modal"
data-target="#reportStats"> {{ 'Stats'|get_plugin_lang('BuyCoursesPlugin') }}</button>
data-target="#reportStats"> {{ 'Stats'|get_plugin_lang('BuyCoursesPlugin') }}
</button>
</div>
<script>
$(document).ready(function () {
$(function () {
$(".saleInfo").click(function () {
var id = this.id;
$.ajax({

@ -63,10 +63,8 @@
</div>
<script>
$(document).ready(function () {
$(function () {
$("#responseButton").hide();
$("#checkAll").click(function () {
$(':checkbox').prop('checked', this.checked);
});

@ -23,15 +23,15 @@
{% if course.tax_enable %}
<div class="price-details-tax">
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ course.currency == 'BRL' ? 'R$' : course.currency }} {{ course.price_without_tax }}
{{ course.item.price_formatted }}
<br>
{{ course.tax_name }} ({{ course.tax_perc }}%):
{{ course.currency == 'BRL' ? 'R$' : course.currency }} {{ course.tax_amount }}
{{ course.tax_name }} ({{ course.item.tax_perc_show }}%):
{{ course.item.tax_amount_formatted }}
</div>
{% endif %}
<div class="price">
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ course.currency == 'BRL' ? 'R$' : course.currency }} {{ course.price }}
{{ course.item.total_price_formatted }}
</div>
</div>
<div class="col-md-9">
@ -43,40 +43,45 @@
</a>
</h3>
{% if course.description %}
<div class="description">
{{ course.description }}
</div>
<div class="description">
{{ course.description }}
</div>
{% endif %}
{% if course.teachers %}
<div class="coaches">
<p>
{{ 'Teachers'|get_plugin_lang('BuyCoursesPlugin')}} :
{% for teacher in course.teachers %}
<em class="fa fa-user" aria-hidden="true"></em>
<a href="{{ _p.web }}main/social/profile.php?u={{ teacher.id }}"
class="teacher-item"> {{ teacher.name }}</a>,
{% endfor %}
</p>
</div>
{% endif %}
<div class="coaches">
<p>
{{ 'Teachers'|get_plugin_lang('BuyCoursesPlugin')}} :
{% for teacher in course.teachers %}
<em class="fa fa-user" aria-hidden="true"></em>
<a href="{{ _p.web }}main/social/profile.php?u={{ teacher.id }}"
class="teacher-item"> {{ teacher.name }}</a>,
{% endfor %}
</p>
</div>
</div>
</div>
</div>
{% elseif buying_session %}
<div class="row">
<div class="col-md-3">
<img alt="{{ session.name }}" class="img-rounded img-responsive""
src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
<img
alt="{{ session.name }}"
class="img-rounded img-responsive"
src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
{% if session.tax_enable %}
<div class="price-details-tax">
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ session.currency == 'BRL' ? 'R$' : session.currency }} {{ session.price_without_tax }}
<br>
{{ session.tax_name }} ({{ session.tax_perc }}%):
{{ session.currency == 'BRL' ? 'R$' : session.currency }} {{ session.tax_amount }}
</div>
<div class="price-details-tax">
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ session.item.price_formatted }}
<br>
{{ session.tax_name }} ({{ session.item.tax_perc_show }}%):
{{ session.item.tax_amount_formatted }}
</div>
{% endif %}
<div class="price">
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ session.currency == 'BRL' ? 'R$' : session.currency }} {{ session.price }}
{{ session.item.total_price_formatted }}
</div>
</div>
<div class="col-md-9">
@ -120,7 +125,7 @@
</div>
</div>
<script>
$(document).ready(function () {
$(function () {
$("label").removeClass('control-label');
$('.form_required').remove();
$("small").remove();

@ -27,8 +27,7 @@
</ul>
<p id="n-price" class="lead text-right" style="color: white;">
<span class="label label-primary">
{{ course.currency == 'BRL' ? 'R$' : course.currency }}
{{ course.price }}
{{ course.item.total_price_formatted }}
</span>
</p>
<p id="s-price" class="lead text-right"></p>
@ -61,8 +60,7 @@
</ul>
<p id="n-price" class="lead text-right" style="color: white;">
<span class="label label-primary">
{{ session.currency == 'BRL' ? 'R$' : session.currency }}
{{ session.price }}
{{ session.item.total_price_formatted }}
</span>
</p>
<p id="s-price" class="lead text-right"></p>
@ -107,7 +105,7 @@
<li>
<em class="fa fa-money"></em>
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}
: {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ price }}
: {{ service_item.total_price_formatted }}
/ {{ service.duration_days == 0 ? 'NoLimit'|get_lang : service.duration_days ~ ' ' ~ 'Days'|get_lang }}
</li>
<li><em class="fa fa-user"></em> {{ service.owner.name }}</li>
@ -117,7 +115,7 @@
</ul>
<p id="n-price" class="lead text-right" style="color: white;">
<span class="label label-primary">
{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ price }}
{{ service_item.total_price_formatted }}
</span>
</p>
<p id="s-price" class="lead text-right"></p>
@ -185,9 +183,8 @@
{{ form }}
</div>
</div>
<script>
$(document).ready(function () {
$(function () {
{% if terms %}
$("#confirm").prop("disabled", true);

@ -11,8 +11,8 @@
</li>
{% endif %}
</ul>
</br>
</br>
<br />
<br />
{{ form }}
<div class="table-responsive">
@ -46,9 +46,9 @@
{{ 'SaleStatusCompleted'|get_plugin_lang('BuyCoursesPlugin') }}
{% endif %}
</td>
<td class="text-center">{{ sale.date }}</td>
<td class="text-center">{{ sale.date | api_get_local_time }}</td>
<td class="text-center">{{ sale.payment_type }}</td>
<td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
<td class="text-right">{{ sale.total_price }}</td>
<td class="text-center">{{ sale.product_type }}</td>
<td>{{ sale.product_name }}</td>
<td>{{ sale.complete_user_name }}</td>

@ -1,9 +1,7 @@
<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
<script type="text/javascript" src="../resources/js/modals.js"></script>
<div id="buy-courses-tabs">
<ul class="nav nav-tabs buy-courses-tabs" role="tablist">
<li id="buy-courses-tab" class="" role="presentation">
<a href="course_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyCourses'| get_lang }}</a>
@ -24,8 +22,6 @@
role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
</li>
</ul>
<table class="table table-striped table-hover">
<thead>
<tr>
@ -43,7 +39,7 @@
<td>{{ sale.name }}</td>
<td class="text-center">{{ sale.service_type }}</td>
<td class="text-center">{{ sale.currency ~ ' ' ~ sale.price }}</td>
<td class="text-center">{{ sale.date }}</td>
<td class="text-center">{{ sale.date | api_get_local_time }}</td>
<td class="text-center">{{ sale.reference }}</td>
<td class="text-center">
<a id="service_sale_info" tag="{{ sale.id }}" name="s_{{ sale.id }}"

@ -20,24 +20,24 @@
src="{{ service.image ? service.image : 'session_default.png'|icon() }}">
</a>
{% if service.tax_enable %}
<div class="price-details-tax">
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price_without_tax }}
<br>
{{ service.tax_name }} ({{ service.tax_perc_show }}%):
{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.tax_amount }}
</div>
<div class="price">
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price_with_tax }}
</div>
<div class="price-details-tax">
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ service.price_formatted }}
<br>
{{ service.tax_name }} ({{ service.tax_perc_show }}%):
{{ service.tax_amount_formatted }}
</div>
<div class="price">
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ service.total_price_formatted }}
</div>
{% else %}
<div class="price">
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin')}} :
{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}
{{ service.total_price_formatted }}
</div>
{% endif %}
</div>
<div class="col-md-9">
<div class="buy-item">
@ -67,14 +67,8 @@
</li>
{% endif %}
<li>
<em class="fa-li fa fa-money" aria-hidden="true"></em>
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}
{% if service.tax_enable %}
: {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price_with_tax }}
{% else %}
: {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}
{% endif %}
/ {{ service.duration_days == 0 ? 'NoLimit'|get_lang : service.duration_days ~ ' ' ~ 'Days'|get_lang }}
<em class="fa-li fa fa-clock-o" aria-hidden="true"></em>
{{ service.duration_days == 0 ? 'NoLimit'|get_lang : service.duration_days ~ ' ' ~ 'Days'|get_lang }}
</li>
<li><em class="fa-li fa fa-user" aria-hidden="true"></em> {{ service.owner_name }}</li>
@ -93,7 +87,7 @@
</div>
</div>
<script>
$(document).ready(function () {
$(function () {
$("label").removeClass('control-label');
$('.form_required').remove();
$("small").remove();

@ -28,7 +28,7 @@
<th class="text-center">{{ 'OrderStatus'|get_plugin_lang('BuyCoursesPlugin') }}</th>
<th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
<th class="text-right">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
{% if sale.invoice == 1 and invoicing_enable %}
{% if invoicing_enable %}
<th class="text-right">{{ 'Invoice'|get_plugin_lang('BuyCoursesPlugin') }}</th>
{% endif %}
<th class="text-center">{{ 'ServiceSaleInfo'|get_plugin_lang('BuyCoursesPlugin') }}</th>
@ -37,7 +37,7 @@
<tbody>
{% for sale in sale_list %}
<tr>
<td class="text-center">{{ sale.service_name }}</td>
<td class="text-center">{{ sale.name }}</td>
<td class="text-center">{{ sale.reference }}</td>
<td class="text-center">
{% if sale.status == sale_status_cancelled %}
@ -48,8 +48,8 @@
{{ 'SaleStatusCompleted'|get_plugin_lang('BuyCoursesPlugin') }}
{% endif %}
</td>
<td class="text-center">{{ sale.date }}</td>
<td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
<td class="text-center">{{ sale.buy_date | api_get_local_time}}</td>
<td class="text-right">{{ sale.service.total_price }}</td>
{% if invoicing_enable %}
<td class="text-center">
{% if sale.invoice == 1 %}
@ -62,7 +62,9 @@
{% endif %}
<td class="text-center">
<a id="service_sale_info" tag="{{ sale.id }}" name="s_{{ sale.id }}"
class="btn btn-info btn-sm">{{ 'Info'|get_lang }}</a>
class="btn btn-info btn-sm">
{{ 'Info'|get_lang }}
</a>
</td>
</tr>
{% endfor %}

Loading…
Cancel
Save