[-] WS : Fixed PSFV-383
This commit is contained in:
@@ -65,7 +65,7 @@ class CombinationCore extends ObjectModel
|
||||
'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13', 'size' => 13),
|
||||
'upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc', 'size' => 12),
|
||||
'wholesale_price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'size' => 27),
|
||||
'price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'size' => 20),
|
||||
'price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isNegativePrice', 'size' => 20),
|
||||
'ecotax' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'size' => 20),
|
||||
'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'size' => 10),
|
||||
'weight' => array('type' => self::TYPE_INT, 'validate' => 'isFloat'),
|
||||
|
||||
@@ -233,6 +233,17 @@ class ValidateCore
|
||||
return preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', $price);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for price validity (including negative price)
|
||||
*
|
||||
* @param string $price Price to validate
|
||||
* @return boolean Validity is ok or not
|
||||
*/
|
||||
public static function isNegativePrice($price)
|
||||
{
|
||||
return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,9})?$/', $price);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for language code (ISO) validity
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user