Και η Λύση σε 1.7.8.10 ειναι :
Μέσα στο classes\validate.php αλλάζουμε
/**
* Validate SIRET Code.
*
* @param string $siret SIRET Code
*
* @return bool Return true if is valid
*/
public static function isSiret($siret)
{
return preg_match(Tools::cleanNonUnicodeSupport('/^[^!<>;?=+@#"°{}_$%]*$/u'), $siret);
}
/**
* Validate APE Code.
*
* @param string $ape APE Code
*
* @return bool Return true if is valid
*/
public static function isApe($ape)
{
return preg_match(Tools::cleanNonUnicodeSupport('/^[^!<>;?=+@#"°{}_$%]*$/u'), $ape);
}
Έτσι παίζει μόνο το siret, για να παίξει και το APE.
Αλλάζουμε στο /src/Core/Domain/Customer/ValueObject/ApeCode.php και βαζουμε
class ApeCode
{
/**
* @var string
*/
private $code;
/**
* @param mixed $code
*/
public function __construct($code)
{
$this->assertIsApeCode($code);
$this->code = $code;
}
/**
* @return string
*/
public function getValue()
{
return $this->code;
}
private function assertIsApeCode($code)
{
if (is_string($code) && empty($code)) {
return;
}
$isApeCode = preg_match(Tools::cleanNonUnicodeSupport('/^[^!<>;?=+@#"°{}_$%]*$/u'), $code);
if (!$isApeCode) {
throw new CustomerConstraintException(sprintf('Invalid ape code %s provided', var_export($code, true)), CustomerConstraintException::INVALID_APE_CODE);
}
}
}
Και για να παίξει και στο backoffice το APE μέσα στο πελάτη αλλάζουμε :
/src/PrestaShopBundle/Form/Admin/Sell/Customer/CustomerType.php
->add('ape_code', TextType::class, [
'label' => $this->trans('APE', 'Admin.Orderscustomers.Feature'),
'required' => false,
'constraints' => [
new Type([
'type' => 'alnum',
'message' => $this->trans('This field is invalid.', 'Admin.Notifications.Error'),
]),
],
])
σε
->add('ape_code', TextType::class, [
'label' => $this->trans('APE', 'Admin.Orderscustomers.Feature'),
'required' => false,
])
Παίζει με ολους του χαρακτήρες.