mirror of
https://github.com/anthonyaxenov/atol-online.git
synced 2024-12-22 17:34:56 +00:00
Небольшие правки по Item (улучшена проверка длины ед. изм.)
This commit is contained in:
parent
2d29ff3994
commit
4fccf7809d
@ -100,17 +100,17 @@ class Item extends Entity
|
|||||||
if ($price) {
|
if ($price) {
|
||||||
$this->setPrice($price);
|
$this->setPrice($price);
|
||||||
}
|
}
|
||||||
if ($payment_object) {
|
|
||||||
$this->setPaymentObject($payment_object);
|
|
||||||
}
|
|
||||||
if ($quantity) {
|
if ($quantity) {
|
||||||
$this->setQuantity($quantity);
|
$this->setQuantity($quantity);
|
||||||
}
|
}
|
||||||
|
if ($measurement_unit) {
|
||||||
|
$this->setMeasurementUnit($measurement_unit);
|
||||||
|
}
|
||||||
if ($vat_type) {
|
if ($vat_type) {
|
||||||
$this->setVatType($vat_type);
|
$this->setVatType($vat_type);
|
||||||
}
|
}
|
||||||
if ($measurement_unit) {
|
if ($payment_object) {
|
||||||
$this->setMeasurementUnit($measurement_unit);
|
$this->setPaymentObject($payment_object);
|
||||||
}
|
}
|
||||||
if ($payment_method) {
|
if ($payment_method) {
|
||||||
$this->setPaymentMethod($payment_method);
|
$this->setPaymentMethod($payment_method);
|
||||||
@ -225,7 +225,7 @@ class Item extends Entity
|
|||||||
public function setMeasurementUnit(string $measurement_unit)
|
public function setMeasurementUnit(string $measurement_unit)
|
||||||
{
|
{
|
||||||
$measurement_unit = trim($measurement_unit);
|
$measurement_unit = trim($measurement_unit);
|
||||||
if (strlen($measurement_unit) > 16) {
|
if ((function_exists('mb_strlen') ? mb_strlen($measurement_unit) : strlen($measurement_unit)) > 16) {
|
||||||
throw new AtolUnitTooLongException($measurement_unit, 16);
|
throw new AtolUnitTooLongException($measurement_unit, 16);
|
||||||
}
|
}
|
||||||
$this->measurement_unit = $measurement_unit;
|
$this->measurement_unit = $measurement_unit;
|
||||||
|
Loading…
Reference in New Issue
Block a user