diff --git a/classes/Address.php b/classes/Address.php index ef5fc8b2f..4108bee85 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -109,28 +109,28 @@ class AddressCore extends ObjectModel 'table' => 'address', 'primary' => 'id_address', 'fields' => array( - 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_from_front' => false), - 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_from_front' => false), - 'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_from_front' => false), - 'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_from_front' => false), - 'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true, 'copy_from_front' => true), - 'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_from_front' => true), - 'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32, 'copy_from_front' => true), - 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 32, 'copy_from_front' => true), - 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32, 'copy_from_front' => true), - 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32, 'copy_from_front' => true), - 'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'copy_from_front' => true), - 'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128, 'copy_from_front' => true), - 'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128, 'copy_from_front' => true), - 'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12, 'copy_from_front' => true), - 'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64, 'copy_from_front' => true), - 'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300, 'copy_from_front' => true), - 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16, 'copy_from_front' => true), - 'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16, 'copy_from_front' => true), - 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16, 'copy_from_front' => true), - 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_from_front' => false), - 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_from_front' => false), - 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_from_front' => false), + 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), + 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), + 'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), + 'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), + 'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'), + 'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), + 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 32), + 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), + 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), + 'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), + 'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128), + 'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128), + 'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12), + 'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64), + 'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300), + 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16), + 'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 16), + 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16), + 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), + 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), + 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), ), ); diff --git a/classes/Customer.php b/classes/Customer.php index 624b8f5f7..d39c7785c 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -155,35 +155,35 @@ class CustomerCore extends ObjectModel 'table' => 'customer', 'primary' => 'id_customer', 'fields' => array( - 'secure_key' => array('type' => self::TYPE_STRING, 'validate' => 'isMd5', 'copy_from_front' => false), - 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32, 'copy_from_front' => true), - 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32, 'copy_from_front' => true), - 'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 128, 'copy_from_front' => true), - 'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'required' => true, 'size' => 32, 'copy_from_front' => true), - 'last_passwd_gen' => array('type' => self::TYPE_STRING, 'copy_from_front' => false), - 'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_from_front' => true), - 'birthday' => array('type' => self::TYPE_DATE, 'validate' => 'isBirthDate', 'copy_from_front' => true), - 'newsletter' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_from_front' => true), - 'newsletter_date_add' => array('type' => self::TYPE_DATE,'copy_from_front' => false), - 'ip_registration_newsletter' => array('type' => self::TYPE_STRING, 'copy_from_front' => false), - 'optin' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_from_front' => true), - 'website' => array('type' => self::TYPE_STRING, 'validate' => 'isUrl', 'copy_from_front' => true), - 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'copy_from_front' => true), - 'siret' => array('type' => self::TYPE_STRING, 'validate' => 'isSiret', 'copy_from_front' => true), - 'ape' => array('type' => self::TYPE_STRING, 'validate' => 'isApe', 'copy_from_front' => true), - 'outstanding_allow_amount' => array('type' => self::TYPE_INT, 'validate' => 'isFloat', 'copy_from_front' => false), - 'show_public_prices' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_from_front' => false), - 'id_risk' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_from_front' => false), - 'max_payment_days' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_from_front' => false), - 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_from_front' => false), - 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_from_front' => false), - 'note' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 65000, 'copy_from_front' => false), - 'is_guest' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_from_front' => false), - 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_from_front' => false), - 'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_from_front' => false), - 'id_default_group' => array('type' => self::TYPE_INT, 'copy_from_front' => false), - 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_from_front' => false), - 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_from_front' => false), + 'secure_key' => array('type' => self::TYPE_STRING, 'validate' => 'isMd5', 'copy_post' => false), + 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), + 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), + 'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 128), + 'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'required' => true, 'size' => 32), + 'last_passwd_gen' => array('type' => self::TYPE_STRING, 'copy_post' => false), + 'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'birthday' => array('type' => self::TYPE_DATE, 'validate' => 'isBirthDate'), + 'newsletter' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'newsletter_date_add' => array('type' => self::TYPE_DATE,'copy_post' => false), + 'ip_registration_newsletter' => array('type' => self::TYPE_STRING, 'copy_post' => false), + 'optin' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'website' => array('type' => self::TYPE_STRING, 'validate' => 'isUrl'), + 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isName'), + 'siret' => array('type' => self::TYPE_STRING, 'validate' => 'isSiret'), + 'ape' => array('type' => self::TYPE_STRING, 'validate' => 'isApe'), + 'outstanding_allow_amount' => array('type' => self::TYPE_INT, '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), + 'max_payment_days' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'copy_post' => false), + 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), + 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), + 'note' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 65000, 'copy_post' => false), + 'is_guest' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), + 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false), + 'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'copy_post' => false), + 'id_default_group' => array('type' => self::TYPE_INT, 'copy_post' => false), + 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), + 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), ), ); diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 492626844..78cea202b 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -798,7 +798,7 @@ abstract class ObjectModelCore $errors[] = ''.self::displayFieldName($field, get_class($this), $htmlentities).' '.Tools::displayError('is invalid.'); else { - if (!isset($data['copy_from_front']) || !$data['copy_from_front']) + if (isset($data['copy_post']) && !$data['copy_post']) continue; if ($field == 'passwd') {