From b4eb12f12a2010055366fcf152cf74e286b8709e Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 29 Jul 2014 11:34:57 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20method=20that=20prevents=20orders=20to=20?= =?UTF-8?q?be=20set=20as=20Paid=20in=20the=20BO=20=09modifi=C3=A9:=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20core/lib/Thelia/Model/Order.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Thelia/Model/Order.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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));