Works on module hook integration
This commit is contained in:
parent
e824078fbe
commit
e27c4da39f
@ -86,9 +86,9 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
/******************************************************************************/
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (! empty($propal->objModules))
|
||||
if (! empty($propal->hooks))
|
||||
{
|
||||
foreach($propal->objModules as $module)
|
||||
foreach($propal->hooks as $module)
|
||||
{
|
||||
$module->doActions($propal);
|
||||
$mesg = $module->error;
|
||||
@ -1388,9 +1388,9 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (! empty($propal->objModules))
|
||||
if (! empty($propal->hooks))
|
||||
{
|
||||
foreach($propal->objModules as $module)
|
||||
foreach($propal->hooks as $module)
|
||||
{
|
||||
$var=!$var;
|
||||
$module->formAddObject($propal);
|
||||
|
||||
@ -427,7 +427,7 @@ class Propal extends CommonObject
|
||||
* \param info_bits Miscellanous informations
|
||||
* \return int 0 en cas de succes
|
||||
*/
|
||||
function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0)
|
||||
function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@ -456,6 +456,8 @@ class Propal extends CommonObject
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
|
||||
if (empty($qty) && empty($special_code)) $special_code=3;
|
||||
|
||||
|
||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||
@ -481,8 +483,7 @@ class Propal extends CommonObject
|
||||
$sql.= " , total_localtax2=".price2num($total_localtax2);
|
||||
$sql.= " , total_ttc=".price2num($total_ttc);
|
||||
$sql.= " , info_bits=".$info_bits;
|
||||
//if ($conf->global->PROPALE_USE_OPTION_LINE && !$qty)
|
||||
$sql.= " , special_code=".(empty($qty)?"3":"0");
|
||||
$sql.= " , special_code=".$special_code;
|
||||
$sql.= " WHERE rowid = '".$rowid."'";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
|
||||
@ -1920,7 +1920,7 @@ class Commande extends CommonObject
|
||||
$sql.= ",localtax1_tx='".price2num($txlocaltax1)."'";
|
||||
$sql.= ",localtax2_tx='".price2num($txlocaltax2)."'";
|
||||
$sql.= ",qty='".price2num($qty)."'";
|
||||
$sql.= ",product_type='".$type."'";
|
||||
if (! empty($type)) $sql.= ",product_type='".$type."'";
|
||||
$sql.= ",info_bits='".$info_bits."'";
|
||||
$sql.= ",total_ht='".price2num($total_ht)."'";
|
||||
$sql.= ",total_tva='".price2num($total_tva)."'";
|
||||
|
||||
@ -76,9 +76,9 @@ if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
/******************************************************************************/
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (! empty($commande->objModules))
|
||||
if (! empty($commande->hooks))
|
||||
{
|
||||
foreach($commande->objModules as $module)
|
||||
foreach($commande->hooks as $module)
|
||||
{
|
||||
$module->doActions($commande);
|
||||
$mesg = $module->error;
|
||||
@ -1672,9 +1672,9 @@ else
|
||||
}
|
||||
|
||||
// Hook of thirdparty module
|
||||
if (! empty($commande->objModules))
|
||||
if (! empty($commande->hooks))
|
||||
{
|
||||
foreach($commande->objModules as $module)
|
||||
foreach($commande->hooks as $module)
|
||||
{
|
||||
$var=!$var;
|
||||
$module->formAddObject($commande);
|
||||
|
||||
@ -33,8 +33,8 @@
|
||||
|
||||
class CommonObject
|
||||
{
|
||||
// Instantiate classes of thirdparty module
|
||||
var $objModules=array();
|
||||
// Instantiate hook classe of thirdparty module
|
||||
var $hooks=array();
|
||||
|
||||
/**
|
||||
* \brief Check if ref is used.
|
||||
@ -1246,18 +1246,29 @@ class CommonObject
|
||||
if ($conf->$module->enabled && in_array($type,$hooks))
|
||||
{
|
||||
// Include class and library of thirdparty module
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$module.'/class/'.$module.'.class.php'))
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$module.'/class/actions_'.$module.'.class.php') &&
|
||||
file_exists(DOL_DOCUMENT_ROOT.'/'.$module.'/class/dao_'.$module.'.class.php'))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/'.$module.'/class/'.$module.'.class.php');
|
||||
// Include actions class (controller)
|
||||
require_once(DOL_DOCUMENT_ROOT.'/'.$module.'/class/actions_'.$module.'.class.php');
|
||||
|
||||
// Include dataservice class (model)
|
||||
require_once(DOL_DOCUMENT_ROOT.'/'.$module.'/class/dao_'.$module.'.class.php');
|
||||
|
||||
// Instantiate actions class (controller)
|
||||
$controlclassname = 'Actions'.ucfirst($module);
|
||||
$objModule = new $controlclassname($this->db);
|
||||
$this->hooks[$objModule->module_number] = $objModule;
|
||||
|
||||
// Instantiate dataservice class (model)
|
||||
$modelclassname = 'Dao'.ucfirst($module);
|
||||
$this->hooks[$objModule->module_number]->object = new $modelclassname($this->db);
|
||||
}
|
||||
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$module.'/lib/'.$module.'.lib.php'))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/'.$module.'/lib/'.$module.'.lib.php');
|
||||
}
|
||||
|
||||
$classname = ucfirst($module);
|
||||
$obj_module = new $classname($this->db);
|
||||
$this->objModules[$obj_module->module_number] = $obj_module;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1356,7 +1367,7 @@ class CommonObject
|
||||
|
||||
if ($line->product_type == 9 && ! empty($line->special_code))
|
||||
{
|
||||
$this->objModules[$line->special_code]->printObjectLine($this,$line,$num,$i);
|
||||
$this->hooks[$line->special_code]->printObjectLine($this,$line,$num,$i);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user