[-] CORE : fixed bug #PSCFV-4523 - Static _PS_DEFAULT_CUSTOMER_GROUP_ is still use in code even if deprecated 1.5.0.1

This commit is contained in:
vAugagneur
2013-01-09 10:26:16 +01:00
parent 9edb5e8911
commit 9154984c78
7 changed files with 17 additions and 11 deletions
+11 -5
View File
@@ -42,7 +42,7 @@ class CustomerCore extends ObjectModel
public $id_gender = 0;
/** @var integer Default group ID */
public $id_default_group = _PS_DEFAULT_CUSTOMER_GROUP_;
public $id_default_group;
/** @var string Lastname */
public $lastname;
@@ -189,7 +189,13 @@ class CustomerCore extends ObjectModel
protected static $_defaultGroupId = array();
protected static $_customerHasAddress = array();
protected static $_customer_groups = array();
public function __contruct($id = null)
{
$this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP');
parent::__construct($id);
}
public function add($autodate = true, $null_values = true)
{
$this->id_shop = ($this->id_shop) ? $this->id_shop : Context::getContext()->shop->id;
@@ -201,11 +207,11 @@ class CustomerCore extends ObjectModel
if ($this->newsletter && !Validate::isDate($this->newsletter_date_add))
$this->newsletter_date_add = date('Y-m-d H:i:s');
if ($this->id_default_group == _PS_DEFAULT_CUSTOMER_GROUP_)
if ($this->id_default_group == Configuration::get('PS_CUSTOMER_GROUP'))
if ($this->is_guest)
$this->id_default_group = Configuration::get('PS_GUEST_GROUP');
$this->id_default_group = (int)Configuration::get('PS_GUEST_GROUP');
else
$this->id_default_group = Configuration::get('PS_CUSTOMER_GROUP');
$this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP');
/* Can't create a guest customer, if this feature is disabled */
if ($this->is_guest && !Configuration::get('PS_GUEST_CHECKOUT_ENABLED'))
+1 -1
View File
@@ -157,7 +157,7 @@ class GroupCore extends ObjectModel
public function delete()
{
if ($this->id == _PS_DEFAULT_CUSTOMER_GROUP_)
if ($this->id == (int)Configuration::get('PS_CUSTOMER_GROUP'))
return false;
if (parent::delete())
{
+1 -1
View File
@@ -432,7 +432,7 @@ class LocalizationPackCore
$attributes = $xml->group_default->attributes();
if (isset($attributes['price_display_method']) && in_array((int)$attributes['price_display_method'], array(0, 1)))
{
$group = new Group((int)_PS_DEFAULT_CUSTOMER_GROUP_);
$group = new Group((int)Configuration::get('PS_CUSTOMER_GROUP'));
$group->price_display_method = (int)$attributes['price_display_method'];
if (!$group->save())
$this->_errors[] = Tools::displayError('An error occurred during the default group update');
+1 -1
View File
@@ -2399,7 +2399,7 @@ class ProductCore extends ObjectModel
if (!Validate::isBool($usetax) || !Validate::isUnsignedId($id_product))
die(Tools::displayError());
// Initializations
$id_group = (isset($context->customer) ? $context->customer->id_default_group : _PS_DEFAULT_CUSTOMER_GROUP_);
$id_group = (isset($context->customer) ? $context->customer->id_default_group : (int)Configuration::get('PS_CUSTOMER_GROUP'));
// 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))
+1 -1
View File
@@ -333,7 +333,7 @@ class WebserviceRequestCore
$id_country = (int)(isset($value['country']) ? $value['country'] : (Configuration::get('PS_COUNTRY_DEFAULT')));
$id_state = (int)(isset($value['state']) ? $value['state'] : 0);
$id_currency = (int)(isset($value['currency']) ? $value['currency'] : Configuration::get('PS_CURRENCY_DEFAULT'));
$id_group = (int)(isset($value['group']) ? $value['group'] : Configuration::get('_PS_DEFAULT_CUSTOMER_GROUP_'));
$id_group = (int)(isset($value['group']) ? $value['group'] : (int)Configuration::get('PS_CUSTOMER_GROUP'));
$quantity = (int)(isset($value['quantity']) ? $value['quantity'] : 1);
$use_tax = (int)(isset($value['use_tax']) ? $value['use_tax'] : Configuration::get('PS_TAX'));
$decimals = (int)(isset($value['decimals']) ? $value['decimals'] : Configuration::get('PS_PRICE_ROUND_MODE'));
+1 -1
View File
@@ -142,7 +142,7 @@ define('_STOCK_MOVEMENT_MISSING_REASON_', 4);
/**
* @deprecated 1.5.0.1
* @see const PS_CUSTOMER_GROUP
* @see Configuration::get('PS_CUSTOMER_GROUP')
*/
define('_PS_DEFAULT_CUSTOMER_GROUP_', 3);
+1 -1
View File
@@ -275,7 +275,7 @@ class ProductControllerCore extends FrontController
protected function assignPriceAndTax()
{
$id_customer = (isset($this->context->customer) ? (int)$this->context->customer->id : 0);
$id_group = (isset($this->context->customer) ? $this->context->customer->id_default_group : _PS_DEFAULT_CUSTOMER_GROUP_);
$id_group = (isset($this->context->customer) ? $this->context->customer->id_default_group : (int)Configuration::get('PS_CUSTOMER_GROUP'));
$id_country = (int)$id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT');
$group_reduction = GroupReduction::getValueForProduct($this->product->id, $id_group);