Merge branch 'develop' into bo_order_design
This commit is contained in:
@@ -29,31 +29,29 @@
|
||||
{if $input.name == 'vat_number'}
|
||||
<div id="vat_area" style="display: visible">
|
||||
{/if}
|
||||
|
||||
{if $input.type == 'text_customer' && !isset($customer)}
|
||||
<label class="control-label col-lg-3 required" for="email">{l s='Customer email'}</label>
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{$smarty.block.parent}
|
||||
{/block}
|
||||
|
||||
{block name="field"}
|
||||
{block name="input"}
|
||||
{if $input.type == 'text_customer'}
|
||||
{if isset($customer)}
|
||||
<div class="col-lg-9">
|
||||
<a class="btn btn-default" href="?tab=AdminCustomers&id_customer={$customer->id|intval}&viewcustomer&token={$tokenCustomer}">
|
||||
<i class="icon-eye-open"></i> {$customer->lastname} {$customer->firstname} ({$customer->email})
|
||||
</a>
|
||||
</div>
|
||||
<a class="btn btn-default" href="?tab=AdminCustomers&id_customer={$customer->id|intval}&viewcustomer&token={$tokenCustomer}">
|
||||
<i class="icon-eye-open"></i> {$customer->lastname} {$customer->firstname} ({$customer->email})
|
||||
</a>
|
||||
<input type="hidden" name="id_customer" value="{$customer->id}" />
|
||||
<input type="hidden" name="email" value="{$customer->email}" />
|
||||
{else}
|
||||
<script type="text/javascript">
|
||||
$('input[name=email]').live('blur', function(e)
|
||||
{/if}
|
||||
{else if $input.type == 'select' && $input.name == 'id_customer'}
|
||||
{$smarty.block.parent}
|
||||
<input type="hidden" name="email" id="email" value="">
|
||||
<script type="text/javascript">
|
||||
$('#id_customer').on('change', function(e)
|
||||
{
|
||||
var email = $(this).val();
|
||||
if (email.length > 5)
|
||||
{
|
||||
var id_customer = parseInt($(this).val());
|
||||
$('#email').val('');
|
||||
if (!isNaN(id_customer)) {
|
||||
var email = $(this).find('[value="'+id_customer+'"]').text();
|
||||
$('#email').val(email);
|
||||
var data = {};
|
||||
data.email = email;
|
||||
data.token = "{$token|escape:'html':'UTF-8'}";
|
||||
@@ -66,31 +64,29 @@
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
async : true,
|
||||
success: function(msg)
|
||||
{
|
||||
if (msg)
|
||||
{
|
||||
success: function(msg) {
|
||||
if (msg) {
|
||||
var infos = msg.infos.replace("\\'", "'").split('_');
|
||||
|
||||
$('input[name=firstname]').val(infos[0]);
|
||||
$('input[name=lastname]').val(infos[1]);
|
||||
$('input[name=company]').val(infos[2]);
|
||||
$('input[name=id_customer]').val(infos[3]);
|
||||
} else {
|
||||
resetCustomerRelatedAddressFields();
|
||||
}
|
||||
},
|
||||
error: function(msg)
|
||||
{
|
||||
}
|
||||
});
|
||||
} else {
|
||||
resetCustomerRelatedAddressFields();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<input type="hidden" name="id_customer" value="{$fields_value[$input.name]}" />
|
||||
<input type="email" id="email" name="email" value="{$fields_value[$input.name]|escape:'html':'UTF-8'}"/>
|
||||
</div>
|
||||
{/if}
|
||||
function resetCustomerRelatedAddressFields() {
|
||||
$('input[name=firstname]').val('');
|
||||
$('input[name=lastname]').val('');
|
||||
$('input[name=company]').val('');
|
||||
$('input[name=id_customer]').val('');
|
||||
}
|
||||
</script>
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="robots" content="NOFOLLOW, NOINDEX">
|
||||
<title>
|
||||
{$shop_name} {if $meta_title != ''}{if isset($navigationPipe)}{$navigationPipe|escape:'html':'UTF-8'}{else}>{/if} {$meta_title}{/if} (PrestaShop™)
|
||||
{$shop_name} {if $meta_title != ''}{if isset($navigationPipe)}{$navigationPipe|escape:'html':'UTF-8'}{else}>{/if} {$meta_title}{/if} (QloApps™)
|
||||
</title>
|
||||
{if isset($css_files)}
|
||||
{foreach from=$css_files key=css_uri item=media}
|
||||
|
||||
31
classes/BoOrder.php
Normal file
31
classes/BoOrder.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
class BoOrder extends PaymentModule
|
||||
{
|
||||
public $active = 1;
|
||||
public $name = 'bo_order';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->displayName = $this->l('Back office order');
|
||||
$this->validateOrderAmount = false;
|
||||
}
|
||||
}
|
||||
@@ -294,21 +294,37 @@ class CustomerCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Return customers list
|
||||
* Returns a list of customers.
|
||||
*
|
||||
* @param null|bool $only_active Returns only active customers when true
|
||||
* @return array Customers
|
||||
* @param null|bool $active Optional. Filter customers by their active status. If null, no filter is applied.
|
||||
* @param null|bool $deleted Optional. Filter customers by their deleted status. If null, no filter is applied.
|
||||
* @param null|bool $havingAddress Optional. Filter customers having|not having address. If true, only customers having an address are returned.
|
||||
* If false, only customers without an address are returned. If null, no filter is applied.
|
||||
* @return array List of customers matching the specified criteria.
|
||||
*/
|
||||
public static function getCustomers($only_active = null)
|
||||
public static function getCustomers($active = null, $deleted = null, $havingAddress = null)
|
||||
{
|
||||
$sql = 'SELECT `id_customer`, `email`, `firstname`, `lastname`
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).
|
||||
($only_active ? ' AND `active` = 1' : '').'
|
||||
ORDER BY `id_customer` ASC';
|
||||
$sqlSelect = 'SELECT c.`id_customer`, c.`email`, c.`firstname`, c.`lastname`';
|
||||
$sqlFrom = 'FROM `'._DB_PREFIX_.'customer` c';
|
||||
$sqlJoin = '';
|
||||
$sqlWhere = 'WHERE 1 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).
|
||||
(!is_null($active) ? ' AND c.`active` = '.(int) $active: ' ' ).
|
||||
(!is_null($deleted) ? ' AND c.`deleted` = '.(int) $deleted : ' ');
|
||||
$sqlOrderBy = 'ORDER BY c.`id_customer` ASC';
|
||||
$sqlGroupBy = 'GROUP BY c.`id_customer`';
|
||||
|
||||
if (!is_null($havingAddress)) {
|
||||
$sqlJoin .= ' LEFT JOIN `'._DB_PREFIX_.'address` a
|
||||
ON a.`id_customer` = c.`id_customer` AND a.`deleted`=0';
|
||||
$sqlWhere .= (($havingAddress) ? ' AND a.`id_address` IS NOT NULL': ' AND a.`id_address` IS NULL');
|
||||
}
|
||||
|
||||
$sql = $sqlSelect .' '. $sqlFrom.' '.$sqlJoin.' '.$sqlWhere.' '.$sqlGroupBy.' '.$sqlOrderBy;
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return customer instance from its e-mail (optionnaly check password)
|
||||
*
|
||||
@@ -951,4 +967,5 @@ class CustomerCore extends ObjectModel
|
||||
$sql_filter .= Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'main');
|
||||
return parent::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ abstract class PaymentModuleCore extends Module
|
||||
public $currencies = true;
|
||||
public $currencies_mode = 'checkbox';
|
||||
public $payment_type = OrderPayment::PAYMENT_TYPE_REMOTE_PAYMENT;
|
||||
public $validateOrderAmount = true;
|
||||
|
||||
public function install()
|
||||
{
|
||||
@@ -162,7 +163,7 @@ abstract class PaymentModuleCore extends Module
|
||||
*/
|
||||
public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
|
||||
$message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
|
||||
$secure_key = false, Shop $shop = null)
|
||||
$secure_key = false, Shop $shop = null, $send_mails = true)
|
||||
{
|
||||
if (self::DEBUG_MODE) {
|
||||
PrestaShopLogger::addLog('PaymentModule::validateOrder - Function called', 1, null, 'Cart', (int)$id_cart, true);
|
||||
@@ -418,8 +419,7 @@ abstract class PaymentModuleCore extends Module
|
||||
// If webservice order request then no need to impose equal amounts(total cart and sent amount) condition
|
||||
if ($order_status->logable
|
||||
&& number_format($cart_total_paid, _PS_PRICE_COMPUTE_PRECISION_) != number_format($amount_paid, _PS_PRICE_COMPUTE_PRECISION_)
|
||||
&& $this->name != 'wsorder'
|
||||
&& $this->name != 'bo_order'
|
||||
&& ($this->validateOrderAmount)
|
||||
) {
|
||||
// if customer is paying full payment amount
|
||||
$id_order_state = Configuration::get('PS_OS_ERROR');
|
||||
@@ -684,24 +684,25 @@ abstract class PaymentModuleCore extends Module
|
||||
if ($voucher->add()) {
|
||||
// If the voucher has conditions, they are now copied to the new voucher
|
||||
CartRule::copyConditions($cart_rule['obj']->id, $voucher->id);
|
||||
|
||||
$params = array(
|
||||
'{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
|
||||
'{voucher_num}' => $voucher->code,
|
||||
'{firstname}' => $this->context->customer->firstname,
|
||||
'{lastname}' => $this->context->customer->lastname,
|
||||
'{id_order}' => $order->reference,
|
||||
'{order_name}' => $order->getUniqReference()
|
||||
);
|
||||
Mail::Send(
|
||||
(int)$order->id_lang,
|
||||
'voucher',
|
||||
sprintf(Mail::l('New voucher for your order %s', (int)$order->id_lang), $order->reference),
|
||||
$params,
|
||||
$this->context->customer->email,
|
||||
$this->context->customer->firstname.' '.$this->context->customer->lastname,
|
||||
null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop
|
||||
);
|
||||
if ($send_mails) {
|
||||
$params = array(
|
||||
'{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
|
||||
'{voucher_num}' => $voucher->code,
|
||||
'{firstname}' => $this->context->customer->firstname,
|
||||
'{lastname}' => $this->context->customer->lastname,
|
||||
'{id_order}' => $order->reference,
|
||||
'{order_name}' => $order->getUniqReference()
|
||||
);
|
||||
Mail::Send(
|
||||
(int)$order->id_lang,
|
||||
'voucher',
|
||||
sprintf(Mail::l('New voucher for your order %s', (int)$order->id_lang), $order->reference),
|
||||
$params,
|
||||
$this->context->customer->email,
|
||||
$this->context->customer->firstname.' '.$this->context->customer->lastname,
|
||||
null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1050,10 +1051,12 @@ abstract class PaymentModuleCore extends Module
|
||||
// Set the order status
|
||||
$new_history = new OrderHistory();
|
||||
$new_history->id_order = (int)$order->id;
|
||||
|
||||
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
|
||||
|
||||
$new_history->addWithemail(true, $extra_vars);
|
||||
if ($send_mails) {
|
||||
$new_history->addWithemail(true, $extra_vars);
|
||||
} else {
|
||||
$new_history->add(true);
|
||||
}
|
||||
|
||||
// Switch to back order if needed
|
||||
$objHotelBookingDetail = new HotelBookingDetail();
|
||||
@@ -1089,7 +1092,11 @@ abstract class PaymentModuleCore extends Module
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int)$order->id;
|
||||
$history->changeIdOrderState($id_order_state, $order, true);
|
||||
$history->addWithemail();
|
||||
if ($send_mails) {
|
||||
$history->addWithemail();
|
||||
} else {
|
||||
$history->add();
|
||||
}
|
||||
}
|
||||
|
||||
unset($order_detail);
|
||||
@@ -1098,7 +1105,11 @@ abstract class PaymentModuleCore extends Module
|
||||
$order = new Order((int)$order->id);
|
||||
|
||||
// Send an e-mail to customer (one order = one email)
|
||||
if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id) {
|
||||
if ($id_order_state != Configuration::get('PS_OS_ERROR')
|
||||
&& $id_order_state != Configuration::get('PS_OS_CANCELED')
|
||||
&& $this->context->customer->id
|
||||
&& $send_mails
|
||||
) {
|
||||
$invoice = new Address($order->id_address_invoice);
|
||||
$delivery = new Address($order->id_address_delivery);
|
||||
$delivery_state = $delivery->id_state ? new State($delivery->id_state) : false;
|
||||
@@ -1327,9 +1338,7 @@ abstract class PaymentModuleCore extends Module
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($idHotel
|
||||
&& Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))
|
||||
) {
|
||||
if ($idHotel && Validate::isLoadedObject($objHotel = new HotelBranchInformation($idHotel))) {
|
||||
if (Configuration::get('PS_ORDER_CONF_MAIL_TO_HOTEL_MANAGER')){
|
||||
// If order currenct state is overbooking, the send overbooking email or send order confirmation email
|
||||
if ($isOverBookingStatus) {
|
||||
|
||||
@@ -26,5 +26,6 @@ class WebserviceOrderCore extends PaymentModule
|
||||
public function __construct()
|
||||
{
|
||||
$this->displayName = $this->l('Order from API');
|
||||
$this->validateOrderAmount = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,18 +112,43 @@ class AdminAddressesControllerCore extends AdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$customerField =array(
|
||||
'type' => 'text_customer',
|
||||
'label' => $this->l('Customer'),
|
||||
'name' => 'id_customer',
|
||||
'required' => false,
|
||||
);
|
||||
if ($this->loadObject(true)
|
||||
&& !$this->object->id
|
||||
&& !Tools::getValue('liteDisplaying')
|
||||
) {
|
||||
$customerEmails = array(array(
|
||||
'email' => $this->l('Select Customer'),
|
||||
'id_customer' => 0,
|
||||
'id_address'=> 0
|
||||
));
|
||||
$customerEmails = array_merge($customerEmails, Customer::getCustomers(null, 0, 0));
|
||||
$customerField = array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Customer'),
|
||||
'name' => 'id_customer',
|
||||
'required' => true,
|
||||
'class' => 'chosen',
|
||||
'options' => array(
|
||||
'query' => $customerEmails,
|
||||
'id' => 'id_customer',
|
||||
'name' => 'email'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Addresses'),
|
||||
'icon' => 'icon-envelope-alt'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text_customer',
|
||||
'label' => $this->l('Customer'),
|
||||
'name' => 'id_customer',
|
||||
'required' => false,
|
||||
),
|
||||
$customerField,
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Identification Number'),
|
||||
@@ -191,9 +216,8 @@ class AdminAddressesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$this->tpl_form_vars = array(
|
||||
'customer' => isset($customer) ? $customer : null,
|
||||
'tokenCustomer' => isset($token_customer) ? $token_customer : null,
|
||||
'back_url' => urldecode(Tools::getValue('back'))
|
||||
'customer' => (isset($customer) && ($this->object->id || Tools::getValue('liteDisplaying'))) ? $customer : null,
|
||||
'tokenCustomer' => isset($token_customer) ? $token_customer : null
|
||||
);
|
||||
|
||||
// Order address fields depending on country format
|
||||
@@ -503,7 +527,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Method called when an ajax request is made
|
||||
* @see AdminController::postProcess()
|
||||
*/
|
||||
|
||||
@@ -24,17 +24,6 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class BoOrder extends PaymentModule
|
||||
{
|
||||
public $active = 1;
|
||||
public $name = 'bo_order';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->displayName = $this->l('Back office order');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @property Order $object
|
||||
*/
|
||||
|
||||
@@ -707,6 +707,15 @@ class AdminStatusesControllerCore extends AdminController
|
||||
$theme = new Theme($this->context->shop->id_theme);
|
||||
$default_path = '../mails/';
|
||||
$theme_path = '../themes/'.$theme->directory.'/mails/'; // Mail templates can also be found in the theme folder
|
||||
$templatesToIgnore = array(
|
||||
'footer.html',
|
||||
'header.html',
|
||||
'shipped.html',
|
||||
'in_transit.html',
|
||||
'download_products.html',
|
||||
'header_order_conf.html',
|
||||
'test.html'
|
||||
);
|
||||
|
||||
$array = array();
|
||||
foreach (Language::getLanguages(false) as $language) {
|
||||
@@ -722,7 +731,9 @@ class AdminStatusesControllerCore extends AdminController
|
||||
// We merge all available emails in one array
|
||||
$templates = array_unique(array_merge(scandir(_PS_ADMIN_DIR_.'/'.$default_path.$iso_code), $theme_templates));
|
||||
foreach ($templates as $key => $template) {
|
||||
if (!strncmp(strrev($template), 'lmth.', 5)) {
|
||||
if (!strncmp(strrev($template), 'lmth.', 5)
|
||||
&& !in_array($template, $templatesToIgnore)
|
||||
) {
|
||||
$search_result = array_search($template, $theme_templates);
|
||||
$array[$iso_code][] = array(
|
||||
'id' => substr($template, 0, -5),
|
||||
|
||||
@@ -79,8 +79,8 @@ class CmsControllerCore extends FrontController
|
||||
} elseif (Validate::isLoadedObject($this->cms_category) && $this->cms_category->active && $this->cms_category->isAssociatedToShop()) {
|
||||
$this->assignCase = 2;
|
||||
} else {
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
header('Status: 404 Not Found');
|
||||
// incase the cms page in invalid i.e, url is tampered
|
||||
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +134,9 @@ class CmsControllerCore extends FrontController
|
||||
'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '',
|
||||
'body_classes' => array($this->php_self.'-'.$this->cms_category->id, $this->php_self.'-'.$this->cms_category->link_rewrite)
|
||||
));
|
||||
} else {
|
||||
// incase the cms page is inactive
|
||||
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
|
||||
}
|
||||
|
||||
$this->setTemplate(_PS_THEME_DIR_.'cms.tpl');
|
||||
|
||||
@@ -103,6 +103,24 @@ class blocknavigationmenu extends Module
|
||||
}
|
||||
}
|
||||
|
||||
public function hookActionObjectCMSUpdateAfter($params)
|
||||
{
|
||||
$idCMS = $params['object']->id;
|
||||
if (!$params['object']->active) {
|
||||
$objCustomNavigationLink = new WkCustomNavigationLink();
|
||||
// Disabling depended Navigation link
|
||||
$objCustomNavigationLink->disableNavigationLinksByIdCMS($idCMS);
|
||||
}
|
||||
}
|
||||
|
||||
public function hookActionObjectCMSDeleteAfter($params)
|
||||
{
|
||||
$idCMS = $params['object']->id;
|
||||
$objCustomNavigationLink = new WkCustomNavigationLink();
|
||||
// Deleting depended Navigation link
|
||||
$objCustomNavigationLink->deleteNavigationLinksByIdCMS($idCMS);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
$objModuleDb = new WkBlockNavigationMenuDb();
|
||||
@@ -125,6 +143,8 @@ class blocknavigationmenu extends Module
|
||||
array (
|
||||
'footer',
|
||||
'actionObjectLanguageAddAfter',
|
||||
'actionObjectCMSUpdateAfter',
|
||||
'actionObjectCMSDeleteAfter',
|
||||
'displayDefaultNavigationHook',
|
||||
'displayNavigationHook',
|
||||
'top',
|
||||
|
||||
@@ -235,6 +235,39 @@ class WkCustomNavigationLink extends ObjectModel
|
||||
$objCustomNavigationLink->is_custom_link = 0;
|
||||
$objCustomNavigationLink->link = 'contact';
|
||||
$objCustomNavigationLink->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getNavigationLinksByIdCMS($idCMS)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'htl_custom_navigation_link`
|
||||
WHERE `id_cms`='.(int) $idCMS
|
||||
);
|
||||
}
|
||||
|
||||
public function disableNavigationLinksByIdCMS($idCMS)
|
||||
{
|
||||
$objCustomNavigationLink = new WkCustomNavigationLink();
|
||||
if ($navLinks = $objCustomNavigationLink->getNavigationLinksByIdCMS($idCMS)) {
|
||||
foreach ($navLinks as $navLink) {
|
||||
$objCustomNavigationLink = new WkCustomNavigationLink((int) $navLink['id_navigation_link']);
|
||||
$objCustomNavigationLink->active = 0;
|
||||
$objCustomNavigationLink->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteNavigationLinksByIdCMS($idCMS)
|
||||
{
|
||||
$objCustomNavigationLink = new WkCustomNavigationLink();
|
||||
if ($navLinks = $objCustomNavigationLink->getNavigationLinksByIdCMS($idCMS)) {
|
||||
foreach ($navLinks as $navLink) {
|
||||
$objCustomNavigationLink = new WkCustomNavigationLink((int) $navLink['id_navigation_link']);
|
||||
$objCustomNavigationLink->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -179,6 +179,17 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
|
||||
if (Validate::isLoadedObject($objNavigationLink)) {
|
||||
$smartyVars['navigationLinkInfo'] = (array) $objNavigationLink;
|
||||
$smartyVars['edit'] = 1;
|
||||
if ($objNavigationLink->id_cms
|
||||
&& Validate::isLoadedObject($objCMS = new CMS($objNavigationLink->id_cms))
|
||||
) {
|
||||
$smartyVars['id_cms_category'] = $objCMS->id_cms_category;
|
||||
if (empty($this->errors)
|
||||
&& !$objCMS->active
|
||||
) {
|
||||
$cmsEditLink = $this->context->link->getAdminLink('AdminCmsContent').'&updatecms&id_cms='.(int) $objCMS->id;
|
||||
$this->warnings[] = $this->l('Please enable linked').' <a href="'.$cmsEditLink.'" target="_blank">'.$this->l('CMS page').'</a> '.$this->l('to enable this navigation link.');
|
||||
}
|
||||
}
|
||||
}
|
||||
// send theme's front pages
|
||||
$themePages = array();
|
||||
@@ -196,7 +207,29 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
|
||||
$smartyVars['themePages'] = $themePages;
|
||||
$smartyVars['languages'] = Language::getLanguages(false);
|
||||
$smartyVars['currentLang'] = Language::getLanguage((int) Configuration::get('PS_LANG_DEFAULT'));
|
||||
$smartyVars['cmsPages'] = CMS::getCMSPages($smartyVars['currentLang'], 1);
|
||||
$categoryWiseCmsPages = array();
|
||||
if ($cmsPages = CMS::getCMSPages($smartyVars['currentLang'], null, false)) {
|
||||
foreach ($cmsPages as $page) {
|
||||
$cmsPage['id_cms'] = $page['id_cms'];
|
||||
$cmsPage['meta_title'] = $page['meta_title'];
|
||||
$categoryWiseCmsPages[$page['id_cms_category']][] = $cmsPage;
|
||||
}
|
||||
}
|
||||
|
||||
if ($cmsCategories = CMSCategory::getCategories($this->context->language->id, false, false)) {
|
||||
if (!isset($smartyVars['id_cms_category'])) {
|
||||
$smartyVars['id_cms_category'] = $cmsCategories[0]['id_cms_category'];
|
||||
}
|
||||
|
||||
foreach ($cmsCategories as $cmsCatKey => $cmsCategory) {
|
||||
if (!isset($categoryWiseCmsPages[$cmsCategory['id_cms_category']])) {
|
||||
unset($cmsCategories[$cmsCatKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$smartyVars['categoryWiseCmsPages'] = $categoryWiseCmsPages;
|
||||
$smartyVars['categories'] = $cmsCategories;
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
$this->fields_form = array(
|
||||
'submit' => array(
|
||||
@@ -261,6 +294,10 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
|
||||
}
|
||||
if ($isCmsPage) {
|
||||
$objCustomNavigationLink->id_cms = $idCms;
|
||||
$objCMS = new CMS((int) $idCms);
|
||||
if (!$objCMS->active) {
|
||||
$active = $objCMS->active;
|
||||
}
|
||||
} else {
|
||||
$objCustomNavigationLink->id_cms = 0;
|
||||
foreach ($languages as $language) {
|
||||
@@ -365,7 +402,7 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
|
||||
if (isset($pos[2]) && (int) $pos[2] === $idNavigationLink) {
|
||||
if ($objFeatureBlock = new WkCustomNavigationLink((int) $pos[2])) {
|
||||
if (isset($position)
|
||||
&& $objFeatureBlock->updatePosition($way, $position, $idNavigationLink)
|
||||
&& $objFeatureBlock->updatePosition($way, $position)
|
||||
) {
|
||||
echo 'ok position '.(int) $position.' for custom navigation link '.(int) $pos[1].'\r\n';
|
||||
} else {
|
||||
@@ -381,9 +418,31 @@ class AdminCustomNavigationLinkSettingController extends ModuleAdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function processStatus()
|
||||
{
|
||||
if (Validate::isLoadedObject($this->loadObject())
|
||||
&& $this->object->id_cms
|
||||
&& Validate::isLoadedObject($objCMS = new CMS($this->object->id_cms))
|
||||
) {
|
||||
if (!$objCMS->active
|
||||
&& !$this->object->active
|
||||
) {
|
||||
$this->errors[] = $this->l('Please activate the linked CMS page to enable this navigation link.');
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->errors)) {
|
||||
return parent::processStatus();
|
||||
}
|
||||
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
$this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/admin/wk_navigation_link.js');
|
||||
if ($this->display == 'edit' || $this->display == 'add') {
|
||||
$this->addJS($this->module->getPathUri().'views/js/admin/wk_navigation_link.js');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,12 @@ $(document).ready(function() {
|
||||
$(".custom_redirect_page_div").removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('change', '#id_cms_category', function(){
|
||||
var id_cat = parseInt($('#id_cms_category').val());
|
||||
$('.cms_pages_table').hide();
|
||||
$('#cms_pages_table_'+id_cat).show();
|
||||
});
|
||||
});
|
||||
|
||||
function showNavigationLinkLangField(lang_iso_code, id_lang)
|
||||
@@ -45,4 +51,4 @@ function showNavigationLinkLangField(lang_iso_code, id_lang)
|
||||
|
||||
$('.navigation_link_name_all').hide();
|
||||
$('#navigation_link_name_'+id_lang).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,26 @@
|
||||
</div>
|
||||
{* Feilds of cms page *}
|
||||
<div id="cms_block_content" class="{if isset($smarty.post.is_cms_block_link)}{if !$smarty.post.is_cms_block_link}hidden{/if}{elseif !isset($navigationLinkInfo['id_cms']) || !$navigationLinkInfo['id_cms']}hidden{/if}">
|
||||
<div class="form-group">
|
||||
<div id="selected_parent_category">
|
||||
<label class="control-label col-lg-3">
|
||||
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Select CMS category to display related CMS pages' mod='blocknavigationmenu'}" data-html="true">
|
||||
{l s='Select CMS category' mod='blocknavigationmenu'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<select class="form-control fixed-width-xxl " name="id_cms_category" id="id_cms_category">
|
||||
{if isset($categories) && count($categories)}
|
||||
{foreach $categories as $category}
|
||||
<option value="{$category.id_cms_category}" {if isset($smarty.post.id_cms_category)}{if ($smarty.post.id_cms_category == $category.id_cms_category)}selected="selected"{/if}{else if isset($id_cms_category) && ($id_cms_category == $category.id_cms_category)}selected="selected"{/if}>{$category.name|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{*Display CMS Pages*}
|
||||
{if isset($cmsPages)}
|
||||
{if isset($categoryWiseCmsPages)}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3">
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
@@ -61,32 +79,34 @@
|
||||
{l s='Select CMS Page' mod='blocknavigationmenu'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<table class="table table-bordered" style="width:40%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="fixed-width-xs">
|
||||
</th>
|
||||
<th class="fixed-width-xs"><span class="title_box">{l s='ID' mod='blocknavigationmenu'}</span></th>
|
||||
<th>
|
||||
<span class="title_box">
|
||||
{l s='CMS Page Name' mod='blocknavigationmenu'}
|
||||
</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $cmsPages as $cmsPage}
|
||||
{foreach $categoryWiseCmsPages as $idCMSCategory => $cmsPages}
|
||||
<div class="col-lg-9">
|
||||
<table class="table table-bordered cms_pages_table" id="cms_pages_table_{$idCMSCategory}" style="width:40%; {if isset($smarty.post.id_cms_category) && $smarty.post.id_cms_category != $idCMSCategory}display:none;{else if isset($id_cms_category) && ($id_cms_category != $idCMSCategory)}display:none;{/if}">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><input type="radio" value="{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}" name="id_cms" {if isset($navigationLinkInfo['id_cms']) && $navigationLinkInfo['id_cms'] == $cmsPage.id_cms}checked="checked"{/if}>
|
||||
</td>
|
||||
<td>{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}</td>
|
||||
<td><label for="groupBox_{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}">{$cmsPage.meta_title}</label></td>
|
||||
<th class="fixed-width-xs">
|
||||
</th>
|
||||
<th class="fixed-width-xs"><span class="title_box">{l s='ID' mod='blocknavigationmenu'}</span></th>
|
||||
<th>
|
||||
<span class="title_box">
|
||||
{l s='CMS Page Name' mod='blocknavigationmenu'}
|
||||
</span>
|
||||
</th>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $cmsPages as $cmsPage}
|
||||
<tr>
|
||||
<td><input type="radio" value="{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}" name="id_cms" {if isset($navigationLinkInfo['id_cms']) && $navigationLinkInfo['id_cms'] == $cmsPage.id_cms}checked="checked"{/if}>
|
||||
</td>
|
||||
<td>{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}</td>
|
||||
<td><label for="groupBox_{$cmsPage.id_cms|escape:'htmlall':'UTF-8'}">{$cmsPage.meta_title}</label></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -2274,10 +2274,14 @@ class HotelBookingDetail extends ObjectModel
|
||||
*
|
||||
* @return [boolean] [true if updated otherwise false]
|
||||
*/
|
||||
public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1, $is_cancelled = 0)
|
||||
public function updateOrderRefundStatus($id_order, $date_from = false, $date_to = false, $id_rooms = array(), $is_refunded = 1, $is_cancelled = null)
|
||||
{
|
||||
$table = 'htl_booking_detail';
|
||||
$data = array('is_refunded' => (int) $is_refunded, 'is_cancelled' => (int) $is_cancelled);
|
||||
$data = array('is_refunded' => (int) $is_refunded);
|
||||
|
||||
if (!is_null($is_cancelled)) {
|
||||
$data['is_cancelled'] = (int) $is_cancelled;
|
||||
}
|
||||
|
||||
if ($id_rooms) {
|
||||
foreach ($id_rooms as $key_rm => $val_rm) {
|
||||
|
||||
@@ -326,10 +326,13 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
} else {
|
||||
$this->errors[] = $this->l('Invalid refund state.');
|
||||
}
|
||||
if (!$voucher_expiry_date = Tools::getValue('voucher_expiry_date')) {
|
||||
$this->errors[] = $this->l('Voucher expiry date is required.');
|
||||
} elseif (!Validate::isDate($voucher_expiry_date)) {
|
||||
$this->errors[] = $this->l('Invalid voucher expiry date.');
|
||||
|
||||
if (Tools::isSubmit('generateDiscount')) {
|
||||
if (!$voucher_expiry_date = Tools::getValue('voucher_expiry_date')) {
|
||||
$this->errors[] = $this->l('Voucher expiry date is required.');
|
||||
} elseif (!Validate::isDate($voucher_expiry_date)) {
|
||||
$this->errors[] = $this->l('Invalid voucher expiry date.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Invalid refund information found.');
|
||||
|
||||
@@ -486,7 +486,8 @@ class HotelReservationSystem extends Module
|
||||
|
||||
// Make rooms available for booking if order status is cancelled, refunded or error
|
||||
if (in_array($params['newOrderStatus']->id, $objHtlBkDtl->getOrderStatusToFreeBookedRoom())) {
|
||||
$isCancelled = 0;
|
||||
// do not change is_cancelled if room is not getting cancelled
|
||||
$isCancelled = null;
|
||||
if ($params['newOrderStatus']->id == Configuration::get('PS_OS_CANCELED')) {
|
||||
$isCancelled = 1;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<i class="icon-info-circle"></i> {l s='Order Cancellation Request Information' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
<br>
|
||||
<form id="{$table|escape:'htmlall':'UTF-8'}_form" class="defaultForm {$name_controller|escape:'htmlall':'UTF-8'} form-horizontal" action="{$current|escape:'htmlall':'UTF-8'}&{if !empty($submit_action)}{$submit_action|escape:'htmlall':'UTF-8'}{/if}&token={$token|escape:'htmlall':'UTF-8'}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<form id="{$table|escape:'htmlall':'UTF-8'}_form" class="defaultForm {$name_controller|escape:'htmlall':'UTF-8'} form-horizontal" action="{$link->getAdminLink('AdminOrderRefundRequests')|escape:'html':'UTF-8'}&vieworder_return&id_order_return={$orderReturnInfo['id']|escape:'html':'UTF-8'|intval}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<div class="panel">
|
||||
{if isset($customer_name)}
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user