-
-
-
- {if isset($icon) && $icon} {/if}
- {$title|escape}
-
-
- {if $subtitle}
-
-
- {$subtitle|escape}
+ {if isset($icon) && $icon} {/if}
+
+
+
+
+ {$title|escape}
- {/if}
-
- {if isset($chart) && $chart}
-
-
-
+ {if $subtitle}
+
+
+ {$subtitle|escape}
+
+
+ {/if}
- {/if}
-
- {if isset($source) && $source}
-
- {elseif isset($value) && $value !== ''}
-
{$value|escape:'html':'UTF-8'}
+ {if isset($chart) && $chart}
+
+ {/if}
+
+ {if isset($source) && $source}
+
+ {elseif isset($value) && $value !== ''}
+ {$value|escape:'html':'UTF-8'}
+ {/if}
+
+ {if isset($href) && $href}
+
{/if}
- {if isset($href) && $href}
-
- {/if}
-
+
{if isset($href) && $href}a{else}div{/if}>
{if isset($source) && $source}
diff --git a/admin/themes/default/template/helpers/list/list_header.tpl b/admin/themes/default/template/helpers/list/list_header.tpl
index 3b180415e..b3e7b84ad 100644
--- a/admin/themes/default/template/helpers/list/list_header.tpl
+++ b/admin/themes/default/template/helpers/list/list_header.tpl
@@ -295,28 +295,30 @@
{$params['title']|escape:'html':'UTF-8'}
diff --git a/admin/themes/default/template/helpers/options/options.tpl b/admin/themes/default/template/helpers/options/options.tpl
index 24a6094cd..527850f73 100644
--- a/admin/themes/default/template/helpers/options/options.tpl
+++ b/admin/themes/default/template/helpers/options/options.tpl
@@ -138,6 +138,9 @@
{elseif isset($input.empty_message)}
{$input.empty_message}
+ {else}
+
+
{/if}
{elseif $field['type'] == 'bool'}
diff --git a/classes/.htaccess b/classes/.htaccess
index 93169e4eb..3de9e4008 100644
--- a/classes/.htaccess
+++ b/classes/.htaccess
@@ -1,2 +1,10 @@
-Order deny,allow
-Deny from all
+# Apache 2.2
+
+ Order deny,allow
+ Deny from all
+
+
+# Apache 2.4
+
+ Require all denied
+
diff --git a/classes/BoOrder.php b/classes/BoOrder.php
new file mode 100644
index 000000000..b6046c5c8
--- /dev/null
+++ b/classes/BoOrder.php
@@ -0,0 +1,31 @@
+
+* @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;
+ }
+}
\ No newline at end of file
diff --git a/classes/Cart.php b/classes/Cart.php
index 6bd68b361..8401a36b9 100644
--- a/classes/Cart.php
+++ b/classes/Cart.php
@@ -2380,7 +2380,6 @@ class CartCore extends ObjectModel
$array = array();
foreach($selectedServiceProducts as $selectedProduct) {
if (isset($array[$selectedProduct['id_hotel']])) {
- $array[$selectedProduct['id_hotel']]['quantity'] += $selectedProduct['quantity'];
$array[$selectedProduct['id_hotel']]['total_price_tax_excl'] += $selectedProduct['total_price_tax_excl'];
$array[$selectedProduct['id_hotel']]['total_price_tax_incl'] += $selectedProduct['total_price_tax_incl'];
} else {
diff --git a/classes/Cookie.php b/classes/Cookie.php
index 0edb66672..90dbc9509 100644
--- a/classes/Cookie.php
+++ b/classes/Cookie.php
@@ -89,8 +89,9 @@ class CookieCore
$this->_path = '/'.$this->_path;
}
$this->_path = rawurlencode($this->_path);
- $this->_path = str_replace('%2F', '/', $this->_path);
- $this->_path = str_replace('%7E', '~', $this->_path);
+ $search = array('%2F', '%7E', '%28', '%29', '%2B', '%26');
+ $replace = array('/', '~', '(', ')', '+', '&');
+ $this->_path = str_replace($search, $replace, $this->_path);
$this->_domain = $this->getDomain($shared_urls);
$this->_sameSite = Configuration::get('PS_COOKIE_SAMESITE');
$this->_name = 'QloApps-'.md5(($this->_standalone ? '' : _PS_VERSION_).$name.$this->_domain);
diff --git a/classes/Customer.php b/classes/Customer.php
index a8c4c3609..a1ef3279e 100644
--- a/classes/Customer.php
+++ b/classes/Customer.php
@@ -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);
}
+
}
diff --git a/classes/CustomerThread.php b/classes/CustomerThread.php
index b6ec27283..70db8c507 100644
--- a/classes/CustomerThread.php
+++ b/classes/CustomerThread.php
@@ -140,14 +140,15 @@ class CustomerThreadCore extends ObjectModel
return Db::getInstance()->executeS($sql);
}
- public static function getIdCustomerThreadByEmailAndIdOrder($email, $id_order)
+ public static function getIdCustomerThreadByEmailAndIdOrder($email, $id_order, $id_contact = false)
{
return Db::getInstance()->getValue('
SELECT cm.id_customer_thread
FROM '._DB_PREFIX_.'customer_thread cm
WHERE cm.email = \''.pSQL($email).'\'
AND cm.id_shop = '.(int)Context::getContext()->shop->id.'
- AND cm.id_order = '.(int)$id_order
+ AND cm.id_order = '.(int)$id_order.' '.
+ (($id_contact) ? ' AND cm.id_contact='.(int) $id_contact : ' ')
);
}
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index 25e41c838..cea68af08 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -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,9 +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->name != 'csvorder'
+ && ($this->validateOrderAmount)
) {
// if customer is paying full payment amount
$id_order_state = Configuration::get('PS_OS_ERROR');
@@ -685,16 +684,15 @@ 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()
- );
- if ($this->name != 'csvorder') {
+ 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',
@@ -1053,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();
@@ -1092,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);
@@ -1101,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 && $this->name != 'csvorder') {
+ 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;
@@ -1330,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) {
diff --git a/classes/Validate.php b/classes/Validate.php
index 63dcacc75..9196216dd 100644
--- a/classes/Validate.php
+++ b/classes/Validate.php
@@ -364,7 +364,7 @@ class ValidateCore
*/
public static function isCityName($city)
{
- return preg_match(Tools::cleanNonUnicodeSupport('/^[^!<>;?=+@#"°{}_$%]*$/u'), $city);
+ return preg_match(Tools::cleanNonUnicodeSupport('/^\p{L}+[^!<>;?=+@#"°{}_$%]*$/u'), $city);
}
/**
diff --git a/classes/cache/Cache.php b/classes/cache/Cache.php
index d13b97791..96b0fed3f 100644
--- a/classes/cache/Cache.php
+++ b/classes/cache/Cache.php
@@ -502,7 +502,7 @@ abstract class CacheCore
$this->_deleteMulti($invalidKeys);
if ($keyToKeep) {
- $this->sql_tables_cached[$table][$keyToKeep] = $toKeep ?? null;
+ $this->sql_tables_cached[$table][$keyToKeep] = isset($toKeep) ? $toKeep : null;
}
}
$this->adjustTableCacheSize = false;
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index ea0c1ffa0..876652420 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -841,13 +841,13 @@ class AdminControllerCore extends Controller
$this->ensureListIdDefinition();
$prefix = $this->getCookieFilterPrefix();
-
+ $filters = array();
if (isset($this->list_id)) {
foreach ($_POST as $key => $value) {
if ($value === '') {
unset($this->context->cookie->{$prefix.$key});
} elseif (stripos($key, $this->list_id.'Filter_') === 0) {
- $this->context->cookie->{$prefix.$key} = !is_array($value) ? $value : json_encode($value);
+ $filters[$prefix.$key] = !is_array($value) ? $value : json_encode($value);
} elseif (stripos($key, 'submitFilter') === 0) {
$this->context->cookie->$key = !is_array($value) ? $value : json_encode($value);
}
@@ -855,7 +855,7 @@ class AdminControllerCore extends Controller
foreach ($_GET as $key => $value) {
if (stripos($key, $this->list_id.'Filter_') === 0) {
- $this->context->cookie->{$prefix.$key} = !is_array($value) ? $value : json_encode($value);
+ $filters[$prefix.$key] = !is_array($value) ? $value : json_encode($value);
} elseif (stripos($key, 'submitFilter') === 0) {
$this->context->cookie->$key = !is_array($value) ? $value : json_encode($value);
}
@@ -863,65 +863,36 @@ class AdminControllerCore extends Controller
if ($value === '' || $value == $this->_defaultOrderBy) {
unset($this->context->cookie->{$prefix.$key});
} else {
- $this->context->cookie->{$prefix.$key} = $value;
+ $filters[$prefix.$key] = $value;
}
} elseif (stripos($key, $this->list_id.'Orderway') === 0 && Validate::isOrderWay($value)) {
if ($value === '' || $value == $this->_defaultOrderWay) {
unset($this->context->cookie->{$prefix.$key});
} else {
- $this->context->cookie->{$prefix.$key} = $value;
+ $filters[$prefix.$key] = $value;
}
}
}
}
- $filters = $this->context->cookie->getFamily($prefix.$this->list_id.'Filter_');
- $definition = false;
- if (isset($this->className) && $this->className) {
- $definition = ObjectModel::getDefinition($this->className);
+ if (empty($filters)) {
+ $filters = $this->context->cookie->getFamily($prefix.$this->list_id.'Filter_');
}
foreach ($filters as $key => $value) {
- /* Extracting filters from $_POST on key filter_ */
- if ($value != null && !strncmp($key, $prefix.$this->list_id.'Filter_', 7 + Tools::strlen($prefix.$this->list_id))) {
- $key_org = $key;
- $key = Tools::substr($key, 7 + Tools::strlen($prefix.$this->list_id));
- /* Table alias could be specified using a ! eg. alias!field */
- $tmp_tab = explode('!', $key);
- $filter = count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0];
-
- if ($field = $this->filterToField($key, $filter)) {
- $type = (array_key_exists('filter_type', $field) ? $field['filter_type'] : (array_key_exists('type', $field) ? $field['type'] : false));
- if ((($type == 'date' || $type == 'datetime' || $type == 'range') || ($type == 'select' && (isset($field['multiple']) && $field['multiple'])))
- && is_string($value)
- ) {
- $value = json_decode($value, true);
+ $key_org = $key;
+ $key = Tools::substr($key, 7 + Tools::strlen($prefix.$this->list_id));
+ /* Table alias could be specified using a ! eg. alias!field */
+ $tmp_tab = explode('!', $key);
+ $filter = count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0];
+ if ($field = $this->filterToField($key, $filter)) {
+ $type = (array_key_exists('filter_type', $field) ? $field['filter_type'] : (array_key_exists('type', $field) ? $field['type'] : false));
+ if (($type == 'date' || $type == 'datetime' || $type == 'range')) {
+ if (is_string($value)) {
+ $filter_value = json_decode($value, true);
}
- $key = isset($tmp_tab[1]) ? $tmp_tab[0].'.`'.$tmp_tab[1].'`' : '`'.$tmp_tab[0].'`';
-
- // as in database 0 means position 1 in the renderlist
- if (isset($field['position']) && Validate::isInt($value)) {
- $value -= 1;
- }
-
- // Assignment by reference
- if (array_key_exists('tmpTableFilter', $field)) {
- $sql_filter = & $this->_tmpTableFilter;
- } elseif (array_key_exists('havingFilter', $field)) {
- $sql_filter = & $this->_filterHaving;
- } else {
- $sql_filter = & $this->_filter;
- }
-
- if (is_array($value)) {
- if ($type == 'select' && (isset($field['multiple']) && $field['multiple']) && isset($field['operator'])) {
- if ($field['operator'] == 'and') {
- $sql_filter .= ' AND '.pSQL($key).' IN ('.pSQL(implode(',', $value)).')';
- $this->_filterHaving .= ' AND COUNT(DISTINCT '.pSQL($key).') = '.(int) count($value);
- } elseif ($field['operator'] == 'or') {
- $sql_filter .= ' AND '.pSQL($key).' IN ('.pSQL(implode(',', $value)).')';
- }
- } elseif ($type == 'range') {
+ if (is_array($filter_value)) {
+ if ($type == 'range') {
// set validation type
if (isset($field['validation']) && $field['validation'] && method_exists('Validate', $field['validation'])) {
$validation = $field['validation'];
@@ -929,57 +900,120 @@ class AdminControllerCore extends Controller
$validation = 'isUnsignedInt';
}
- if (isset($value[0]) && ($value[0] !== '' || $value[0] === 0)) {
- if (!Validate::$validation($value[0])) {
- $this->errors[] = Tools::displayError('The \'From\' value is invalid');
- } else {
- $sql_filter .= ' AND '.pSQL($key).' >= '.pSQL($value[0]);
+ if (isset($filter_value[0]) && ($filter_value[0] !== '' || $filter_value[0] === 0)) {
+ if (!Validate::$validation($filter_value[0])) {
+ $this->errors[] = sprintf(Tools::displayError('The %s field \'From\' value is invalid'), $field['title']);
}
}
- if (isset($value[1]) && ($value[1] !== '' || $value[1] === 0)) {
- if (!Validate::$validation($value[1])) {
- $this->errors[] = Tools::displayError('The \'To\' value is invalid');
- } elseif ((isset($value[0]) && ($value[0] !== '' || $value[0] === 0)) && $value[0] > $value[1]) {
- $this->errors[] = Tools::displayError('The \'To\' value cannot be less than \'From\' value');
- } else {
- $sql_filter .= ' AND '.pSQL($key).' <= '.pSQL($value[1]);
+ if (isset($filter_value[1]) && ($filter_value[1] !== '' || $filter_value[1] === 0)) {
+ if (!Validate::$validation($filter_value[1])) {
+ $this->errors[] = sprintf(Tools::displayError('The %s field \'To\' value is invalid'), $field['title']);
+ } elseif ((isset($filter_value[0]) && ($filter_value[0] !== '' || $filter_value[0] === 0)) && $filter_value[0] > $filter_value[1]) {
+ $this->errors[] = sprintf(Tools::displayError('The %s field \'To\' value cannot be less than \'From\' value'), $field['title']);
}
}
} else {
- if (isset($value[0]) && !empty($value[0])) {
- if (!Validate::isDate($value[0])) {
- $this->errors[] = Tools::displayError('The \'From\' date format is invalid (YYYY-MM-DD)');
- } else {
- $sql_filter .= ' AND '.pSQL($key).' >= \''.pSQL(Tools::dateFrom($value[0])).'\'';
+ if (isset($filter_value[0]) && !empty($filter_value[0])) {
+ if (!Validate::isDate($filter_value[0])) {
+ $this->errors[] = sprintf(Tools::displayError('The %s field \'From\' date format is invalid (YYYY-MM-DD)'), $field['title']);
}
}
- if (isset($value[1]) && !empty($value[1])) {
- if (!Validate::isDate($value[1])) {
- $this->errors[] = Tools::displayError('The \'To\' date format is invalid (YYYY-MM-DD)');
- } elseif (isset($value[0]) && !empty($value[0]) && strtotime($value[0]) > strtotime($value[1])) {
- $this->errors[] = Tools::displayError('The \'To\' date cannot be earlier than \'From\' date');
- } else {
- $sql_filter .= ' AND '.pSQL($key).' <= \''.pSQL(Tools::dateTo($value[1])).'\'';
+ if (isset($filter_value[1]) && !empty($filter_value[1])) {
+ if (!Validate::isDate($filter_value[1])) {
+ $this->errors[] = sprintf(Tools::displayError('The %s field \'To\' date format is invalid (YYYY-MM-DD)'), $field['title']);
+ } elseif (isset($filter_value[0]) && !empty($filter_value[0]) && strtotime($filter_value[0]) > strtotime($filter_value[1])) {
+ $this->errors[] = sprintf(Tools::displayError('The %s field \'To\' date cannot be earlier than \'From\' date'), $field['title']);
}
}
}
- } else {
- $sql_filter .= ' AND ';
- $check_key = ($key == $this->identifier || $key == '`'.$this->identifier.'`');
- $alias = ($definition && !empty($definition['fields'][$filter]['shop'])) ? 'sa' : 'a';
+ }
+ }
+ }
+ }
- if ($type == 'int' || $type == 'bool') {
- $sql_filter .= (($check_key || $key == '`active`') ? $alias.'.' : '').pSQL($key).' = '.(int)$value.' ';
- } elseif ($type == 'decimal') {
- $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' = '.(float)$value.' ';
- } elseif ($type == 'select') {
- $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' = \''.pSQL($value).'\' ';
- } elseif ($type == 'price') {
- $value = (float)str_replace(',', '.', $value);
- $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' = '.pSQL(trim($value)).' ';
- } else {
- $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' LIKE \'%'.pSQL(trim($value)).'%\' ';
+ if (empty($this->errors)) {
+ $definition = false;
+ if (isset($this->className) && $this->className) {
+ $definition = ObjectModel::getDefinition($this->className);
+ }
+ if ($filters) {
+ foreach ($filters as $key => $value) {
+ $this->context->cookie->$key = $value;
+
+ /* Extracting filters from $_POST on key filter_ */
+ if ($value != null && !strncmp($key, $prefix.$this->list_id.'Filter_', 7 + Tools::strlen($prefix.$this->list_id))) {
+ $key_org = $key;
+ $key = Tools::substr($key, 7 + Tools::strlen($prefix.$this->list_id));
+ /* Table alias could be specified using a ! eg. alias!field */
+ $tmp_tab = explode('!', $key);
+ $filter = count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0];
+
+ if ($field = $this->filterToField($key, $filter)) {
+ $type = (array_key_exists('filter_type', $field) ? $field['filter_type'] : (array_key_exists('type', $field) ? $field['type'] : false));
+ if ((($type == 'date' || $type == 'datetime' || $type == 'range') || ($type == 'select' && (isset($field['multiple']) && $field['multiple'])))
+ && is_string($value)
+ ) {
+ $value = json_decode($value, true);
+ }
+ $key = isset($tmp_tab[1]) ? $tmp_tab[0].'.`'.$tmp_tab[1].'`' : '`'.$tmp_tab[0].'`';
+
+ // as in database 0 means position 1 in the renderlist
+ if (isset($field['position']) && Validate::isInt($value)) {
+ $value -= 1;
+ }
+
+ // Assignment by reference
+ if (array_key_exists('tmpTableFilter', $field)) {
+ $sql_filter = & $this->_tmpTableFilter;
+ } elseif (array_key_exists('havingFilter', $field)) {
+ $sql_filter = & $this->_filterHaving;
+ } else {
+ $sql_filter = & $this->_filter;
+ }
+
+ if (is_array($value)) {
+ if ($type == 'select' && (isset($field['multiple']) && $field['multiple']) && isset($field['operator'])) {
+ if ($field['operator'] == 'and') {
+ $sql_filter .= ' AND '.pSQL($key).' IN ('.pSQL(implode(',', $value)).')';
+ $this->_filterHaving .= ' AND COUNT(DISTINCT '.pSQL($key).') = '.(int) count($value);
+ } elseif ($field['operator'] == 'or') {
+ $sql_filter .= ' AND '.pSQL($key).' IN ('.pSQL(implode(',', $value)).')';
+ }
+ } elseif ($type == 'range') {
+
+ if (isset($value[0]) && ($value[0] !== '' || $value[0] === 0)) {
+ $sql_filter .= ' AND '.pSQL($key).' >= '.pSQL($value[0]);
+ }
+ if (isset($value[1]) && ($value[1] !== '' || $value[1] === 0)) {
+ $sql_filter .= ' AND '.pSQL($key).' <= '.pSQL($value[1]);
+ }
+ } else {
+ if (isset($value[0]) && !empty($value[0])) {
+ $sql_filter .= ' AND '.pSQL($key).' >= \''.pSQL(Tools::dateFrom($value[0])).'\'';
+ }
+ if (isset($value[1]) && !empty($value[1])) {
+ $sql_filter .= ' AND '.pSQL($key).' <= \''.pSQL(Tools::dateTo($value[1])).'\'';
+ }
+ }
+ } else {
+ $sql_filter .= ' AND ';
+ $check_key = ($key == $this->identifier || $key == '`'.$this->identifier.'`');
+ $alias = ($definition && !empty($definition['fields'][$filter]['shop'])) ? 'sa' : 'a';
+
+ if ($type == 'int' || $type == 'bool') {
+ $sql_filter .= (($check_key || $key == '`active`') ? $alias.'.' : '').pSQL($key).' = '.(int)$value.' ';
+ } elseif ($type == 'decimal') {
+ $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' = '.(float)$value.' ';
+ } elseif ($type == 'select') {
+ $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' = \''.pSQL($value).'\' ';
+ } elseif ($type == 'price') {
+ $value = (float)str_replace(',', '.', $value);
+ $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' = '.pSQL(trim($value)).' ';
+ } else {
+ $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' LIKE \'%'.pSQL(trim($value)).'%\' ';
+ }
+ }
}
}
}
@@ -1042,7 +1076,7 @@ class AdminControllerCore extends Controller
if ($this->filter && $this->action != 'reset_filters') {
$this->processFilter();
}
- if (isset($_POST) && count($_POST) && (int)Tools::getValue('submitFilter'.$this->list_id) || Tools::isSubmit('submitReset'.$this->list_id)) {
+ if (empty($this->errors) && isset($_POST) && count($_POST) && (int)Tools::getValue('submitFilter'.$this->list_id) || Tools::isSubmit('submitReset'.$this->list_id)) {
$this->setRedirectAfter(self::$currentIndex.'&token='.$this->token.(Tools::isSubmit('submitFilter'.$this->list_id) ? '&submitFilter'.$this->list_id.'='.(int)Tools::getValue('submitFilter'.$this->list_id) : '').(isset($_GET['id_'.$this->list_id]) ? '&id_'.$this->list_id.'='.(int)$_GET['id_'.$this->list_id] : ''));
}
diff --git a/classes/helper/HelperTreeHotels.php b/classes/helper/HelperTreeHotels.php
index 5849ffb73..dd142943a 100644
--- a/classes/helper/HelperTreeHotels.php
+++ b/classes/helper/HelperTreeHotels.php
@@ -382,6 +382,23 @@ class HelperTreeHotelsCore extends TreeCore
$this->addAction($expand_all);
if ($this->useCheckBox()) {
+ if ($this->useBulkActions()) {
+ $check_all = new TreeToolbarLink(
+ 'Check All',
+ '#',
+ 'checkAllAssociatedHotels($(\'#'.$this->getId().'\'));return false;',
+ 'icon-check-sign');
+ $check_all->setAttribute('id', 'check-all-'.$this->getId());
+ $uncheck_all = new TreeToolbarLink(
+ 'Uncheck All',
+ '#',
+ 'uncheckAllAssociatedHotels($(\'#'.$this->getId().'\'));return false;',
+ 'icon-check-empty');
+ $uncheck_all->setAttribute('id', 'uncheck-all-'.$this->getId());
+ $this->addAction($check_all);
+ $this->addAction($uncheck_all);
+ }
+
$this->setNodeFolderTemplate('tree_node_hotel_folder_checkbox.tpl');
$this->setNodeItemTemplate('tree_node_hotel_item_checkbox.tpl');
$this->setAttribute('use_checkbox', $this->useCheckBox());
diff --git a/classes/module/ModuleGraph.php b/classes/module/ModuleGraph.php
index f087a0a2c..190787bfe 100644
--- a/classes/module/ModuleGraph.php
+++ b/classes/module/ModuleGraph.php
@@ -77,6 +77,7 @@ abstract class ModuleGraphCore extends Module
if (is_callable(array($this, 'setDayValues'))) {
$this->setDayValues($layers);
}
+ $this->_titles['x'][] = $this->l('Time');
}
// If the granularity is inferior to 1 month
// @TODO : change to manage 28 to 31 days
@@ -110,6 +111,7 @@ abstract class ModuleGraphCore extends Module
if (is_callable(array($this, 'setMonthValues'))) {
$this->setMonthValues($layers);
}
+ $this->_titles['x'][] = $this->l('Date');
}
// If the granularity is less than 1 year
elseif (strtotime('-1 year', strtotime($this->_employee->stats_date_to)) < strtotime($this->_employee->stats_date_from)) {
@@ -141,6 +143,7 @@ abstract class ModuleGraphCore extends Module
if (is_callable(array($this, 'setYearValues'))) {
$this->setYearValues($layers);
}
+ $this->_titles['x'][] = $this->l('Month');
}
// If the granularity is greater than 1 year
else {
@@ -163,6 +166,7 @@ abstract class ModuleGraphCore extends Module
if (is_callable(array($this, 'setAllTimeValues'))) {
$this->setAllTimeValues($layers);
}
+ $this->_titles['x'][] = $this->l('Year');
}
}
@@ -210,7 +214,7 @@ abstract class ModuleGraphCore extends Module
if (isset($this->_values[$key])) {
// We don't want strings to be divided. Example: product name
if (is_numeric($this->_values[$key])) {
- $this->_csv .= $this->_values[$key] / (($datas['type'] == 'pie') ? $total : 1);
+ $this->_csv .= $this->_values[$key] * 100 / (($datas['type'] == 'pie') ? $total : 1) . '%';
} else {
$this->_csv .= $this->_values[$key];
}
@@ -220,7 +224,7 @@ abstract class ModuleGraphCore extends Module
} else {
// We don't want strings to be divided. Example: product name
if (is_numeric($this->_values[$i][$key])) {
- $this->_csv .= $this->_values[$i][$key] / (($datas['type'] == 'pie') ? $total : 1);
+ $this->_csv .= $this->_values[$i][$key] * 100 / (($datas['type'] == 'pie') ? $total : 1) . '%';
} else {
$this->_csv .= $this->_values[$i][$key];
}
diff --git a/classes/module/ModuleGrid.php b/classes/module/ModuleGrid.php
index 024066626..13f6f18ee 100644
--- a/classes/module/ModuleGrid.php
+++ b/classes/module/ModuleGrid.php
@@ -153,7 +153,10 @@ abstract class ModuleGridCore extends Module
protected function csvExport($datas)
{
$this->_sort = $datas['defaultSortColumn'];
- $this->setLang(Context::getContext()->language->id);
+ $context = Context::getContext();
+ $this->setLang($context->language->id);
+ $this->setEmployee($context->employee->id);
+
if (isset($datas['option'])) {
$this->setOption($datas['option'], $layers);
}
diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php
index 3d28fca40..6065a4d45 100644
--- a/classes/pdf/HTMLTemplateInvoice.php
+++ b/classes/pdf/HTMLTemplateInvoice.php
@@ -822,7 +822,9 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
*/
protected function getTemplateByCountry($iso_country)
{
- $file = Configuration::get('PS_INVOICE_MODEL');
+ // $file = Configuration::get('PS_INVOICE_MODEL');
+ // @todo redesign invoice template for b2b, for now we have ony one template design.
+ $file = 'invoice';
// try to fetch the iso template
$template = $this->getTemplate($file.'.'.$iso_country);
diff --git a/classes/webservice/WebserviceOrder.php b/classes/webservice/WebserviceOrder.php
index 4b1d337e4..860fcc0c0 100644
--- a/classes/webservice/WebserviceOrder.php
+++ b/classes/webservice/WebserviceOrder.php
@@ -26,5 +26,6 @@ class WebserviceOrderCore extends PaymentModule
public function __construct()
{
$this->displayName = $this->l('Order from API');
+ $this->validateOrderAmount = false;
}
}
diff --git a/config/.htaccess b/config/.htaccess
index 93169e4eb..3de9e4008 100644
--- a/config/.htaccess
+++ b/config/.htaccess
@@ -1,2 +1,10 @@
-Order deny,allow
-Deny from all
+# Apache 2.2
+
+ Order deny,allow
+ Deny from all
+
+
+# Apache 2.4
+
+ Require all denied
+
diff --git a/config/xml/.htaccess b/config/xml/.htaccess
index 93169e4eb..3de9e4008 100644
--- a/config/xml/.htaccess
+++ b/config/xml/.htaccess
@@ -1,2 +1,10 @@
-Order deny,allow
-Deny from all
+# Apache 2.2
+
+ Order deny,allow
+ Deny from all
+
+
+# Apache 2.4
+
+ Require all denied
+
diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php
index 83a646cb6..5f6bb472d 100644
--- a/controllers/admin/AdminAddressesController.php
+++ b/controllers/admin/AdminAddressesController.php
@@ -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()
*/
diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php
index bd9ffd404..fe099e12c 100644
--- a/controllers/admin/AdminCustomersController.php
+++ b/controllers/admin/AdminCustomersController.php
@@ -739,6 +739,9 @@ class AdminCustomersControllerCore extends AdminController
$helper->color = 'color4';
$helper->title = $this->l('New Customers', null, null, false);
$nbDaysNewCustomers = Validate::isUnsignedInt(Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS')) ? Configuration::get('PS_KPI_NEW_CUSTOMERS_NB_DAYS') : 30;
+ $date_from = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day'));
+ $date_to = date('Y-m-d');
+ $helper->href = $this->context->link->getAdminLink('AdminCustomers').'&customerFilter_date_add[]='.$date_from.'&customerFilter_date_add[]='.$date_to;
$helper->subtitle = sprintf($this->l('%d Days', null, null, false), (int) $nbDaysNewCustomers);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_new_customers';
$helper->tooltip = $this->l('The total number of new customers who registered in given period of time.', null, null, false);
@@ -958,7 +961,7 @@ class AdminCustomersControllerCore extends AdminController
// If customer is going to be deleted permanently then if customer has orders the change this customer as an anonymous customer
if (Validate::isLoadedObject($objCustomer = $this->loadObject())) {
if ($this->delete_mode == 'real' && Order::getCustomerOrders($objCustomer->id, true)) {
- $objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::getShopDomain();
+ $objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::link_rewrite(Configuration::get('PS_SHOP_NAME')).'_anonymous.com';
$objCustomer->deleted = 1;
if (!$objCustomer->update()) {
$this->errors[] = Tools::displayError('Some error ocurred while deleting the Customer');
@@ -1040,37 +1043,48 @@ class AdminCustomersControllerCore extends AdminController
$this->redirect_after = false;
}
// Check that the new email is not already in use
- $customer_email = strval(Tools::getValue('email'));
+ $customer_email = trim(strval(Tools::getValue('email')));
$customer = new Customer();
if (Validate::isEmail($customer_email)) {
$customer->getByEmail($customer_email);
- }
- if ($customer->id) {
- $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
+ if ($customer->id) {
+ $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
+ $this->display = 'edit';
+ return $customer;
+ } elseif (Customer::customerExists($customer_email, false, true)) {
+ $this->errors[] = Tools::displayError('The email is already associated with a banned account. Please use a different one.');
+ $this->display = 'edit';
+ } elseif (trim(Tools::getValue('passwd')) == '') {
+ $this->validateRules();
+ $this->errors[] = Tools::displayError('Password can not be empty.');
+ $this->display = 'edit';
+ } elseif ($customer = parent::processAdd()) {
+ $this->context->smarty->assign('new_customer', $customer);
+ return $customer;
+ }
+ } else {
+ $this->errors[] = Tools::displayError('Invalid email address.');
$this->display = 'edit';
- return $customer;
- } elseif (trim(Tools::getValue('passwd')) == '') {
- $this->validateRules();
- $this->errors[] = Tools::displayError('Password can not be empty.');
- $this->display = 'edit';
- } elseif ($customer = parent::processAdd()) {
- $this->context->smarty->assign('new_customer', $customer);
- return $customer;
}
+
return false;
}
+
public function processUpdate()
{
if (Validate::isLoadedObject($this->object)) {
- $customer_email = strval(Tools::getValue('email'));
+ $customer_email = trim(strval(Tools::getValue('email')));
// check if e-mail already used
if ($customer_email != $this->object->email) {
$customer = new Customer();
if (Validate::isEmail($customer_email)) {
$customer->getByEmail($customer_email);
+ } else {
+ $this->errors[] = Tools::displayError('Invalid email address.');
}
+
if (($customer->id) && ($customer->id != (int)$this->object->id)) {
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
}
@@ -1289,4 +1303,41 @@ class AdminCustomersControllerCore extends AdminController
die('ok');
}
}
+
+ public function ajaxProcessVerifyCustomerEmail()
+ {
+ $response = array('status' => true);
+ $idCustomer = Tools::getValue('id_customer', 0);
+ if (($email = trim(strval(Tools::getValue('email'))))
+ && ($idCustomerByEmail = Customer::customerExists($email, true, false))
+ && (Validate::isLoadedObject($objCustomer = new Customer($idCustomerByEmail)))
+ && $idCustomerByEmail != $idCustomer // the admin is trying to add/update the account
+ ) {
+ $response['status'] = false;
+ if ($objCustomer->deleted) {
+ $response['msg'] = Tools::displayError('This email is already associated with a banned account. Please use a different one.');
+ } else {
+ $response['msg'] = Tools::displayError('An account already exists for this email address.');
+ }
+ }
+
+ $this->ajaxDie(json_encode($response));
+ }
+
+ public function setMedia()
+ {
+ parent::setMedia();
+ if ($this->loadObject(true)
+ && ($this->display == 'edit' || $this->display == 'add')
+ ) {
+ $idCustomer = $this->object->id ? $this->object->id : 0;
+ Media::addJSDef(
+ array(
+ 'customer_controller_url' => self::$currentIndex.'&token='.$this->token,
+ 'id_customer' => $idCustomer
+ )
+ );
+ $this->addJS(_PS_JS_DIR_.'admin/customers.js');
+ }
+ }
}
diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php
index 6cb46c39b..0c6018ec8 100644
--- a/controllers/admin/AdminNormalProductsController.php
+++ b/controllers/admin/AdminNormalProductsController.php
@@ -2992,7 +2992,7 @@ class AdminNormalProductsControllerCore extends AdminController
->setUseSearch(false)
->setFullTree(0)
->setSelectedCategories($categories)
- ->setUseBulkActions(false);
+ ->setUseBulkActions(true);
$data->assign(array('default_category' => $default_category,
'selected_cat_ids' => implode(',', array_keys($selected_cat)),
@@ -3508,7 +3508,7 @@ class AdminNormalProductsControllerCore extends AdminController
->setRoomsOnly(false)
->setSelectedHotels($selectedElements['hotels'])
->setSelectedRoomTypes($selectedElements['room_types'])
- ->setUseBulkActions(false)
+ ->setUseBulkActions(true)
->setAccessedHotels(HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1, 0));
$data->assign('hotel_tree', $tree->render());
diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php
index 4068a6f09..241ed1c29 100644
--- a/controllers/admin/AdminOrderPreferencesController.php
+++ b/controllers/admin/AdminOrderPreferencesController.php
@@ -82,6 +82,7 @@ class AdminOrderPreferencesControllerCore extends AdminController
)
);
+ $maxOrderDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE', Configuration::get('MAX_GLOBAL_BOOKING_DATE'));
$this->fields_options = array(
'order_restrict' => array(
'title' => $this->l('Order Restrict'),
@@ -92,11 +93,13 @@ class AdminOrderPreferencesControllerCore extends AdminController
'hint' => $this->l('Maximum date of check-out for which rooms of your hotels can be booked.'),
'type' => 'text',
'id' => 'max_global_book_date',
+ 'auto_value' => false,
+ 'value' => date('d-m-Y', strtotime($maxOrderDate)),
'class' => 'fixed-width-xxl readonly',
),
'GLOBAL_PREPARATION_TIME' => array(
- 'title' => $this->l('Preparation time'),
- 'hint' => $this->l('Number of days required to prepare a room for a guest\'s stay. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'),
+ 'title' => $this->l('Minimum booking offset'),
+ 'hint' => $this->l('The minimum booking offset is the minimum number of days before the check-in date that a guest must book a room. For example, if you set this value to 3 and someone is booking on 2nd of March he can only book rooms for dates from and after 3 days, i.e, 5th of March.'),
'desc' => $this->l('Set to 0 to disable this feature.'),
'type' => 'text',
'class' => 'fixed-width-xl',
@@ -329,6 +332,7 @@ class AdminOrderPreferencesControllerCore extends AdminController
$this->errors[] = Tools::displayError('Please assign a valid CMS page for Terms and Conditions.');
}
+ $_POST['MAX_GLOBAL_BOOKING_DATE'] = date('Y-m-d', strtotime(Tools::getValue('MAX_GLOBAL_BOOKING_DATE')));
$maxGlobalBookingDate = Tools::getValue('MAX_GLOBAL_BOOKING_DATE');
$globalPreparationTime = Tools::getValue('GLOBAL_PREPARATION_TIME');
$maxGlobalBookingDateFormatted = date('Y-m-d', strtotime($maxGlobalBookingDate));
@@ -342,9 +346,9 @@ class AdminOrderPreferencesControllerCore extends AdminController
}
if ($globalPreparationTime === '') {
- $this->errors[] = Tools::displayError('Field \'Preparation time\' can not be empty.');
+ $this->errors[] = Tools::displayError('Field \'Minimum booking offset\' can not be empty.');
} elseif ($globalPreparationTime !== '0' && !Validate::isUnsignedInt($globalPreparationTime)) {
- $this->errors[] = Tools::displayError('Field \'Preparation time\' is invalid.');
+ $this->errors[] = Tools::displayError('Field \'Minimum booking offset\' is invalid.');
}
}
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index db4a3f943..731570bdf 100644
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -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
*/
@@ -5278,20 +5267,23 @@ class AdminOrdersControllerCore extends AdminController
// update order detail for selected aditional services
foreach ($selectedAdditonalServices['additional_services'] as $service) {
$serviceOrderDetail = new OrderDetail($service['id_order_detail']);
- if ($service['quantity'] >= $serviceOrderDetail->product_quantity) {
+
+ $cart_quantity = $service['quantity'];
+ if ($service['product_price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
+ $cart_quantity = $cart_quantity * $product_quantity;
+ }
+ if ($cart_quantity >= $serviceOrderDetail->product_quantity) {
$serviceOrderDetail->delete();
} else {
- $order_detail->total_price_tax_incl -= Tools::ps_round($service['total_price_tax_incl'], 6);
- $order_detail->total_price_tax_excl -= Tools::ps_round($service['total_price_tax_excl'], 6);
-
- $serviceOldQuantity = $serviceOrderDetail->product_quantity;
- $serviceOrderDetail->product_quantity = $serviceOldQuantity - $service['quantity'];
+ $serviceOrderDetail->total_price_tax_incl -= Tools::ps_round($service['total_price_tax_incl'], 6);
+ $serviceOrderDetail->total_price_tax_excl -= Tools::ps_round($service['total_price_tax_excl'], 6);
+ $serviceOrderDetail->product_quantity -= $cart_quantity;
// update taxes
- $res &= $order_detail->updateTaxAmount($order);
+ $res &= $serviceOrderDetail->updateTaxAmount($order);
// Save order detail
- $res &= $order_detail->update();
+ $res &= $serviceOrderDetail->update();
}
}
/*End*/
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index fd06fb947..626a7984b 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -201,13 +201,15 @@ class AdminProductsControllerCore extends AdminController
LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)
LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON (fp.`id_product` = a.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_demand` hrtd ON (hrtd.`id_product` = a.`id_product`)
- LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` hrtsp ON ((hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.' AND hrtsp.`id_element` = hrt.`id_hotel`) OR (hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND hrtsp.`id_element` = a.`id_product`))';
+ LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` hrtsp ON ((hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.' AND hrtsp.`id_element` = hrt.`id_hotel`) OR (hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND hrtsp.`id_element` = a.`id_product`))
+ LEFT JOIN `'._DB_PREFIX_.'htl_advance_payment` hap ON (hap.`id_product` = a.`id_product`)';
- $this->_select .= ' (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, ';
+ $this->_select .= ' a.`show_at_front`, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, ';
$this->_select .= 'hrt.`adults`, hrt.`children`, hrt.`max_guests`, hb.`id` as id_hotel, aa.`city`, hbl.`hotel_name`, ';
$this->_select .= 'shop.`name` AS `shopname`, a.`id_shop_default`, ';
$this->_select .= $alias_image.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`';
- $this->_select .= ', IFNULL((SELECT hap.`active` FROM `'._DB_PREFIX_.'htl_advance_payment` hap WHERE hap.`id_product` = a.`id_product`), 0) AS advance_payment';
+ $this->_select .= ', IFNULL(hap.`active`, 0) AS advance_payment';
+ $this->_select .= ', IF(IFNULL(hap.`active`, 0), 1, 0) badge_success, IF(IFNULL(hap.`active`, 0), 0, 1) badge_danger ';
if ($join_category) {
$this->_join .= ' INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = '.(int)$this->_category->id.') ';
@@ -319,10 +321,23 @@ class AdminProductsControllerCore extends AdminController
'optional' => true,
);
+ $this->fields_list['show_at_front'] = array(
+ 'title' => $this->l('Show at front'),
+ 'align' => 'text-center',
+ 'type' => 'bool',
+ 'active' => 'show_at_front',
+ 'optional' => true,
+ 'havingFilter' => true,
+ 'visible_default' => true,
+ 'orderby' => false,
+ );
+
if (Configuration::get('WK_ALLOW_ADVANCED_PAYMENT')) {
$this->fields_list['advance_payment'] = array(
'title' => $this->l('Advance Payment'),
- 'active' => 'advance_payment',
+ 'callback' => 'getAdvancePaymentStatus',
+ 'badge_success' => true,
+ 'badge_danger' => true,
'align' => 'text-center',
'type' => 'bool',
'optional' => true,
@@ -431,6 +446,18 @@ class AdminProductsControllerCore extends AdminController
}
}
+ public function getAdvancePaymentStatus($val, $row)
+ {
+ if ($val) {
+ $str_return = $this->l('Yes');
+ } else {
+ $str_return = $this->l('No');
+ }
+
+ return $str_return;
+ }
+
+
private function buildCategoryOptions($category)
{
$space = str_repeat(' ', 5 * (($category['level_depth'] - $this->objLocationsCategory->level_depth) - 1));
@@ -816,6 +843,13 @@ class AdminProductsControllerCore extends AdminController
if (!$id_hotel_new) {
$id_hotel_new = $room_type_info['id_hotel'];
}
+
+ if ($product->hasAttributes()) {
+ Product::updateDefaultAttribute($product->id);
+ } else {
+ Product::duplicateSpecificPrices($id_product_old, $product->id);
+ }
+
$id_room_type_new = HotelRoomType::duplicateRoomType(
$id_product_old,
$product->id,
@@ -839,11 +873,6 @@ class AdminProductsControllerCore extends AdminController
} else {
$this->errors[] = Tools::displayError('An error occurred while duplicating room type.');
}
- if ($product->hasAttributes()) {
- Product::updateDefaultAttribute($product->id);
- } else {
- Product::duplicateSpecificPrices($id_product_old, $product->id);
- }
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
@@ -1336,10 +1365,10 @@ class AdminProductsControllerCore extends AdminController
$this->errors[] = Tools::displayError('You do not have permission to add this.');
}
}
- // Toggle Advance Payment
- elseif (Tools::getIsset('advance_payment'.$this->table)) {
+ // Toggle Show at front
+ elseif (Tools::getIsset('show_at_front'.$this->table)) {
if ($this->tabAccess['edit'] === '1') {
- $this->action = 'toggleAdvancePayment';
+ $this->action = 'toggleShowAtFront';
} else {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
@@ -1896,38 +1925,21 @@ class AdminProductsControllerCore extends AdminController
return $res;
}
- public function processToggleAdvancePayment()
+ public function processToggleShowAtFront()
{
- if (Configuration::get('WK_ALLOW_ADVANCED_PAYMENT')) {
- $this->loadObject(true);
- if (!Validate::isLoadedObject($this->object)) {
- return false;
- }
+ if (!$this->loadObject()) {
+ return false;
+ }
- if (!Product::isBookingProduct($this->object->id)) {
- return false;
- }
+ if (!Product::isBookingProduct($this->object->id)) {
+ return false;
+ }
- $objHotelAdvancedPayment = new HotelAdvancedPayment();
- $roomTypeAdvancePaymentInfo = $objHotelAdvancedPayment->getIdAdvPaymentByIdProduct($this->object->id);
- if ($roomTypeAdvancePaymentInfo) {
- $objHotelAdvancedPayment = new HotelAdvancedPayment($roomTypeAdvancePaymentInfo['id']);
- $objHotelAdvancedPayment->active = !$objHotelAdvancedPayment->active;
- } else {
- $objHotelAdvancedPayment->id_product = $this->object->id;
- $objHotelAdvancedPayment->payment_type = '';
- $objHotelAdvancedPayment->value = '';
- $objHotelAdvancedPayment->id_currency = '';
- $objHotelAdvancedPayment->tax_include = '';
- $objHotelAdvancedPayment->calculate_from = 0;
- $objHotelAdvancedPayment->active = 1;
- }
-
- if ($objHotelAdvancedPayment->save()) {
- Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4');
- } else {
- $this->errors[] = $this->l('Something went wrong while updating Advance payment status.');
- }
+ $this->object->show_at_front = !$this->object->show_at_front;
+ if ($this->object->save()) {
+ Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4');
+ } else {
+ $this->errors[] = $this->l('An error occurred while updating "show at front".');
}
}
@@ -2202,10 +2214,14 @@ class AdminProductsControllerCore extends AdminController
}
if (!$res) {
- $this->errors[] = sprintf(
- Tools::displayError('The %s field is invalid.'),
- call_user_func(array($className, 'displayFieldName'), $field, $className)
- );
+ if (Tools::strtolower($field) == 'wholesale_price') {
+ $this->errors[] = Tools::displayError('The Pre-tax operating cost field is invalid.');
+ } else {
+ $this->errors[] = sprintf(
+ Tools::displayError('The %s field is invalid.'),
+ call_user_func(array($className, 'displayFieldName'), $field, $className)
+ );
+ }
}
}
}
@@ -2459,7 +2475,7 @@ class AdminProductsControllerCore extends AdminController
$helper->title = $this->l('Occupied Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=occupied_rooms';
- $helper->tooltip = $this->l('The current count of rooms that are currently occupied by guests.', null, null, false);
+ $helper->tooltip = $this->l('The count of rooms that are currently occupied by guests.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2469,7 +2485,7 @@ class AdminProductsControllerCore extends AdminController
$helper->title = $this->l('Vacant Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=vacant_rooms';
- $helper->tooltip = $this->l('The count of rooms that are currently unoccupied and available for booking.', null, null, false);
+ $helper->tooltip = $this->l('The count of rooms that are either booked but currently unoccupied or available for booking', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2479,7 +2495,7 @@ class AdminProductsControllerCore extends AdminController
$helper->title = $this->l('Booked Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=booked_rooms';
- $helper->tooltip = $this->l('The number of rooms that are currently booked but not yet occupied.', null, null, false);
+ $helper->tooltip = $this->l('The total number of rooms that are currently booked and and awaiting guest check-in', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2489,7 +2505,7 @@ class AdminProductsControllerCore extends AdminController
$helper->title = $this->l('Disabled Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=disabled_rooms';
- $helper->tooltip = $this->l('The number of rooms that are currently disabled.', null, null, false);
+ $helper->tooltip = $this->l('The total number of rooms that are currently disabled.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2499,7 +2515,7 @@ class AdminProductsControllerCore extends AdminController
$helper->title = $this->l('Online Bookable Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=online_bookable_rooms';
- $helper->tooltip = $this->l('The total number of rooms that can be booked only using website.', null, null, false);
+ $helper->tooltip = $this->l('The total number of rooms that can be booked directly from the front office.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
@@ -2509,7 +2525,7 @@ class AdminProductsControllerCore extends AdminController
$helper->title = $this->l('Offline Bookable Rooms', null, null, false);
$helper->subtitle = $this->l('Today', null, null, false);
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=offline_bookable_rooms';
- $helper->tooltip = $this->l('The number of rooms that can be booked either through website or offline channels (e.g., phone or in-person).', null, null, false);
+ $helper->tooltip = $this->l('The total number of rooms available for booking through the back office.', null, null, false);
$kpis[] = $helper;
$helper = new HelperKpi();
diff --git a/controllers/admin/AdminSpecificPriceRuleController.php b/controllers/admin/AdminSpecificPriceRuleController.php
index 4694f46e3..783aced1d 100644
--- a/controllers/admin/AdminSpecificPriceRuleController.php
+++ b/controllers/admin/AdminSpecificPriceRuleController.php
@@ -172,6 +172,7 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
'name' => 'name',
'maxlength' => 32,
'required' => true,
+ 'col' => 3,
'hint' => $this->l('Forbidden characters').' <>;=#{}'
),
array(
@@ -222,8 +223,8 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
'name' => 'price',
'disabled' => ($this->object->price == -1 ? 1 : 0),
'maxlength' => 10,
- 'suffix' => $this->context->currency->getSign('right'),
-
+ 'suffix' => $this->context->currency->sign,
+ 'col' => 3,
),
array(
'type' => 'checkbox',
@@ -279,6 +280,7 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Reduction'),
'name' => 'reduction',
+ 'col' => 3,
'required' => true,
),
),
@@ -297,16 +299,12 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
);
$price = $this->getFieldValue($this->object, 'price');
- if ($price != -1 && Validate::isPrice($price)) {
- $price = number_format($price, 6);
- } else {
+ if ($price == -1 || !Validate::isPrice($price)) {
$price = '';
}
$reduction = $this->getFieldValue($this->object, 'reduction');
- if (Validate::isPrice($reduction)) {
- $reduction = number_format($reduction, 6);
- } else {
+ if (!Validate::isPrice($reduction)) {
$reduction = 0;
}
diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php
index 782f989f8..b2ef1e69b 100644
--- a/controllers/admin/AdminStatsController.php
+++ b/controllers/admin/AdminStatsController.php
@@ -573,20 +573,20 @@ class AdminStatsControllerCore extends AdminStatsTabController
{
$sql = 'SELECT p.`id_product`,
(
- SELECT IFNULL(SUM(ROUND((DATEDIFF(LEAST(hbd.`date_to`, "'.pSQL($dateTo).'"), GREATEST(hbd.`date_from`, "'.pSQL($dateFrom).'")) / DATEDIFF(hbd.`date_to`, hbd.`date_from`)) * hbd.`total_price_tax_excl`, 2)), 0)
+ SELECT count(hbd.`id_product`)
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
LEFT JOIN `'._DB_PREFIX_.'orders` o
ON (o.`id_order` = hbd.`id_order`)
WHERE hbd.`id_product` = p.`id_product` AND o.`valid` = 1
AND hbd.`date_to` > "'.pSQL($dateFrom).'" AND hbd.`date_from` < "'.pSQL($dateTo).'"
- ) AS totalRevenue
- FROM `'._DB_PREFIX_.'product` p
+ ) as total_booked FROM `'._DB_PREFIX_.'product` p
INNER JOIN `'._DB_PREFIX_.'htl_room_type` hrt
ON (hrt.`id_product` = p.`id_product`)
- WHERE p.`active` = 1 AND p.`booking_product` = 1'.
+ WHERE p.`active` = 1 AND p.`booking_product` = 1 '.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hrt') : '').'
- HAVING totalRevenue > 0
- ORDER BY totalRevenue DESC';
+ GROUP By p.`id_product`
+ HAVING total_booked > 0
+ ORDER BY total_booked DESC';
return Db::getInstance()->getValue($sql);
}
@@ -856,20 +856,36 @@ class AdminStatsControllerCore extends AdminStatsTabController
break;
case 'occupied_rooms':
- $value = AdminStatsController::getOccupiedRooms(0);
+ $value = AdminStatsController::getDistinctRoomBookingsCount(
+ date('Y-m-d', strtotime('-1 day')),
+ date('Y-m-d'),
+ 0,
+ HotelBookingDetail::STATUS_CHECKED_IN
+ );
break;
case 'vacant_rooms':
- $totalAvailableRooms = AdminStatsController::getAvailableRoomsForDiscreteDates(date('Y-m-d'), null, 0);
- $totalAvailableRooms = $totalAvailableRooms[strtotime(date('Y-m-d'))];
- $totalOccupiedRooms = AdminStatsController::getOccupiedRooms(0);
- $value = $totalAvailableRooms - $totalOccupiedRooms;
+ $totalUnAvailRooms = AdminStatsController::getDisabledRoomsForDiscreteDates(date('Y-m-d'), null, 0);
+ $totalUnAvailRooms = $totalUnAvailRooms[strtotime(date('Y-m-d'))];
+ $totalRooms = AdminStatsController::getTotalRooms(0);
+ $totalOccupiedRooms = AdminStatsController::getDistinctRoomBookingsCount(
+ date('Y-m-d', strtotime('-1 day')),
+ date('Y-m-d'),
+ 0,
+ HotelBookingDetail::STATUS_CHECKED_IN
+ );
+ $value = $totalRooms - ($totalUnAvailRooms + $totalOccupiedRooms);
break;
case 'booked_rooms':
- $value = AdminStatsController::getBookedRooms(0);
+ $value = AdminStatsController::getDistinctRoomBookingsCount(
+ date('Y-m-d'),
+ date('Y-m-d', strtotime('+1 day')),
+ 0,
+ HotelBookingDetail::STATUS_ALLOTED
+ );
break;
@@ -965,6 +981,12 @@ class AdminStatsControllerCore extends AdminStatsTabController
case 'average_lead_time':
$dateToday = date('Y-m-d');
$value = Tools::ps_round(AdminStatsController::getAverageLeadTime(), 2);
+ if ($value && $value <= 1) {
+ $value .= ' '.$this->l('day');
+ } else {
+ $value .= ' '.$this->l('days');
+ }
+
break;
case 'average_guest_in_booking':
$dateToday = date('Y-m-d');
@@ -1103,13 +1125,14 @@ class AdminStatsControllerCore extends AdminStatsTabController
);
}
- public static function getTotalRooms($idHotel = null)
+ public static function getTotalRooms($idHotel = null, $active = null)
{
$sql = 'SELECT COUNT(hri.`id`)
FROM `'._DB_PREFIX_.'htl_room_information` hri
INNER JOIN `'._DB_PREFIX_.'product` p
ON (p.`id_product` = hri.`id_product`)
WHERE p.`booking_product` = 1 '.
+ (!is_null($active) ? ' AND p.`active` ='.(int) $active : ' ').
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '');
return Db::getInstance()->getValue($sql);
@@ -1123,16 +1146,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
$occupancyData = array('count_total' => 0, 'count_occupied' => 0, 'count_available' => 0, 'count_unavailable' => 0);
- $countTotal = Db::getInstance()->getValue(
- 'SELECT COUNT(hri.`id`)
- FROM `'._DB_PREFIX_.'htl_room_information` hri
- INNER JOIN `'._DB_PREFIX_.'htl_branch_info` hbi
- ON (hbi.`id` = hri.`id_hotel`)
- LEFT JOIN `'._DB_PREFIX_.'product` p
- ON (p.`id_product` = hri.`id_product`)
- WHERE p.`active` = 1'.
- HotelBranchInformation::addHotelRestriction($idsHotel, 'hri')
- );
+ $countTotal = self::getTotalRooms($idsHotel, true);
$occupancyData['count_total'] = $countTotal;
// Occupied rooms are booked rooms that are not refunded in the date range
@@ -1417,7 +1431,27 @@ class AdminStatsControllerCore extends AdminStatsTabController
return $result;
}
- public static function getTotalOccupiedRooms($dateFrom, $dateTo, $idHotel = null)
+ public static function getDistinctRoomBookingsCount($dateFrom = false, $dateTo = false, $idHotel = null, $roomBookingStatus = null)
+ {
+ $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`)
+ FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
+ LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri
+ ON (hri.`id` = hbd.`id_room`)
+ LEFT JOIN `'._DB_PREFIX_.'product` p
+ ON (p.`id_product` = hri.`id_product`)
+ WHERE p.`active` = 1
+ AND hbd.`is_refunded` = 0
+ AND hbd.`is_cancelled` = 0 '.
+ (($dateFrom && $dateTo) ? ' AND hbd.`date_from` <= "'.pSQL($dateTo).' 00:00:00" AND hbd.`date_to` > "'.pSQL($dateFrom).' 00:00:00" ': ' ').
+ (!is_null($roomBookingStatus) ? ' AND hbd.`id_status` = '.(int) $roomBookingStatus : ' ').
+ (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
+ $result = Db::getInstance()->getValue($sql);
+
+ return $result ? $result : 0;
+
+ }
+
+ public static function getTotalBookedRooms($dateFrom, $dateTo, $idHotel = null)
{
$sql = 'SELECT COUNT(hbd.`id_room`)
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
@@ -1795,46 +1829,6 @@ class AdminStatsControllerCore extends AdminStatsTabController
return $result;
}
- /**
- * Returns the number of rooms that have been checked-in.
- */
- public static function getOccupiedRooms($idHotel = null)
- {
- $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`)
- FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
- LEFT JOIN `'._DB_PREFIX_.'htl_room_information` hri
- ON (hri.`id` = hbd.`id_room`)
- LEFT JOIN `'._DB_PREFIX_.'product` p
- ON (p.`id_product` = hri.`id_product`)
- WHERE p.`active` = 1
- AND hbd.`is_refunded` = 0
- AND hbd.`is_cancelled` = 0
- AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.
- (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
- $result = Db::getInstance()->getValue($sql);
-
- return $result;
- }
-
- /**
- * Returns the number of rooms that have been booked but not checked-in yet.
- */
- public static function getBookedRooms($idHotel = null)
- {
- $dateToday = date('Y-m-d');
-
- $sql = 'SELECT COUNT(DISTINCT hbd.`id_room`)
- FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
- WHERE hbd.`is_refunded` = 0
- AND hbd.`is_cancelled` = 0
- AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_ALLOTED.'
- AND hbd.`date_from` = "'.pSQL($dateToday).' 00:00:00"'.
- (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
- $result = Db::getInstance()->getValue($sql);
-
- return $result;
- }
-
public static function getTotalFrequentCustomers($nbOrders = 5, $idHotel = null)
{
$sql = 'SELECT COUNT(t.`id_customer`)
@@ -1891,7 +1885,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
public static function getTotalNewCustomers($nbDaysNewCustomers)
{
- $maxDateAdd = date('Y-m-d H:i:s', strtotime('-'.$nbDaysNewCustomers.' day'));
+ $maxDateAdd = date('Y-m-d', strtotime('-'.$nbDaysNewCustomers.' day'));
$sql = 'SELECT COUNT(c.`id_customer`)
FROM `'._DB_PREFIX_.'customer` c
WHERE c.`date_add` >= "'.pSQL($maxDateAdd).'" AND c.`deleted` = 0';
@@ -1976,7 +1970,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
$nightsBookedByDate = self::getRoomNightsData($dateFrom, $dateTo, $idHotel);
$totalNightsBooked = array_sum($nightsBookedByDate);
- $totalOccupiedRoom = self::getTotalOccupiedRooms($dateFrom, $dateTo, $idHotel);
+ $totalOccupiedRoom = self::getTotalBookedRooms($dateFrom, $dateTo, $idHotel);
return $totalOccupiedRoom ? ($totalNightsBooked / $totalOccupiedRoom) : 0;
}
diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php
index e10140b77..aadb4ee44 100644
--- a/controllers/admin/AdminStatusesController.php
+++ b/controllers/admin/AdminStatusesController.php
@@ -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),
diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php
index 0fc5f8efb..cd78e3395 100644
--- a/controllers/front/CategoryController.php
+++ b/controllers/front/CategoryController.php
@@ -101,16 +101,8 @@ class CategoryControllerCore extends FrontController
// validate dates if available
$dateFrom = Tools::getValue('date_from');
$dateTo = Tools::getValue('date_to');
-
- $currentTimestamp = strtotime(date('Y-m-d'));
- $dateFromTimestamp = strtotime($dateFrom);
- $dateToTimestamp = strtotime($dateTo);
-
- if ($dateFrom != '' && ($dateFromTimestamp === false || ($dateFromTimestamp < $currentTimestamp))) {
- Tools::redirect($this->context->link->getPageLink('pagenotfound'));
- }
-
- if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $currentTimestamp))) {
+ $idHotel = HotelBranchInformation::getHotelIdByIdCategory($id_category);
+ if (!HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
@@ -165,6 +157,16 @@ class CategoryControllerCore extends FrontController
$currency = new Currency($this->context->currency->id);
if ($id_hotel = HotelBranchInformation::getHotelIdByIdCategory($id_category)) {
+ $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($id_hotel);
+ if ($preparationTime
+ && strtotime('+ '.$preparationTime.' day') >= strtotime($date_from)
+ ) {
+ $date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day'));
+ if (strtotime($date_from) >= strtotime($date_to)) {
+ $date_to = date('Y-m-d', strtotime($date_from) + 86400);
+ }
+ }
+
$id_cart = $this->context->cart->id;
$id_guest = $this->context->cookie->id_guest;
diff --git a/controllers/front/CmsController.php b/controllers/front/CmsController.php
index 01a4726bb..c855df6b4 100644
--- a/controllers/front/CmsController.php
+++ b/controllers/front/CmsController.php
@@ -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');
diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php
index 8daa86948..5a65c9795 100644
--- a/controllers/front/ContactController.php
+++ b/controllers/front/ContactController.php
@@ -77,7 +77,7 @@ class ContactControllerCore extends FrontController
SELECT cm.id_customer_thread FROM '._DB_PREFIX_.'customer_thread cm
WHERE cm.id_customer_thread = '.(int)$id_customer_thread.' AND cm.id_shop = '.(int)$this->context->shop->id.' AND token = \''.pSQL(Tools::getValue('token')).'\'')
) || (
- $id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($from, $id_order)
+ $id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($from, $id_order, $id_contact)
))) {
$fields = Db::getInstance()->executeS('
SELECT cm.id_customer_thread, cm.id_contact, cm.id_customer, cm.id_order, cm.id_product, cm.email
@@ -308,6 +308,7 @@ class ContactControllerCore extends FrontController
$this->context->smarty->assign(
array(
'hotelsInfo' => $hotelsInfo,
+ 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
'gblHtlPhone' => $gblHtlPhone,
'gblHtlEmail' => $gblHtlEmail,
'gblHtlAddress' => $gblHtlAddress,
diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php
index 6a097dbc2..79ec067c2 100644
--- a/controllers/front/GuestTrackingController.php
+++ b/controllers/front/GuestTrackingController.php
@@ -614,7 +614,9 @@ class GuestTrackingControllerCore extends FrontController
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($objOrder->id)) {
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
if (Validate::isLoadedObject($objHotelBranchInformation)) {
- if ($apiKey = Configuration::get('PS_API_KEY')) {
+ if (($apiKey = Configuration::get('PS_API_KEY'))
+ && Configuration::get('WK_GOOGLE_ACTIVE_MAP')
+ ) {
if (floatval($objHotelBranchInformation->latitude) != 0
&& floatval($objHotelBranchInformation->longitude) != 0
) {
diff --git a/controllers/front/OrderConfirmationController.php b/controllers/front/OrderConfirmationController.php
index 8c63c8907..a60326859 100644
--- a/controllers/front/OrderConfirmationController.php
+++ b/controllers/front/OrderConfirmationController.php
@@ -175,6 +175,7 @@ class OrderConfirmationControllerCore extends FrontController
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($idOrder, $customer->id_guest, $type_value['product_id']);
}
if ($rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id'])) {
+ $cart_htl_data[$type_key]['id_order'] = $idOrder;
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
$cart_htl_data[$type_key]['adults'] = $rm_dtl['adults'];
@@ -366,9 +367,6 @@ class OrderConfirmationControllerCore extends FrontController
}
}
- if (!empty($cart_htl_data)) {
- $this->context->smarty->assign('cart_htl_data', $cart_htl_data);
- }
if (!empty($cart_service_products)) {
$this->context->smarty->assign('cart_service_products', $cart_service_products);
}
@@ -399,6 +397,10 @@ class OrderConfirmationControllerCore extends FrontController
$this->context->smarty->assign('orders_has_invoice', $orders_has_invoice);
}
+ if (!empty($cart_htl_data)) {
+ $this->context->smarty->assign('cart_htl_data', $cart_htl_data);
+ }
+
$shw_bo_msg = Configuration::get('WK_SHOW_MSG_ON_BO');
$bo_msg = Configuration::get('WK_BO_MESSAGE');
$this->context->smarty->assign(
@@ -469,6 +471,8 @@ class OrderConfirmationControllerCore extends FrontController
parent::setMedia();
$this->addCSS(_THEME_CSS_DIR_.'history.css');
$this->addJS(_THEME_JS_DIR_.'history.js');
+ $this->addJS(_THEME_JS_DIR_.'order-confirmation.js');
+ $this->addCSS(_THEME_CSS_DIR_.'order-confirmation.css');
$this->addJqueryPlugin(array('fancybox')); //fancybox not found for some client theme
$this->addJqueryUI('ui.tooltip', 'base', true);
}
diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php
index 6bebed805..d7b3d9ca7 100644
--- a/controllers/front/OrderDetailController.php
+++ b/controllers/front/OrderDetailController.php
@@ -423,6 +423,7 @@ class OrderDetailControllerCore extends FrontController
'obj_hotel_branch_information' => $objHotelBranchInformation,
'hotel_address_info' => $hotelAddressInfo,
'hotel_refund_rules' => $hotelRefundRules,
+ 'view_on_map' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
)
);
@@ -797,7 +798,9 @@ class OrderDetailControllerCore extends FrontController
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder(Tools::getValue('id_order'))) {
$objHotelBranchInformation = new HotelBranchInformation($idHotel, $this->context->language->id);
if (Validate::isLoadedObject($objHotelBranchInformation)) {
- if ($apiKey = Configuration::get('PS_API_KEY')) {
+ if (($apiKey = Configuration::get('PS_API_KEY'))
+ && Configuration::get('WK_GOOGLE_ACTIVE_MAP')
+ ) {
if (floatval($objHotelBranchInformation->latitude) != 0
&& floatval($objHotelBranchInformation->longitude) != 0
) {
diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php
index feed31828..ee809dc2f 100644
--- a/controllers/front/OrderOpcController.php
+++ b/controllers/front/OrderOpcController.php
@@ -426,7 +426,9 @@ class OrderOpcControllerCore extends ParentOrderController
public function initContent()
{
// validate room types before payment by customer
- $this->errors = HotelCartBookingData::validateCartBookings();
+ if ($orderRestrictErr = HotelCartBookingData::validateCartBookings()) {
+ $this->errors = array_merge($this->errors, $orderRestrictErr);
+ }
parent::initContent();
@@ -494,7 +496,7 @@ class OrderOpcControllerCore extends ParentOrderController
// $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$this->context->smarty->assign(
array(
- 'orderRestrictErr' => count($this->errors) ? 1 : 0,
+ 'orderRestrictErr' => count($orderRestrictErr) ? 1 : 0,
// 'allDemands' => $allDemands,
// 'defaultcurrencySign' => $objCurrency->sign,
'THEME_DIR' => _THEME_DIR_,
diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php
index 1028ae6e0..ac7a4b8a4 100644
--- a/controllers/front/ProductController.php
+++ b/controllers/front/ProductController.php
@@ -109,26 +109,18 @@ class ProductControllerCore extends FrontController
// validate dates if available
$dateFrom = Tools::getValue('date_from');
$dateTo = Tools::getValue('date_to');
-
- $currentTimestamp = strtotime(date('Y-m-d'));
- $dateFromTimestamp = strtotime($dateFrom);
- $dateToTimestamp = strtotime($dateTo);
-
- if ($dateFrom != '' && ($dateFromTimestamp === false || ($dateFromTimestamp < $currentTimestamp))) {
- Tools::redirect($this->context->link->getPageLink('pagenotfound'));
- }
-
- if ($dateTo != '' && ($dateToTimestamp === false || ($dateToTimestamp < $currentTimestamp))) {
- Tools::redirect($this->context->link->getPageLink('pagenotfound'));
- }
-
parent::init();
if ($id_product = (int) Tools::getValue('id_product')) {
$this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
}
- if (!$this->product->booking_product || ($this->product->booking_product && !$this->product->show_at_front)) {
+ $objHotelRoomType = new HotelRoomType();
+ $hotelRoomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($this->product->id);
+ $idHotel = (int) $hotelRoomInfo['id_hotel'];
+ if (!HotelHelper::validateDateRangeForHotel($dateFrom, $dateTo, $idHotel)) {
+ Tools::redirect($this->context->link->getPageLink('pagenotfound'));
+ } else if (!$this->product->booking_product || ($this->product->booking_product && !$this->product->show_at_front)) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
@@ -341,6 +333,7 @@ class ProductControllerCore extends FrontController
$date_from = Tools::getValue('date_from');
$date_to = Tools::getValue('date_to');
+ $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id);
if (!($date_from = Tools::getValue('date_from'))) {
$date_from = date('Y-m-d');
// set date to according to los
@@ -355,6 +348,17 @@ class ProductControllerCore extends FrontController
$date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
}
+ if ($preparationTime
+ && strtotime('+ '.$preparationTime.' day') >= strtotime($date_from)
+ ) {
+ $date_from = date('Y-m-d', strtotime('+ '.$preparationTime.' day'));
+ if (strtotime($date_from) >= strtotime($date_to)) {
+ $objHotelRoomTypeRestrictionDateRange = new HotelRoomTypeRestrictionDateRange();
+ $los = $objHotelRoomTypeRestrictionDateRange->getRoomTypeLengthOfStay($this->product->id, $date_from);
+ $date_to = date('Y-m-d', strtotime('+'.$los['min_los'].' day', strtotime($date_from)));
+ }
+ }
+
$hotel_branch_obj = new HotelBranchInformation($hotel_id);
/*Max date of ordering for order restrict*/
$order_date_restrict = false;
@@ -368,9 +372,6 @@ class ProductControllerCore extends FrontController
}
}
/*End*/
- // booking preparation time
- $preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_id);
-
$objHotelImage = new HotelImage();
$hotelImageLink = null;
if ($coverImage = HotelImage::getCover($hotel_id)) {
diff --git a/docs/.htaccess b/docs/.htaccess
index 8703119f9..3de9e4008 100644
--- a/docs/.htaccess
+++ b/docs/.htaccess
@@ -1 +1,10 @@
-Deny from ALL
+# Apache 2.2
+
+ Order deny,allow
+ Deny from all
+
+
+# Apache 2.4
+
+ Require all denied
+
diff --git a/docs/csv_import/.htaccess b/docs/csv_import/.htaccess
index 18aba5838..041b7e558 100644
--- a/docs/csv_import/.htaccess
+++ b/docs/csv_import/.htaccess
@@ -1 +1,10 @@
-Allow from ALL
\ No newline at end of file
+# Apache 2.2
+
+ Order allow,deny
+ Allow from ALL
+
+
+# Apache 2.4
+
+ Require all granted
+
diff --git a/download/.htaccess b/download/.htaccess
index 93169e4eb..3de9e4008 100644
--- a/download/.htaccess
+++ b/download/.htaccess
@@ -1,2 +1,10 @@
-Order deny,allow
-Deny from all
+# Apache 2.2
+
+ Order deny,allow
+ Deny from all
+
+
+# Apache 2.4
+
+ Require all denied
+
diff --git a/img/.htaccess b/img/.htaccess
new file mode 100644
index 000000000..b892de715
--- /dev/null
+++ b/img/.htaccess
@@ -0,0 +1,16 @@
+# Apache 2.2
+
+ Order deny,allow
+ Deny from all
+
+ Allow from all
+
+
+
+# Apache 2.4
+
+ Require all denied
+
+ Require all granted
+
+
\ No newline at end of file
diff --git a/img/cms/.htaccess b/img/cms/.htaccess
deleted file mode 100644
index 91920ed0a..000000000
--- a/img/cms/.htaccess
+++ /dev/null
@@ -1,8 +0,0 @@
-
- php_flag engine off
-
-deny from all
-
- order deny,allow
- allow from all
-
diff --git a/img/hotel_header_image.jpg b/img/hotel_header_image.jpg
index ce7f91454..fbb6d003d 100644
Binary files a/img/hotel_header_image.jpg and b/img/hotel_header_image.jpg differ
diff --git a/install/langs/cs/data/meta.xml b/install/langs/cs/data/meta.xml
index 8aea57f69..fee7a64b4 100644
--- a/install/langs/cs/data/meta.xml
+++ b/install/langs/cs/data/meta.xml
@@ -145,10 +145,10 @@
prodejny
-
Objednávka
+
Rychlá Objednávka
-
objednavka
+
rychla-objednavka
Sledování objednávky návštěvníka
diff --git a/js/admin/customers.js b/js/admin/customers.js
new file mode 100644
index 000000000..5eaa94c7d
--- /dev/null
+++ b/js/admin/customers.js
@@ -0,0 +1,51 @@
+/*
+* Copyright since 2010 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
+* @copyright Since 2010 Webkul IN
+* @license https://store.webkul.com/license.html
+*/
+
+$(document).ready(function() {
+ $(document).on('focusout', '#email', function() {
+ var email = $.trim($('#email').val());
+ if (email != '') {
+ $('.customer_email_msg').hide();
+ $.ajax({
+ url: customer_controller_url,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ ajax : 1,
+ id_customer: id_customer,
+ email: email,
+ action: 'verifyCustomerEmail'
+ },
+ success: function(response) {
+ if (!response.status) {
+ if ($('#email').closest('.input-group').parent().find('.customer_email_msg').length) {
+ $('.customer_email_msg').text(response.msg);
+ } else {
+ $('#email').closest('.input-group').parent().append(''+ response.msg+'
');
+ }
+
+ $('.customer_email_msg').show();
+ } else {
+ $('.customer_email_msg').hide();
+ }
+ }
+ });
+ }
+ });
+});
diff --git a/js/admin/price.js b/js/admin/price.js
index 0097696d0..977499823 100644
--- a/js/admin/price.js
+++ b/js/admin/price.js
@@ -123,15 +123,12 @@ function calcPrice()
function calcPriceTI()
{
- var priceTE = parseFloat(document.getElementById('priceTEReal').value.replace(/,/g, '.'));
+ var priceTE = parseFloat($('#priceTEReal').val().replace(/,/g, '.'));
var newPrice = addTaxes(priceTE);
- document.getElementById('priceTI').value = (isNaN(newPrice) == true || newPrice < 0) ? '' :
- ps_round(newPrice, priceDisplayPrecision);
- document.getElementById('finalPrice').innerHTML = (isNaN(newPrice) == true || newPrice < 0) ? '' :
- ps_round(newPrice, priceDisplayPrecision).toFixed(priceDisplayPrecision);
- document.getElementById('finalPriceWithoutTax').innerHTML = (isNaN(priceTE) == true || priceTE < 0) ? '' :
- (ps_round(priceTE, 6)).toFixed(6);
+ $('#priceTI').val((isNaN(newPrice) == true || newPrice < 0) ? '' : ps_round(newPrice, priceDisplayPrecision));
+ $('#finalPrice').html((isNaN(newPrice) == true || newPrice < 0) ? '' : ps_round(newPrice, priceDisplayPrecision).toFixed(priceDisplayPrecision));
+ $('#finalPriceWithoutTax').html((isNaN(priceTE) == true || priceTE < 0) ? '' : (ps_round(priceTE, 6)).toFixed(6));
calcReduction();
if (isNaN(parseFloat($('#priceTI').val())))
@@ -149,15 +146,13 @@ function calcPriceTI()
function calcPriceTE()
{
ecotax_tax_excl = $('#ecotax').val() / (1 + ecotaxTaxRate);
- var priceTI = parseFloat(document.getElementById('priceTI').value.replace(/,/g, '.'));
+ var priceTI = parseFloat($('#priceTI').val().replace(/,/g, '.'));
var newPrice = removeTaxes(ps_round(priceTI - getEcotaxTaxIncluded(), priceDisplayPrecision));
- document.getElementById('priceTE').value = (isNaN(newPrice) == true || newPrice < 0) ? '' :
- ps_round(newPrice, 6).toFixed(6);
- document.getElementById('priceTEReal').value = (isNaN(newPrice) == true || newPrice < 0) ? 0 : ps_round(newPrice, 9);
- document.getElementById('finalPrice').innerHTML = (isNaN(newPrice) == true || newPrice < 0) ? '' :
- ps_round(priceTI, priceDisplayPrecision).toFixed(priceDisplayPrecision);
- document.getElementById('finalPriceWithoutTax').innerHTML = (isNaN(newPrice) == true || newPrice < 0) ? '' :
- (ps_round(newPrice, 6)).toFixed(6);
+
+ $('#priceTE').val((isNaN(newPrice) == true || newPrice < 0) ? '' : ps_round(newPrice, 6).toFixed(6));
+ $('#priceTEReal').val((isNaN(newPrice) == true || newPrice < 0) ? 0 : ps_round(newPrice, 9));
+ $('#finalPrice').html((isNaN(newPrice) == true || newPrice < 0) ? '' : ps_round(priceTI, priceDisplayPrecision).toFixed(priceDisplayPrecision));
+ $('#finalPriceWithoutTax').html((isNaN(newPrice) == true || newPrice < 0) ? '' : (ps_round(newPrice, 6)).toFixed(6));
calcReduction();
}
diff --git a/js/daterangepicker/jquery.daterangepicker.js b/js/daterangepicker/jquery.daterangepicker.js
index e9338be38..6115348dc 100755
--- a/js/daterangepicker/jquery.daterangepicker.js
+++ b/js/daterangepicker/jquery.daterangepicker.js
@@ -2597,7 +2597,7 @@
if (opt.endDate && compare_month(nextMonth(defaultTime), opt.endDate) > 0) defaultTime = prevMonth(moment(opt.endDate).toDate());
}
- if (opt.singleDate) {
+ if (opt.singleDate || opt.singleMonth) {
if (opt.startDate && compare_month(defaultTime, opt.startDate) < 0) defaultTime = moment(opt.startDate).toDate();
if (opt.endDate && compare_month(defaultTime, opt.endDate) > 0) defaultTime = moment(opt.endDate).toDate();
}
diff --git a/js/daterangepicker/jquery.daterangepicker.min.js b/js/daterangepicker/jquery.daterangepicker.min.js
index 508ddcce6..4c7a27afd 100755
--- a/js/daterangepicker/jquery.daterangepicker.min.js
+++ b/js/daterangepicker/jquery.daterangepicker.min.js
@@ -4,4 +4,4 @@
* @link https://github.com/longbill/jquery-date-range-picker
* @license MIT
*/
-!function(e){"function"==typeof define&&define.amd?define(["jquery","moment"],e):"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery"),require("moment")):e(jQuery,moment)}(function(U,Q){"use strict";U.dateRangePickerLanguages={default:{selected:"Selected:",day:"Day",days:"Days",apply:"Close","week-1":"mo","week-2":"tu","week-3":"we","week-4":"th","week-5":"fr","week-6":"sa","week-7":"su","week-number":"W","month-name":["january","february","march","april","may","june","july","august","september","october","november","december"],shortcuts:"Shortcuts","custom-values":"Custom Values",past:"Past",following:"Following",previous:"Previous","prev-week":"Week","prev-month":"Month","prev-year":"Year",next:"Next","next-week":"Week","next-month":"Month","next-year":"Year","less-than":"Date range should not be more than %d days","more-than":"Date range should not be less than %d days","default-more":"Please select a date range longer than %d days","default-single":"Please select a date","default-less":"Please select a date range less than %d days","default-range":"Please select a date range between %d and %d days","default-default":"Please select a date range",time:"Time",hour:"Hour",minute:"Minute"},id:{selected:"Terpilih:",day:"Hari",days:"Hari",apply:"Tutup","week-1":"sen","week-2":"sel","week-3":"rab","week-4":"kam","week-5":"jum","week-6":"sab","week-7":"min","week-number":"W","month-name":["januari","februari","maret","april","mei","juni","juli","agustus","september","oktober","november","desember"],shortcuts:"Pintas","custom-values":"Nilai yang ditentukan",past:"Yang Lalu",following:"Mengikuti",previous:"Sebelumnya","prev-week":"Minggu","prev-month":"Bulan","prev-year":"Tahun",next:"Selanjutnya","next-week":"Minggu","next-month":"Bulan","next-year":"Tahun","less-than":"Tanggal harus lebih dari %d hari","more-than":"Tanggal harus kurang dari %d hari","default-more":"Jarak tanggal harus lebih lama dari %d hari","default-single":"Silakan pilih tanggal","default-less":"Jarak rentang tanggal tidak boleh lebih lama dari %d hari","default-range":"Rentang tanggal harus antara %d dan %d hari","default-default":"Silakan pilih rentang tanggal",time:"Waktu",hour:"Jam",minute:"Menit"},az:{selected:"Seçildi:",day:" gün",days:" gün",apply:"tətbiq","week-1":"1","week-2":"2","week-3":"3","week-4":"4","week-5":"5","week-6":"6","week-7":"7","month-name":["yanvar","fevral","mart","aprel","may","iyun","iyul","avqust","sentyabr","oktyabr","noyabr","dekabr"],shortcuts:"Qısayollar",past:"Keçmiş",following:"Növbəti",previous:" ","prev-week":"Öncəki həftə","prev-month":"Öncəki ay","prev-year":"Öncəki il",next:" ","next-week":"Növbəti həftə","next-month":"Növbəti ay","next-year":"Növbəti il","less-than":"Tarix aralığı %d gündən çox olmamalıdır","more-than":"Tarix aralığı %d gündən az olmamalıdır","default-more":"%d gündən çox bir tarix seçin","default-single":"Tarix seçin","default-less":"%d gündən az bir tarix seçin","default-range":"%d və %d gün aralığında tarixlər seçin","default-default":"Tarix aralığı seçin"},bg:{selected:"Избрано:",day:"Ден",days:"Дни",apply:"Затвори","week-1":"пн","week-2":"вт","week-3":"ср","week-4":"чт","week-5":"пт","week-6":"сб","week-7":"нд","week-number":"С","month-name":["януари","февруари","март","април","май","юни","юли","август","септември","октомври","ноември","декември"],shortcuts:"Преки пътища","custom-values":"Персонализирани стойности",past:"Минал",following:"Следващ",previous:"Предишен","prev-week":"Седмица","prev-month":"Месец","prev-year":"Година",next:"Следващ","next-week":"Седмица","next-month":"Месец","next-year":"Година","less-than":"Периодът от време не трябва да е повече от %d дни","more-than":"Периодът от време не трябва да е по-малко от %d дни","default-more":"Моля изберете период по-дълъг от %d дни","default-single":"Моля изберете дата","default-less":"Моля изберете период по-къс от %d дни","default-range":"Моля изберете период между %d и %d дни","default-default":"Моля изберете период",time:"Време",hour:"Час",minute:"Минута"},cn:{selected:"已选择:",day:"天",days:"天",apply:"确定","week-1":"一","week-2":"二","week-3":"三","week-4":"四","week-5":"五","week-6":"六","week-7":"日","week-number":"周","month-name":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],shortcuts:"快捷选择",past:"过去",following:"将来",previous:" ","prev-week":"上周","prev-month":"上个月","prev-year":"去年",next:" ","next-week":"下周","next-month":"下个月","next-year":"明年","less-than":"所选日期范围不能大于%d天","more-than":"所选日期范围不能小于%d天","default-more":"请选择大于%d天的日期范围","default-less":"请选择小于%d天的日期范围","default-range":"请选择%d天到%d天的日期范围","default-single":"请选择一个日期","default-default":"请选择一个日期范围",time:"时间",hour:"小时",minute:"分钟"},cz:{selected:"Vybráno:",day:"Den",days:"Dny",apply:"Zavřít","week-1":"po","week-2":"út","week-3":"st","week-4":"čt","week-5":"pá","week-6":"so","week-7":"ne","month-name":["leden","únor","březen","duben","květen","červen","červenec","srpen","září","říjen","listopad","prosinec"],shortcuts:"Zkratky",past:"po",following:"následující",previous:"předchozí","prev-week":"týden","prev-month":"měsíc","prev-year":"rok",next:"další","next-week":"týden","next-month":"měsíc","next-year":"rok","less-than":"Rozsah data by neměl být větší než %d dnů","more-than":"Rozsah data by neměl být menší než %d dnů","default-more":"Prosím zvolte rozsah data větší než %d dnů","default-single":"Prosím zvolte datum","default-less":"Prosím zvolte rozsah data menší než %d dnů","default-range":"Prosím zvolte rozsah data mezi %d a %d dny","default-default":"Prosím zvolte rozsah data"},de:{selected:"Auswahl:",day:"Tag",days:"Tage",apply:"Schließen","week-1":"mo","week-2":"di","week-3":"mi","week-4":"do","week-5":"fr","week-6":"sa","week-7":"so","month-name":["januar","februar","märz","april","mai","juni","juli","august","september","oktober","november","dezember"],shortcuts:"Schnellwahl",past:"Vorherige",following:"Folgende",previous:"Vorherige","prev-week":"Woche","prev-month":"Monat","prev-year":"Jahr",next:"Nächste","next-week":"Woche","next-month":"Monat","next-year":"Jahr","less-than":"Datumsbereich darf nicht größer sein als %d Tage","more-than":"Datumsbereich darf nicht kleiner sein als %d Tage","default-more":"Bitte mindestens %d Tage auswählen","default-single":"Bitte ein Datum auswählen","default-less":"Bitte weniger als %d Tage auswählen","default-range":"Bitte einen Datumsbereich zwischen %d und %d Tagen auswählen","default-default":"Bitte ein Start- und Enddatum auswählen",Time:"Zeit",hour:"Stunde",minute:"Minute"},es:{selected:"Seleccionado:",day:"Día",days:"Días",apply:"Cerrar","week-1":"lu","week-2":"ma","week-3":"mi","week-4":"ju","week-5":"vi","week-6":"sa","week-7":"do","month-name":["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],shortcuts:"Accesos directos",past:"Pasado",following:"Siguiente",previous:"Anterior","prev-week":"Semana","prev-month":"Mes","prev-year":"Año",next:"Siguiente","next-week":"Semana","next-month":"Mes","next-year":"Año","less-than":"El rango no debería ser mayor de %d días","more-than":"El rango no debería ser menor de %d días","default-more":"Por favor selecciona un rango mayor a %d días","default-single":"Por favor selecciona un día","default-less":"Por favor selecciona un rango menor a %d días","default-range":"Por favor selecciona un rango entre %d y %d días","default-default":"Por favor selecciona un rango de fechas."},fr:{selected:"Sélection:",day:"Jour",days:"Jours",apply:"Fermer","week-1":"lu","week-2":"ma","week-3":"me","week-4":"je","week-5":"ve","week-6":"sa","week-7":"di","month-name":["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],shortcuts:"Raccourcis",past:"Passé",following:"Suivant",previous:"Précédent","prev-week":"Semaine","prev-month":"Mois","prev-year":"Année",next:"Suivant","next-week":"Semaine","next-month":"Mois","next-year":"Année","less-than":"L'intervalle ne doit pas être supérieure à %d jours","more-than":"L'intervalle ne doit pas être inférieure à %d jours","default-more":"Merci de choisir une intervalle supérieure à %d jours","default-single":"Merci de choisir une date","default-less":"Merci de choisir une intervalle inférieure %d jours","default-range":"Merci de choisir une intervalle comprise entre %d et %d jours","default-default":"Merci de choisir une date"},hu:{selected:"Kiválasztva:",day:"Nap",days:"Nap",apply:"Ok","week-1":"h","week-2":"k","week-3":"sz","week-4":"cs","week-5":"p","week-6":"sz","week-7":"v","month-name":["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],shortcuts:"Gyorsválasztó",past:"Múlt",following:"Következő",previous:"Előző","prev-week":"Hét","prev-month":"Hónap","prev-year":"Év",next:"Következő","next-week":"Hét","next-month":"Hónap","next-year":"Év","less-than":"A kiválasztás nem lehet több %d napnál","more-than":"A kiválasztás nem lehet több %d napnál","default-more":"Válassz ki egy időszakot ami hosszabb mint %d nap","default-single":"Válassz egy napot","default-less":"Válassz ki egy időszakot ami rövidebb mint %d nap","default-range":"Válassz ki egy %d - %d nap hosszú időszakot","default-default":"Válassz ki egy időszakot"},it:{selected:"Selezionati:",day:"Giorno",days:"Giorni",apply:"Chiudi","week-1":"lu","week-2":"ma","week-3":"me","week-4":"gi","week-5":"ve","week-6":"sa","week-7":"do","month-name":["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],shortcuts:"Scorciatoie",past:"Scorso",following:"Successivo",previous:"Precedente","prev-week":"Settimana","prev-month":"Mese","prev-year":"Anno",next:"Prossimo","next-week":"Settimana","next-month":"Mese","next-year":"Anno","less-than":"L'intervallo non dev'essere maggiore di %d giorni","more-than":"L'intervallo non dev'essere minore di %d giorni","default-more":"Seleziona un intervallo maggiore di %d giorni","default-single":"Seleziona una data","default-less":"Seleziona un intervallo minore di %d giorni","default-range":"Seleziona un intervallo compreso tra i %d e i %d giorni","default-default":"Seleziona un intervallo di date"},ko:{selected:"기간:",day:"일",days:"일간",apply:"닫기","week-1":"월","week-2":"화","week-3":"수","week-4":"목","week-5":"금","week-6":"토","week-7":"일","week-number":"주","month-name":["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],shortcuts:"단축키들",past:"지난(오늘기준)",following:"이후(오늘기준)",previous:"이전","prev-week":"1주","prev-month":"1달","prev-year":"1년",next:"다음","next-week":"1주","next-month":"1달","next-year":"1년","less-than":"날짜 범위는 %d 일보다 많을 수 없습니다","more-than":"날짜 범위는 %d 일보다 작을 수 없습니다","default-more":"날짜 범위를 %d 일보다 길게 선택해 주세요","default-single":"날짜를 선택해 주세요","default-less":"%d 일보다 작은 날짜를 선택해 주세요","default-range":"%d와 %d 일 사이의 날짜 범위를 선택해 주세요","default-default":"날짜 범위를 선택해 주세요",time:"시각",hour:"시",minute:"분"},no:{selected:"Valgt:",day:"Dag",days:"Dager",apply:"Lukk","week-1":"ma","week-2":"ti","week-3":"on","week-4":"to","week-5":"fr","week-6":"lø","week-7":"sø","month-name":["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],shortcuts:"Snarveier","custom-values":"Egendefinerte Verdier",past:"Over",following:"Følger",previous:"Forrige","prev-week":"Uke","prev-month":"Måned","prev-year":"År",next:"Neste","next-week":"Uke","next-month":"Måned","next-year":"År","less-than":"Datoperioden skal ikkje være lengre enn %d dager","more-than":"Datoperioden skal ikkje være kortere enn %d dager","default-more":"Vennligst velg ein datoperiode lengre enn %d dager","default-single":"Vennligst velg ein dato","default-less":"Vennligst velg ein datoperiode mindre enn %d dager","default-range":"Vennligst velg ein datoperiode mellom %d og %d dager","default-default":"Vennligst velg ein datoperiode",time:"Tid",hour:"Time",minute:"Minutter"},nl:{selected:"Geselecteerd:",day:"Dag",days:"Dagen",apply:"Ok","week-1":"ma","week-2":"di","week-3":"wo","week-4":"do","week-5":"vr","week-6":"za","week-7":"zo","month-name":["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],shortcuts:"Snelkoppelingen","custom-values":"Aangepaste waarden",past:"Verleden",following:"Komend",previous:"Vorige","prev-week":"Week","prev-month":"Maand","prev-year":"Jaar",next:"Volgende","next-week":"Week","next-month":"Maand","next-year":"Jaar","less-than":"Interval moet langer dan %d dagen zijn","more-than":"Interval mag niet minder dan %d dagen zijn","default-more":"Selecteer een interval langer dan %dagen","default-single":"Selecteer een datum","default-less":"Selecteer een interval minder dan %d dagen","default-range":"Selecteer een interval tussen %d en %d dagen","default-default":"Selecteer een interval",time:"Tijd",hour:"Uur",minute:"Minuut"},ru:{selected:"Выбрано:",day:"День",days:"Дней",apply:"Применить","week-1":"пн","week-2":"вт","week-3":"ср","week-4":"чт","week-5":"пт","week-6":"сб","week-7":"вс","month-name":["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"],shortcuts:"Быстрый выбор","custom-values":"Пользовательские значения",past:"Прошедшие",following:"Следующие",previous:" ","prev-week":"Неделя","prev-month":"Месяц","prev-year":"Год",next:" ","next-week":"Неделя","next-month":"Месяц","next-year":"Год","less-than":"Диапазон не может быть больше %d дней","more-than":"Диапазон не может быть меньше %d дней","default-more":"Пожалуйста выберите диапазон больше %d дней","default-single":"Пожалуйста выберите дату","default-less":"Пожалуйста выберите диапазон меньше %d дней","default-range":"Пожалуйста выберите диапазон между %d и %d днями","default-default":"Пожалуйста выберите диапазон",time:"Время",hour:"Часы",minute:"Минуты"},uk:{selected:"Вибрано:",day:"День",days:"Днів",apply:"Застосувати","week-1":"пн","week-2":"вт","week-3":"ср","week-4":"чт","week-5":"пт","week-6":"сб","week-7":"нд","month-name":["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],shortcuts:"Швидкий вибір","custom-values":"Значення користувача",past:"Минулі",following:"Наступні",previous:" ","prev-week":"Тиждень","prev-month":"Місяць","prev-year":"Рік",next:" ","next-week":"Тиждень","next-month":"Місяць","next-year":"Рік","less-than":"Діапазон не може бути більш ніж %d днів","more-than":"Діапазон не може бути меньш ніж %d днів","default-more":"Будь ласка виберіть діапазон більше %d днів","default-single":"Будь ласка виберіть дату","default-less":"Будь ласка виберіть діапазон менше %d днів","default-range":"Будь ласка виберіть діапазон між %d та %d днями","default-default":"Будь ласка виберіть діапазон",time:"Час",hour:"Години",minute:"Хвилини"},pl:{selected:"Wybrany:",day:"Dzień",days:"Dni",apply:"Zamknij","week-1":"pon","week-2":"wt","week-3":"śr","week-4":"czw","week-5":"pt","week-6":"so","week-7":"nd","month-name":["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"],shortcuts:"Skróty","custom-values":"Niestandardowe wartości",past:"Przeszłe",following:"Następne",previous:"Poprzednie","prev-week":"tydzień","prev-month":"miesiąc","prev-year":"rok",next:"Następny","next-week":"tydzień","next-month":"miesiąc","next-year":"rok","less-than":"Okres nie powinien być dłuższy niż %d dni","more-than":"Okres nie powinien być krótszy niż %d ni","default-more":"Wybierz okres dłuższy niż %d dni","default-single":"Wybierz datę","default-less":"Wybierz okres krótszy niż %d dni","default-range":"Wybierz okres trwający od %d do %d dni","default-default":"Wybierz okres",time:"Czas",hour:"Godzina",minute:"Minuta"},se:{selected:"Vald:",day:"dag",days:"dagar",apply:"godkänn","week-1":"ma","week-2":"ti","week-3":"on","week-4":"to","week-5":"fr","week-6":"lö","week-7":"sö","month-name":["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],shortcuts:"genvägar","custom-values":"Anpassade värden",past:"över",following:"följande",previous:"förra","prev-week":"vecka","prev-month":"månad","prev-year":"år",next:"nästa","next-week":"vecka","next-month":"måned","next-year":"år","less-than":"Datumintervall bör inte vara mindre än %d dagar","more-than":"Datumintervall bör inte vara mer än %d dagar","default-more":"Välj ett datumintervall längre än %d dagar","default-single":"Välj ett datum","default-less":"Välj ett datumintervall mindre än %d dagar","default-range":"Välj ett datumintervall mellan %d och %d dagar","default-default":"Välj ett datumintervall",time:"tid",hour:"timme",minute:"minut"},pt:{selected:"Selecionado:",day:"Dia",days:"Dias",apply:"Fechar","week-1":"seg","week-2":"ter","week-3":"qua","week-4":"qui","week-5":"sex","week-6":"sab","week-7":"dom","week-number":"N","month-name":["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],shortcuts:"Atalhos","custom-values":"Valores Personalizados",past:"Passado",following:"Seguinte",previous:"Anterior","prev-week":"Semana","prev-month":"Mês","prev-year":"Ano",next:"Próximo","next-week":"Próxima Semana","next-month":"Próximo Mês","next-year":"Próximo Ano","less-than":"O período selecionado não deve ser maior que %d dias","more-than":"O período selecionado não deve ser menor que %d dias","default-more":"Selecione um período superior a %d dias","default-single":"Selecione uma data","default-less":"Selecione um período inferior a %d dias","default-range":"Selecione um período de %d a %d dias","default-default":"Selecione um período",time:"Tempo",hour:"Hora",minute:"Minuto"},tc:{selected:"已選擇:",day:"天",days:"天",apply:"確定","week-1":"一","week-2":"二","week-3":"三","week-4":"四","week-5":"五","week-6":"六","week-7":"日","week-number":"週","month-name":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],shortcuts:"快速選擇",past:"過去",following:"將來",previous:" ","prev-week":"上週","prev-month":"上個月","prev-year":"去年",next:" ","next-week":"下週","next-month":"下個月","next-year":"明年","less-than":"所選日期範圍不能大於%d天","more-than":"所選日期範圍不能小於%d天","default-more":"請選擇大於%d天的日期範圍","default-less":"請選擇少於%d天的日期範圍","default-range":"請選擇%d天到%d天的日期範圍","default-single":"請選擇一個日期","default-default":"請選擇一個日期範圍",time:"日期",hour:"小時",minute:"分鐘"},ja:{selected:"選択しました:",day:"日",days:"日",apply:"確定","week-1":"月","week-2":"火","week-3":"水","week-4":"木","week-5":"金","week-6":"土","week-7":"日","month-name":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],shortcuts:"クイック選択",past:"過去",following:"将来",previous:" ","prev-week":"先週","prev-month":"先月","prev-year":"昨年",next:" ","next-week":"来週","next-month":"来月","next-year":"来年","less-than":"日付の範囲は%d日以上にすべきではありません","more-than":"日付の範囲は%d日を下回ってはいけません","default-more":"%d日よりも長い期間を選択してください","default-less":"%d日未満の期間を選択してください","default-range":"%d日と%d日の間の日付範囲を選択してください","default-single":"日付を選択してください","default-default":"日付範囲を選択してください",time:"時間",hour:"時間",minute:"分"},da:{selected:"Valgt:",day:"Dag",days:"Dage",apply:"Luk","week-1":"ma","week-2":"ti","week-3":"on","week-4":"to","week-5":"fr","week-6":"lø","week-7":"sø","month-name":["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],shortcuts:"genveje","custom-values":"Brugerdefinerede værdier",past:"Forbi",following:"Følgende",previous:"Forrige","prev-week":"uge","prev-month":"måned","prev-year":"år",next:"Næste","next-week":"uge","next-month":"måned","next-year":"år","less-than":"Dato interval bør ikke være med end %d dage","more-than":"Dato interval bør ikke være mindre end %d dage","default-more":"Vælg datointerval længere end %d dage","default-single":"Vælg dato","default-less":"Vælg datointerval mindre end %d dage","default-range":"Vælg datointerval mellem %d og %d dage","default-default":"Vælg datointerval",time:"tid",hour:"time",minute:"minut"},fi:{selected:"Valittu:",day:"Päivä",days:"Päivää",apply:"Sulje","week-1":"ma","week-2":"ti","week-3":"ke","week-4":"to","week-5":"pe","week-6":"la","week-7":"su","week-number":"V","month-name":["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"],shortcuts:"Pikavalinnat","custom-values":"Mukautetut Arvot",past:"Menneet",following:"Tulevat",previous:"Edellinen","prev-week":"Viikko","prev-month":"Kuukausi","prev-year":"Vuosi",next:"Seuraava","next-week":"Viikko","next-month":"Kuukausi","next-year":"Vuosi","less-than":"Aikajakson tulisi olla vähemmän kuin %d päivää","more-than":"Aikajakson ei tulisi olla vähempää kuin %d päivää","default-more":"Valitse pidempi aikajakso kuin %d päivää","default-single":"Valitse päivä","default-less":"Valitse lyhyempi aikajakso kuin %d päivää","default-range":"Valitse aikajakso %d ja %d päivän väliltä","default-default":"Valitse aikajakso",time:"Aika",hour:"Tunti",minute:"Minuutti"},cat:{selected:"Seleccionats:",day:"Dia",days:"Dies",apply:"Tanca","week-1":"Dl","week-2":"Dm","week-3":"Dc","week-4":"Dj","week-5":"Dv","week-6":"Ds","week-7":"Dg","week-number":"S","month-name":["gener","febrer","març","abril","maig","juny","juliol","agost","setembre","octubre","novembre","desembre"],shortcuts:"Dreçeres","custom-values":"Valors personalitzats",past:"Passat",following:"Futur",previous:"Anterior","prev-week":"Setmana","prev-month":"Mes","prev-year":"Any",next:"Següent","next-week":"Setmana","next-month":"Mes","next-year":"Any","less-than":"El període no hauria de ser de més de %d dies","more-than":"El període no hauria de ser de menys de %d dies","default-more":"Perfavor selecciona un període més gran de %d dies","default-single":"Perfavor selecciona una data","default-less":"Perfavor selecciona un període de menys de %d dies","default-range":"Perfavor selecciona un període d'entre %d i %d dies","default-default":"Perfavor selecciona un període",time:"Temps",hour:"Hora",minute:"Minut"},sk:{selected:"Vybrané:",day:"Deň",days:"Dni",apply:"Zavrieť","week-1":"po","week-2":"út","week-3":"st","week-4":"št","week-5":"pi","week-6":"so","week-7":"ne","week-number":"T","month-name":["január","február","marec","apríl","máj","jún","júl","august","september","október","november","december"],shortcuts:"Skratky","custom-values":"Vlastné hodnoty",past:"po",following:"nasledujúci",previous:"predchádzajúci","prev-week":"týždeň","prev-month":"mesiac","prev-year":"rok",next:"ďalší","next-week":"týždeň","next-month":"mesiac","next-year":"rok","less-than":"Rozsah dátumu by nemal byť väčší ako %d dní","more-than":"Rozsah dátumu by nemal byť menší ako %d dní","default-more":"Prosím zvoľte rozsah dlhší ako %d dní","default-single":"Prosím zvoľte dátum","default-less":"Prosím zvoľte rozsah menší ako %d dní","default-range":"Prosím zvoľte rozsah medzi %d a %d dňami","default-default":"Prosím zvoľte rozsah",time:"Čas",hour:"Hodina",minute:"Minúta"}},U.fn.dateRangePicker=function(f){f||(f={}),(f=U.extend(!0,{autoClose:!1,format:"YYYY-MM-DD",separator:" to ",language:"auto",startOfWeek:"sunday",getValue:function(){return U(this).val()},setValue:function(e){U(this).attr("readonly")||U(this).is(":disabled")||e==U(this).val()||U(this).val(e)},startDate:!1,endDate:!1,time:{enabled:!1},minDays:0,maxDays:0,showShortcuts:!1,shortcuts:{},customShortcuts:[],inline:!1,container:"body",alwaysOpen:!1,singleDate:!1,lookBehind:!1,batchMode:!1,duration:200,stickyMonths:!1,dayDivAttrs:[],dayTdAttrs:[],selectForward:!1,selectBackward:!1,applyBtnClass:"",singleMonth:"auto",hoveringTooltip:function(e,t,a){return 1 ";if(!f.monthSelect)return n;var r=!!f.startDate&&Q(f.startDate).add(f.singleMonth||"month2"!==t?0:1,"month"),s=!!f.endDate&&Q(f.endDate).add(f.singleMonth||"month1"!==t?0:-1,"month"),o=r&&e.isSame(r,"year")?r.get("month"):0,i=s&&e.isSame(s,"year")?s.get("month"):11,d=Math.min(o,a),l=Math.max(i,a);if(d===l)return n;return P("month",V({minSelectable:o,maxSelectable:i,minVisible:d,maxVisible:l},a,function(e){return A(e)}))}(e=Q(e).toDate(),t),n=function(e,t){var a=(e=Q(e)).get("year"),n='