Merge branch 'develop' into qlo-php-smarty
This commit is contained in:
@@ -1,3 +1,87 @@
|
||||
####################################
|
||||
# V1.5.1
|
||||
####################################
|
||||
|
||||
## Added Features:
|
||||
- Core:
|
||||
- #208: "Catalog Mode" option added by which user can view room details but not abe to create booking
|
||||
|
||||
|
||||
## Improvements:
|
||||
- Back Office:
|
||||
- #206: Removed Other Modules setting from admin Hotel Reservation System -> Settings
|
||||
- #200: Removed shipping option from car rule condition.
|
||||
- #199: Removed "Display suppliers and manufacturers" and "Display best sellers" options from Admin Preferences controller
|
||||
- #193: Removed Payment Modules setting from admin Hotel Reservation System -> Settings
|
||||
- #189: Moved hotel selection from configuration tab to information tab
|
||||
- #179: Added hotel column in room type feature pricing list
|
||||
- #177: Removed multishop option
|
||||
- #149: Removed carrier column from Booking Carts Controller
|
||||
- #183: Added hotel name along with room name when adding filter of room type for cart rule
|
||||
- #204, #196, #182: Text Changes
|
||||
- #110, #111: Code Optimization
|
||||
|
||||
- Core:
|
||||
- #223: getHotelCartBookingData() : function multiplication optimized
|
||||
- #225: HotelRoomTypeFeaturePricing.php optimized (Removed unused variables, removed static values assigned)
|
||||
- #218: Added hotel name column in order confirmation mail and invoice.
|
||||
- #210: CMS page Delivery is not valid for hotel industry. So changed it to Policies page
|
||||
- #205: Prevent deleting profile which is used by at least one employee
|
||||
- #214: blockcart module :: Removed unused hooks displayLeftColumn and displayrightColumn
|
||||
- #180: license file name changed from LICENSES to LICENSE
|
||||
- #181: Readme file improvements with more information and links
|
||||
- #221: dataforfrontsearch() function now calculate and provide "feature_price_diff" value in response
|
||||
- #175: Changed QloApps versioning system (Ex: X.X.X.X)
|
||||
- #175: Updated module compatibility check with QloApps version
|
||||
- #215: "hotelreservationsystem.php" code optimization in hook "actionValidateOrder"
|
||||
- #117, #118, #119, #120, #121, #122, #134, #137, #138, #139: Changes for PHP7 compatibility
|
||||
- #178: Text Changes
|
||||
- #198, #226: Multiple hooks are added in the different QloApps core files
|
||||
- #217: `auto_generated` column in `address` table added to track address creation source
|
||||
- #207: New order states 'Partial payment accepted' and 'Awaiting partial payment' added for the partial payment
|
||||
|
||||
- Front Office:
|
||||
- #222: Disabled mobile keyboard pop up when using date-picker in home search
|
||||
- #208: Room type listing on search result page moved to different template "room_type_listing.tpl"
|
||||
- #185: Replaced star rating plugin with jquery Raty in Product Comments module
|
||||
- #156: "product.js" code multiplication optimized
|
||||
- #215: "ajax-cart.js" add validation
|
||||
- #125, #127, #141, #142: Changes for PHP7 compatibility
|
||||
- #187: Display voucher name along with voucher code on order page
|
||||
|
||||
|
||||
## Bug Fixed:
|
||||
- Back Office:
|
||||
- #211: Errors on cart rule page when add room type, which is not assigned to hotel, selected in room type condition
|
||||
- #197: wrong theme information is displayed at Preferences -> Themes admin controller
|
||||
- #195: Filter by position in the render lists of admin controllers
|
||||
- #194: Entering wrong discount while Group creation, page redirects to list page
|
||||
- #192: Using filter in customer Group list, page redirects to previous list
|
||||
- #189: Room Type associations with its hotel parent category
|
||||
- #176: Birthday input field width in Helper Form
|
||||
- #173: Undefined varaible issue Manage Order Refund Request Controller
|
||||
- #171: Multiple request on single click in Helper List
|
||||
- #160: "Access Denied" issue when an employee other than super admin create a new room.
|
||||
- #168: Room number not updating after room reallocation and swap
|
||||
- #162: Additional facility price changes for room type after saving
|
||||
- #147: Creating order status without entering "status name", page redirects to blank page
|
||||
- #148: Creating order refund status without entering "status name", page redirects to list page
|
||||
- #229: Resolved undefined variable error in Manage Order Refund Request Controller
|
||||
|
||||
- Front Office:
|
||||
- #212: Design issue of select in the ADDITIONAL FACILITIES if text exceeds from block in the product detail page
|
||||
- #209: Errors on the search result page: If new group is created and only this group is assigned to the customer
|
||||
- #203: Guest is unable to submit Refund Request again after entering invalid Refund Reason once
|
||||
- #158: Hotel selection in search panel for mobile devices
|
||||
- #169: Wrong price displayed when booking from 1 march to 30 march
|
||||
- #151: Room search check-in && check-out don't change when friendly URL is disabled.
|
||||
|
||||
- Core:
|
||||
- #186: Links in mail for my-account, guest tracking and my orders pages are now localized to customer language.
|
||||
- #109: updated invalid varaible "pshone_mobile" to "phone_mobile"
|
||||
- #202: "global.css" added missing class for aligning images left and right in discription
|
||||
|
||||
|
||||
####################################
|
||||
# V1.5.0
|
||||
####################################
|
||||
|
||||
13
SECURITY.md
Normal file
13
SECURITY.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.5.x | :white_check_mark: |
|
||||
| 1.4.x | :white_check_mark: |
|
||||
| < 1.4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report (suspected) security vulnerabilities to support@qloapps.com. You will receive a response from us within 48 hours. If the issue is confirmed, we will release a patch as soon as possible depending on complexity.
|
||||
@@ -72,12 +72,12 @@ if (Tools::isSubmit('ajaxProductPackItems')) {
|
||||
|
||||
if (Tools::isSubmit('getChildrenCategories') && Tools::isSubmit('id_category_parent')) {
|
||||
$children_categories = Category::getChildrenWithNbSelectedSubCat(Tools::getValue('id_category_parent'), Tools::getValue('selectedCat'), Context::getContext()->language->id, null, Tools::getValue('use_shop_context'));
|
||||
die(Tools::jsonEncode($children_categories));
|
||||
die(json_encode($children_categories));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getNotifications')) {
|
||||
$notification = new Notification;
|
||||
die(Tools::jsonEncode($notification->getLastElements()));
|
||||
die(json_encode($notification->getLastElements()));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('updateElementEmployee') && Tools::getValue('updateElementEmployeeType')) {
|
||||
@@ -111,7 +111,7 @@ if (Tools::isSubmit('getParentCategoriesId') && $id_category = Tools::getValue('
|
||||
$output[] = $result;
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($output));
|
||||
die(json_encode($output));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getZones')) {
|
||||
@@ -121,7 +121,7 @@ if (Tools::isSubmit('getZones')) {
|
||||
}
|
||||
$html .= '</select>';
|
||||
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
|
||||
die(Tools::jsonEncode($array));
|
||||
die(json_encode($array));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getEmailHTML') && $email = Tools::getValue('email')) {
|
||||
|
||||
@@ -137,7 +137,7 @@ if ($items && ($excludeIds || strpos($_SERVER['HTTP_REFERER'], 'AdminScenes') !=
|
||||
}
|
||||
}
|
||||
$results = array_values($results);
|
||||
echo Tools::jsonEncode($results);
|
||||
echo json_encode($results);
|
||||
} else {
|
||||
Tools::jsonEncode(new stdClass);
|
||||
json_encode(new stdClass);
|
||||
}
|
||||
|
||||
@@ -524,8 +524,8 @@ function runAdminTab($tab, $ajax_mode = false)
|
||||
}
|
||||
|
||||
// we can display the correct url
|
||||
// die(Tools::jsonEncode(array(Translate::getAdminTranslation('Invalid security token'),$url)));
|
||||
die(Tools::jsonEncode(Translate::getAdminTranslation('Invalid security token')));
|
||||
// die(json_encode(array(Translate::getAdminTranslation('Invalid security token'),$url)));
|
||||
die(json_encode(Translate::getAdminTranslation('Invalid security token')));
|
||||
} else {
|
||||
// If this is an XSS attempt, then we should only display a simple, secure page
|
||||
if (ob_get_level() && ob_get_length() > 0) {
|
||||
|
||||
@@ -377,7 +377,7 @@ class Crypt_Blowfish
|
||||
for ($i = 0; $i < 18; $i++) {
|
||||
$data = 0;
|
||||
for ($j = 4; $j > 0; $j--) {
|
||||
$data = $data << 8 | ord($key{$k});
|
||||
$data = $data << 8 | ord($key[$k]);
|
||||
$k = ($k + 1) % $len;
|
||||
}
|
||||
$this->_P[$i] ^= $data;
|
||||
|
||||
@@ -2632,6 +2632,9 @@ class CartCore extends ObjectModel
|
||||
*/
|
||||
public static function desintifier($int, $delimiter = ',')
|
||||
{
|
||||
if (!$int)
|
||||
return;
|
||||
|
||||
$delimiter_len = $int[0];
|
||||
$int = strrev(substr($int, 1));
|
||||
$elm = explode(str_repeat('0', $delimiter_len + 1), $int);
|
||||
@@ -4317,7 +4320,7 @@ class CartCore extends ObjectModel
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
$cartData = Tools::jsonDecode(Tools::jsonEncode($xml, true));
|
||||
$cartData = json_decode(json_encode($xml, true));
|
||||
|
||||
$this->id_address_delivery = $cartData->cart->id_address;
|
||||
$this->id_address_invoice = $cartData->cart->id_address;
|
||||
@@ -4344,7 +4347,7 @@ class CartCore extends ObjectModel
|
||||
$postData = trim(file_get_contents('php://input'));
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
$cartData = Tools::jsonDecode(Tools::jsonEncode($xml, true));
|
||||
$cartData = json_decode(json_encode($xml, true));
|
||||
|
||||
$this->id_address_delivery = $cartData->cart->id_address;
|
||||
$this->id_address_invoice = $cartData->cart->id_address;
|
||||
@@ -4384,14 +4387,14 @@ class CartCore extends ObjectModel
|
||||
|
||||
$extraDemands = null;
|
||||
foreach ($bookingRows as $booking) {
|
||||
$booking = Tools::jsonDecode(Tools::jsonEncode($booking, true), true);
|
||||
$booking = json_decode(json_encode($booking, true), true);
|
||||
if (isset($booking['extra_demands']['extra_demand'])) {
|
||||
$extraDemands = $booking['extra_demands']['extra_demand'];
|
||||
if (isset($extraDemands['id_global_demand'])) {
|
||||
$extraDemands = array($extraDemands);
|
||||
}
|
||||
// $extraDemands = Tools::jsonDecode($extraDemands, true);
|
||||
$extraDemands = Tools::jsonEncode($extraDemands);
|
||||
// $extraDemands = json_decode($extraDemands, true);
|
||||
$extraDemands = json_encode($extraDemands);
|
||||
}
|
||||
|
||||
// get room booking info
|
||||
|
||||
@@ -1220,7 +1220,7 @@ class CartRuleCore extends ObjectModel
|
||||
if ($type == 'shop') {
|
||||
$shops = Context::getContext()->employee->getAssociatedShops();
|
||||
if (count($shops)) {
|
||||
$shop_list = ' AND t.id_shop IN ('.implode(array_map('intval', $shops), ',').') ';
|
||||
$shop_list = ' AND t.id_shop IN ('.implode(',', array_map('intval', $shops)).') ';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ class ConfigurationTestCore
|
||||
'upload_max_filesize' => false,
|
||||
'max_execution_time' => false,
|
||||
'fopen' => false,
|
||||
'zip' => false,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -180,7 +181,7 @@ class ConfigurationTestCore
|
||||
|
||||
public static function test_magicquotes()
|
||||
{
|
||||
return !get_magic_quotes_gpc();
|
||||
return function_exists('get_magic_quotes_gpc') ? !get_magic_quotes_gpc() : true;
|
||||
}
|
||||
|
||||
public static function test_upload()
|
||||
@@ -215,6 +216,12 @@ class ConfigurationTestCore
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function test_zip()
|
||||
{
|
||||
return extension_loaded('zip');
|
||||
}
|
||||
|
||||
|
||||
public static function test_fopen()
|
||||
{
|
||||
return ini_get('allow_url_fopen');
|
||||
|
||||
@@ -136,7 +136,7 @@ class ConnectionCore extends ObjectModel
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
ORDER BY `date_add` DESC';
|
||||
$result = Db::getInstance()->getRow($sql, false);
|
||||
if (!$result['id_guest'] && (int)$cookie->id_guest) {
|
||||
if (!isset($result['id_guest']) && (int)$cookie->id_guest) {
|
||||
// The old connections details are removed from the database in order to spare some memory
|
||||
Connection::cleanConnectionsPages();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class CookieCore
|
||||
$this->_standalone = $standalone;
|
||||
$this->_expire = is_null($expire) ? time() + 1728000 : (int)$expire;
|
||||
$this->_path = trim(($this->_standalone ? '' : Context::getContext()->shop->physical_uri).$path, '/\\').'/';
|
||||
if ($this->_path{0} != '/') {
|
||||
if ($this->_path[0] != '/') {
|
||||
$this->_path = '/'.$this->_path;
|
||||
}
|
||||
$this->_path = rawurlencode($this->_path);
|
||||
|
||||
@@ -798,7 +798,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
// If the language pack has not been provided, retrieve it from prestashop.com
|
||||
if (!$lang_pack) {
|
||||
$lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$iso_code));
|
||||
$lang_pack = json_decode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$iso_code));
|
||||
}
|
||||
|
||||
// If a language pack has been found or provided, prefill the language object with the value
|
||||
@@ -914,7 +914,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.Tools::strtolower((string)$iso))) {
|
||||
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||
} elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link)) {
|
||||
} elseif (!$lang_pack = json_decode($lang_pack_link)) {
|
||||
$errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
||||
} elseif (empty($lang_pack->error) && ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.Tools::strtolower($lang_pack->iso_code.'.gzip')))) {
|
||||
if (!@file_put_contents($file, $content)) {
|
||||
|
||||
@@ -628,7 +628,7 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
$this->clearCache();
|
||||
|
||||
// Automatically fill dates
|
||||
if (array_key_exists('date_upd', $this)) {
|
||||
if (property_exists($this, 'date_upd')) {
|
||||
$this->date_upd = date('Y-m-d H:i:s');
|
||||
if (isset($this->update_fields) && is_array($this->update_fields) && count($this->update_fields)) {
|
||||
$this->update_fields['date_upd'] = true;
|
||||
@@ -636,7 +636,7 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
}
|
||||
|
||||
// Automatically fill dates
|
||||
if (array_key_exists('date_add', $this) && $this->date_add == null) {
|
||||
if (property_exists($this, 'date_add') && $this->date_add == null) {
|
||||
$this->date_add = date('Y-m-d H:i:s');
|
||||
if (isset($this->update_fields) && is_array($this->update_fields) && count($this->update_fields)) {
|
||||
$this->update_fields['date_add'] = true;
|
||||
@@ -818,7 +818,7 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
public function toggleStatus()
|
||||
{
|
||||
// Object must have a variable called 'active'
|
||||
if (!array_key_exists('active', $this)) {
|
||||
if (!property_exists($this, 'active')) {
|
||||
throw new PrestaShopException('property "active" is missing in object '.get_class($this));
|
||||
}
|
||||
|
||||
@@ -1770,7 +1770,7 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
|
||||
}
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (array_key_exists($key, $this)) {
|
||||
if (property_exists($this, $key)) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5776,7 +5776,7 @@ class ProductCore extends ObjectModel
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
|
||||
$roomtypeData = Tools::jsonDecode(Tools::jsonEncode($xml), true);
|
||||
$roomtypeData = json_decode(json_encode($xml), true);
|
||||
|
||||
// set room map info for the hotel from request
|
||||
return Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'htl_room_type` (`id_product`, `id_hotel`, `adult`, `children`, `date_add`, `date_upd`) VALUES ('.(int)$this->id.', '.(int) $roomtypeData['room_type']['id_hotel'].', '.(int) $roomtypeData['room_type']['adults'].', '.(int) $roomtypeData['room_type']['children'].', \''.date('Y-m-d h:i:s').'\', \''.date('Y-m-d h:i:s').'\')');
|
||||
|
||||
@@ -236,7 +236,7 @@ class ReferrerCore extends ObjectModel
|
||||
if ($implode) {
|
||||
$sql = 'SELECT COUNT(id_order) AS orders, SUM(total_paid_real / conversion_rate) AS sales
|
||||
FROM '._DB_PREFIX_.'orders
|
||||
WHERE id_order IN ('.implode($implode, ',').')
|
||||
WHERE id_order IN ('.implode(',', $implode).')
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER).'
|
||||
AND valid = 1';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
@@ -349,6 +349,6 @@ class ReferrerCore extends ObjectModel
|
||||
'percent_fee' => Tools::displayPrice($stats_sales['sales'] * $referrer->percent_fee / 100, $currency),
|
||||
);
|
||||
|
||||
die('['.Tools::jsonEncode($json_array).']');
|
||||
die('['.json_encode($json_array).']');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,65 +104,7 @@ class ToolsCore
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('mcrypt_create_iv')) {
|
||||
$bytes = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
|
||||
|
||||
if ($bytes !== false && strlen($bytes) === $length) {
|
||||
return $bytes;
|
||||
}
|
||||
}
|
||||
|
||||
// Else try to get $length bytes of entropy.
|
||||
// Thanks to Zend
|
||||
|
||||
$result = '';
|
||||
$entropy = '';
|
||||
$msec_per_round = 400;
|
||||
$bits_per_round = 2;
|
||||
$total = $length;
|
||||
$hash_length = 20;
|
||||
|
||||
while (strlen($result) < $length) {
|
||||
$bytes = ($total > $hash_length) ? $hash_length : $total;
|
||||
$total -= $bytes;
|
||||
|
||||
for ($i=1; $i < 3; $i++) {
|
||||
$t1 = microtime(true);
|
||||
$seed = mt_rand();
|
||||
|
||||
for ($j=1; $j < 50; $j++) {
|
||||
$seed = sha1($seed);
|
||||
}
|
||||
|
||||
$t2 = microtime(true);
|
||||
$entropy .= $t1 . $t2;
|
||||
}
|
||||
|
||||
$div = (int) (($t2 - $t1) * 1000000);
|
||||
|
||||
if ($div <= 0) {
|
||||
$div = 400;
|
||||
}
|
||||
|
||||
$rounds = (int) ($msec_per_round * 50 / $div);
|
||||
$iter = $bytes * (int) (ceil(8 / $bits_per_round));
|
||||
|
||||
for ($i = 0; $i < $iter; $i ++) {
|
||||
$t1 = microtime();
|
||||
$seed = sha1(mt_rand());
|
||||
|
||||
for ($j = 0; $j < $rounds; $j++) {
|
||||
$seed = sha1($seed);
|
||||
}
|
||||
|
||||
$t2 = microtime();
|
||||
$entropy .= $t1 . $t2;
|
||||
}
|
||||
|
||||
$result .= sha1($entropy, true);
|
||||
}
|
||||
|
||||
return substr($result, 0, $length);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function strReplaceFirst($search, $replace, $subject, $cur = 0)
|
||||
@@ -1071,7 +1013,7 @@ class ToolsCore
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
console.'.$type.'('.Tools::jsonEncode($object).');
|
||||
console.'.$type.'('.json_encode($object).');
|
||||
</script>
|
||||
';
|
||||
}
|
||||
@@ -1827,10 +1769,10 @@ class ToolsCore
|
||||
return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1);
|
||||
}
|
||||
|
||||
public static function ucwords($str)
|
||||
public static function ucwords($str, $encoding = 'utf-8')
|
||||
{
|
||||
if (function_exists('mb_convert_case')) {
|
||||
return mb_convert_case($str, MB_CASE_TITLE);
|
||||
return mb_convert_case($str, MB_CASE_TITLE, $encoding);
|
||||
}
|
||||
return ucwords(Tools::strtolower($str));
|
||||
}
|
||||
@@ -2665,19 +2607,15 @@ exit;
|
||||
/**
|
||||
* jsonDecode convert json string to php array / object
|
||||
*
|
||||
* @param string $json
|
||||
* @param string $data
|
||||
* @param bool $assoc (since 1.4.2.4) if true, convert to associativ array
|
||||
* @return array
|
||||
*/
|
||||
public static function jsonDecode($json, $assoc = false)
|
||||
public static function jsonDecode($data, $assoc = false, $depth = 512, $options = 0
|
||||
)
|
||||
{
|
||||
if (function_exists('json_decode')) {
|
||||
return json_decode($json, $assoc);
|
||||
} else {
|
||||
include_once(_PS_TOOL_DIR_.'json/json.php');
|
||||
$pear_json = new Services_JSON(($assoc) ? SERVICES_JSON_LOOSE_TYPE : 0);
|
||||
return $pear_json->decode($json);
|
||||
}
|
||||
Tools::displayAsDeprecated();
|
||||
return json_decode($data, $assoc, $depth, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2686,15 +2624,15 @@ exit;
|
||||
* @param array $data
|
||||
* @return string json
|
||||
*/
|
||||
public static function jsonEncode($data)
|
||||
public static function jsonEncode($data, $options = 0, $depth = 512)
|
||||
{
|
||||
if (function_exists('json_encode')) {
|
||||
return json_encode($data);
|
||||
} else {
|
||||
include_once(_PS_TOOL_DIR_.'json/json.php');
|
||||
$pear_json = new Services_JSON();
|
||||
return $pear_json->encode($data);
|
||||
Tools::displayAsDeprecated();
|
||||
if (PHP_VERSION_ID < 50500) { /* PHP version < 5.5.0 */
|
||||
return json_encode($data, $options);
|
||||
}
|
||||
|
||||
return json_encode($data, $options, $depth);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2859,14 +2797,9 @@ exit;
|
||||
*/
|
||||
public static function ZipTest($from_file)
|
||||
{
|
||||
if (class_exists('ZipArchive', false)) {
|
||||
$zip = new ZipArchive();
|
||||
return ($zip->open($from_file, ZIPARCHIVE::CHECKCONS) === true);
|
||||
} else {
|
||||
require_once(_PS_ROOT_DIR_.'/tools/pclzip/pclzip.lib.php');
|
||||
$zip = new PclZip($from_file);
|
||||
return ($zip->privCheckFormat() === true);
|
||||
}
|
||||
$zip = new ZipArchive();
|
||||
|
||||
return ($zip->open($from_file, ZipArchive::CHECKCONS) === true);
|
||||
}
|
||||
|
||||
public static function getSafeModeStatus()
|
||||
@@ -2886,23 +2819,12 @@ exit;
|
||||
if (!file_exists($to_dir)) {
|
||||
mkdir($to_dir, 0777);
|
||||
}
|
||||
if (class_exists('ZipArchive', false)) {
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($from_file) === true && $zip->extractTo($to_dir) && $zip->close()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
require_once(_PS_ROOT_DIR_.'/tools/pclzip/pclzip.lib.php');
|
||||
$zip = new PclZip($from_file);
|
||||
$list = $zip->extract(PCLZIP_OPT_PATH, $to_dir, PCLZIP_OPT_REPLACE_NEWER);
|
||||
foreach ($list as $file) {
|
||||
if ($file['status'] != 'ok' && $file['status'] != 'already_a_directory') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($from_file) === true && $zip->extractTo($to_dir) && $zip->close()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function chmodr($path, $filemode)
|
||||
@@ -3631,8 +3553,6 @@ exit;
|
||||
|
||||
public static function purifyHTML($html, $uri_unescape = null, $allow_style = false)
|
||||
{
|
||||
require_once(_PS_TOOL_DIR_.'htmlpurifier/HTMLPurifier.standalone.php');
|
||||
|
||||
static $use_html_purifier = null;
|
||||
static $purifier = null;
|
||||
|
||||
|
||||
@@ -1803,14 +1803,14 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
|
||||
if ($conf = Tools::getValue('conf')) {
|
||||
$this->context->smarty->assign('conf', $this->json ? Tools::jsonEncode($this->_conf[(int)$conf]) : $this->_conf[(int)$conf]);
|
||||
$this->context->smarty->assign('conf', $this->json ? json_encode($this->_conf[(int)$conf]) : $this->_conf[(int)$conf]);
|
||||
}
|
||||
|
||||
foreach (array('errors', 'warnings', 'informations', 'confirmations') as $type) {
|
||||
if (!is_array($this->$type)) {
|
||||
$this->$type = (array)$this->$type;
|
||||
}
|
||||
$this->context->smarty->assign($type, $this->json ? Tools::jsonEncode(array_unique($this->$type)) : array_unique($this->$type));
|
||||
$this->context->smarty->assign($type, $this->json ? json_encode(array_unique($this->$type)) : array_unique($this->$type));
|
||||
}
|
||||
|
||||
if ($this->show_page_header_toolbar && !$this->lite_display) {
|
||||
@@ -1824,7 +1824,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'page' => $this->json ? Tools::jsonEncode($page) : $page,
|
||||
'page' => $this->json ? json_encode($page) : $page,
|
||||
'header' => $this->context->smarty->fetch($header_tpl),
|
||||
'footer' => $this->context->smarty->fetch($footer_tpl),
|
||||
)
|
||||
|
||||
@@ -435,7 +435,7 @@ class HelperListCore extends Helper
|
||||
'token' => $token != null ? $token : $this->token,
|
||||
'action' => self::$cache_lang['Details'],
|
||||
'params' => $ajax_params,
|
||||
'json_params' => Tools::jsonEncode($ajax_params)
|
||||
'json_params' => json_encode($ajax_params)
|
||||
));
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
@@ -142,8 +142,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
$invoiceAddressPatternRules = Tools::jsonDecode(Configuration::get('PS_INVCE_INVOICE_ADDR_RULES'), true);
|
||||
$deliveryAddressPatternRules = Tools::jsonDecode(Configuration::get('PS_INVCE_DELIVERY_ADDR_RULES'), true);
|
||||
$invoiceAddressPatternRules = json_decode(Configuration::get('PS_INVCE_INVOICE_ADDR_RULES'), true);
|
||||
$deliveryAddressPatternRules = json_decode(Configuration::get('PS_INVCE_DELIVERY_ADDR_RULES'), true);
|
||||
|
||||
$invoice_address = new Address((int)$this->order->id_address_invoice);
|
||||
$country = new Country((int)$invoice_address->id_country);
|
||||
@@ -444,8 +444,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from']);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to']);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require_once(_PS_TOOL_DIR_.'tcpdf/config/lang/eng.php');
|
||||
require_once(_PS_TOOL_DIR_.'tcpdf/tcpdf.php');
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@ class TreeToolbarSearchCore extends TreeToolbarButtonCore implements
|
||||
$html = '';
|
||||
|
||||
foreach ($data as $item) {
|
||||
$html .= Tools::jsonEncode($item).',';
|
||||
$html .= json_encode($item).',';
|
||||
if (array_key_exists('children', $item) && !empty($item['children'])) {
|
||||
$html .= $this->_renderData($item['children']);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class TreeToolbarSearchCategoriesCore extends TreeToolbarButtonCore implements
|
||||
$html = '';
|
||||
|
||||
foreach ($data as $item) {
|
||||
$html .= Tools::jsonEncode($item).',';
|
||||
$html .= json_encode($item).',';
|
||||
if (array_key_exists('children', $item) && !empty($item['children'])) {
|
||||
$html .= $this->_renderData($item['children']);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ define('_PS_PRICE_DISPLAY_PRECISION_', Configuration::get('PS_PRICE_DISPLAY_PREC
|
||||
define('_PS_PRICE_COMPUTE_PRECISION_', _PS_PRICE_DISPLAY_PRECISION_);
|
||||
|
||||
if (Configuration::get('PS_USE_HTMLPURIFIER')) {
|
||||
require_once(_PS_TOOL_DIR_.'htmlpurifier/HTMLPurifier.standalone.php');
|
||||
require_once(_PS_TOOL_DIR_.'htmlpurifier/HTMLPurifier.auto.php');
|
||||
}
|
||||
|
||||
/* Load all languages */
|
||||
|
||||
@@ -140,7 +140,7 @@ define('_PS_TMP_IMG_DIR_', _PS_IMG_DIR_.'tmp/');
|
||||
define('_PS_TRANS_PATTERN_', '(.*[^\\\\])');
|
||||
define('_PS_MIN_TIME_GENERATE_PASSWD_', '360');
|
||||
if (!defined('_PS_MAGIC_QUOTES_GPC_')) {
|
||||
define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc());
|
||||
define('_PS_MAGIC_QUOTES_GPC_', function_exists('get_magic_quotes_gpc')? @get_magic_quotes_gpc() : false);
|
||||
}
|
||||
|
||||
define('_CAN_LOAD_FILES_', 1);
|
||||
|
||||
@@ -495,7 +495,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
$customer = Customer::searchByName($email);
|
||||
if (!empty($customer)) {
|
||||
$customer = $customer['0'];
|
||||
echo Tools::jsonEncode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company'])));
|
||||
echo json_encode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company'])));
|
||||
}
|
||||
}
|
||||
die;
|
||||
|
||||
@@ -76,7 +76,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
||||
protected static function createCombinations($list)
|
||||
{
|
||||
if (count($list) <= 1) {
|
||||
return count($list) ? array_map(create_function('$v', 'return (array($v));'), $list[0]) : $list;
|
||||
return count($list) ? array_map(function ($v) {return (array($v));}, $list[0]) : $list;
|
||||
}
|
||||
$res = array();
|
||||
$first = array_pop($list);
|
||||
|
||||
@@ -297,7 +297,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
$associations = array();
|
||||
}
|
||||
|
||||
$this->fields_form['shop_associations'] = Tools::jsonEncode($associations);
|
||||
$this->fields_form['shop_associations'] = json_encode($associations);
|
||||
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'color',
|
||||
|
||||
@@ -652,7 +652,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$return['errors'] = $this->errors;
|
||||
}
|
||||
if (count($this->errors) || $die) {
|
||||
die(Tools::jsonEncode($return));
|
||||
die(json_encode($return));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$return['id_carrier'] = $carrier->id;
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($return));
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
protected function changeGroups($id_carrier, $delete = true)
|
||||
|
||||
@@ -140,7 +140,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
echo Tools::jsonEncode(array('html' => $html, 'next_link' => $next_link));
|
||||
echo json_encode(array('html' => $html, 'next_link' => $next_link));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
@@ -589,7 +589,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
)
|
||||
ORDER BY c.`firstname`, c.`lastname` ASC
|
||||
LIMIT 50');
|
||||
die(Tools::jsonEncode($customers));
|
||||
die(json_encode($customers));
|
||||
}
|
||||
// Both product filter (free product and product discount) search for products
|
||||
if (Tools::isSubmit('giftProductFilter') || Tools::isSubmit('reductionProductFilter')) {
|
||||
@@ -599,7 +599,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
$products,
|
||||
$this->context->employee->id_profile
|
||||
);
|
||||
die(Tools::jsonEncode($products));
|
||||
die(json_encode($products));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,7 +642,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
public function ajaxProcessSearchProducts()
|
||||
{
|
||||
$array = $this->searchProducts(Tools::getValue('product_search'));
|
||||
$this->content = trim(Tools::jsonEncode($array));
|
||||
$this->content = trim(json_encode($array));
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
@@ -771,6 +771,6 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
if ($vouchers = CartRule::getCartsRuleByCode(Tools::getValue('q'), (int)$this->context->language->id, true)) {
|
||||
$found = true;
|
||||
}
|
||||
echo Tools::jsonEncode(array('found' => $found, 'vouchers' => $vouchers));
|
||||
echo json_encode(array('found' => $found, 'vouchers' => $vouchers));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,10 +403,10 @@ class AdminCartsControllerCore extends AdminController
|
||||
$errors[] = Tools::displayError('Invalid combination');
|
||||
}
|
||||
if (count($errors)) {
|
||||
die(Tools::jsonEncode($errors));
|
||||
die(json_encode($errors));
|
||||
}
|
||||
if ($this->context->cart->deleteProduct($id_product, $id_product_attribute, (int)Tools::getValue('id_customization'))) {
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -520,7 +520,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
echo Tools::jsonEncode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));
|
||||
echo json_encode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->context->cart->gift_message = $gift_message;
|
||||
}
|
||||
$this->context->cart->save();
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
} elseif (Validate::isLoadedObject($message)) {
|
||||
$message->delete();
|
||||
}
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
|
||||
$result = $this->ajaxReturnVars();
|
||||
$result['cart_detail_html'] = $cart_dtl_tpl;//tpl is added to the returned array
|
||||
echo Tools::jsonEncode($result);
|
||||
echo json_encode($result);
|
||||
}
|
||||
}
|
||||
public function ajaxProcessUpdateLang()
|
||||
@@ -604,7 +604,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->context->cart->id_lang = (int)$lang->id;
|
||||
$this->context->cart->save();
|
||||
}
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$errors[] = Tools::displayError('The order cannot be renewed.');
|
||||
} else {
|
||||
$this->context->cart = $new_cart['cart'];
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -632,7 +632,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
if ($this->context->cart->removeCartRule((int)Tools::getValue('id_cart_rule'))) {
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -663,7 +663,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->context->cart->addCartRule((int)$cart_rule->id);
|
||||
}
|
||||
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,14 +681,14 @@ class AdminCartsControllerCore extends AdminController
|
||||
$errors[] = Tools::displayError('Can\'t add the voucher.');
|
||||
}
|
||||
}
|
||||
echo Tools::jsonEncode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));
|
||||
echo json_encode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateAddress()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
echo Tools::jsonEncode(array('addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang)));
|
||||
echo json_encode(array('addresses' => $this->context->customer->getAddresses((int)$this->context->cart->id_lang)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,7 +709,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
/*$this->context->cart->id_address_invoice = (int)$address_invoice->id;*/
|
||||
$this->context->cart->save();
|
||||
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -825,7 +825,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$to_return = array_merge($this->ajaxReturnVars(), array('found' => false));
|
||||
}
|
||||
|
||||
echo Tools::jsonEncode($to_return);
|
||||
echo json_encode($to_return);
|
||||
}
|
||||
|
||||
public function ajaxReturnVars()
|
||||
@@ -879,7 +879,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
|
||||
public function displayAjaxGetSummary()
|
||||
{
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateProductPrice()
|
||||
@@ -903,7 +903,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$specific_price->from = '0000-00-00 00:00:00';
|
||||
$specific_price->to = '0000-00-00 00:00:00';
|
||||
$specific_price->add();
|
||||
echo Tools::jsonEncode($this->ajaxReturnVars());
|
||||
echo json_encode($this->ajaxReturnVars());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -961,14 +961,14 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
public function ajaxProcessStatusCategory()
|
||||
{
|
||||
if (!$id_category = (int)Tools::getValue('id_category')) {
|
||||
die(Tools::jsonEncode(array('success' => false, 'error' => true, 'text' => $this->l('Failed to update the status'))));
|
||||
die(json_encode(array('success' => false, 'error' => true, 'text' => $this->l('Failed to update the status'))));
|
||||
} else {
|
||||
$category = new Category((int)$id_category);
|
||||
if (Validate::isLoadedObject($category)) {
|
||||
$category->active = $category->active == 1 ? 0 : 1;
|
||||
$category->save() ?
|
||||
die(Tools::jsonEncode(array('success' => true, 'text' => $this->l('The status has been updated successfully')))) :
|
||||
die(Tools::jsonEncode(array('success' => false, 'error' => true, 'text' => $this->l('Failed to update the status'))));
|
||||
die(json_encode(array('success' => true, 'text' => $this->l('The status has been updated successfully')))) :
|
||||
die(json_encode(array('success' => false, 'error' => true, 'text' => $this->l('Failed to update the status'))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('syncImapMail')) {
|
||||
die(Tools::jsonEncode($this->syncImap()));
|
||||
die(json_encode($this->syncImap()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1104,7 +1104,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$to_return = array('found' => false);
|
||||
}
|
||||
|
||||
$this->content = Tools::jsonEncode($to_return);
|
||||
$this->content = json_encode($to_return);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -370,7 +370,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
'extra' => (int)Tools::getValue('extra')
|
||||
);
|
||||
|
||||
die(Tools::jsonEncode(Hook::exec('dashboardData', $params, $id_module, true, true, (int)Tools::getValue('dashboard_use_push'))));
|
||||
die(json_encode(Hook::exec('dashboardData', $params, $id_module, true, true, (int)Tools::getValue('dashboard_use_push'))));
|
||||
}
|
||||
|
||||
public function ajaxProcessSetSimulationMode()
|
||||
@@ -437,7 +437,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($return));
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
public function ajaxProcessSaveDashConfig()
|
||||
@@ -475,6 +475,6 @@ class AdminDashboardControllerCore extends AdminController
|
||||
$return['widget_html'] = $module_obj->$hook($params);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($return));
|
||||
die(json_encode($return));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,6 +673,6 @@ class AdminEmployeesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($this->tabs_list));
|
||||
die(json_encode($this->tabs_list));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
$result['discount'] = $category_reduction;
|
||||
$result['hasError'] = false;
|
||||
}
|
||||
die(Tools::jsonEncode($result));
|
||||
die(json_encode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -665,7 +665,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$_FILES['file']['filename'] = $filename_prefix.str_replace('\0', '', $_FILES['file']['name']);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($_FILES));
|
||||
die(json_encode($_FILES));
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
|
||||
@@ -169,11 +169,11 @@ class AdminInformationControllerCore extends AdminController
|
||||
$this->file_list = array('missing' => array(), 'updated' => array());
|
||||
$xml = @simplexml_load_file(_PS_API_URL_.'/xml/md5/'._PS_VERSION_.'.xml');
|
||||
if (!$xml || !isset($xml->ps_root_dir[0])) {
|
||||
die(Tools::jsonEncode($this->file_list));
|
||||
die(json_encode($this->file_list));
|
||||
}
|
||||
|
||||
$this->getListOfUpdatedFiles($xml->ps_root_dir[0]);
|
||||
die(Tools::jsonEncode($this->file_list));
|
||||
die(json_encode($this->file_list));
|
||||
}
|
||||
|
||||
public function getListOfUpdatedFiles(SimpleXMLElement $dir, $path = '')
|
||||
|
||||
@@ -543,7 +543,7 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
|
||||
// Get all iso code available
|
||||
if ($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.Tools::getValue('ps_version').'&iso_lang='.Tools::strtolower(Tools::getValue('iso_lang')))) {
|
||||
$result = Tools::jsonDecode($lang_packs);
|
||||
$result = json_decode($lang_packs);
|
||||
if ($lang_packs !== '' && $result && !isset($result->error)) {
|
||||
$this->status = 'ok';
|
||||
$this->content = $lang_packs;
|
||||
|
||||
@@ -219,14 +219,14 @@ class AdminLoginControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('ajax')) {
|
||||
die(Tools::jsonEncode(array('hasErrors' => false, 'redirect' => $url)));
|
||||
die(json_encode(array('hasErrors' => false, 'redirect' => $url)));
|
||||
} else {
|
||||
$this->redirect_after = $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('ajax')) {
|
||||
die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => $this->errors)));
|
||||
die(json_encode(array('hasErrors' => true, 'errors' => $this->errors)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,19 +270,19 @@ class AdminLoginControllerCore extends AdminController
|
||||
if (!$result) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while attempting to change your password.');
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'hasErrors' => false,
|
||||
'confirm' => $this->l('Your password has been emailed to you.', 'AdminTab', false, false)
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'hasErrors' => true,
|
||||
'errors' => array(Tools::displayError('An error occurred while attempting to change your password.'))
|
||||
)));
|
||||
}
|
||||
} elseif (Tools::isSubmit('ajax')) {
|
||||
die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => $this->errors)));
|
||||
die(json_encode(array('hasErrors' => true, 'errors' => $this->errors)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
public function displayAjaxRefreshModuleList()
|
||||
{
|
||||
echo Tools::jsonEncode(array('status' => $this->status));
|
||||
echo json_encode(array('status' => $this->status));
|
||||
}
|
||||
|
||||
|
||||
@@ -1091,7 +1091,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
// Get the list of installed module ans prepare it for ajax call.
|
||||
if (($list = Tools::getValue('installed_modules'))) {
|
||||
Context::getContext()->smarty->assign('installed_modules', Tools::jsonEncode(explode('|', $list)));
|
||||
Context::getContext()->smarty->assign('installed_modules', json_encode(explode('|', $list)));
|
||||
}
|
||||
|
||||
// If redirect parameter is present and module already installed, we redirect on configuration module page
|
||||
@@ -1532,7 +1532,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// AutoComplete array
|
||||
$autocomplete_list .= Tools::jsonEncode(array(
|
||||
$autocomplete_list .= json_encode(array(
|
||||
'displayName' => (string)$module->displayName,
|
||||
'desc' => (string)$module->description,
|
||||
'name' => (string)$module->name,
|
||||
|
||||
@@ -552,7 +552,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
$hookableList['hasError'] = false;
|
||||
die(Tools::jsonEncode($hookableList));
|
||||
die(json_encode($hookableList));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($hookableModulesList));
|
||||
die(json_encode($hookableModulesList));
|
||||
}
|
||||
}
|
||||
public function ajaxProcessSaveHook()
|
||||
|
||||
@@ -1715,7 +1715,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$to_return = array('found' => false);
|
||||
}
|
||||
|
||||
$this->content = Tools::jsonEncode($to_return);
|
||||
$this->content = json_encode($to_return);
|
||||
}
|
||||
|
||||
public function ajaxProcessSendMailValidateOrder()
|
||||
@@ -1745,11 +1745,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
true,
|
||||
$cart->id_shop
|
||||
)) {
|
||||
die(Tools::jsonEncode(array('errors' => false, 'result' => $this->l('The email was sent to your customer.'))));
|
||||
die(json_encode(array('errors' => false, 'result' => $this->l('The email was sent to your customer.'))));
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->content = Tools::jsonEncode(array('errors' => true, 'result' => $this->l('Error in sending the email to your customer.')));
|
||||
$this->content = json_encode(array('errors' => true, 'result' => $this->l('Error in sending the email to your customer.')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1759,7 +1759,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$id_order = (int) Tools::getValue('id_order');
|
||||
$order = new Order($id_order);
|
||||
if (!Validate::isLoadedObject($order)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The order object cannot be loaded.')
|
||||
)));
|
||||
@@ -1768,7 +1768,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$old_cart_rules = Context::getContext()->cart->getCartRules();
|
||||
|
||||
if ($order->hasBeenShipped()) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot add products to delivered orders. ')
|
||||
)));
|
||||
@@ -1782,37 +1782,37 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$curr_date = date('Y-m-d');
|
||||
/*Validations*/
|
||||
if ($date_from == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter Check In Date.'),
|
||||
)));
|
||||
} elseif (!Validate::isDateFormat($date_from)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a Valid Check In Date.'),
|
||||
)));
|
||||
} elseif ($date_to == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter Check Out Date.'),
|
||||
)));
|
||||
} elseif (!Validate::isDateFormat($date_to)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a valid Check out Date.'),
|
||||
)));
|
||||
} elseif ($date_from < $curr_date) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check In date should not be date before current date.'),
|
||||
)));
|
||||
} elseif ($date_to <= $date_from) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check out Date Should be after Check In date.'),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($product_informations['product_quantity'])) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a valid Quantity.'),
|
||||
)));
|
||||
@@ -1836,19 +1836,19 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$total_available_rooms = $hotel_room_data['stats']['num_avail'];
|
||||
|
||||
if ($total_available_rooms < $req_rm) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Required number of rooms are not available.'),
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Some error occured Please try again.'),
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Some error occured Please try again.'),
|
||||
)));
|
||||
@@ -1865,7 +1865,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$idProduct = $product_informations['product_id'];
|
||||
$product = new Product($idProduct, false, $order->id_lang);
|
||||
if (!Validate::isLoadedObject($product)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The product object cannot be loaded.')
|
||||
)));
|
||||
@@ -1874,7 +1874,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if (isset($product_informations['product_attribute_id']) && $product_informations['product_attribute_id']) {
|
||||
$combination = new Combination($product_informations['product_attribute_id']);
|
||||
if (!Validate::isLoadedObject($combination)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The combination object cannot be loaded.')
|
||||
)));
|
||||
@@ -1986,9 +1986,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($update_quantity < 0) {
|
||||
// If product has attribute, minimal quantity is set with minimal quantity of attribute
|
||||
$minimal_quantity = ($product_informations['product_attribute_id']) ? Attribute::getAttributeMinimalQty($product_informations['product_attribute_id']) : $product->minimal_quantity;
|
||||
die(Tools::jsonEncode(array('error' => sprintf(Tools::displayError('You must add %d minimum quantity', false), $minimal_quantity))));
|
||||
die(json_encode(array('error' => sprintf(Tools::displayError('You must add %d minimum quantity', false), $minimal_quantity))));
|
||||
} elseif (!$update_quantity) {
|
||||
die(Tools::jsonEncode(array('error' => Tools::displayError('You already have the maximum quantity available for this product.', false))));
|
||||
die(json_encode(array('error' => Tools::displayError('You already have the maximum quantity available for this product.', false))));
|
||||
}
|
||||
|
||||
// If order is valid, we can create a new invoice or edit an existing invoice
|
||||
@@ -2264,7 +2264,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => true,
|
||||
//'view' => $this->createTemplate('_product_line.tpl')->fetch(),
|
||||
'can_edit' => $this->tabAccess['add'],
|
||||
@@ -2290,7 +2290,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
// $order_detail = new OrderDetail(Tools::getValue('id_order_detail'));
|
||||
// if (!Validate::isLoadedObject($order_detail))
|
||||
// die(Tools::jsonEncode(array(
|
||||
// die(json_encode(array(
|
||||
// 'result' => false,
|
||||
// 'error' => Tools::displayError('The OrderDetail object cannot be loaded.')
|
||||
// )));
|
||||
@@ -2298,7 +2298,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$id_product = Tools::getValue('id_product');
|
||||
$product = new Product($id_product);
|
||||
if (!Validate::isLoadedObject($product)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The product object cannot be loaded.')
|
||||
)));
|
||||
@@ -2306,13 +2306,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$address = new Address(Tools::getValue('id_address'));
|
||||
if (!Validate::isLoadedObject($address)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The address object cannot be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => true,
|
||||
'product' => $product,
|
||||
'tax_rate' => $product->getTaxesRate($address),
|
||||
@@ -2354,47 +2354,47 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$qty_diff = $product_quantity - $old_product_quantity;
|
||||
/*By webkul to validate fields before deleting the cart and order data form the tables*/
|
||||
if ($id_hotel == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Hotel Id is mising.'),
|
||||
)));
|
||||
} elseif ($id_room == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Room Id is missing.'),
|
||||
)));
|
||||
} elseif ($new_date_from == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter Check In Date.'),
|
||||
)));
|
||||
} elseif (!Validate::isDateFormat($new_date_from)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a Valid Check In Date.'),
|
||||
)));
|
||||
} elseif ($new_date_to == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter Check Out Date.'),
|
||||
)));
|
||||
} elseif (!Validate::isDateFormat($new_date_to)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Please Enter a valid Check out Date.'),
|
||||
)));
|
||||
} elseif ($new_date_from < $curr_date) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check In date should not be after current date.'),
|
||||
)));
|
||||
} elseif ($new_date_to <= $new_date_from) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check out Date Should be after Check In date.'),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($product_quantity)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity.'),
|
||||
)));
|
||||
@@ -2402,7 +2402,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$rooms_booked = $obj_booking_detail->getRoomBookinInformationForDateRangeByOrder($id_room, $old_date_from, $old_date_to, $new_date_from, $new_date_to);
|
||||
if ($rooms_booked) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('This Room Unavailable For Selected Duration.'),
|
||||
)));
|
||||
@@ -2580,7 +2580,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
));
|
||||
|
||||
if (!$res) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => $res,
|
||||
'error' => Tools::displayError('An error occurred while editing the product line.')
|
||||
)));
|
||||
@@ -2597,7 +2597,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$this->sendChangedNotification($order);
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => $res,
|
||||
'view' => $view,
|
||||
'can_edit' => $this->tabAccess['add'],
|
||||
@@ -2627,32 +2627,32 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$product_quantity = (int) $obj_booking_detail->getNumberOfDays($date_from, $date_to);
|
||||
/*By webkul to validate fields before deleting the cart and order data form the tables*/
|
||||
if ($id_hotel == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Hotel Id is mising.'),
|
||||
)));
|
||||
} elseif ($id_room == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Room Id is missing.'),
|
||||
)));
|
||||
} elseif ($date_from == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check In Date is missing.'),
|
||||
)));
|
||||
} elseif ($date_to == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check Out Date is missing.'),
|
||||
)));
|
||||
} elseif ($date_to == '') {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Check Out Date is missing.'),
|
||||
)));
|
||||
} elseif (!Validate::isUnsignedInt($product_quantity)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity.'),
|
||||
)));
|
||||
@@ -2757,7 +2757,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (!$res) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => $res,
|
||||
'error' => Tools::displayError('An error occurred while attempting to delete the product line.')
|
||||
)));
|
||||
@@ -2795,7 +2795,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$this->sendChangedNotification($order);
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => $res,
|
||||
'order' => $order,
|
||||
'invoices' => $invoice_array,
|
||||
@@ -2807,28 +2807,28 @@ class AdminOrdersControllerCore extends AdminController
|
||||
protected function doEditProductValidation(OrderDetail $order_detail, Order $order, OrderInvoice $order_invoice = null)
|
||||
{
|
||||
if (!Validate::isLoadedObject($order_detail)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The Order Detail object could not be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if (!empty($order_invoice) && !Validate::isLoadedObject($order_invoice)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The invoice object cannot be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($order)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The order object cannot be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if ($order_detail->id_order != $order->id) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot edit the order detail for this order.')
|
||||
)));
|
||||
@@ -2836,14 +2836,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
// We can't edit a delivered order
|
||||
if ($order->hasBeenDelivered()) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot edit a delivered order.')
|
||||
)));
|
||||
}
|
||||
|
||||
if (!empty($order_invoice) && $order_invoice->id_order != Tools::getValue('id_order')) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot use this invoice for the order')
|
||||
)));
|
||||
@@ -2854,21 +2854,21 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$product_price_tax_excl = str_replace(',', '.', Tools::getValue('product_price_tax_excl'));
|
||||
|
||||
if (!Validate::isPrice($product_price_tax_incl) || !Validate::isPrice($product_price_tax_excl)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid price')
|
||||
)));
|
||||
}
|
||||
//commented by webkul here quantity is gap between booking days which is calulated and validated in ajaxProcessEditProductOnOrder();
|
||||
/*if (!is_array(Tools::getValue('product_quantity')) && !Validate::isUnsignedInt(Tools::getValue('product_quantity')))
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity')
|
||||
)));
|
||||
elseif (is_array(Tools::getValue('product_quantity')))
|
||||
foreach (Tools::getValue('product_quantity') as $qty)
|
||||
if (!Validate::isUnsignedInt($qty))
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('Invalid quantity')
|
||||
)));*/
|
||||
@@ -2877,21 +2877,21 @@ class AdminOrdersControllerCore extends AdminController
|
||||
protected function doDeleteProductLineValidation(OrderDetail $order_detail, Order $order)
|
||||
{
|
||||
if (!Validate::isLoadedObject($order_detail)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The Order Detail object could not be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($order)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The order object cannot be loaded.')
|
||||
)));
|
||||
}
|
||||
|
||||
if ($order_detail->id_order != $order->id) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot delete the order detail.')
|
||||
)));
|
||||
@@ -2899,7 +2899,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
// We can't edit a delivered order
|
||||
if ($order->hasBeenDelivered()) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('You cannot edit a delivered order.')
|
||||
)));
|
||||
@@ -2916,13 +2916,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$StockAvailable = StockAvailable::getQuantityAvailableByProduct($order_detail->product_id, $order_detail->product_attribute_id, $order_detail->id_shop);
|
||||
$product = new Product($order_detail->product_id, true, null, $order_detail->id_shop);
|
||||
if (!Validate::isLoadedObject($product)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('The Product object could not be loaded.')
|
||||
)));
|
||||
} else {
|
||||
if (($StockAvailable < $add_quantity) && (!$product->isAvailableWhenOutOfStock((int)$product->out_of_stock))) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => false,
|
||||
'error' => Tools::displayError('This product is no longer in stock with those attributes ')
|
||||
)));
|
||||
@@ -3074,7 +3074,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$authorized_modules = array();
|
||||
|
||||
if (!Validate::isLoadedObject($customer) || !is_array($modules)) {
|
||||
die(Tools::jsonEncode(array('result' => false)));
|
||||
die(json_encode(array('result' => false)));
|
||||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
@@ -3093,7 +3093,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'payment_modules' => $payment_modules,
|
||||
));
|
||||
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'result' => true,
|
||||
'view' => $this->createTemplate('_select_payment.tpl')->fetch(),
|
||||
)));
|
||||
@@ -3128,7 +3128,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$result['status'] = 'failed';
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($result));
|
||||
die(json_encode($result));
|
||||
}
|
||||
|
||||
// To show rooms extra demands in the modal box in order details view page
|
||||
@@ -3238,8 +3238,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($idCartBooking = Tools::getValue('id_cart_booking')) {
|
||||
if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
$roomDemands = Tools::jsonDecode($roomDemands, true);
|
||||
$roomDemands = Tools::jsonEncode($roomDemands);
|
||||
$roomDemands = json_decode($roomDemands, true);
|
||||
$roomDemands = json_encode($roomDemands);
|
||||
$objCartbookingCata->extra_demands = $roomDemands;
|
||||
if ($objCartbookingCata->save()) {
|
||||
die('1');
|
||||
@@ -3255,7 +3255,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($idHtlBooking = Tools::getValue('id_htl_booking')) {
|
||||
if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail($idHtlBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
if ($roomDemands = Tools::jsonDecode($roomDemands, true)) {
|
||||
if ($roomDemands = json_decode($roomDemands, true)) {
|
||||
$order = new Order($objBookingDetail->id_order);
|
||||
$vatAddress = new Address((int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$idLang = (int)$order->id_lang;
|
||||
|
||||
@@ -1014,7 +1014,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$res = @memcache_get_server_status($memcache, $host, $port);
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode(array($res)));
|
||||
die(json_encode(array($res)));
|
||||
}
|
||||
}
|
||||
die;
|
||||
|
||||
@@ -600,7 +600,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function ajaxProcessAddAttachment()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '0') {
|
||||
return die(Tools::jsonEncode(array('error' => $this->l('You do not have the right permission'))));
|
||||
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
|
||||
}
|
||||
if (isset($_FILES['attachment_file'])) {
|
||||
if ((int)$_FILES['attachment_file']['error'] === 1) {
|
||||
@@ -720,7 +720,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($_FILES));
|
||||
die(json_encode($_FILES));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1296,7 +1296,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($json));
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
public function processSpecificPricePriorities()
|
||||
@@ -1632,7 +1632,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($json));
|
||||
die(json_encode($json));
|
||||
}
|
||||
|
||||
public function ajaxProcessDefaultProductAttribute()
|
||||
@@ -1656,7 +1656,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($json));
|
||||
die(json_encode($json));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1671,7 +1671,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$combinations[$key]['attributes'][] = array($combination['group_name'], $combination['attribute_name'], $combination['id_attribute']);
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($combinations));
|
||||
die(json_encode($combinations));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1732,13 +1732,13 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function ajaxProcessUpdateImagePosition()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '0') {
|
||||
return die(Tools::jsonEncode(array('error' => $this->l('You do not have the right permission'))));
|
||||
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
|
||||
}
|
||||
$res = false;
|
||||
if ($json = Tools::getValue('json')) {
|
||||
$res = true;
|
||||
$json = stripslashes($json);
|
||||
$images = Tools::jsonDecode($json, true);
|
||||
$images = json_decode($json, true);
|
||||
foreach ($images as $id => $position) {
|
||||
$img = new Image((int)$id);
|
||||
$img->position = (int)$position;
|
||||
@@ -1755,7 +1755,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function ajaxProcessUpdateCover()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '0') {
|
||||
return die(Tools::jsonEncode(array('error' => $this->l('You do not have the right permission'))));
|
||||
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
|
||||
}
|
||||
Image::deleteCover((int)Tools::getValue('id_product'));
|
||||
$img = new Image((int)Tools::getValue('id_image'));
|
||||
@@ -2742,7 +2742,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if ($manufacturers) {
|
||||
foreach ($manufacturers as $manufacturer) {
|
||||
$tmp = array("optionValue" => $manufacturer['id_manufacturer'], "optionDisplay" => htmlspecialchars(trim($manufacturer['name'])));
|
||||
$jsonArray[] = Tools::jsonEncode($tmp);
|
||||
$jsonArray[] = json_encode($tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2925,7 +2925,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function renderForm()
|
||||
{
|
||||
// This nice code (irony) is here to store the product name, because the row after will erase product name in multishop context
|
||||
$this->product_name = $this->object->name[$this->context->language->id];
|
||||
if (Validate::isLoadedObject(($this->object))) {
|
||||
$this->product_name = $this->object->name[$this->context->language->id];
|
||||
}
|
||||
|
||||
if (!method_exists($this, 'initForm'.$this->tab_display)) {
|
||||
return;
|
||||
@@ -2965,7 +2967,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->tpl_form_vars['token'] = $this->token;
|
||||
$this->tpl_form_vars['combinationImagesJs'] = $this->getCombinationImagesJs();
|
||||
$this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int)Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
|
||||
$this->tpl_form_vars['post_data'] = Tools::jsonEncode($_POST);
|
||||
$this->tpl_form_vars['post_data'] = json_encode($_POST);
|
||||
$this->tpl_form_vars['save_error'] = !empty($this->errors);
|
||||
$this->tpl_form_vars['mod_evasive'] = Tools::apacheModExists('evasive');
|
||||
$this->tpl_form_vars['mod_security'] = Tools::apacheModExists('security');
|
||||
@@ -3339,7 +3341,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
foreach ($hotelRoomInfo as &$room) {
|
||||
if ($room['id_status'] == 3) {
|
||||
$disabledDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
|
||||
$room['disabled_dates_json'] = Tools::jsonEncode($disabledDates);
|
||||
$room['disabled_dates_json'] = json_encode($disabledDates);
|
||||
}
|
||||
}
|
||||
$data->assign('htl_room_info', $hotelRoomInfo);
|
||||
@@ -3492,7 +3494,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$disableDtsArr = array();
|
||||
foreach ($room_status as $key => $status) {
|
||||
if ($status == 3) {
|
||||
$disableDtsArr[$key] = Tools::jsonDecode($disable_dates[$key], true);
|
||||
$disableDtsArr[$key] = json_decode($disable_dates[$key], true);
|
||||
$this->validateDisableDateRanges($disableDtsArr[$key]);
|
||||
}
|
||||
}
|
||||
@@ -3714,7 +3716,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if ($booking_calendar_data) {
|
||||
die(Tools::jsonEncode($booking_calendar_data));
|
||||
die(json_encode($booking_calendar_data));
|
||||
} else {
|
||||
die(0);
|
||||
}
|
||||
@@ -4793,7 +4795,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array($image_uploader->getName() => $files)));
|
||||
die(json_encode(array($image_uploader->getName() => $files)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5421,28 +5423,28 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function ajaxProcessProductQuantity()
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '0') {
|
||||
return die(Tools::jsonEncode(array('error' => $this->l('You do not have the right permission'))));
|
||||
return die(json_encode(array('error' => $this->l('You do not have the right permission'))));
|
||||
}
|
||||
if (!Tools::getValue('actionQty')) {
|
||||
return Tools::jsonEncode(array('error' => $this->l('Undefined action')));
|
||||
return json_encode(array('error' => $this->l('Undefined action')));
|
||||
}
|
||||
|
||||
$product = new Product((int)Tools::getValue('id_product'), true);
|
||||
switch (Tools::getValue('actionQty')) {
|
||||
case 'depends_on_stock':
|
||||
if (Tools::getValue('value') === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if ((int)Tools::getValue('value') != 0 && (int)Tools::getValue('value') != 1) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Incorrect value'))));
|
||||
die(json_encode(array('error' => $this->l('Incorrect value'))));
|
||||
}
|
||||
if (!$product->advanced_stock_management && (int)Tools::getValue('value') == 1) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Not possible if advanced stock management is disabled. '))));
|
||||
die(json_encode(array('error' => $this->l('Not possible if advanced stock management is disabled. '))));
|
||||
}
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)Tools::getValue('value') == 1 && (Pack::isPack($product->id) && !Pack::allUsesAdvancedStockManagement($product->id)
|
||||
&& ($product->pack_stock_type == 2 || $product->pack_stock_type == 1 ||
|
||||
($product->pack_stock_type == 3 && (Configuration::get('PS_PACK_STOCK_TYPE') == 1 || Configuration::get('PS_PACK_STOCK_TYPE') == 2))))) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('You cannot use advanced stock management for this pack because').'<br />'.
|
||||
die(json_encode(array('error' => $this->l('You cannot use advanced stock management for this pack because').'<br />'.
|
||||
$this->l('- advanced stock management is not enabled for these room types').'<br />'.
|
||||
$this->l('- you have chosen to decrement room types quantities.'))));
|
||||
}
|
||||
@@ -5453,15 +5455,15 @@ class AdminProductsControllerCore extends AdminController
|
||||
case 'pack_stock_type':
|
||||
$value = Tools::getValue('value');
|
||||
if ($value === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if ((int)$value != 0 && (int)$value != 1
|
||||
&& (int)$value != 2 && (int)$value != 3) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Incorrect value'))));
|
||||
die(json_encode(array('error' => $this->l('Incorrect value'))));
|
||||
}
|
||||
if ($product->depends_on_stock && !Pack::allUsesAdvancedStockManagement($product->id) && ((int)$value == 1
|
||||
|| (int)$value == 2 || ((int)$value == 3 && (Configuration::get('PS_PACK_STOCK_TYPE') == 1 || Configuration::get('PS_PACK_STOCK_TYPE') == 2)))) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('You cannot use this stock management option because:').'<br />'.
|
||||
die(json_encode(array('error' => $this->l('You cannot use this stock management option because:').'<br />'.
|
||||
$this->l('- advanced stock management is not enabled for these room types').'<br />'.
|
||||
$this->l('- advanced stock management is enabled for the pack'))));
|
||||
}
|
||||
@@ -5471,10 +5473,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
case 'out_of_stock':
|
||||
if (Tools::getValue('value') === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if (!in_array((int)Tools::getValue('value'), array(0, 1, 2))) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Incorrect value'))));
|
||||
die(json_encode(array('error' => $this->l('Incorrect value'))));
|
||||
}
|
||||
|
||||
StockAvailable::setProductOutOfStock($product->id, (int)Tools::getValue('value'));
|
||||
@@ -5482,10 +5484,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
case 'set_qty':
|
||||
if (Tools::getValue('value') === false || (!is_numeric(trim(Tools::getValue('value'))))) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if (Tools::getValue('id_product_attribute') === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined id room type attribute'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined id room type attribute'))));
|
||||
}
|
||||
|
||||
StockAvailable::setQuantity($product->id, (int)Tools::getValue('id_product_attribute'), (int)Tools::getValue('value'));
|
||||
@@ -5495,18 +5497,18 @@ class AdminProductsControllerCore extends AdminController
|
||||
$error = ob_get_contents();
|
||||
if (!empty($error)) {
|
||||
ob_end_clean();
|
||||
die(Tools::jsonEncode(array('error' => $error)));
|
||||
die(json_encode(array('error' => $error)));
|
||||
}
|
||||
break;
|
||||
case 'advanced_stock_management' :
|
||||
if (Tools::getValue('value') === false) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Undefined value'))));
|
||||
die(json_encode(array('error' => $this->l('Undefined value'))));
|
||||
}
|
||||
if ((int)Tools::getValue('value') != 1 && (int)Tools::getValue('value') != 0) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Incorrect value'))));
|
||||
die(json_encode(array('error' => $this->l('Incorrect value'))));
|
||||
}
|
||||
if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && (int)Tools::getValue('value') == 1) {
|
||||
die(Tools::jsonEncode(array('error' => $this->l('Not possible if advanced stock management is disabled. '))));
|
||||
die(json_encode(array('error' => $this->l('Not possible if advanced stock management is disabled. '))));
|
||||
}
|
||||
|
||||
$product->setAdvancedStockManagement((int)Tools::getValue('value'));
|
||||
@@ -5516,7 +5518,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
break;
|
||||
|
||||
}
|
||||
die(Tools::jsonEncode(array('error' => false)));
|
||||
die(json_encode(array('error' => false)));
|
||||
}
|
||||
|
||||
public function getCombinationImagesJS()
|
||||
@@ -5666,7 +5668,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
GROUP BY pl.`id_product`
|
||||
LIMIT '.(int)$limit);
|
||||
}
|
||||
die(Tools::jsonEncode($result));
|
||||
die(json_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ class AdminQuickAccessesControllerCore extends AdminController
|
||||
public function getQuickAccessesList()
|
||||
{
|
||||
$links = QuickAccess::getQuickAccesses($this->context->language->id);
|
||||
return Tools::jsonEncode(array_map(array($this, 'getLinkToken'), $links));
|
||||
return json_encode(array_map(array($this, 'getLinkToken'), $links));
|
||||
}
|
||||
|
||||
public function getLinkToken($item)
|
||||
@@ -195,7 +195,7 @@ class AdminQuickAccessesControllerCore extends AdminController
|
||||
$this->errors = array_unique($this->errors);
|
||||
if (!empty($this->errors)) {
|
||||
$this->errors['has_errors'] = true;
|
||||
$this->ajaxDie(Tools::jsonEncode($this->errors));
|
||||
$this->ajaxDie(json_encode($this->errors));
|
||||
return false;
|
||||
}
|
||||
return $this->getQuickAccessesList();
|
||||
|
||||
@@ -197,7 +197,7 @@ class AdminRequestSqlControllerCore extends AdminController
|
||||
unset($attributes[$key]['Default']);
|
||||
unset($attributes[$key]['Extra']);
|
||||
}
|
||||
die(Tools::jsonEncode($attributes));
|
||||
die(json_encode($attributes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
$iso_lang = Tools::strtolower(Context::getContext()->language->iso_code);
|
||||
$iso_country = Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')));
|
||||
if (($json_content = Tools::file_get_contents('https://api-addons.prestashop.com/'._PS_VERSION_.'/search/'.urlencode($this->query).'/'.$iso_country.'/'.$iso_lang.'/')) != false) {
|
||||
$results = Tools::jsonDecode($json_content, true);
|
||||
$results = json_decode($json_content, true);
|
||||
if (isset($results['id'])) {
|
||||
$this->_list['addons'] = array($results);
|
||||
} else {
|
||||
|
||||
@@ -36,7 +36,7 @@ class AdminShopControllerCore extends AdminController
|
||||
$this->table = 'shop';
|
||||
$this->className = 'Shop';
|
||||
$this->multishop_context = Shop::CONTEXT_ALL;
|
||||
|
||||
|
||||
$this->id_shop_group = (int)Tools::getValue('id_shop_group');
|
||||
|
||||
/* if $_GET['id_shop'] is transmitted, virtual url can be loaded in config.php, so we wether transmit shop_id in herfs */
|
||||
@@ -250,7 +250,7 @@ class AdminShopControllerCore extends AdminController
|
||||
elseif (Shop::getTotalShops() == 1)
|
||||
$this->errors[] = Tools::displayError('You cannot disable the last shop.');
|
||||
}*/
|
||||
|
||||
|
||||
if (Tools::isSubmit('submitAddshopAndStay') || Tools::isSubmit('submitAddshop')) {
|
||||
$shop_group = new ShopGroup((int)Tools::getValue('id_shop_group'));
|
||||
if ($shop_group->shopNameExists(Tools::getValue('name'), (int)Tools::getValue('id_shop'))) {
|
||||
@@ -475,7 +475,7 @@ class AdminShopControllerCore extends AdminController
|
||||
$root_category = new Category($root_categories[0]['id_category']);
|
||||
$children = $root_category->getAllChildren($this->context->language->id);
|
||||
$selected_cat[] = $root_categories[0]['id_category'];
|
||||
|
||||
|
||||
foreach ($children as $child) {
|
||||
$selected_cat[] = $child->id;
|
||||
}
|
||||
@@ -576,7 +576,7 @@ class AdminShopControllerCore extends AdminController
|
||||
'zone' => $this->l('Zones'),
|
||||
'cart_rule' => $this->l('Cart rules'),
|
||||
);
|
||||
|
||||
|
||||
// Hook for duplication of shop data
|
||||
$modules_list = Hook::getHookModuleExecList('actionShopDataDuplication');
|
||||
if (is_array($modules_list) && count($modules_list) > 0) {
|
||||
@@ -586,7 +586,7 @@ class AdminShopControllerCore extends AdminController
|
||||
}
|
||||
|
||||
asort($import_data);
|
||||
|
||||
|
||||
if (!$this->object->id) {
|
||||
$this->fields_import_form = array(
|
||||
'radio' => array(
|
||||
@@ -615,9 +615,9 @@ class AdminShopControllerCore extends AdminController
|
||||
|
||||
$this->fields_value = array(
|
||||
'id_shop_group' => (Tools::getValue('id_shop_group') ? Tools::getValue('id_shop_group') :
|
||||
(isset($obj->id_shop_group)) ? $obj->id_shop_group : Shop::getContextShopGroupID()),
|
||||
((isset($obj->id_shop_group)) ? $obj->id_shop_group : Shop::getContextShopGroupID())),
|
||||
'id_category' => (Tools::getValue('id_category') ? Tools::getValue('id_category') :
|
||||
(isset($obj->id_category)) ? $obj->id_category : (int)Configuration::get('PS_HOME_CATEGORY')),
|
||||
((isset($obj->id_category)) ? $obj->id_category : (int)Configuration::get('PS_HOME_CATEGORY'))),
|
||||
'id_theme_checked' => (isset($obj->id_theme) ? $obj->id_theme : $id_theme)
|
||||
);
|
||||
|
||||
@@ -653,7 +653,7 @@ class AdminShopControllerCore extends AdminController
|
||||
if (Tools::isSubmit('id_category_default')) {
|
||||
$_POST['id_category'] = (int)Tools::getValue('id_category_default');
|
||||
}
|
||||
|
||||
|
||||
/* Checking fields validity */
|
||||
$this->validateRules();
|
||||
|
||||
@@ -711,13 +711,13 @@ class AdminShopControllerCore extends AdminController
|
||||
if (!array_key_exists('Edit', self::$cache_lang)) {
|
||||
self::$cache_lang['Edit'] = $this->l('Edit', 'Helper');
|
||||
}
|
||||
|
||||
|
||||
$tpl->assign(array(
|
||||
'href' => $this->context->link->getAdminLink('AdminShop').'&shop_id='.(int)$id.'&update'.$this->table,
|
||||
'action' => self::$cache_lang['Edit'],
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
|
||||
return $tpl->fetch();
|
||||
} else {
|
||||
return;
|
||||
@@ -738,7 +738,7 @@ class AdminShopControllerCore extends AdminController
|
||||
$root_category = new Category($root_categories[0]['id_category']);
|
||||
$children = $root_category->getAllChildren($this->context->language->id);
|
||||
$selected_cat[] = $root_categories[0]['id_category'];
|
||||
|
||||
|
||||
foreach ($children as $child) {
|
||||
$selected_cat[] = $child->id;
|
||||
}
|
||||
@@ -860,6 +860,6 @@ class AdminShopControllerCore extends AdminController
|
||||
'children' => $tree,
|
||||
));
|
||||
|
||||
die(Tools::jsonEncode($tree));
|
||||
die(json_encode($tree));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ class AdminShopUrlControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$this->tpl_form_vars = array(
|
||||
'js_shop_url' => Tools::jsonEncode($list_shop_with_url)
|
||||
'js_shop_url' => json_encode($list_shop_with_url)
|
||||
);
|
||||
|
||||
$this->fields_value = array(
|
||||
|
||||
@@ -542,7 +542,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
}
|
||||
$value .= '%';
|
||||
|
||||
// ConfigurationKPI::updateValue('CONVERSION_RATE_CHART', Tools::jsonEncode($data));
|
||||
// ConfigurationKPI::updateValue('CONVERSION_RATE_CHART', json_encode($data));
|
||||
ConfigurationKPI::updateValue('CONVERSION_RATE', $value);
|
||||
ConfigurationKPI::updateValue('CONVERSION_RATE_EXPIRE', strtotime(date('Y-m-d 00:00:00', strtotime('+1 day'))));
|
||||
break;
|
||||
@@ -793,8 +793,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
if (isset($data)) {
|
||||
$array['data'] = $data;
|
||||
}
|
||||
die(Tools::jsonEncode($array));
|
||||
die(json_encode($array));
|
||||
}
|
||||
die(Tools::jsonEncode(array('has_errors' => true)));
|
||||
die(json_encode(array('has_errors' => true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
}
|
||||
$this->content .= $this->renderView();
|
||||
}
|
||||
|
||||
|
||||
$this->content .= $this->displayMenu();
|
||||
$this->content .= $this->displayCalendar();
|
||||
$this->content .= $this->displayStats();
|
||||
@@ -97,7 +97,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
$identifier = 'module';
|
||||
$id = Tools::getValue('module');
|
||||
}
|
||||
|
||||
|
||||
$action = Context::getContext()->link->getAdminLink('AdminStats');
|
||||
$action .= ($action && $table ? '&'.Tools::safeOutput($action) : '');
|
||||
$action .= ($identifier && $id ? '&'.Tools::safeOutput($identifier).'='.(int)$id : '');
|
||||
@@ -172,7 +172,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
|
||||
public function checkModulesNames($a, $b)
|
||||
{
|
||||
return (bool)($a['displayName'] > $b['displayName']);
|
||||
@@ -205,7 +205,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
if (!isset($module_instance)) {
|
||||
$module_instance = Module::getInstanceByName($module_name);
|
||||
}
|
||||
|
||||
|
||||
if ($module_instance && $module_instance->active) {
|
||||
$hook = Hook::exec('displayAdminStatsModules', null, $module_instance->id);
|
||||
}
|
||||
@@ -223,9 +223,9 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
public function postProcess()
|
||||
{
|
||||
$this->context = Context::getContext();
|
||||
|
||||
|
||||
$this->processDateRange();
|
||||
|
||||
|
||||
if (Tools::getValue('submitSettings')) {
|
||||
if ($this->tabAccess['edit'] === '1') {
|
||||
self::$currentIndex .= '&module='.Tools::getValue('module');
|
||||
@@ -237,7 +237,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function processDateRange()
|
||||
{
|
||||
if (Tools::isSubmit('submitDatePicker')) {
|
||||
@@ -281,21 +281,21 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessSetDashboardDateRange()
|
||||
{
|
||||
$this->processDateRange();
|
||||
|
||||
|
||||
if ($this->isXmlHttpRequest()) {
|
||||
if (is_array($this->errors) && count($this->errors)) {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'has_errors' => true,
|
||||
'errors' => array($this->errors),
|
||||
'date_from' => $this->context->employee->stats_date_from,
|
||||
'date_to' => $this->context->employee->stats_date_to)
|
||||
));
|
||||
} else {
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'has_errors' => false,
|
||||
'date_from' => $this->context->employee->stats_date_from,
|
||||
'date_to' => $this->context->employee->stats_date_to)
|
||||
|
||||
@@ -719,7 +719,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$this->tpl_form_vars['products_list'] = $products;
|
||||
$this->tpl_form_vars['product_ids'] = implode($product_ids, '|');
|
||||
$this->tpl_form_vars['product_ids'] = implode('|', $product_ids);
|
||||
$this->tpl_form_vars['product_ids_to_delete'] = '';
|
||||
$this->tpl_form_vars['supplier_id'] = $supply_order->id_supplier;
|
||||
$this->tpl_form_vars['currency'] = $currency;
|
||||
@@ -1771,7 +1771,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
if ($items) {
|
||||
die(Tools::jsonEncode($items));
|
||||
die(json_encode($items));
|
||||
}
|
||||
|
||||
die(1);
|
||||
|
||||
@@ -546,7 +546,7 @@ class AdminTaxRulesGroupControllerCore extends AdminController
|
||||
foreach ($tax_rules as $key => $result) {
|
||||
$output[$key] = $result;
|
||||
}
|
||||
die(Tools::jsonEncode($output));
|
||||
die(json_encode($output));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -179,8 +179,8 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$file_name = $this->link_lang_pack.'?version='._PS_VERSION_;
|
||||
$array_stream_context = @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 8)));
|
||||
if ($lang_packs = Tools::file_get_contents($file_name, false, $array_stream_context)) {
|
||||
// Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us
|
||||
if ($lang_packs != '' && $lang_packs = Tools::jsonDecode($lang_packs, true)) {
|
||||
// Notice : for php < 5.2 compatibility, json_decode. The second parameter to true will set us
|
||||
if ($lang_packs != '' && $lang_packs = json_decode($lang_packs, true)) {
|
||||
foreach ($lang_packs as $key => $lang_pack) {
|
||||
if (!Language::isInstalled($lang_pack['iso_code'])) {
|
||||
$packs_to_install[$key] = $lang_pack;
|
||||
@@ -1019,7 +1019,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$arr_good_ext = array('.tpl', '.php');
|
||||
|
||||
foreach ($files as $key => $file) {
|
||||
if ($file{0} === '.' || in_array(substr($file, 0, strrpos($file, '.')), $this->all_iso_lang)) {
|
||||
if ($file[0] === '.' || in_array(substr($file, 0, strrpos($file, '.')), $this->all_iso_lang)) {
|
||||
unset($files[$key]);
|
||||
} elseif ($type_clear === 'file' && !in_array(substr($file, strrpos($file, '.')), $arr_good_ext)) {
|
||||
unset($files[$key]);
|
||||
@@ -2872,7 +2872,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$initial_root_dir = $root_dir;
|
||||
foreach ($modules as $module) {
|
||||
$root_dir = $initial_root_dir;
|
||||
if ($module{0} == '.') {
|
||||
if ($module[0] == '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ class AddressControllerCore extends FrontController
|
||||
'hasError' => (bool)$this->errors,
|
||||
'errors' => $this->errors
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ class AddressControllerCore extends FrontController
|
||||
'id_address_delivery' => (int)$this->context->cart->id_address_delivery,
|
||||
'id_address_invoice' => (int)$this->context->cart->id_address_invoice
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
|
||||
// Redirect to old page or current page
|
||||
@@ -364,7 +364,7 @@ class AddressControllerCore extends FrontController
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ class AuthControllerCore extends FrontController
|
||||
'page' => $this->context->smarty->fetch($this->template),
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ class AuthControllerCore extends FrontController
|
||||
'errors' => $this->errors,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
} else {
|
||||
$this->context->smarty->assign('authentification_error', $this->errors);
|
||||
}
|
||||
@@ -516,7 +516,7 @@ class AuthControllerCore extends FrontController
|
||||
'id_address_invoice' => $this->context->cart->id_address_invoice,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
|
||||
if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) {
|
||||
@@ -690,7 +690,7 @@ class AuthControllerCore extends FrontController
|
||||
'id_address_invoice' => $this->context->cart->id_address_invoice,
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
// if registration type is in two steps, we redirect to register address
|
||||
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) {
|
||||
@@ -730,7 +730,7 @@ class AuthControllerCore extends FrontController
|
||||
'isSaved' => false,
|
||||
'id_customer' => 0
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
$this->context->smarty->assign('account_error', $this->errors);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class CartControllerCore extends FrontController
|
||||
}
|
||||
} elseif (!$this->isTokenValid()) {
|
||||
if (Tools::getValue('ajax')) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasError' => true,
|
||||
'errors' => array(Tools::displayError('Impossible to add the product to the cart. Please refresh page.')),
|
||||
)));
|
||||
@@ -137,7 +137,7 @@ class CartControllerCore extends FrontController
|
||||
}
|
||||
|
||||
if ($total_quantity < $minimal_quantity) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasError' => true,
|
||||
'errors' => array(sprintf(Tools::displayError('You must add %d minimum quantity', !Tools::getValue('ajax')), $minimal_quantity)),
|
||||
)));
|
||||
@@ -210,7 +210,7 @@ class CartControllerCore extends FrontController
|
||||
$new_id_address_delivery = (int)Tools::getValue('new_id_address_delivery');
|
||||
|
||||
if (!count(Carrier::getAvailableCarrierList(new Product($this->id_product), null, $new_id_address_delivery))) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasErrors' => true,
|
||||
'error' => Tools::displayError('It is not possible to deliver this product to the selected address.', false),
|
||||
)));
|
||||
@@ -312,7 +312,7 @@ class CartControllerCore extends FrontController
|
||||
if (isset($hotel_room_data['stats']['num_avail'])) {
|
||||
$total_available_rooms = $hotel_room_data['stats']['num_avail'];
|
||||
if ($total_available_rooms < $req_rm) {
|
||||
die(Tools::jsonEncode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms)));
|
||||
die(json_encode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms)));
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Rooms are unavailable. Please try with different dates');
|
||||
@@ -322,10 +322,10 @@ class CartControllerCore extends FrontController
|
||||
}
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status' => 'failed3')));
|
||||
die(json_encode(array('status' => 'failed3')));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status' => 'failed4')));
|
||||
die(json_encode(array('status' => 'failed4')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,8 +416,8 @@ class CartControllerCore extends FrontController
|
||||
foreach ($hotel_room_info_arr as $key_hotel_room_info => $val_hotel_room_info) {
|
||||
if ($chkQty < $req_rm) {
|
||||
$roomDemand = Tools::getValue('roomDemands');
|
||||
$roomDemand = Tools::jsonDecode($roomDemand, true);
|
||||
$roomDemand = Tools::jsonEncode($roomDemand);
|
||||
$roomDemand = json_decode($roomDemand, true);
|
||||
$roomDemand = json_encode($roomDemand);
|
||||
$obj_htl_cart_booking_data = new HotelCartBookingData();
|
||||
$obj_htl_cart_booking_data->id_cart = $this->context->cart->id;
|
||||
$obj_htl_cart_booking_data->id_guest = $this->context->cart->id_guest;
|
||||
@@ -519,10 +519,10 @@ class CartControllerCore extends FrontController
|
||||
public function displayAjax()
|
||||
{
|
||||
if ($this->errors) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array('hasError' => true, 'errors' => $this->errors)));
|
||||
$this->ajaxDie(json_encode(array('hasError' => true, 'errors' => $this->errors)));
|
||||
}
|
||||
if ($this->ajax_refresh) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array('refresh' => true)));
|
||||
$this->ajaxDie(json_encode(array('refresh' => true)));
|
||||
}
|
||||
|
||||
// write cookie if can't on destruct
|
||||
@@ -560,7 +560,7 @@ class CartControllerCore extends FrontController
|
||||
|
||||
$json = '';
|
||||
Hook::exec('actionCartListOverride', array('summary' => $result, 'json' => &$json));
|
||||
$this->ajaxDie(Tools::jsonEncode(array_merge($result, (array)Tools::jsonDecode($json, true))));
|
||||
$this->ajaxDie(json_encode(array_merge($result, (array)json_decode($json, true))));
|
||||
}
|
||||
// @todo create a hook
|
||||
elseif (file_exists(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php')) {
|
||||
|
||||
@@ -305,7 +305,7 @@ class ContactControllerCore extends FrontController
|
||||
if (Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
|
||||
$hotelLocationArray = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY'));
|
||||
if ($hotelLocationArray) {
|
||||
$this->context->smarty->assign('hotelLocationArray', Tools::jsonEncode($hotelLocationArray));
|
||||
$this->context->smarty->assign('hotelLocationArray', json_encode($hotelLocationArray));
|
||||
}
|
||||
}
|
||||
//End
|
||||
|
||||
@@ -138,7 +138,7 @@ class OrderControllerCore extends ParentOrderController
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
|
||||
if ($this->nbProducts) {
|
||||
|
||||
@@ -208,7 +208,7 @@ class OrderDetailControllerCore extends FrontController
|
||||
$hasError = 1;
|
||||
}
|
||||
if ($bookingRefunds = Tools::getValue('bookings_to_refund')) {
|
||||
if (!count($bookingRefunds = Tools::jsonDecode($bookingRefunds, true))) {
|
||||
if (!count($bookingRefunds = json_decode($bookingRefunds, true))) {
|
||||
$hasError = 1;
|
||||
} else {
|
||||
foreach ($bookingRefunds as $idHtlBooking) {
|
||||
@@ -248,9 +248,9 @@ class OrderDetailControllerCore extends FrontController
|
||||
// Emails to customer, admin on refund request state change
|
||||
$objOrderReturn->changeIdOrderReturnState(OrderReturnState::ORDER_RETRUN_FIRST_STATUS, $objOrderReturn->id);
|
||||
|
||||
die(Tools::jsonEncode(array('status' => 1)));
|
||||
die(json_encode(array('status' => 1)));
|
||||
}
|
||||
die(Tools::jsonEncode(array('status' => 0)));
|
||||
die(json_encode(array('status' => 0)));
|
||||
}
|
||||
// END ajax request handle
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$this->getFormatedSummaryDetail()
|
||||
);
|
||||
Cart::addExtraCarriers($return);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating the cart.');
|
||||
}
|
||||
@@ -89,7 +89,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
case 'updateTOSStatusAndGetPayments':
|
||||
if (Tools::isSubmit('checked')) {
|
||||
$this->context->cookie->checkedTOS = (int)Tools::getValue('checked');
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'),
|
||||
'HOOK_PAYMENT' => $this->_getPaymentMethods()
|
||||
)));
|
||||
@@ -97,7 +97,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
break;
|
||||
|
||||
case 'getCarrierList':
|
||||
$this->ajaxDie(Tools::jsonEncode($this->_getCarrierList()));
|
||||
$this->ajaxDie(json_encode($this->_getCarrierList()));
|
||||
break;
|
||||
|
||||
case 'editCustomer':
|
||||
@@ -132,14 +132,14 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
} else {
|
||||
$return['isSaved'] = false;
|
||||
}
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
break;
|
||||
|
||||
case 'getAddressBlockAndCarriersAndPayments':
|
||||
if ($this->context->customer->isLogged() || $this->context->customer->isGuest()) {
|
||||
// check if customer have addresses
|
||||
if (!Customer::getAddressesTotalById($this->context->customer->id)) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array('no_address' => 1)));
|
||||
$this->ajaxDie(json_encode(array('no_address' => 1)));
|
||||
}
|
||||
if (file_exists(_PS_MODULE_DIR_.'blockuserinfo/blockuserinfo.php')) {
|
||||
include_once(_PS_MODULE_DIR_.'blockuserinfo/blockuserinfo.php');
|
||||
@@ -183,7 +183,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
),
|
||||
$this->getFormatedSummaryDetail()
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($return));
|
||||
$this->ajaxDie(json_encode($return));
|
||||
}
|
||||
die(Tools::displayError());
|
||||
break;
|
||||
@@ -265,11 +265,11 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
'refresh' => (bool)$this->ajax_refresh),
|
||||
$this->getFormatedSummaryDetail()
|
||||
);
|
||||
$this->ajaxDie(Tools::jsonEncode($result));
|
||||
$this->ajaxDie(json_encode($result));
|
||||
}
|
||||
}
|
||||
if (count($this->errors)) {
|
||||
$this->ajaxDie(Tools::jsonEncode(array(
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasError' => true,
|
||||
'errors' => $this->errors
|
||||
)));
|
||||
@@ -958,8 +958,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
if ($idCartBooking = Tools::getValue('id_cart_booking')) {
|
||||
if (Validate::isLoadedObject($objCartbookingCata = new HotelCartBookingData($idCartBooking))) {
|
||||
$roomDemands = Tools::getValue('room_demands');
|
||||
$roomDemands = Tools::jsonDecode($roomDemands, true);
|
||||
$roomDemands = Tools::jsonEncode($roomDemands);
|
||||
$roomDemands = json_decode($roomDemands, true);
|
||||
$roomDemands = json_encode($roomDemands);
|
||||
$objCartbookingCata->extra_demands = $roomDemands;
|
||||
if ($objCartbookingCata->save()) {
|
||||
die('1');
|
||||
|
||||
@@ -969,7 +969,7 @@ class ProductControllerCore extends FrontController
|
||||
$totalPrice += $totalRoomPrice;
|
||||
$demandsPrice = 0;
|
||||
if ($roomDemand = Tools::getValue('room_demands')) {
|
||||
if ($roomDemand = Tools::jsonDecode($roomDemand, true)) {
|
||||
if ($roomDemand = json_decode($roomDemand, true)) {
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
$demandsPrice = $objRoomDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$idProduct,
|
||||
@@ -1009,6 +1009,6 @@ class ProductControllerCore extends FrontController
|
||||
$result['msg'] = 'failed3';
|
||||
$result['avail_rooms'] = 0;
|
||||
}
|
||||
die(Tools::jsonEncode($result));
|
||||
die(json_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +64,12 @@ class SearchControllerCore extends FrontController
|
||||
}
|
||||
Hook::exec('actionSearch', array('expr' => $query, 'total' => count($searchResults)));
|
||||
}
|
||||
$this->ajaxDie(Tools::jsonEncode($searchResults));
|
||||
$this->ajaxDie(json_encode($searchResults));
|
||||
}
|
||||
|
||||
//Only controller content initialization when the user use the normal search
|
||||
parent::initContent();
|
||||
|
||||
|
||||
$product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int)$this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
|
||||
|
||||
if ($this->instant_search && !is_array($query)) {
|
||||
|
||||
@@ -430,7 +430,7 @@ abstract class InstallControllerHttp
|
||||
if (!$success && empty($message)) {
|
||||
$message = print_r(@error_get_last(), true);
|
||||
}
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'success' => (bool)$success,
|
||||
'message' => $message,
|
||||
// 'memory' => round(memory_get_peak_usage()/1024/1024, 2).' Mo',
|
||||
|
||||
@@ -221,7 +221,7 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
|
||||
$this->model_install->xml_loader_ids = $this->datas->xml_loader_ids;
|
||||
$result = $this->model_install->populateDatabase();
|
||||
$this->datas->xml_loader_ids = $this->model_install->xml_loader_ids;
|
||||
Configuration::updateValue('PS_INSTALL_XML_LOADERS_ID', Tools::jsonEncode($this->datas->xml_loader_ids));
|
||||
Configuration::updateValue('PS_INSTALL_XML_LOADERS_ID', json_encode($this->datas->xml_loader_ids));
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
|
||||
{
|
||||
$this->initializeContext();
|
||||
|
||||
if ((!$this->datas->xml_loader_ids || !is_array($this->datas->xml_loader_ids)) && ($xml_ids = Tools::jsonDecode(Configuration::get('PS_INSTALL_XML_LOADERS_ID'), true))) {
|
||||
if ((!$this->datas->xml_loader_ids || !is_array($this->datas->xml_loader_ids)) && ($xml_ids = json_decode(Configuration::get('PS_INSTALL_XML_LOADERS_ID'), true))) {
|
||||
$this->datas->xml_loader_ids = $xml_ids;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ class InstallControllerHttpSystem extends InstallControllerHttp
|
||||
'max_execution_time' => $this->l('In the PHP configuration set max_execution_time to minimum 500'),
|
||||
'upload_max_filesize' => $this->l('In the PHP configuration set upload_max_filesize to minimum 16M'),
|
||||
'fopen' => $this->l('Cannot open external URLs (requires allow_url_fopen as On).'),
|
||||
'zip' => $this->l('ZIP extension is not enabled'),
|
||||
)
|
||||
),
|
||||
array(
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
$this->loader->setDefaultPath();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var dependencies = <?php echo Tools::jsonEncode($dependencies) ?>;
|
||||
var dependencies = <?php echo json_encode($dependencies) ?>;
|
||||
</script>
|
||||
<form action="" method="post">
|
||||
Selectionnez la liste des entités à resynchroniser. Afin d'éviter au maximum les erreurs, sélectionnez uniquement les entitiés que vous avez modifier.
|
||||
|
||||
@@ -25,4 +25,4 @@
|
||||
*/
|
||||
|
||||
define('_PS_INSTALL_VERSION_', '1.6.1.23');
|
||||
define('_QLO_INSTALL_VERSION_', '1.5.0.0');
|
||||
define('_QLO_INSTALL_VERSION_', '1.5.1.0');
|
||||
@@ -654,7 +654,6 @@ class InstallModelInstall extends InstallAbstractModel
|
||||
'wkhotelfeaturesblock',
|
||||
'wkhotelroom',
|
||||
'wktestimonialblock',
|
||||
'socialsharing',
|
||||
'bankwire',
|
||||
'cheque',
|
||||
'paypal',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
var install_is_done = '<?php echo addslashes($this->l('Done!')) ?>';
|
||||
var process_steps = <?php echo Tools::jsonEncode($this->process_steps) ?>;
|
||||
var process_steps = <?php echo json_encode($this->process_steps) ?>;
|
||||
var admin = '<?php echo(file_exists('../admin-dev') ? '../admin-dev' : '../admin') ?>';
|
||||
-->
|
||||
</script>
|
||||
|
||||
@@ -86,7 +86,7 @@ class AddConfToFile
|
||||
|
||||
public function checkString($string)
|
||||
{
|
||||
if (get_magic_quotes_gpc()) {
|
||||
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
|
||||
$string = stripslashes($string);
|
||||
}
|
||||
if (!is_numeric($string)) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
if (!defined('_PS_MAGIC_QUOTES_GPC_')) {
|
||||
define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc());
|
||||
define('_PS_MAGIC_QUOTES_GPC_', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
|
||||
}
|
||||
if (!defined('_PS_MYSQL_REAL_ESCAPE_STRING_')) {
|
||||
define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string'));
|
||||
|
||||
@@ -31,7 +31,7 @@ function ps1607_language_code_update()
|
||||
if (is_array($langs) && $langs) {
|
||||
foreach ($langs as $lang) {
|
||||
if (Tools::strlen($lang['language_code']) == 2) {
|
||||
$result = Tools::jsonDecode(Tools::file_get_contents('https://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.Tools::strtolower($lang['iso_code'])));
|
||||
$result = json_decode(Tools::file_get_contents('https://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.Tools::strtolower($lang['iso_code'])));
|
||||
if ($result && !isset($result->error) && Tools::strlen($result->language_code) > 2) {
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'lang` SET `language_code` = \''.pSQL($result->language_code).'\' WHERE `id_lang` = '.(int)$lang['id_lang']).' LIMIT 1';
|
||||
}
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
-----------------------------
|
||||
# V1.6.2 to V1.6.3
|
||||
-----------------------------
|
||||
|
||||
## Improved/Changed Features:
|
||||
|
||||
* [CO] : Removed unused hooks displayLeftColumn and displayrightColumn
|
||||
* [CO] : 'getHotelCartBookingData' function from blockcart.php is removed and called from HotelCartBookingData::getHotelCartBookingData()
|
||||
|
||||
|
||||
-----------------------------
|
||||
# V1.6.1 to V1.6.2
|
||||
-----------------------------
|
||||
|
||||
@@ -34,7 +34,7 @@ class blockcart extends Module
|
||||
{
|
||||
$this->name = 'blockcart';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.6.2';
|
||||
$this->version = '1.6.3';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -224,7 +224,8 @@ class blockcart extends Module
|
||||
}
|
||||
|
||||
$this->assignContentVars($params);
|
||||
$res = Tools::jsonDecode(Tools::removeHtmlComments($this->display(__FILE__, 'blockcart-json.tpl')), true);
|
||||
|
||||
$res = json_decode(Tools::removeHtmlComments($this->display(__FILE__, 'blockcart-json.tpl')), true);
|
||||
|
||||
if (isset($params['cookie']->avail_rooms)) {
|
||||
$res['avail_rooms'] = $params['cookie']->avail_rooms;
|
||||
@@ -237,7 +238,7 @@ class blockcart extends Module
|
||||
$res['crossSelling'] = $this->display(__FILE__, 'crossselling.tpl');
|
||||
}
|
||||
|
||||
$res = Tools::jsonEncode($res);
|
||||
$res = json_encode($res);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -57,21 +57,21 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode(array('status'=>'success', 'avail_rooms'=>$total_available_rooms)));
|
||||
die(json_encode(array('status'=>'success', 'avail_rooms'=>$total_available_rooms)));
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed1')));
|
||||
die(json_encode(array('status'=>'failed1')));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'unavailable_quantity', 'avail_rooms'=>$total_available_rooms)));
|
||||
die(json_encode(array('status'=>'unavailable_quantity', 'avail_rooms'=>$total_available_rooms)));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed2')));
|
||||
die(json_encode(array('status'=>'failed2')));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed3')));
|
||||
die(json_encode(array('status'=>'failed3')));
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed4')));
|
||||
die(json_encode(array('status'=>'failed4')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,9 +94,9 @@
|
||||
$result = $obj_htl_cart_booking_data->deleteCartBookingData($id_cart, $id_product);
|
||||
|
||||
if ($result) {
|
||||
die(Tools::jsonEncode(array('status'=>'success', 'avail_rooms'=>$total_available_rooms)));
|
||||
die(json_encode(array('status'=>'success', 'avail_rooms'=>$total_available_rooms)));
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed')));
|
||||
die(json_encode(array('status'=>'failed')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,10 +109,10 @@
|
||||
$cart_obj = new Cart($id_cart);
|
||||
$update_cart_product = $cart_obj->updateQty($num_rooms_to_decr_from_cart, $id_product, null, false, $operator = 'down', 0, null, true);
|
||||
if ($update_cart_product) {
|
||||
die(Tools::jsonEncode(array('status'=>'success', 'msg'=>'successfully cart product updated.')));
|
||||
die(json_encode(array('status'=>'success', 'msg'=>'successfully cart product updated.')));
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('status'=>'failed', 'msg'=>'error while updating cart product.')));
|
||||
die(json_encode(array('status'=>'failed', 'msg'=>'error while updating cart product.')));
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode(array('status'=>'failed', 'msg'=>'error while deleting room from cart booking table.')));
|
||||
die(json_encode(array('status'=>'failed', 'msg'=>'error while deleting room from cart booking table.')));
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class BlockcartCheckRoomAvailabilityAjaxProcessModuleFrontController extends Mod
|
||||
}
|
||||
}
|
||||
die(
|
||||
Tools::jsonEncode(
|
||||
json_encode(
|
||||
array(
|
||||
'status'=>'success',
|
||||
'msg'=>'successfully cart product updated.',
|
||||
@@ -60,7 +60,7 @@ class BlockcartCheckRoomAvailabilityAjaxProcessModuleFrontController extends Mod
|
||||
);
|
||||
}
|
||||
die(
|
||||
Tools::jsonEncode(
|
||||
json_encode(
|
||||
array('status'=>'failed', 'msg'=>'error while deleting room from cart booking table.')
|
||||
)
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ class AdminBlockCategoriesController extends ModuleAdminController
|
||||
}
|
||||
|
||||
public function ajaxProcessuploadThumbnailImages()
|
||||
{
|
||||
{
|
||||
$category = new Category((int)Tools::getValue('id_category'));
|
||||
|
||||
if (isset($_FILES['thumbnail']))
|
||||
@@ -74,7 +74,7 @@ class AdminBlockCategoriesController extends ModuleAdminController
|
||||
{
|
||||
$total_errors['name'] = sprintf(Tools::displayError('An error occurred while uploading the image :'));
|
||||
$total_errors['error'] = sprintf(Tools::displayError('You cannot upload more files'));
|
||||
die(Tools::jsonEncode(array('thumbnail' => array($total_errors))));
|
||||
die(json_encode(array('thumbnail' => array($total_errors))));
|
||||
}
|
||||
|
||||
foreach ($files as $key => &$file)
|
||||
@@ -99,7 +99,7 @@ class AdminBlockCategoriesController extends ModuleAdminController
|
||||
unset($file['save_path']);
|
||||
|
||||
if (isset($file['tmp_name']))
|
||||
unset($file['tmp_name']);
|
||||
unset($file['tmp_name']);
|
||||
|
||||
//Add image preview and delete url
|
||||
$file['image'] = ImageManager::thumbnail(_PS_CAT_IMG_DIR_.(int)$category->id.'-'.$id.'_thumb.jpg',
|
||||
@@ -113,7 +113,7 @@ class AdminBlockCategoriesController extends ModuleAdminController
|
||||
else
|
||||
Tools::clearSmartyCache();
|
||||
|
||||
die(Tools::jsonEncode(array('thumbnail' => $files)));
|
||||
die(json_encode(array('thumbnail' => $files)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@ if (substr(Tools::encrypt('blocklayered/index'),0,10) != Tools::getValue('token'
|
||||
die('Bad token');
|
||||
|
||||
$blockLayered = new BlockLayered();
|
||||
$cursor = Tools::jsonDecode(Tools::getValue('cursor', '{}'), true);
|
||||
$cursor = json_decode(Tools::getValue('cursor', '{}'), true);
|
||||
echo $blockLayered->indexUrl($cursor, (int)Tools::getValue('truncate'));
|
||||
@@ -1621,7 +1621,7 @@ class BlockLayered extends Module
|
||||
'template_name' => $template['name'],
|
||||
'attribute_groups' => $attribute_groups,
|
||||
'features' => $features,
|
||||
'filters' => Tools::jsonEncode($filters),
|
||||
'filters' => json_encode($filters),
|
||||
'total_filters' => 6+count($attribute_groups)+count($features)
|
||||
));
|
||||
|
||||
@@ -1862,7 +1862,7 @@ class BlockLayered extends Module
|
||||
break;
|
||||
|
||||
case 'manufacturer':
|
||||
$query_filters_where .= ' AND p.id_manufacturer IN ('.implode($selected_filters['manufacturer'], ',').')';
|
||||
$query_filters_where .= ' AND p.id_manufacturer IN ('.implode(',', $selected_filters['manufacturer']).')';
|
||||
break;
|
||||
|
||||
case 'condition':
|
||||
@@ -2005,7 +2005,7 @@ class BlockLayered extends Module
|
||||
$this->products = array();
|
||||
else
|
||||
{
|
||||
$product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int)$this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
|
||||
$product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int)$this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
|
||||
$n = (int)Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'));
|
||||
$nb_day_new_product = (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20);
|
||||
|
||||
@@ -3049,8 +3049,8 @@ class BlockLayered extends Module
|
||||
$query_filters = '';
|
||||
else
|
||||
{
|
||||
array_walk($filter_value, create_function('&$id_manufacturer', '$id_manufacturer = (int)$id_manufacturer;'));
|
||||
$query_filters = ' AND p.id_manufacturer IN ('.implode($filter_value, ',').')';
|
||||
array_walk($filter_value, function (&$id_manufacturer) {$id_manufacturer = (int)$id_manufacturer;});
|
||||
$query_filters = ' AND p.id_manufacturer IN ('.implode(',', $filter_value).')';
|
||||
}
|
||||
if ($ignore_join)
|
||||
return array('where' => $query_filters);
|
||||
@@ -3177,7 +3177,7 @@ class BlockLayered extends Module
|
||||
$vars = array_merge($vars, array('pagination_bottom' => $smarty->assign('paginationId', 'bottom')
|
||||
->fetch(_PS_THEME_DIR_.'pagination.tpl')));
|
||||
/* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
|
||||
return Tools::jsonEncode($vars);
|
||||
return json_encode($vars);
|
||||
}
|
||||
|
||||
public function getProducts($selected_filters, &$products, &$nb_products, &$p, &$n, &$pages_nb, &$start, &$stop, &$range)
|
||||
|
||||
@@ -51,7 +51,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
elseif (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action)))
|
||||
$this->{'ajaxProcess'.Tools::toCamelCase($action)}();
|
||||
else
|
||||
die(Tools::jsonEncode(array('error' => 'method doesn\'t exist')));
|
||||
die(json_encode(array('error' => 'method doesn\'t exist')));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +150,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
public function ajaxProcessDeleteList()
|
||||
{
|
||||
if (!$this->context->customer->isLogged())
|
||||
die(Tools::jsonEncode(array('success' => false,
|
||||
die(json_encode(array('success' => false,
|
||||
'error' => $this->module->l('You aren\'t logged in', 'mywishlist'))));
|
||||
|
||||
$default = Tools::getIsset('default');
|
||||
@@ -165,7 +165,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
$wishlist->delete();
|
||||
}
|
||||
else
|
||||
die(Tools::jsonEncode(array('success' => false,
|
||||
die(json_encode(array('success' => false,
|
||||
'error' => $this->module->l('Cannot delete this wishlist', 'mywishlist'))));
|
||||
|
||||
if ($default_change)
|
||||
@@ -173,19 +173,19 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
$array = WishList::getDefault($id_customer);
|
||||
|
||||
if (count($array))
|
||||
die(Tools::jsonEncode(array(
|
||||
die(json_encode(array(
|
||||
'success' => true,
|
||||
'id_default' => $array[0]['id_wishlist']
|
||||
)));
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array('success' => true)));
|
||||
die(json_encode(array('success' => true)));
|
||||
}
|
||||
|
||||
public function ajaxProcessSetDefault()
|
||||
{
|
||||
if (!$this->context->customer->isLogged())
|
||||
die(Tools::jsonEncode(array('success' => false,
|
||||
die(json_encode(array('success' => false,
|
||||
'error' => $this->module->l('You aren\'t logged in', 'mywishlist'))));
|
||||
|
||||
$default = Tools::getIsset('default');
|
||||
@@ -196,16 +196,16 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
$wishlist = new WishList((int)$id_wishlist);
|
||||
if (Validate::isLoadedObject($wishlist) && $wishlist->id_customer == $this->context->customer->id && $wishlist->setDefault())
|
||||
die(Tools::jsonEncode(array('success' => true)));
|
||||
die(json_encode(array('success' => true)));
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode(array('error' => true)));
|
||||
die(json_encode(array('error' => true)));
|
||||
}
|
||||
|
||||
public function ajaxProcessProductChangeWishlist()
|
||||
{
|
||||
if (!$this->context->customer->isLogged())
|
||||
die(Tools::jsonEncode(array('success' => false,
|
||||
die(json_encode(array('success' => false,
|
||||
'error' => $this->module->l('You aren\'t logged in', 'mywishlist'))));
|
||||
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
@@ -222,7 +222,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
!is_int($priority) || ($priority < 0 && $priority > 2) || !$id_old_wishlist || !$id_new_wishlist ||
|
||||
(Validate::isLoadedObject($new_wishlist) && $new_wishlist->id_customer != $this->context->customer->id) ||
|
||||
(Validate::isLoadedObject($old_wishlist) && $old_wishlist->id_customer != $this->context->customer->id))
|
||||
die(Tools::jsonEncode(array('success' => false, 'error' => $this->module->l('Error while moving product to another list', 'mywishlist'))));
|
||||
die(json_encode(array('success' => false, 'error' => $this->module->l('Error while moving product to another list', 'mywishlist'))));
|
||||
|
||||
$res = true;
|
||||
$check = (int)Db::getInstance()->getValue('SELECT quantity FROM '._DB_PREFIX_.'wishlist_product
|
||||
@@ -240,7 +240,7 @@ class BlockWishListMyWishListModuleFrontController extends ModuleFrontController
|
||||
}
|
||||
|
||||
if (!$res)
|
||||
die(Tools::jsonEncode(array('success' => false, 'error' => $this->module->l('Error while moving product to another list', 'mywishlist'))));
|
||||
die(Tools::jsonEncode(array('success' => true, 'msg' => $this->module->l('The product has been correctly moved', 'mywishlist'))));
|
||||
die(json_encode(array('success' => false, 'error' => $this->module->l('Error while moving product to another list', 'mywishlist'))));
|
||||
die(json_encode(array('success' => true, 'msg' => $this->module->l('The product has been correctly moved', 'mywishlist'))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +176,6 @@ class GraphNvD3 extends ModuleGraphEngine
|
||||
$array['data'][] = array('values' => $nvd3_values, 'key' => $this->_titles['main'][$layer]);
|
||||
}
|
||||
}
|
||||
die(preg_replace('/"([0-9]+)"/', '$1', Tools::jsonEncode($array)));
|
||||
die(preg_replace('/"([0-9]+)"/', '$1', json_encode($array)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,19 +43,19 @@ class GridHtml extends ModuleGridEngine
|
||||
$this->version = '1.3.1';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
|
||||
Module::__construct();
|
||||
|
||||
|
||||
$this->displayName = $this->l('Simple HTML table display');
|
||||
$this->description = $this->l('Allows the statistics system to display data in a grid.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function install()
|
||||
{
|
||||
return (parent::install() AND $this->registerHook('GridEngine'));
|
||||
}
|
||||
|
||||
|
||||
public static function hookGridEngine($params, $grider)
|
||||
{
|
||||
self::$_columns = $params['columns'];
|
||||
@@ -112,7 +112,7 @@ class GridHtml extends ModuleGridEngine
|
||||
$("#grid_1 tbody").append("<tr><td class=\"center\" colspan=\"" + '.count($params['columns']).' + "\">'.$params['emptyMsg'].'</td></tr>");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function gridNextPage(url)
|
||||
{
|
||||
var from = url.match(/&start=[0-9]+/i);
|
||||
@@ -123,7 +123,7 @@ class GridHtml extends ModuleGridEngine
|
||||
url = url.replace(/&start=[0-9]+/i, "") + from;
|
||||
getGridData(url);
|
||||
}
|
||||
|
||||
|
||||
function gridPrevPage(url)
|
||||
{
|
||||
var from = url.match(/&start=[0-9]+/i);
|
||||
@@ -145,46 +145,46 @@ class GridHtml extends ModuleGridEngine
|
||||
</script>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
public function setColumnsInfos(&$infos)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function setValues($values)
|
||||
{
|
||||
$this->_values = $values;
|
||||
}
|
||||
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
}
|
||||
|
||||
|
||||
public function setSize($width, $height)
|
||||
{
|
||||
$this->_width = $width;
|
||||
$this->_height = $height;
|
||||
}
|
||||
|
||||
|
||||
public function setTotalCount($totalCount)
|
||||
{
|
||||
$this->_totalCount = $totalCount;
|
||||
}
|
||||
|
||||
|
||||
public function setLimit($start, $limit)
|
||||
{
|
||||
$this->_start = (int)$start;
|
||||
$this->_limit = (int)$limit;
|
||||
}
|
||||
|
||||
|
||||
public function render()
|
||||
{
|
||||
echo Tools::jsonEncode(array(
|
||||
echo json_encode(array(
|
||||
'total' => $this->_totalCount,
|
||||
'from' => min($this->_start + 1, $this->_totalCount),
|
||||
'to' => min($this->_start + $this->_limit, $this->_totalCount),
|
||||
'values' => $this->_values
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,37 @@
|
||||
-------------------------
|
||||
# V1.4.1 to V1.4.2
|
||||
-------------------------
|
||||
|
||||
## Added Features:
|
||||
|
||||
[+] CO : [#198] Multiple hooks are added in the different QloApps core files
|
||||
|
||||
## Improved/changed features:
|
||||
|
||||
[*] BO : [110, #111] Code Optimization
|
||||
[*] BO : [#179] Added hotel column in room type feature pricing list
|
||||
[*] BO : [#204, #196, #182] Text Changes
|
||||
[*] BO : [#193] Removed Payment Modules setting from admin Hotel Reservation System -> Settings
|
||||
[*] BO : [#206] Removed Other Modules setting from admin Hotel Reservation System -> Settings
|
||||
|
||||
[*] CO : [#215] "hotelreservationsystem.php" code optimization in hook "actionValidateOrder"
|
||||
[*] CO : [#221] dataforfrontsearch() function now calculate and provide "feature_price_diff" value in response
|
||||
[*] CO : [#223] getHotelCartBookingData() : function multiplication optimized
|
||||
[*] CO : [#225] HotelRoomTypeFeaturePricing.php optimized (Removed unused variables, removed static values assigned)
|
||||
|
||||
## Bug/Issues Resolved:
|
||||
|
||||
[-] FO : Fixed : [#169] Wrong price displayed when booking from 1 march to 30 march
|
||||
[*] FO : [#215] "ajax-cart.js" add validation
|
||||
|
||||
[-] BO : Fixed : [#162] Additional facility price changes for room type after saving
|
||||
[-] BO : Fixed : [#168] Room number not updating after room reallocation and swap
|
||||
[-] BO : Fixed : [#173] Undefined varaible issue Manage Order Refund Request Controller
|
||||
[-] BO : Fixed : [#211] Errors on cart rule page when add room type, which is not assigned to hotel, selected in room type condition
|
||||
[-] BO : Fixed : [#229] Resolved undefined variable error in Manage Order Refund Request Controller
|
||||
|
||||
|
||||
|
||||
-------------------------
|
||||
# V1.4.0 to V1.4.1
|
||||
-------------------------
|
||||
|
||||
@@ -840,7 +840,7 @@ class HotelBranchInformation extends ObjectModel
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
|
||||
$hotelData = Tools::jsonDecode(Tools::jsonEncode($xml));
|
||||
$hotelData = json_decode(json_encode($xml));
|
||||
if (isset($hotelData->hotel->max_order_date)) {
|
||||
if ($maxOrderDate = $hotelData->hotel->max_order_date) {
|
||||
$this->setWsMaxOrderDate($maxOrderDate);
|
||||
@@ -863,7 +863,7 @@ class HotelBranchInformation extends ObjectModel
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string(utf8_decode($postData));
|
||||
|
||||
$hotelData = Tools::jsonDecode(Tools::jsonEncode($xml));
|
||||
$hotelData = json_decode(json_encode($xml));
|
||||
if (isset($hotelData->hotel->max_order_date)) {
|
||||
if ($maxOrderDate = $hotelData->hotel->max_order_date) {
|
||||
$this->setWsMaxOrderDate($maxOrderDate);
|
||||
|
||||
@@ -764,7 +764,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
AND fp.`active`=1 AND fp.`date_from` <= \''.pSQL($date).'\' AND fp.`date_to` >= \''.pSQL($date).'\''
|
||||
)) {
|
||||
foreach ($featurePrice as $fRow) {
|
||||
$specialDays = Tools::jsonDecode($fRow['special_days']);
|
||||
$specialDays = json_decode($fRow['special_days']);
|
||||
if (in_array(strtolower(date('D', strtotime($date))), $specialDays)) {
|
||||
return $fRow;
|
||||
}
|
||||
@@ -1105,7 +1105,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
|
||||
if ($getTotalPrice) {
|
||||
if ($roomTypeDemands['extra_demands']
|
||||
&& ($extraDemand = Tools::jsonDecode($roomTypeDemands['extra_demands'], true))
|
||||
&& ($extraDemand = json_decode($roomTypeDemands['extra_demands'], true))
|
||||
) {
|
||||
$totalDemandsPrice += $objRoomDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$roomTypeDemands['id_product'],
|
||||
@@ -1116,7 +1116,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$roomTypeDemands['extra_demands'] = Tools::jsonDecode(
|
||||
$roomTypeDemands['extra_demands'] = json_decode(
|
||||
$roomTypeDemands['extra_demands'],
|
||||
true
|
||||
);
|
||||
@@ -1146,7 +1146,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
foreach ($roomTypeDemands as $key => &$demand) {
|
||||
if ($getTotalPrice) {
|
||||
if ($demand['extra_demands']
|
||||
&& ($extraDemand = Tools::jsonDecode($demand['extra_demands'], true))
|
||||
&& ($extraDemand = json_decode($demand['extra_demands'], true))
|
||||
) {
|
||||
$totalDemandsPrice += $objRoomDemandPrice->getRoomTypeDemandsTotalPrice(
|
||||
$demand['id_product'],
|
||||
@@ -1157,7 +1157,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$demand['extra_demands'] = Tools::jsonDecode(
|
||||
$demand['extra_demands'] = json_decode(
|
||||
$demand['extra_demands'],
|
||||
true
|
||||
);
|
||||
@@ -1193,7 +1193,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
// Webservice :: get extra demands for the cart booking
|
||||
public function getWsExtraDemands()
|
||||
{
|
||||
$extraDemands = Tools::jsonDecode($this->extra_demands, true);
|
||||
$extraDemands = json_decode($this->extra_demands, true);
|
||||
if (count($extraDemands)) {
|
||||
foreach ($extraDemands as &$demnad) {
|
||||
$demnad['id'] = $demnad['id_global_demand'];
|
||||
|
||||
@@ -54,10 +54,8 @@ class HotelOrderRestrictDate extends ObjectModel
|
||||
$obj_ord_rest = new self();
|
||||
$order_restrict_data = $obj_ord_rest->getDataByHotelId($id_hotel);
|
||||
|
||||
$max_order_date_restr = $order_restrict_data['max_order_date'];
|
||||
|
||||
if (isset($max_order_date_restr) && $max_order_date_restr) {
|
||||
$max_order_date = $max_order_date_restr;
|
||||
if (isset($order_restrict_data['max_order_date']) && $order_restrict_data['max_order_date']) {
|
||||
$max_order_date = $order_restrict_data['max_order_date'];
|
||||
} elseif (isset($global_max_order_date) && $global_max_order_date) {
|
||||
$max_order_date = $global_max_order_date;
|
||||
} else {
|
||||
|
||||
@@ -143,7 +143,7 @@ class HotelRoomTypeDemandPrice extends ObjectModel
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject($objCartBooking = new HotelCartBookingData($demandInfo['id']))) {
|
||||
$objCartBooking->extra_demands = Tools::jsonEncode($demandInfo['extra_demands']);
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null)
|
||||
{
|
||||
$this->moduleInstance = Module::getInstanceByName('hotelreservationsystem');
|
||||
parent::__construct($id);
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = true)
|
||||
@@ -221,7 +221,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$date_to = date('Y-m-d', strtotime($date_to));
|
||||
|
||||
for($date = $date_from; $date < $date_to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) {
|
||||
if (in_array(strtolower(Date('D', $date)), $specialDays)) {
|
||||
if (in_array(Tools::strtolower(Date('D', $date)), $specialDays)) {
|
||||
$specialDaysCount++;
|
||||
}
|
||||
}
|
||||
@@ -321,7 +321,6 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
*/
|
||||
public function updateRoomTypesFeaturePricesAvailability($featurePricePlans)
|
||||
{
|
||||
$moduleInstance = new HotelReservationSystem();
|
||||
$this->errors = array();
|
||||
if ($featurePricePlans) {
|
||||
if (isset($featurePricePlans['data']) && $featurePricePlans['data']) {
|
||||
@@ -333,8 +332,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$id_product = $key;
|
||||
// feature price rates create and updates
|
||||
if (isset($roomTypeRates['rate'])) {
|
||||
//$productPriceTE = Product::getPriceStatic((int) $id_product, false);
|
||||
$productPriceTE = 1000;
|
||||
$productPriceTE = Product::getPriceStatic((int) $id_product, false);
|
||||
if ($productPriceTE != $roomTypeRates['rate']) {
|
||||
if ($productPriceTE > $roomTypeRates['rate']) {
|
||||
$priceImpactWay = 1;
|
||||
@@ -361,7 +359,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$id_product,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$type = 'specific_date'
|
||||
'specific_date'
|
||||
);
|
||||
if ($featurePriceExists) {
|
||||
if (!$this->saveFeaturePricePlan($featurePriceExists['id'], 2, $params)) {
|
||||
@@ -378,7 +376,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$id_product,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$type='date_range'
|
||||
'date_range'
|
||||
);
|
||||
if ($featurePriceExists) {
|
||||
if ($featurePriceExists['date_from'] == $dateFrom
|
||||
@@ -392,7 +390,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$this->errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId'];
|
||||
}
|
||||
} else {
|
||||
for($date = $date_from; $date < $date_to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) {
|
||||
for($date = $dateFrom; $date < $dateTo; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) {
|
||||
$currentDate = date('Y-m-d', $date);
|
||||
$nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)));
|
||||
$params['dateFrom'] = $currentDate;
|
||||
@@ -402,7 +400,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$id_product,
|
||||
$currentDate,
|
||||
$nextDayDate,
|
||||
$type = 'specific_date'
|
||||
'specific_date'
|
||||
);
|
||||
if ($featurePriceExists) {
|
||||
if (!$this->saveFeaturePricePlan(
|
||||
@@ -431,7 +429,6 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
if (isset($roomTypeRates['inventory'])) {
|
||||
$totalAvailableNotBooked = 0;
|
||||
$totalAvailableRooms = 0;
|
||||
$totalRooms = 0;
|
||||
$hotelRoomType = new HotelRoomType();
|
||||
$hotelBookingDetail = new HotelBookingDetail();
|
||||
$hotelRoomInformation = new HotelRoomInformation();
|
||||
@@ -458,17 +455,10 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
);
|
||||
$countBookedRooms = count($bookedRoomsInfo);
|
||||
if (isset($roomTypeAvailabilityInfo['stats']['total_rooms'])) {
|
||||
$totalRooms = $roomTypeAvailabilityInfo['stats']['total_rooms'];
|
||||
$totalAvailableNotBooked = $roomTypeAvailabilityInfo['stats']['total_rooms'] - $countBookedRooms;
|
||||
$totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail'];
|
||||
$totalAvailableNotBooked = 5;
|
||||
$totalAvailableRooms = 3;
|
||||
}
|
||||
|
||||
/*p($totalAvailableRooms);
|
||||
p($roomTypeRates['inventory']);
|
||||
p($totalAvailableNotBooked);
|
||||
die;*/
|
||||
if ($roomTypeRates['inventory'] <= $totalAvailableNotBooked) {
|
||||
if ($roomTypeRates['inventory'] < $totalAvailableRooms) {
|
||||
$numDisabledRooms = $totalAvailableRooms - $roomTypeRates['inventory'];
|
||||
@@ -479,7 +469,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$dateTo
|
||||
);
|
||||
if ($availableRooms) {
|
||||
foreach ($availableRooms as $room_k => $room) {
|
||||
foreach ($availableRooms as $room) {
|
||||
$objRoomDisableDates = new HotelRoomDisableDates();
|
||||
$params['id_room'] = $room['id'];
|
||||
$params['date_from'] = $dateFrom;
|
||||
@@ -519,7 +509,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
$dateTo
|
||||
);
|
||||
if ($disabledRooms) {
|
||||
foreach ($disabledRooms as $k_rm => $disableRoom) {
|
||||
foreach ($disabledRooms as $disableRoom) {
|
||||
if ($roomsToEnable > 0) {
|
||||
$hotelRoomInformation = new HotelRoomInformation($disableRoom['id']);
|
||||
$objRoomDisableDates = new HotelRoomDisableDates();
|
||||
@@ -572,13 +562,15 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
|
||||
'HotelRoomTypeFeaturePricing'
|
||||
);
|
||||
}
|
||||
die;
|
||||
|
||||
$result = array();
|
||||
if (count($this->errors)) {
|
||||
$result['status'] = 'failed';
|
||||
$result['errors'] = $this->errors;
|
||||
} else {
|
||||
$result['status'] = 'success';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class HotelRoomTypeGlobalDemand extends ObjectModel
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject($objCartBooking = new HotelCartBookingData($demandInfo['id']))) {
|
||||
$objCartBooking->extra_demands = Tools::jsonEncode($demandInfo['extra_demands']);
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class HotelRoomTypeGlobalDemandAdvanceOption extends ObjectModel
|
||||
}
|
||||
if ($cartChanged) {
|
||||
if (Validate::isLoadedObject($objCartBooking = new HotelCartBookingData($demandInfo['id']))) {
|
||||
$objCartBooking->extra_demands = Tools::jsonEncode($demandInfo['extra_demands']);
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ class QloRoomType extends QloWebservice
|
||||
// }
|
||||
|
||||
// // convert object to array
|
||||
// $address = Tools::jsonDecode(Tools::jsonEncode($address), true);
|
||||
// $address = json_decode(json_encode($address), true);
|
||||
|
||||
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('address', array());
|
||||
// $address['country'] = Country::getNameById($this->id_lang, $address['id_country']);
|
||||
|
||||
@@ -80,7 +80,7 @@ class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInt
|
||||
$outputXML = $this->objOutput->getObjectRender()->overrideContent($this->output);
|
||||
if (isset($this->wsObject->urlFragments['outputformat']) && $this->wsObject->urlFragments['outputformat'] == 'json') {
|
||||
$outputXML = simplexml_load_string($outputXML, null, LIBXML_NOCDATA);
|
||||
$json = Tools::jsonEncode($outputXML);
|
||||
$json = json_encode($outputXML);
|
||||
$content = preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", $json);
|
||||
header('Content-Type: application/json');
|
||||
die($content);
|
||||
@@ -153,7 +153,7 @@ class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInt
|
||||
}
|
||||
} else {
|
||||
// If input type is json
|
||||
$array = Tools::jsonDecode($inputXML, true);
|
||||
$array = json_decode($inputXML, true);
|
||||
if (isset($array['json']) && $array['json'] && isset($array[$head])) {
|
||||
return ($head ? $array[$head] : $array);
|
||||
} else {
|
||||
@@ -172,7 +172,7 @@ class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInt
|
||||
|
||||
$xmlEntities = $xml->children();
|
||||
// Convert multi-dimention xml into an array
|
||||
$array = Tools::jsonDecode(Tools::jsonEncode($xmlEntities), true);
|
||||
$array = json_decode(json_encode($xmlEntities), true);
|
||||
|
||||
return ($head ? $array[$head] : $array);
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($states));
|
||||
die(json_encode($states));
|
||||
}
|
||||
|
||||
public function ajaxProcessUploadHotelImages()
|
||||
@@ -514,19 +514,19 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
$hotelImgPath = _PS_MODULE_DIR_.'hotelreservationsystem/views/img/hotel_img/';
|
||||
$imageDetail = $objHotelImage->uploadHotelImages($_FILES['hotel_image'], $idHotel, $hotelImgPath);
|
||||
if ($imageDetail) {
|
||||
die(Tools::jsonEncode($imageDetail));
|
||||
die(json_encode($imageDetail));
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('hasError' => true)));
|
||||
die(json_encode(array('hasError' => true)));
|
||||
}
|
||||
} else {
|
||||
die(
|
||||
Tools::jsonEncode(
|
||||
json_encode(
|
||||
array('hasError' => true, 'message' => $_FILES['hotel_image']['name'].': '.$invalidImg)
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
die(Tools::jsonEncode(array('hasError' => true)));
|
||||
die(json_encode(array('hasError' => true)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
|
||||
}
|
||||
}
|
||||
if ($objFeaturePrice->special_days) {
|
||||
$smartyVars['special_days'] = Tools::jsonDecode($objFeaturePrice->special_days, true);
|
||||
$smartyVars['special_days'] = json_decode($objFeaturePrice->special_days, true);
|
||||
}
|
||||
$smartyVars['objFeaturePrice'] = $objFeaturePrice;
|
||||
$smartyVars['edit'] = 1;
|
||||
@@ -247,7 +247,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
|
||||
$impactValue = Tools::getValue('impact_value');
|
||||
$dateSelectionType = Tools::getValue('date_selection_type');
|
||||
$specificDate = date('Y-m-d', strtotime(Tools::getValue('specific_date')));
|
||||
$jsonSpecialDays = Tools::jsonEncode($specialDays);
|
||||
$jsonSpecialDays = json_encode($specialDays);
|
||||
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
$objFeaturePricing = new HotelRoomTypeFeaturePricing();
|
||||
@@ -437,18 +437,18 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
|
||||
$product['name'].= ' / '.$onjBranchInfo->hotel_name;
|
||||
}
|
||||
}
|
||||
echo Tools::jsonEncode($productsByName, true);
|
||||
echo json_encode($productsByName, true);
|
||||
die;
|
||||
} else {
|
||||
die(
|
||||
Tools::jsonEncode(
|
||||
json_encode(
|
||||
array('status' => 'failed', 'msg' => $this->l('No match found for entered room type name.'))
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
die(
|
||||
Tools::jsonEncode(
|
||||
json_encode(
|
||||
array('status' => 'failed', 'msg' => $this->l('No match found for entered room type name.'))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -292,7 +292,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$hotel_id = Tools::getValue('hotel_id');
|
||||
$obj_room_type = new HotelRoomType();
|
||||
$room_type_info = $obj_room_type->getRoomTypeByHotelId($hotel_id, Configuration::get('PS_LANG_DEFAULT'), 1);
|
||||
die(Tools::jsonEncode($room_type_info));
|
||||
die(json_encode($room_type_info));
|
||||
}
|
||||
|
||||
public function ajaxProcessAddDataToCart()
|
||||
@@ -412,7 +412,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
'id_cart_book_data' => $obj_cart_book_data->id);
|
||||
|
||||
if ($obj_cart_book_data->id) {
|
||||
die(Tools::jsonEncode($cart_data));
|
||||
die(json_encode($cart_data));
|
||||
} else {
|
||||
die(0);
|
||||
}
|
||||
@@ -495,7 +495,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
'booking_data' => $booking_data,
|
||||
);
|
||||
}
|
||||
die(Tools::jsonEncode($cart_data));
|
||||
die(json_encode($cart_data));
|
||||
} else {
|
||||
die(0);
|
||||
}
|
||||
@@ -534,7 +534,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$start_date = date('Y-m-d', strtotime('+1 day', strtotime($start_date)));
|
||||
}
|
||||
if ($booking_calendar_data) {
|
||||
die(Tools::jsonEncode($booking_calendar_data));
|
||||
die(json_encode($booking_calendar_data));
|
||||
} else {
|
||||
die(0);
|
||||
}
|
||||
|
||||
@@ -261,15 +261,14 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
|
||||
/*If Admin update the status of the order cancellation request*/
|
||||
if (Tools::isSubmit('submitRefundReqBookings')) {
|
||||
$idOrderReturn = Tools::getValue('id_order_return');
|
||||
$idsReturnDetail = Tools::getValue('id_order_return_detail');
|
||||
if (Validate::isLoadedObject($objOrderReturn = new OrderReturn($idOrderReturn))) {
|
||||
$objOrder = new Order($objOrderReturn->id_order);
|
||||
$hasOrderPaid = $objOrder->hasBeenPaid();
|
||||
$idRefundState = Tools::getValue('id_refund_state');
|
||||
if (Validate::isLoadedObject($objRefundState = new OrderReturnState($idRefundState))) {
|
||||
if ($objRefundState->refunded) {
|
||||
$refundedAmounts = Tools::getValue('refund_amounts');
|
||||
$idsReturnDetail = Tools::getValue('id_order_return_detail');
|
||||
|
||||
$hasOrderPaid = $objOrder->hasBeenPaid();
|
||||
|
||||
if ($hasOrderPaid) {
|
||||
if ($idsReturnDetail && count($idsReturnDetail)) {
|
||||
|
||||
@@ -29,7 +29,7 @@ class hotelreservationsystem extends Module
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'hotelreservationsystem';
|
||||
$this->version = '1.4.1';
|
||||
$this->version = '1.4.2';
|
||||
$this->author = 'Webkul';
|
||||
$this->need_instance = 0;
|
||||
$this->bootstrap = true;
|
||||
@@ -299,7 +299,7 @@ class hotelreservationsystem extends Module
|
||||
if (Validate::isLoadedObject(
|
||||
$objCartBooking = new HotelCartBookingData($demandInfo['id'])
|
||||
)) {
|
||||
$objCartBooking->extra_demands = Tools::jsonEncode($demandInfo['extra_demands']);
|
||||
$objCartBooking->extra_demands = json_encode($demandInfo['extra_demands']);
|
||||
$objCartBooking->save();
|
||||
}
|
||||
}
|
||||
@@ -411,7 +411,7 @@ class hotelreservationsystem extends Module
|
||||
$idLang
|
||||
))) {
|
||||
$objHtlBkDtl->hotel_name = $objHotelBranch->hotel_name;
|
||||
$objHtlBkDtl->room_type_name = $product['product_name'];
|
||||
$objHtlBkDtl->room_type_name = $product['name'];
|
||||
$objHtlBkDtl->city = $objHotelBranch->city;
|
||||
$objHtlBkDtl->state = State::getNameById($objHotelBranch->state_id);
|
||||
$objHtlBkDtl->country = Country::getNameById($idLang, $objHotelBranch->country_id);
|
||||
@@ -443,7 +443,7 @@ class hotelreservationsystem extends Module
|
||||
if ($objHtlBkDtl->save()) {
|
||||
// save extra demands info
|
||||
if ($objCartBkData->extra_demands
|
||||
&& ($extraDemands = Tools::jsonDecode($objCartBkData->extra_demands, true))
|
||||
&& ($extraDemands = json_decode($objCartBkData->extra_demands, true))
|
||||
) {
|
||||
$objRoomDemandPrice = new HotelRoomTypeDemandPrice();
|
||||
foreach ($extraDemands as $demand) {
|
||||
|
||||
@@ -99,7 +99,7 @@ class ApiPaypalPlus
|
||||
/*
|
||||
* Init variable
|
||||
*/
|
||||
$oPayPalToken = Tools::jsonDecode($result);
|
||||
$oPayPalToken = json_decode($result);
|
||||
|
||||
if (isset($oPayPalToken->error)) {
|
||||
return false;
|
||||
@@ -159,7 +159,7 @@ class ApiPaypalPlus
|
||||
'Authorization:Bearer '.$accessToken,
|
||||
);
|
||||
|
||||
$result = Tools::jsonDecode($this->sendByCURL(URL_PPP_WEBPROFILE, Tools::jsonEncode($data), $header));
|
||||
$result = json_decode($this->sendByCURL(URL_PPP_WEBPROFILE, json_encode($data), $header));
|
||||
if (isset($result->id)) {
|
||||
return $result->id;
|
||||
} else {
|
||||
@@ -189,7 +189,7 @@ class ApiPaypalPlus
|
||||
'Authorization:Bearer '.$accessToken,
|
||||
);
|
||||
|
||||
return Tools::jsonDecode($this->sendByCURL(URL_PPP_WEBPROFILE, false, $header));
|
||||
return json_decode($this->sendByCURL(URL_PPP_WEBPROFILE, false, $header));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ class ApiPaypalPlus
|
||||
'Authorization:Bearer '.$access_token,
|
||||
);
|
||||
|
||||
$result = $this->sendByCURL(URL_PPP_CREATE_PAYMENT, Tools::jsonEncode($data), $header);
|
||||
$result = $this->sendByCURL(URL_PPP_CREATE_PAYMENT, json_encode($data), $header);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user