示例#1
0
 /**
  * Save field modify to history.
  *
  * @param string $name				Field name.
  * @param null|string $oldValue		Old value.
  * @param null|string $value		New value.
  */
 protected function addChangesToHistory($name, $oldValue = null, $value = null)
 {
     if ($this->getId() > 0) {
         $historyFields = array();
         if ($name == "PRICE") {
             $historyFields = array('OLD_PRICE' => $oldValue, 'CURRENCY' => $this->getCurrency());
         }
         OrderHistory::addField('ORDER', $this->getId(), $name, $oldValue, $value, $this->getId(), $this, $historyFields);
     }
 }
示例#2
0
 /**
  * @param string $name
  * @param null $oldValue
  * @param null $value
  * @throws ObjectNotFoundException
  */
 protected function addChangesToHistory($name, $oldValue = null, $value = null)
 {
     if ($this->getId() > 0) {
         $fields = array();
         /** @var Basket $basket */
         if (!($basket = $this->getCollection())) {
             throw new ObjectNotFoundException('Entity "Basket" not found');
         }
         if ($basket->getOrder() && $basket->getOrderId() > 0) {
             if ($name == "QUANTITY") {
                 if (floatval($value) == 0) {
                     return;
                 }
                 $fields = array('PRODUCT_ID' => $this->getProductId(), 'QUANTITY' => $this->getQuantity(), 'NAME' => $this->getField('NAME'));
             }
             OrderHistory::addField('BASKET', $basket->getOrderId(), $name, $oldValue, $value, $this->getId(), $this, $fields);
         }
     }
 }
示例#3
0
 /**
  * @param string $name
  * @param null|string $oldValue
  * @param null|string $value
  * @throws Main\ObjectNotFoundException
  */
 protected function addChangesToHistory($name, $oldValue = null, $value = null)
 {
     if ($this->getId() > 0) {
         /** @var ShipmentItemStoreCollection $shipmentItemStoreCollection */
         if (!($shipmentItemStoreCollection = $this->getCollection())) {
             throw new Main\ObjectNotFoundException('Entity "ShipmentItemStoreCollection" not found');
         }
         /** @var ShipmentItem $shipmentItem */
         if (!($shipmentItem = $shipmentItemStoreCollection->getShipmentItem())) {
             throw new Main\ObjectNotFoundException('Entity "ShipmentItem" not found');
         }
         /** @var ShipmentItemCollection $shipmentItemCollection */
         if (!($shipmentItemCollection = $shipmentItem->getCollection())) {
             throw new Main\ObjectNotFoundException('Entity "ShipmentItemCollection" not found');
         }
         /** @var Shipment $shipment */
         if (!($shipment = $shipmentItemCollection->getShipment())) {
             throw new Main\ObjectNotFoundException('Entity "Shipment" not found');
         }
         if ($shipment->isSystem()) {
             return;
         }
         /** @var ShipmentCollection $shipmentCollection */
         if (!($shipmentCollection = $shipment->getCollection())) {
             throw new Main\ObjectNotFoundException('Entity "ShipmentCollection" not found');
         }
         /** @var Order $order */
         if (($order = $shipmentCollection->getOrder()) && $order->getId() > 0) {
             $historyFields = array();
             /** @var BasketItem $basketItem */
             if ($basketItem = $shipmentItem->getBasketItem()) {
                 $historyFields = array('NAME' => $basketItem->getField('NAME'), 'PRODUCT_ID' => $basketItem->getField('PRODUCT_ID'));
             }
             OrderHistory::addField('SHIPMENT_ITEM_STORE', $order->getId(), $name, $oldValue, $value, $this->getId(), $this, $historyFields);
         }
     }
 }
示例#4
0
 /**
  * @param string $name
  * @param null $oldValue
  * @param null $value
  * @throws Main\ObjectNotFoundException
  */
 protected function addChangesToHistory($name, $oldValue = null, $value = null)
 {
     if ($this->getId() > 0 && !$this->isSystem()) {
         /** @var ShipmentCollection $shipmentCollection */
         if (!($shipmentCollection = $this->getCollection())) {
             throw new Main\ObjectNotFoundException('Entity "ShipmentCollection" not found');
         }
         /** @var Order $order */
         if (($order = $shipmentCollection->getOrder()) && $order->getId() > 0) {
             OrderHistory::addField('SHIPMENT', $order->getId(), $name, $oldValue, $value, $this->getId(), $this);
         }
     }
 }
示例#5
0
 /**
  * Save field modify to history.
  *
  * @param string $name				Field name.
  * @param null|string $oldValue		Old value.
  * @param null|string $value		New value.
  */
 protected function addChangesToHistory($name, $oldValue = null, $value = null)
 {
     if ($this->getId() > 0) {
         OrderHistory::addField('ORDER', $this->getId(), $name, $oldValue, $value, $this->getId());
     }
 }