Merge branch 'develop' into gli-2538
This commit is contained in:
@@ -149,8 +149,7 @@ class CustomerCore extends ObjectModel
|
||||
'last_passwd_gen' => array('setter' => null),
|
||||
'secure_key' => array('setter' => null),
|
||||
'deleted' => array(),
|
||||
'passwd' => array('setter' => 'setWsPasswd'),
|
||||
'phone' => array()
|
||||
'passwd' => array('setter' => 'setWsPasswd')
|
||||
),
|
||||
'associations' => array(
|
||||
'groups' => array('resource' => 'group'),
|
||||
@@ -180,6 +179,7 @@ class CustomerCore extends ObjectModel
|
||||
'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
||||
'siret' => array('type' => self::TYPE_STRING, 'validate' => 'isSiret'),
|
||||
'ape' => array('type' => self::TYPE_STRING, 'validate' => 'isApe'),
|
||||
'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
|
||||
'outstanding_allow_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'copy_post' => false),
|
||||
'show_public_prices' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false),
|
||||
'id_risk' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false),
|
||||
@@ -206,12 +206,8 @@ class CustomerCore extends ObjectModel
|
||||
$this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP');
|
||||
parent::__construct($id);
|
||||
|
||||
if ($this->email) {
|
||||
$this->phone = CustomerGuestDetail::getCustomerPhone($this->email, false);
|
||||
}
|
||||
|
||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) {
|
||||
$this->webserviceParameters['fields']['phone']['required'] = true;
|
||||
self::$definition['fields']['phone']['required'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +260,7 @@ class CustomerCore extends ObjectModel
|
||||
}
|
||||
$success = parent::add($autodate, $null_values);
|
||||
$this->updateGroup($this->groupBox);
|
||||
$this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($this->email, false));
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
@@ -289,22 +285,9 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
$objOldCustomer = new Customer($this->id);
|
||||
$success = parent::update(true);
|
||||
$this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($objOldCustomer->email, false));
|
||||
return $success;
|
||||
}
|
||||
|
||||
public function updateCustomerAdditionalDetails($idCustomerGuest)
|
||||
{
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuest);
|
||||
$objCustomerGuestDetail->id_customer = 0;
|
||||
$objCustomerGuestDetail->id_gender = $this->id_gender;
|
||||
$objCustomerGuestDetail->firstname = $this->firstname;
|
||||
$objCustomerGuestDetail->lastname = $this->lastname;
|
||||
$objCustomerGuestDetail->email = $this->email;
|
||||
$objCustomerGuestDetail->phone = $this->phone;
|
||||
return $objCustomerGuestDetail->save();
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!count(Order::getCustomerOrders((int)$this->id))) {
|
||||
@@ -344,8 +327,6 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
CartRule::deleteByIdCustomer((int)$this->id);
|
||||
// delete customer data from customerGuest table
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail(CustomerGuestDetail::getIdCustomerGuest($this->email, false));
|
||||
$objCustomerGuestDetail->delete();
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
|
||||
@@ -1384,7 +1384,7 @@ abstract class PaymentModuleCore extends Module
|
||||
} // End foreach $order_detail_list
|
||||
|
||||
// delete cart feature prices after booking creation success
|
||||
HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart);
|
||||
HotelRoomTypeFeaturePricing::deleteFeaturePrices($id_cart);
|
||||
|
||||
if (count($cart_rules)) {
|
||||
foreach ($cart_rules as $idCartRule => $cartRule) {
|
||||
|
||||
@@ -3043,7 +3043,7 @@ class ProductCore extends ObjectModel
|
||||
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null,
|
||||
$only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null,
|
||||
$id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null,
|
||||
$use_customer_price = true, $id_product_roomtype = false)
|
||||
$use_customer_price = true, $id_product_roomtype = false, $id_group = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
@@ -3060,14 +3060,16 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
// Initializations
|
||||
$id_group = null;
|
||||
if ($id_customer) {
|
||||
$id_group = Customer::getDefaultGroupId((int)$id_customer);
|
||||
}
|
||||
|
||||
if (!$id_group) {
|
||||
$id_group = (int)Group::getCurrent()->id;
|
||||
if ($id_customer) {
|
||||
$id_group = Customer::getDefaultGroupId((int)$id_customer);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$id_group || !Validate::isLoadedObject(new Group((int) $id_group))) {
|
||||
$id_group = (int)Group::getCurrent()->id;
|
||||
}
|
||||
// If there is cart in context or if the specified id_cart is different from the context cart id
|
||||
if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart && $cur_cart->id != $id_cart)) {
|
||||
/*
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
class TranslateCore
|
||||
{
|
||||
public static $ignore_folder = array('.', '..', '.svn', '.git', '.htaccess', 'index.php');
|
||||
public static $adminTranslations = array();
|
||||
public static $moduleTranslations = array();
|
||||
|
||||
/**
|
||||
* Get a translation for an admin controller
|
||||
@@ -43,21 +45,19 @@ class TranslateCore
|
||||
public static function getAdminTranslation($string, $class = 'AdminTab', $addslashes = false, $htmlentities = true, $sprintf = null)
|
||||
{
|
||||
static $modules_tabs = null;
|
||||
|
||||
// @todo remove global keyword in translations files and use static
|
||||
global $_LANGADM;
|
||||
|
||||
if ($modules_tabs === null) {
|
||||
$modules_tabs = Tab::getModuleTabList();
|
||||
}
|
||||
|
||||
if ($_LANGADM == null) {
|
||||
$iso = Context::getContext()->language->iso_code;
|
||||
if (empty($iso)) {
|
||||
$iso = Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
}
|
||||
$iso = Context::getContext()->language->iso_code;
|
||||
if (empty($iso)) {
|
||||
$iso = Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
}
|
||||
|
||||
if (!isset(self::$adminTranslations[$iso])) {
|
||||
if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php')) {
|
||||
include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
|
||||
self::$adminTranslations[$iso] = $GLOBALS['_LANGADM'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,10 +71,10 @@ class TranslateCore
|
||||
|
||||
$string = preg_replace("/\\\*'/", "\'", $string);
|
||||
$key = md5($string);
|
||||
if (isset($_LANGADM[$class.$key])) {
|
||||
$str = $_LANGADM[$class.$key];
|
||||
if (isset(self::$adminTranslations[$iso][$class.$key])) {
|
||||
$str = self::$adminTranslations[$iso][$class.$key];
|
||||
} else {
|
||||
$str = Translate::getGenericAdminTranslation($string, $key, $_LANGADM);
|
||||
$str = Translate::getGenericAdminTranslation($string, $key, self::$adminTranslations[$iso]);
|
||||
}
|
||||
|
||||
if ($htmlentities) {
|
||||
@@ -128,7 +128,7 @@ class TranslateCore
|
||||
*/
|
||||
public static function getModuleTranslation($module, $string, $source, $sprintf = null, $addslashes = false, $language = null)
|
||||
{
|
||||
global $_MODULES, $_MODULE, $_LANGADM;
|
||||
global $_MODULE;
|
||||
|
||||
static $lang_cache = array();
|
||||
// $_MODULES is a cache of translations for all module.
|
||||
@@ -146,15 +146,19 @@ class TranslateCore
|
||||
$force_refresh = true;
|
||||
}
|
||||
|
||||
if ((!isset($translations_merged[$name]) && isset(Context::getContext()->language)) || $force_refresh) {
|
||||
$iso = $language->iso_code;
|
||||
if (!isset(self::$moduleTranslations[$iso])) {
|
||||
self::$moduleTranslations[$iso] = array();
|
||||
}
|
||||
if ((isset(Context::getContext()->language) && !isset($translations_merged[$name])) || $force_refresh) {
|
||||
$files_by_priority = array(
|
||||
// Translations in theme
|
||||
_PS_THEME_DIR_.'modules/'.$name.'/translations/'.$language->iso_code.'.php',
|
||||
_PS_THEME_DIR_.'modules/'.$name.'/'.$language->iso_code.'.php',
|
||||
_PS_THEME_DIR_.'modules/'.$name.'/translations/'.$iso.'.php',
|
||||
_PS_THEME_DIR_.'modules/'.$name.'/'.$iso.'.php',
|
||||
// PrestaShop 1.5 translations
|
||||
_PS_MODULE_DIR_.$name.'/translations/'.$language->iso_code.'.php',
|
||||
_PS_MODULE_DIR_.$name.'/translations/'.$iso.'.php',
|
||||
// PrestaShop 1.4 translations
|
||||
_PS_MODULE_DIR_.$name.'/'.$language->iso_code.'.php'
|
||||
_PS_MODULE_DIR_.$name.'/'.$iso.'.php'
|
||||
);
|
||||
// if force_refresh is set reverse the list because array_merge will overrite the previous file with new file
|
||||
if ($force_refresh) {
|
||||
@@ -163,8 +167,8 @@ class TranslateCore
|
||||
foreach ($files_by_priority as $file) {
|
||||
if (file_exists($file)) {
|
||||
include_once($file);
|
||||
$_MODULES = !empty($_MODULES) ? ($force_refresh ? array_merge($_MODULES, $_MODULE) : $_MODULES + $_MODULE) : $_MODULE; //we use "+" instead of array_merge() when force_refresh is false because array merge erase existing values.
|
||||
$translations_merged[$name] = true;
|
||||
self::$moduleTranslations[$iso] = !empty(self::$moduleTranslations[$iso]) ? ($force_refresh ? array_merge(self::$moduleTranslations[$iso], $_MODULE) : self::$moduleTranslations[$iso] + $_MODULE) : $_MODULE; //we use "+" instead of array_merge() when force_refresh is false because array merge erase existing values.
|
||||
$translations_merged[$language->iso_code][$name] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,7 +178,7 @@ class TranslateCore
|
||||
$cache_key = $name.'|'.$string.'|'.$source.'|'.(int)$addslashes;
|
||||
|
||||
if (!isset($lang_cache[$cache_key])) {
|
||||
if ($_MODULES == null) {
|
||||
if (self::$moduleTranslations[$iso] == null) {
|
||||
if ($sprintf !== null) {
|
||||
$string = Translate::checkAndReplaceArgs($string, $sprintf);
|
||||
}
|
||||
@@ -190,18 +194,18 @@ class TranslateCore
|
||||
$default_key_file = strtolower('<{'.$name.'}prestashop>'.$file).'_'.$key;
|
||||
}
|
||||
|
||||
if (isset($current_key_file) && !empty($_MODULES[$current_key_file])) {
|
||||
$ret = stripslashes($_MODULES[$current_key_file]);
|
||||
} elseif (isset($default_key_file) && !empty($_MODULES[$default_key_file])) {
|
||||
$ret = stripslashes($_MODULES[$default_key_file]);
|
||||
} elseif (!empty($_MODULES[$current_key])) {
|
||||
$ret = stripslashes($_MODULES[$current_key]);
|
||||
} elseif (!empty($_MODULES[$default_key])) {
|
||||
$ret = stripslashes($_MODULES[$default_key]);
|
||||
if (isset($current_key_file) && !empty(self::$moduleTranslations[$iso][$current_key_file])) {
|
||||
$ret = stripslashes(self::$moduleTranslations[$iso][$current_key_file]);
|
||||
} elseif (isset($default_key_file) && !empty(self::$moduleTranslations[$iso][$default_key_file])) {
|
||||
$ret = stripslashes(self::$moduleTranslations[$iso][$default_key_file]);
|
||||
} elseif (!empty(self::$moduleTranslations[$iso][$current_key])) {
|
||||
$ret = stripslashes(self::$moduleTranslations[$iso][$current_key]);
|
||||
} elseif (!empty(self::$moduleTranslations[$iso][$default_key])) {
|
||||
$ret = stripslashes(self::$moduleTranslations[$iso][$default_key]);
|
||||
}
|
||||
// if translation was not found in module, look for it in AdminController or Helpers
|
||||
elseif (!empty($_LANGADM)) {
|
||||
$ret = stripslashes(Translate::getGenericAdminTranslation($string, $key, $_LANGADM));
|
||||
elseif (isset(self::$adminTranslations[$iso]) && !empty(self::$adminTranslations[$iso])) {
|
||||
$ret = stripslashes(Translate::getGenericAdminTranslation($string, $key, self::$adminTranslations[$iso]));
|
||||
} else {
|
||||
$ret = stripslashes($string);
|
||||
}
|
||||
|
||||
1
classes/cache/Cache.php
vendored
1
classes/cache/Cache.php
vendored
@@ -90,6 +90,7 @@ abstract class CacheCore
|
||||
'page_viewed',
|
||||
'employee',
|
||||
'log',
|
||||
'htl_cart_booking_data',
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1269,7 +1269,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$this->bookingCustomer = $objCustomer;
|
||||
} else {
|
||||
$objCustomer = new Customer();
|
||||
$this->bookingCustomer = $objCustomer->getByEmail($guestDetails['email']);
|
||||
$this->bookingCustomer = $objCustomer->getByEmail($guestDetails['email'], null, false);
|
||||
}
|
||||
|
||||
if (isset($this->bookingCustomer->id)
|
||||
@@ -1710,7 +1710,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
'id_cart' => (int) $this->context->cart->id,
|
||||
'id_guest' => (int) $this->context->cart->id_guest,
|
||||
'date_from' => date('Y-m-d', strtotime($dateFrom)),
|
||||
'date_to' => date('Y-m-d', strtotime($dateTo)),
|
||||
'date_to' => date('Y-m-d', strtotime($dateTo) - _TIME_1_DAY_),
|
||||
'id_room' => $objCartBookingData->id_room,
|
||||
'price' => $room['unit_price_without_tax']
|
||||
)
|
||||
@@ -2331,7 +2331,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
}
|
||||
|
||||
$this->deleteWsFeaturePrices();
|
||||
HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id);
|
||||
HotelRoomTypeFeaturePricing::deleteFeaturePrices($this->context->cart->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2878,8 +2878,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$objRoomTypeFeaturePricing->id_room = (int) $params['id_room'];
|
||||
$objRoomTypeFeaturePricing->feature_price_name = $feature_price_name;
|
||||
$objRoomTypeFeaturePricing->date_selection_type = HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE;
|
||||
$objRoomTypeFeaturePricing->date_from = date('Y-m-d', strtotime($params['date_from']));
|
||||
$objRoomTypeFeaturePricing->date_to = date('Y-m-d', strtotime($params['date_to']));
|
||||
$objRoomTypeFeaturePricing->date_from = $params['date_from'];
|
||||
$objRoomTypeFeaturePricing->date_to = $params['date_to'];
|
||||
$objRoomTypeFeaturePricing->is_special_days_exists = 0;
|
||||
$objRoomTypeFeaturePricing->special_days = json_encode(false);
|
||||
$objRoomTypeFeaturePricing->impact_way = HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE;
|
||||
@@ -2970,7 +2970,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
'id_cart' => (int) $objCart->id,
|
||||
'id_guest' => (int) $objCart->id_guest,
|
||||
'date_from' => date('Y-m-d', strtotime($objHotelBookingDetail->date_from)),
|
||||
'date_to' => date('Y-m-d', strtotime($objHotelBookingDetail->date_to)),
|
||||
'date_to' => date('Y-m-d', strtotime($objHotelBookingDetail->date_to) - _TIME_1_DAY_),
|
||||
'id_room' => $objHotelBookingDetail->id_room,
|
||||
'price' => $room['unit_price_without_tax']
|
||||
)
|
||||
@@ -3006,7 +3006,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
|
||||
$objOrder->total_products_wt += $objHotelBookingDetail->total_price_tax_incl;
|
||||
$objOrder->update();
|
||||
|
||||
HotelRoomTypeFeaturePricing::deleteByIdCart($objCart->id);
|
||||
HotelRoomTypeFeaturePricing::deleteFeaturePrices($objCart->id);
|
||||
$this->deleteWsFeaturePrices();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user