CalculateCosts function : add hook
This commit is contained in:
parent
9881e7753d
commit
6a15962477
@ -1028,10 +1028,20 @@ class BOM extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function calculateCosts()
|
public function calculateCosts()
|
||||||
{
|
{
|
||||||
|
global $hookmanager;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
$this->unit_cost = 0;
|
$this->unit_cost = 0;
|
||||||
$this->total_cost = 0;
|
$this->total_cost = 0;
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook = $hookmanager->executeHooks('calculateCostsBom', $parameters, $this); // Note that $action and $object may have been modified by hook
|
||||||
|
|
||||||
|
|
||||||
|
if ($reshook > 0) {
|
||||||
|
return $hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($this->lines) && count($this->lines)) {
|
if (is_array($this->lines) && count($this->lines)) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||||
$productFournisseur = new ProductFournisseur($this->db);
|
$productFournisseur = new ProductFournisseur($this->db);
|
||||||
@ -1078,6 +1088,9 @@ class BOM extends CommonObject
|
|||||||
$this->unit_cost = price2num($this->total_cost * $this->qty, 'MU');
|
$this->unit_cost = price2num($this->total_cost * $this->qty, 'MU');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user