Fix method that prevents orders to be set as Paid in the BO

modifié:         core/lib/Thelia/Model/Order.php
This commit is contained in:
Benjamin Perche
2014-07-29 11:34:57 +02:00
parent 6963754d62
commit b4eb12f12a

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