Merge pull request #555 from lovenunu/fix-order

Fix method that prevents orders to be set as Paid in the BO
This commit is contained in:
Julien
2014-07-29 13:11:05 +02:00

View File

@@ -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));