Ejemplo n.º 1
0
 /**
  * Sets new value to specified field of shipment item
  *
  * @param string $name
  * @param mixed $value
  * @return Result
  * @throws Main\ArgumentOutOfRangeException
  * @throws Main\NotSupportedException
  * @throws \Exception
  */
 public function setField($name, $value)
 {
     if ($this->isSystem()) {
         throw new Main\NotSupportedException();
     }
     if ($name == "DELIVERY_ID") {
         if (strval($value) != '' && !Delivery\Services\Manager::isExistService($value)) {
             $result = new Result();
             $result->addError(new ResultError(Loc::getMessage('SALE_SHIPMENT_WRONG_DELIVERY_SERVICE'), 'SALE_SHIPMENT_WRONG_DELIVERY_SERVICE'));
         }
     }
     return parent::setField($name, $value);
 }