43 return new $className();
81 $items = $entity::loadForPayment(
$payment->getId());
82 foreach ($items as $item)
91 $items = $entity::loadForPayment(
$payment->getId());
92 foreach ($items as $item)
109 public static function getList(array $parameters = array())
111 return Internals\PayableItemTable::getList($parameters);
120 'SALE_PAYABLE_ITEM_COLLECTION_INCOMPATIBLE_ITEM_TYPE',
121 [
'#CLASS#' => PayableItem::class]
126 return parent::addItem($item);
146 && $basketItem->
getBasketCode() === $payableBasketItem->getBasketCode())
158 $payableItem = $payableItemClass::create($this, $basketItem);
164 public function onBeforeBasketItemDelete(BasketItem $basketItem)
166 $result =
new Result();
172 $entity = $item->getEntityObject();
173 if ($entity->getBasketCode() === $basketItem->getBasketCode())
175 $r = $item->delete();
176 if (!$r->isSuccess())
178 $result->addErrors($r->getErrors());
194 public function createItemByShipment(Shipment $shipment) : PayableShipmentItem
199 if ($shipment->getInternalIndex() === $item->getEntityObject()->getInternalIndex())
211 $payableItem = $payableItemClass::create($this, $shipment);
250 public function save()
254 $dbRes = static::getList([
255 'filter' => [
'PAYMENT_ID' => $this->
getPayment()->getId()]
258 while ($item = $dbRes->fetch())
262 static::deleteInternal($item[
'ID']);
267 foreach ($this->collection as $entity)
269 $r = $entity->save();
270 if (!$r->isSuccess())
272 $result->addErrors($r->getErrors());
294 $dbRes = static::getList([
295 "filter" => [
"=PAYMENT_ID" => $paymentId],
299 while ($entity = $dbRes->fetch())
301 $r = static::deleteInternal($entity[
'ID']);
302 if (!$r->isSuccess())
304 $result->addErrors($r->getErrors());
318 return Internals\PayableItemTable::delete($primary);
327 public function createClone(\SplObjectStorage $cloneEntity)
329 if ($this->
isClone() && $cloneEntity->contains($this))
331 return $cloneEntity[$this];
335 $payableItemCollection = parent::createClone($cloneEntity);
339 if ($cloneEntity->contains($this->payment))
345 return $payableItemCollection;
static getMessage($code, $replace=null, $language=null)