예제 #1
0
 /**
  * Postprocess inserted entity
  *
  * @param \XLite\Model\OrderItem $entity OrderItem entity
  * @param array                  $line   Array of entity data from request
  *
  * @return boolean
  */
 protected function postprocessInsertedEntity(\XLite\Model\AEntity $entity, array $line)
 {
     $result = parent::postprocessInsertedEntity($entity, $line);
     if ($result && \XLite\Controller\Admin\Order::isNeedProcessStock()) {
         // Process PIN codes on order save
         $order = $this->getOrder();
         if ($order->isProcessed()) {
             $order->processPINCodes();
         }
     }
     return $result;
 }
예제 #2
0
 /**
  * Postprocess inserted entity
  *
  * @param \XLite\Model\OrderItem $entity OrderItem entity
  * @param array                  $line   Array of entity data from request
  *
  * @return boolean
  */
 protected function postprocessInsertedEntity(\XLite\Model\AEntity $entity, array $line)
 {
     $result = parent::postprocessInsertedEntity($entity, $line);
     if ($result && \XLite\Controller\Admin\Order::isNeedProcessStock()) {
         // Create private attachments
         $entity->createPrivateAttachments();
         // Renew private attachments
         foreach ($entity->getPrivateAttachments() as $attachment) {
             $attachment->renew();
         }
     }
     return $result;
 }
예제 #3
0
 /**
  * Return true if stock need to be updated after order items changed
  *
  * @return boolean
  */
 protected function isNeedUpdateStock()
 {
     static $result;
     if (null === $result) {
         $result = \XLite\Controller\Admin\Order::isNeedProcessStock();
         if ($result) {
             $order = $this->getOrder();
             $property = \XLite\Core\Database::getRepo('XLite\\Model\\Order\\Status\\Property')->findOneBy(array('paymentStatus' => $order->getPaymentStatus(), 'shippingStatus' => $order->getShippingStatus()));
             $result = !($property ? $property->getIncStock() : false);
         }
     }
     return $result;
 }