示例#1
0
 /**
  * @param string $name						Field name.
  * @param string|int|float $value			Field value.
  * @return Result|bool
  * @throws Main\ArgumentOutOfRangeException
  * @throws \Exception
  */
 public function setField($name, $value)
 {
     if ($this->isCalculatedField($name)) {
         $this->calculatedFields->set($name, $value);
         return true;
     }
     return parent::setField($name, $value);
 }
示例#2
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)
 {
     /** @var ShipmentItemCollection $collection */
     $collection = $this->getCollection();
     $shipment = $collection->getShipment();
     if ($shipment->isSystem() && $name != 'RESERVED_QUANTITY') {
         throw new Main\NotSupportedException();
     }
     return parent::setField($name, $value);
 }
示例#3
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);
 }
示例#4
0
 /**
  * @param $name
  * @param $value
  * @return Result
  * @throws Main\ArgumentOutOfRangeException
  * @throws Main\NotImplementedException
  * @throws \Exception
  */
 public function setField($name, $value)
 {
     if ($name == "PAY_SYSTEM_ID") {
         if (intval($value) > 0 && !PaySystemService::isExist($value)) {
             $result = new Result();
             $result->addError(new ResultError(Loc::getMessage('SALE_PAYMENT_WRONG_PAYMENT_SERVICE'), 'SALE_PAYMENT_WRONG_PAYMENT_SERVICE'));
             return $result;
         }
         /** @var PaymentCollection $paymentCollection */
         if (!($paymentCollection = $this->getCollection())) {
             throw new Main\ObjectNotFoundException('Entity "PaymentCollection" not found');
         }
         if (count($paymentCollection) == 1) {
             /** @var Order $order */
             if ($order = $paymentCollection->getOrder()) {
                 if (strval($order->getField('PAY_SYSTEM_ID')) == '') {
                     $order->setFieldNoDemand('PAY_SYSTEM_ID', intval($value));
                 }
             }
         }
     }
     return parent::setField($name, $value);
 }