[-] BO : Fixed bug #PSTEST-937. Add new attributes to the forbidden list and fix the layout during the creation of a new country
This commit is contained in:
+25
-11
@@ -88,7 +88,19 @@ class AddressFormatCore extends ObjectModel
|
|||||||
'need_zip_code',
|
'need_zip_code',
|
||||||
'contains_states',
|
'contains_states',
|
||||||
'call_prefixes',
|
'call_prefixes',
|
||||||
'call_prefix');
|
'show_public_prices',
|
||||||
|
'max_payment',
|
||||||
|
'max_payment_days',
|
||||||
|
'geoloc_postcode',
|
||||||
|
'logged',
|
||||||
|
'account_number',
|
||||||
|
'groupBox',
|
||||||
|
'ape',
|
||||||
|
'max_payment',
|
||||||
|
'outstanding_allow_amount',
|
||||||
|
'call_prefix',
|
||||||
|
'definition',
|
||||||
|
);
|
||||||
|
|
||||||
public static $forbiddenClassList = array(
|
public static $forbiddenClassList = array(
|
||||||
'Manufacturer',
|
'Manufacturer',
|
||||||
@@ -155,9 +167,9 @@ class AddressFormatCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$associationName[0] = strtolower($associationName[0]);
|
$associationName[0] = strtolower($associationName[0]);
|
||||||
if (in_array($associationName[0], self::$forbiddenPropertyList) ||
|
if (in_array($associationName[0], self::$forbiddenPropertyList) ||
|
||||||
!$this->_checkValidateClassField('Address', $associationName[0], false))
|
!$this->_checkValidateClassField('Address', $associationName[0], false))
|
||||||
$this->_errorFormatList[] = Tools::displayError('This name isn\'t allowed').': '.
|
$this->_errorFormatList[] = Tools::displayError('This name isn\'t allowed').': '.
|
||||||
$associationName[0];
|
$associationName[0];
|
||||||
}
|
}
|
||||||
else if ($totalNameUsed == 2)
|
else if ($totalNameUsed == 2)
|
||||||
{
|
{
|
||||||
@@ -170,18 +182,20 @@ class AddressFormatCore extends ObjectModel
|
|||||||
|
|
||||||
if (in_array($associationName[0], self::$forbiddenClassList))
|
if (in_array($associationName[0], self::$forbiddenClassList))
|
||||||
$this->_errorFormatList[] = Tools::displayError('This name isn\'t allowed').': '.
|
$this->_errorFormatList[] = Tools::displayError('This name isn\'t allowed').': '.
|
||||||
$associationName[0];
|
$associationName[0];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check if the id field name exist in the Address class
|
// Check if the id field name exist in the Address class
|
||||||
$this->_checkValidateClassField('Address', 'id_'.strtolower($associationName[0]), true);
|
// Don't check this attribute on Address (no sense)
|
||||||
|
if ($associationName[0] != 'Address')
|
||||||
|
$this->_checkValidateClassField('Address', 'id_'.strtolower($associationName[0]), true);
|
||||||
|
|
||||||
// Check if the field name exist in the class write by the user
|
// Check if the field name exist in the class write by the user
|
||||||
$this->_checkValidateClassField($associationName[0], $associationName[1], false);
|
$this->_checkValidateClassField($associationName[0], $associationName[1], false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -206,13 +220,13 @@ class AddressFormatCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$this->_checkLiableAssociation($patternName, $fieldsValidate);
|
$this->_checkLiableAssociation($patternName, $fieldsValidate);
|
||||||
$usedKeyList[] = $patternName;
|
$usedKeyList[] = $patternName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->_errorFormatList[] = Tools::displayError('This key is used too many times (once allowed)').
|
$this->_errorFormatList[] = Tools::displayError('This key is used too many times (once allowed)').
|
||||||
': '.$patternName;
|
': '.$patternName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return (count($this->_errorFormatList)) ? false : true;
|
return (count($this->_errorFormatList)) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -353,9 +353,11 @@ class AdminCountriesControllerCore extends AdminController
|
|||||||
|
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
if (Tools::getValue('submitAdd'.$this->table))
|
$res = parent::postProcess();
|
||||||
|
|
||||||
|
if (Tools::getValue('submitAdd'.$this->table) && $res)
|
||||||
{
|
{
|
||||||
$id_country = Tools::getValue('id_country');
|
$id_country = ($id_country = Tools::getValue('id_country')) ? $id_country : $res['id'];
|
||||||
$tmp_addr_format = new AddressFormat($id_country);
|
$tmp_addr_format = new AddressFormat($id_country);
|
||||||
|
|
||||||
$save_status = false;
|
$save_status = false;
|
||||||
@@ -389,7 +391,7 @@ class AdminCountriesControllerCore extends AdminController
|
|||||||
unset($tmp_addr_format);
|
unset($tmp_addr_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::postProcess();
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function displayValidFields()
|
protected function displayValidFields()
|
||||||
|
|||||||
Reference in New Issue
Block a user