[-] Classes : fix #PSCFV-2185 - bad handling of order states for merchandise returns
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15036 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+23
-7
@@ -771,6 +771,20 @@ class OrderCore extends ObjectModel
|
|||||||
return count($this->getHistory((int)($this->id_lang), Configuration::get('PS_OS_PREPARATION')));
|
return count($this->getHistory((int)($this->id_lang), Configuration::get('PS_OS_PREPARATION')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the current order state is paid and shipped
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isPaidAndShipped()
|
||||||
|
{
|
||||||
|
$order_state = $this->getCurrentOrderState();
|
||||||
|
if ($order_state && $order_state->paid && $order_state->shipped)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get customer orders
|
* Get customer orders
|
||||||
*
|
*
|
||||||
@@ -1029,15 +1043,17 @@ class OrderCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can this order be returned by the client?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function isReturnable()
|
public function isReturnable()
|
||||||
{
|
{
|
||||||
$payment = $this->getHistory((int)($this->id_lang), Configuration::get('PS_OS_PAYMENT'));
|
if (Configuration::get('PS_ORDER_RETURN') && $this->isPaidAndShipped())
|
||||||
$delivred = $this->getHistory((int)($this->id_lang), Configuration::get('PS_OS_DELIVERED'));
|
return $this->getNumberOfDays();
|
||||||
if ($payment && $delivred && strtotime($delivred[0]['date_add']) < strtotime($payment[0]['date_add']))
|
|
||||||
return ((int)(Configuration::get('PS_ORDER_RETURN')) == 1 && $this->getNumberOfDays());
|
return false;
|
||||||
else
|
|
||||||
return ((int)Configuration::get('PS_ORDER_RETURN') == 1 && (int)$this->getCurrentState() == Configuration::get('PS_OS_DELIVERED') && $this->getNumberOfDays());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getLastInvoiceNumber()
|
public static function getLastInvoiceNumber()
|
||||||
|
|||||||
Reference in New Issue
Block a user