public function place() { if ($this->isPlaced()) { throw new LogicException('QTY is already reserved.'); } if ($this->order->getAccount()->getChildObject()->getQtyReservationDays() <= 0) { throw new LogicException('QTY reservation is disabled in Account settings.'); } $this->order->associateWithStore(false); $this->order->associateItemsWithProducts(false); try { $this->performAction(self::ACTION_SUB, self::STATE_PLACED); $this->order->addSuccessLog('QTY has been reserved.'); } catch (Exception $e) { $this->order->addErrorLog('QTY was not reserved. Reason: %msg%', array('msg' => $e->getMessage())); return false; } return true; }
public function __construct(array $params = array(), Ess_M2ePro_Model_Order $order, $action = NULL) { $this->order = $order; $this->action = $action; parent::__construct($params, NULL, $order->getAccount()); }