diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php index 5cea21cc7..85fa72e67 100644 --- a/core/lib/Thelia/Model/Order.php +++ b/core/lib/Thelia/Model/Order.php @@ -79,6 +79,17 @@ class Order extends BaseOrder return $this->choosenInvoiceAddress; } + public function preSave(ConnectionInterface $con = null) + { + if ($this->isPaid() && null === $this->getInvoiceDate()) { + $this + ->setInvoiceDate(time()); + } + + return parent::preSave($con); + } + + /** * {@inheritDoc} */ @@ -100,15 +111,6 @@ class Order extends BaseOrder $this->dispatchEvent(TheliaEvents::ORDER_AFTER_CREATE, new OrderEvent($this)); } - public function postSave(ConnectionInterface $con = null) - { - if ($this->isPaid() && null === $this->getInvoiceDate()) { - $this - ->setInvoiceDate(time()) - ->save($con); - } - } - public function generateRef() { return sprintf('ORD%s', str_pad($this->getId(), 12, 0, STR_PAD_LEFT));