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:
@@ -79,6 +79,17 @@ class Order extends BaseOrder
|
|||||||
return $this->choosenInvoiceAddress;
|
return $this->choosenInvoiceAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function preSave(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
if ($this->isPaid() && null === $this->getInvoiceDate()) {
|
||||||
|
$this
|
||||||
|
->setInvoiceDate(time());
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::preSave($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@@ -100,15 +111,6 @@ 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()
|
||||||
{
|
{
|
||||||
return sprintf('ORD%s', str_pad($this->getId(), 12, 0, STR_PAD_LEFT));
|
return sprintf('ORD%s', str_pad($this->getId(), 12, 0, STR_PAD_LEFT));
|
||||||
|
|||||||
Reference in New Issue
Block a user