Skip to content

Commit ebc8ae7

Browse files
Merge branch 'Qloapps:develop' into gli-2560
2 parents 41b5e8b + 38cd74e commit ebc8ae7

67 files changed

Lines changed: 3206 additions & 114 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
{if isset($selectedRoomDemands) && $selectedRoomDemands}
3333
<li role="presentation" class="active"><a href="#room_type_demands_desc" aria-controls="facilities" role="tab" data-toggle="tab">{l s='Facilities'}</a></li>
3434
{/if}
35-
{if isset($serviceProducts) && $serviceProducts}
36-
<li role="presentation" {if !isset($selectedRoomDemands) || !$selectedRoomDemands}class="active"{/if}><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
37-
{/if}
35+
<li role="presentation" {if !isset($selectedRoomDemands) || !$selectedRoomDemands}class="active"{/if}><a href="#room_type_service_product_desc" aria-controls="services" role="tab" data-toggle="tab">{l s='Services'}</a></li>
3836
</ul>
3937
<div class="tab-content">
4038
{if isset($selectedRoomDemands) && $selectedRoomDemands}

admin/themes/default/template/controllers/orders/form.tpl

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,7 @@
15721572
id_room: idRoom,
15731573
id_cart: idCart,
15741574
id_product: idProduct,
1575+
id_customer: id_customer,
15751576
id_hotel_cart_booking: idHotelCartBooking,
15761577
action: 'getRoomTypeCartDemands',
15771578
ajax: true
@@ -1877,7 +1878,7 @@
18771878
<i class="icon-user"></i>
18781879
{l s='Customer'}
18791880
</div>
1880-
<div id="search-customer-form-group" class="form-group">
1881+
<div id="search-customer-form-group" {if isset($cart->id_customer) && $cart->id_customer && isset($customer) && $customer }style="display:none;"{/if} class="form-group">
18811882
<label class="control-label col-lg-3">
18821883
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Search for an existing customer by typing the first letters of his/her name.'}">
18831884
{l s='Search for a customer'}
@@ -1904,7 +1905,26 @@
19041905
</div>
19051906
</div>
19061907
<div class="row">
1907-
<div id="customers"></div>
1908+
<div id="customers">
1909+
{if isset($cart->id_customer) && $cart->id_customer && isset($customer) && $customer }
1910+
<div class="customerCard col-lg-4 selected-customer">
1911+
<div class="panel">
1912+
<div class="panel-heading">
1913+
<i class="icon-ok text-success"></i>{$customer->firstname} {$customer->lastname} <span class="pull-right">#{$customer->id}</span>
1914+
</div>
1915+
<span>{$customer->email}</span><br>
1916+
<span class="text-muted"></span><br>
1917+
<div class="panel-footer">
1918+
<a href="{$link->getAdminLink('AdminCustomers')}&id_customer={$customer->id}&viewcustomer&liteDisplaying=1" class="btn btn-default fancybox">
1919+
<i class="icon-search"></i> Details </a>
1920+
<button type="button" data-id_cart="6" data-customer="2" class="btn btn-default pull-right change-customer">
1921+
<i class="icon-refresh"></i>&nbsp;Change
1922+
</button>
1923+
</div>
1924+
</div>
1925+
</div>
1926+
{/if}
1927+
</div>
19081928
</div>
19091929
{*<div id="carts">
19101930
<button type="button" id="show_old_carts" class="btn btn-default pull-right" data-toggle="collapse" data-target="#old_carts_orders">
@@ -1962,7 +1982,7 @@
19621982
</div>
19631983
{include file='controllers/orders/_current_cart_details_data.tpl'}
19641984
1965-
<form class="form-horizontal" action="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;addorder=1&amp;cart_id={$cart->id}" method="post" style="display:none" id="cart_detail_form">
1985+
<form class="form-horizontal" action="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;addorder=1&amp;cart_id={$cart->id}" method="post" {if !isset($customer) && !$customer }style="display:none;"{/if} id="cart_detail_form">
19661986
<div class="panel" id="products_part" style="display:none;">
19671987
<div class="panel-heading">
19681988
<i class="icon-shopping-cart"></i>

classes/CartRule.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,10 +1477,7 @@ public static function autoAddToCart(?Context $context = null)
14771477
*/
14781478
public static function isFeatureActive()
14791479
{
1480-
static $is_feature_active = null;
1481-
if ($is_feature_active === null) {
1482-
$is_feature_active = (bool)Configuration::get('PS_CART_RULE_FEATURE_ACTIVE');
1483-
}
1480+
$is_feature_active = (bool)Configuration::get('PS_CART_RULE_FEATURE_ACTIVE');
14841481
return $is_feature_active;
14851482
}
14861483

classes/Profile.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,18 @@ public static function getProfileAccesses($id_profile, $type = 'id_tab')
141141
);
142142
}
143143
} else {
144-
$result = Db::getInstance()->executeS('
145-
SELECT *
146-
FROM `'._DB_PREFIX_.'access` a
147-
LEFT JOIN `'._DB_PREFIX_.'tab` t ON t.id_tab = a.id_tab
148-
WHERE `id_profile` = '.(int)$id_profile);
144+
if ($result = Db::getInstance()->executeS('
145+
SELECT * FROM `'._DB_PREFIX_.'access` a
146+
LEFT JOIN `'._DB_PREFIX_.'tab` t ON t.id_tab = a.id_tab
147+
WHERE `id_profile` = '.(int)$id_profile)
148+
) {
149+
foreach ($result as $key => $profileAccess) {
150+
$result[$key]['view'] = (int) $profileAccess['view'];
151+
$result[$key]['delete'] = (int) $profileAccess['delete'];
152+
$result[$key]['add'] = (int) $profileAccess['add'];
153+
$result[$key]['edit'] = (int) $profileAccess['edit'];
154+
}
155+
}
149156

150157
foreach ($result as $row) {
151158
self::$_cache_accesses[$id_profile][$type][$row[$type]] = $row;

classes/Tools.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,29 +2608,26 @@ public static function generateIndex()
26082608
public static function getDefaultIndexContent()
26092609
{
26102610
return '<?php
2611-
/**
2612-
* 2007-'.date('Y').' PrestaShop
2613-
*
2611+
/*
26142612
* NOTICE OF LICENSE
26152613
*
2616-
* This source file is subject to the Open Software License (OSL 3.0)
2617-
* that is bundled with this package in the file LICENSE.txt.
2614+
* This source file is subject to the Open Software License version 3.0
2615+
* that is bundled with this package in the file LICENSE.md
26182616
* It is also available through the world-wide-web at this URL:
2619-
* http://opensource.org/licenses/osl-3.0.php
2617+
* https://opensource.org/license/osl-3-0-php
26202618
* If you did not receive a copy of the license and are unable to
26212619
* obtain it through the world-wide-web, please send an email
2622-
* to license@prestashop.com so we can send you a copy immediately.
2620+
* to support@qloapps.com so we can send you a copy immediately.
26232621
*
26242622
* DISCLAIMER
26252623
*
2626-
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
2627-
* versions in the future. If you wish to customize PrestaShop for your
2628-
* needs please refer to http://www.prestashop.com for more information.
2624+
* Do not edit or add to this file if you wish to upgrade this module to a newer
2625+
* versions in the future. If you wish to customize this module for your needs
2626+
* please refer to https://store.webkul.com/customisation-guidelines for more information.
26292627
*
2630-
* @author PrestaShop SA <contact@prestashop.com>
2631-
* @copyright 2007-'.date('Y').' PrestaShop SA
2632-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
2633-
* International Registered Trademark & Property of PrestaShop SA
2628+
* @author Webkul IN
2629+
* @copyright Since 2010 Webkul
2630+
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
26342631
*/
26352632
26362633
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

classes/cache/CacheFs.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ protected function __construct()
3737

3838
$keys_filename = $this->getFilename(self::KEYS_NAME);
3939
if (@filemtime($keys_filename)) {
40-
$this->keys = unserialize(file_get_contents($keys_filename));
40+
$keys = @unserialize(file_get_contents($keys_filename));
41+
$this->keys = is_array($keys) ? $keys : array();
4142
}
4243
}
4344

classes/controller/AdminController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ public function processFilter()
886886
}
887887

888888
if (is_array($value)) {
889-
if ($value[0] === '' && $value[1] === '') {
889+
if (isset($value[0], $value[1]) && $value[0] === '' && $value[1] === '') {
890890
$value = '';
891891
} else {
892892
$value = json_encode($value);
@@ -915,7 +915,7 @@ public function processFilter()
915915
}
916916

917917
if (is_array($value)) {
918-
if ($value[0] === '' && $value[1] === '') {
918+
if (isset($value[0], $value[1]) && $value[0] === '' && $value[1] === '') {
919919
$value = '';
920920
} else {
921921
$value = json_encode($value);

classes/webservice/WebserviceSpecificManagementBookings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public function formatRoomInRequestData($data)
507507
$formattedRooms[$key]['occupancy'] = $occupancy;
508508
if (isset($room['id_tax_rules_group'])) {
509509
$formattedRooms[$key]['id_tax_rules_group'] = $room['id_tax_rules_group'];
510-
} else if ($room['total_tax']) {
510+
} else if (isset($room['total_tax'])) {
511511
$formattedRooms[$key]['total_tax'] = $room['total_tax'];
512512
}
513513
}

controllers/admin/AdminImportController.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3223,7 +3223,25 @@ public function supplyOrdersDetailsImport()
32233223

32243224
public function utf8EncodeArray($array)
32253225
{
3226-
return (is_array($array) ? array_map('utf8_encode', $array) : mb_convert_encoding($array, 'UTF-8', 'ISO-8859-1'));
3226+
if (is_array($array)) {
3227+
return array_map(function ($value) {
3228+
if (is_array($value)) {
3229+
return $this->utf8EncodeArray($value);
3230+
}
3231+
3232+
if (!is_string($value)) {
3233+
return $value;
3234+
}
3235+
3236+
return mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
3237+
}, $array);
3238+
}
3239+
3240+
if (!is_string($array)) {
3241+
return $array;
3242+
}
3243+
3244+
return mb_convert_encoding($array, 'UTF-8', 'ISO-8859-1');
32273245
}
32283246

32293247
protected function getNbrColumn($handle, $glue)

controllers/admin/AdminOrdersController.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ public function renderForm()
485485
'advance_payment_amount_without_tax' => $cart->getOrderTotal(false, Cart::ADVANCE_PAYMENT),
486486
'advance_payment_amount_with_tax' => $cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT),
487487
'cart' => $cart,
488+
'customer' => $cart->id_customer ? new Customer($cart->id_customer): null ,
488489
'currencies' => Currency::getCurrenciesByIdShop(Context::getContext()->shop->id),
489490
'langs' => Language::getLanguages(true, Context::getContext()->shop->id),
490491
'payment_modules' => $payment_modules,
@@ -3593,10 +3594,11 @@ public function renderView()
35933594
}
35943595
}
35953596

3596-
$messages = array_merge($customerMessages, $messages);
3597-
usort($messages, function ($a, $b) {
3598-
return strtotime($a['date_add']) < strtotime($b['date_add']);
3599-
});
3597+
if($messages = array_merge($customerMessages, $messages)){
3598+
usort($messages, function ($a, $b) {
3599+
return (strtotime($a['date_add']) < strtotime($b['date_add'])) ? 1 : -1;
3600+
});
3601+
}
36003602
}
36013603

36023604
// send hotel standalone and standalone products
@@ -7489,7 +7491,7 @@ public function ajaxProcessUpdateSelectedRoomServices()
74897491
$response['hasError'] = true;
74907492
$response['errors'][] = Tools::displayError('Invalid quantity provided for service').': '.$objServiceProductOrderDetail->name;
74917493
}
7492-
} elseif ($serviceQuantities[$idRoomTypeServiceProductOrderDetail] > 1) {
7494+
} elseif (is_array($serviceQuantities) && isset($serviceQuantities[$idRoomTypeServiceProductOrderDetail]) && $serviceQuantities[$idRoomTypeServiceProductOrderDetail] > 1) {
74937495
$response['hasError'] = true;
74947496
$response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objServiceProductOrderDetail->name;
74957497
}
@@ -7510,7 +7512,11 @@ public function ajaxProcessUpdateSelectedRoomServices()
75107512
$result = true;
75117513
foreach ($selectedServicesOrderDetails as $idRoomTypeServiceProductOrderDetail) {
75127514
$objServiceProductOrderDetail = new ServiceProductOrderDetail($idRoomTypeServiceProductOrderDetail);
7513-
$quantity = $serviceQuantities[$idRoomTypeServiceProductOrderDetail];
7515+
if(is_array($serviceQuantities) && isset($serviceQuantities[$idRoomTypeServiceProductOrderDetail])) {
7516+
$quantity = (int)$serviceQuantities[$idRoomTypeServiceProductOrderDetail];
7517+
} else {
7518+
$quantity = 1;
7519+
}
75147520
$unitPrice = $serviceUnitPrices[$idRoomTypeServiceProductOrderDetail];
75157521

75167522
$objHotelBookingDetail = new HotelBookingDetail($objServiceProductOrderDetail->id_htl_booking_detail);

0 commit comments

Comments
 (0)