Add manually patch

9ae9b2b02a
This commit is contained in:
Laurent Destailleur 2013-07-27 12:22:00 +02:00
parent b4d2c8f76d
commit 1d4ce231db

View File

@ -262,8 +262,27 @@ class Product extends CommonObject
}
if (empty($this->ref))
{
$this->error='ErrorWrongParameters';
return -2;
// Load object modCodeProduct
$module=(! empty($conf->global->PRODUCT_CODEPRODUCT_ADDON)?$conf->global->PRODUCT_CODEPRODUCT_ADDON:'mod_codeproduct_leopard');
if ($module != 'mod_codeproduct_leopard') // Do not load module file
{
if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php')
{
$module = substr($module, 0, dol_strlen($module)-4);
}
dol_include_once('/core/modules/product/'.$module.'.php');
$modCodeProduct = new $module;
if (! empty($modCodeProduct->code_auto))
{
$this->ref = $modCodeProduct->getNextValue($this,$this->type);
}
unset($modCodeProduct);
}
if (empty($this->ref))
{
$this->error='ProductModuleNotSetupForAutoRef';
return -2;
}
}
dol_syslog(get_class($this)."::create ref=".$this->ref." price=".$this->price." price_ttc=".$this->price_ttc." tva_tx=".$this->tva_tx." price_base_type=".$this->price_base_type, LOG_DEBUG);