set invoiceDate to current date when order status is changed to paid

This commit is contained in:
Manuel Raynaud
2014-04-11 08:52:22 +02:00
parent 4f6092f86c
commit 8f988b3553

View File

@@ -38,6 +38,15 @@ class Order extends BaseOrder
$this->dispatchEvent(TheliaEvents::ORDER_AFTER_CREATE, new OrderEvent($this)); $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() public function generateRef()
{ {
/* order addresses are unique */ /* order addresses are unique */