// stock : update supplier orders interface + change state bug fix
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9975 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -303,12 +303,28 @@ class SupplierOrderCore extends ObjectModel
|
||||
return ObjectModel::hydrateCollection('SupplierOrderDetail', $results);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the order has entries
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasEntries()
|
||||
{
|
||||
$query = new DbQuery();
|
||||
$query->select('COUNT(*)');
|
||||
$query->from('supplier_order_detail s');
|
||||
$query->where('s.id_supplier_order = '.(int)$this->id);
|
||||
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current state allow to edit the current order
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isEditable()
|
||||
public function isEditable()
|
||||
{
|
||||
// build query
|
||||
$query = new DbQuery();
|
||||
@@ -324,7 +340,7 @@ class SupplierOrderCore extends ObjectModel
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isDeliveryNoteAvailable()
|
||||
public function isDeliveryNoteAvailable()
|
||||
{
|
||||
// build query
|
||||
$query = new DbQuery();
|
||||
@@ -340,7 +356,7 @@ class SupplierOrderCore extends ObjectModel
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isInReceiptState()
|
||||
public function isInReceiptState()
|
||||
{
|
||||
// build query
|
||||
$query = new DbQuery();
|
||||
|
||||
@@ -151,16 +151,13 @@ class SupplierOrderStateCore extends ObjectModel
|
||||
|
||||
//check first if the order is editable
|
||||
if ($is_editable)
|
||||
$query->where('s.editable = 0');
|
||||
//check if the delivery note is available
|
||||
else if ($is_delivery_note)
|
||||
$query->where('s.editable = 1 OR s.delivery_note = 1');
|
||||
//check if the delivery note is available or if the state correspond to a pending receipt state
|
||||
else if ($is_delivery_note || $is_pending_receipt)
|
||||
$query->where('s.delivery_note = 0 AND s.editable = 0');
|
||||
//check if the state correspond to a pending receipt state
|
||||
else if ($is_pending_receipt)
|
||||
$query->where('s.receipt_state = 1 OR (s.receipt_state = 0 AND s.pending_receipt = 0) AND s.delivery_note = 0 AND s.editable = 0');
|
||||
//check if the state correspond to a receipt state
|
||||
else if ($is_receipt_state)
|
||||
$query->where('s.receipt_state = 1 OR (s.receipt_state = 0 AND s.pending_receipt = 0 AND s.delivery_note = 0 AND s.editable = 0)');
|
||||
$query->where('s.receipt_state = 1 OR s.enclosed = 1');
|
||||
}
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
|
||||
Reference in New Issue
Block a user