New: Import use generated codes if not provided into input file.

This commit is contained in:
Laurent Destailleur 2012-03-04 13:00:53 +01:00
parent 00b7ad4a78
commit 055689e2dc
8 changed files with 155 additions and 72 deletions

View File

@ -31,16 +31,19 @@ require_once(DOL_DOCUMENT_ROOT ."/core/modules/import/modules_import.php");
*/ */
class ImportCsv extends ModeleImports class ImportCsv extends ModeleImports
{ {
var $id; var $db;
var $error; var $datatoimport;
var $error='';
var $errors=array(); var $errors=array();
var $label; var $id; // Id of driver
var $extension; var $label; // Label of driver
var $version; var $extension; // Extension of files imported by driver
var $version; // Version of driver
var $label_lib; var $label_lib; // Label of external lib used by driver
var $version_lib; var $version_lib; // Version of external lib used by driver
var $separator; var $separator;
@ -53,9 +56,10 @@ class ImportCsv extends ModeleImports
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $datatoimport String code describing import set (ex: 'societe_1')
*/ */
function ImportCsv($db) function ImportCsv($db,$datatoimport)
{ {
global $conf,$langs; global $conf,$langs;
$this->db = $db; $this->db = $db;
@ -75,6 +79,9 @@ class ImportCsv extends ModeleImports
// If driver use an external library, put its name here // If driver use an external library, put its name here
$this->label_lib='Dolibarr'; $this->label_lib='Dolibarr';
$this->version_lib=DOL_VERSION; $this->version_lib=DOL_VERSION;
$this->datatoimport=$datatoimport;
if (preg_match('/^societe_/',$datatoimport)) $this->thirpartyobject=new Societe($this->db);
} }
function getDriverId() function getDriverId()
@ -287,6 +294,7 @@ class ImportCsv extends ModeleImports
function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid) function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid)
{ {
global $langs,$conf,$user; global $langs,$conf,$user;
global $thirdparty_static; // Specifi to thirdparty import
$error=0; $error=0;
$warning=0; $warning=0;
@ -392,6 +400,42 @@ class ImportCsv extends ModeleImports
{ {
if (empty($newval)) $newval='0'; if (empty($newval)) $newval='0';
} }
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifnull')
{
if (empty($newval) || $newval='auto')
{
$this->thirpartyobject->get_codeclient(0,0);
$newval=$this->thirpartyobject->code_client;
//print 'code_client='.$newval;
}
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsuppliercodeifnull')
{
if (empty($newval) || $newval='auto')
{
$newval=$this->thirpartyobject->get_codefournisseur(0,1);
$newval=$this->thirpartyobject->code_fournisseur;
//print 'code_fournisseur='.$newval;
}
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomeraccountancycodeifnull')
{
if (empty($newval) || $newval='auto')
{
$this->thirpartyobject->get_codecompta('customer');
$newval=$this->thirpartyobject->code_compta;
//print 'code_compta='.$newval;
}
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsupplieraccountancycodeifnull')
{
if (empty($newval) || $newval='auto')
{
$this->thirpartyobject->get_codecompta('supplier');
$newval=$this->thirpartyobject->code_compta_fournisseur;
//print 'code_compta_fournisseur='.$newval;
}
}
//print 'Val to use as insert is '.$newval.'<br>'; //print 'Val to use as insert is '.$newval.'<br>';
} }

View File

@ -26,19 +26,30 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php');
/** /**
* \class ModeleImports * Parent class for import file readers
* \brief Parent class for import file readers
*/ */
class ModeleImports class ModeleImports
{ {
var $db;
var $datatoimport;
var $error=''; var $error='';
var $driverlabel=array(); var $id; // Id of driver
var $driverdesc=array(); var $label; // Label of driver
var $driverversion=array(); var $extension; // Extension of files imported by driver
var $version; // Version of driver
var $liblabel=array(); var $label_lib; // Label of external lib used by driver
var $libversion=array(); var $version_lib; // Version of external lib used by driver
// Array of all drivers
var $_driverlabel=array();
var $_driverdesc=array();
var $_driverversion=array();
var $_liblabel=array();
var $_libversion=array();
/** /**
@ -49,8 +60,9 @@ class ModeleImports
} }
/** /**
* \brief Charge en memoire et renvoie la liste des modeles actifs * Charge en memoire et renvoie la liste des modeles actifs
* \param db Handler de base *
* @param DoliDB $db Handler de base
*/ */
function liste_modeles($db) function liste_modeles($db)
{ {
@ -75,29 +87,31 @@ class ModeleImports
$classname = "Import".ucfirst($moduleid); $classname = "Import".ucfirst($moduleid);
require_once($file); require_once($file);
$module = new $classname($db); $module = new $classname($db,'');
// Picto // Picto
$this->picto[$module->id]=$module->picto; $this->picto[$module->id]=$module->picto;
// Driver properties // Driver properties
$this->driverlabel[$module->id]=$module->getDriverLabel(); $this->_driverlabel[$module->id]=$module->getDriverLabel();
$this->driverdesc[$module->id]=$module->getDriverDesc(); $this->_driverdesc[$module->id]=$module->getDriverDesc();
$this->driverversion[$module->id]=$module->getDriverVersion(); $this->_driverversion[$module->id]=$module->getDriverVersion();
// If use an external lib // If use an external lib
$this->liblabel[$module->id]=$module->getLibLabel(); $this->_liblabel[$module->id]=$module->getLibLabel();
$this->libversion[$module->id]=$module->getLibVersion(); $this->_libversion[$module->id]=$module->getLibVersion();
$i++; $i++;
} }
} }
} }
return array_keys($this->driverlabel); return array_keys($this->_driverlabel);
} }
/** /**
* \brief Return picto of import driver * Return picto of import driver
*
* @return string
*/ */
function getPicto($key) function getPicto($key)
{ {
@ -105,43 +119,53 @@ class ModeleImports
} }
/** /**
* \brief Renvoi libelle d'un driver import * Renvoi libelle d'un driver import
*
* @return string
*/ */
function getDriverLabel($key) function getDriverLabel($key)
{ {
return $this->driverlabel[$key]; return $this->_driverlabel[$key];
} }
/** /**
* \brief Renvoi la description d'un driver import * Renvoi la description d'un driver import
*
* @return string
*/ */
function getDriverDesc($key) function getDriverDesc($key)
{ {
return $this->driverdesc[$key]; return $this->_driverdesc[$key];
} }
/** /**
* \brief Renvoi version d'un driver import * Renvoi version d'un driver import
*
* @return string
*/ */
function getDriverVersion($key) function getDriverVersion($key)
{ {
return $this->driverversion[$key]; return $this->_driverversion[$key];
} }
/** /**
* \brief Renvoi libelle de librairie externe du driver * Renvoi libelle de librairie externe du driver
*
* @return string
*/ */
function getLibLabel($key) function getLibLabel($key)
{ {
return $this->liblabel[$key]; return $this->_liblabel[$key];
} }
/** /**
* \brief Renvoi version de librairie externe du driver * Renvoi version de librairie externe du driver
*
* @return string
*/ */
function getLibVersion($key) function getLibVersion($key)
{ {
return $this->libversion[$key]; return $this->_libversion[$key];
} }
} }

View File

@ -270,7 +270,7 @@ class modSociete extends DolibarrModules
$this->import_icon[$r]='company'; $this->import_icon[$r]='company';
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe','extra'=>MAIN_DB_PREFIX.'societe_extrafields'); // List of tables to insert into (insert done in same order) $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'societe','extra'=>MAIN_DB_PREFIX.'societe_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation"); $this->import_fields_array[$r]=array('s.nom'=>"Name*",'s.status'=>"Status",'s.client'=>"Customer*",'s.fournisseur'=>"Supplier*",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.code_compta'=>"CustomerAccountancyCode",'s.code_compta_fournisseur'=>"SupplierAccountancyCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'s.fk_pays'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Effectif","s.fk_forme_juridique"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','s.default_lang'=>'DefaultLanguage','s.barcode'=>'BarCode','s.datec'=>"DateCreation");
// Add extra fields // Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'"; $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -288,11 +288,15 @@ class modSociete extends DolibarrModules
$this->import_convertvalue_array[$r]=array( $this->import_convertvalue_array[$r]=array(
's.fk_typent'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ctypent.class.php','class'=>'Ctypent','method'=>'fetch','dict'=>'DictionnaryCompanyType'), 's.fk_typent'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ctypent.class.php','class'=>'Ctypent','method'=>'fetch','dict'=>'DictionnaryCompanyType'),
's.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cpays.class.php','class'=>'Cpays','method'=>'fetch','dict'=>'DictionnaryCountry'), 's.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cpays.class.php','class'=>'Cpays','method'=>'fetch','dict'=>'DictionnaryCountry'),
's.fk_stcomm'=>array('rule'=>'zeroifnull') 's.fk_stcomm'=>array('rule'=>'zeroifnull'),
's.code_client'=>array('rule'=>'getcustomercodeifnull'),
's.code_fournisseur'=>array('rule'=>'getsuppliercodeifnull'),
's.code_compta'=>array('rule'=>'getcustomeraccountancycodeifnull'),
's.code_compta_fournisseur'=>array('rule'=>'getsupplieraccountancycodeifnull')
); );
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); $this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001",'s.code_fournisseur'=>"SU01-0001",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789'); $this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(mktime(),'%Y-%m-%d'),'s.code_client'=>"CU01-0001 or auto",'s.code_fournisseur'=>"SU01-0001 or auto",'s.address'=>"61 jump street",'s.cp'=>"123456",'s.ville'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.tel'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note'=>"This is an example of note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789');
// Import list of contact and attributes // Import list of contact and attributes
$r++; $r++;

View File

@ -73,7 +73,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
$langs->load("companies"); $langs->load("companies");
$form = new Form($this->db); $form = new Form($this->db);
$disabled = ((! empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? ' disabled="disabled"' : ''); $disabled = ((! empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? ' disabled="disabled"' : '');
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
@ -153,7 +153,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
/** Return next value /** Return next value
* *
* @param objsoc Object third party * @param objsoc Object third party
* @param $type Client ou fournisseur (1:client, 2:fournisseur) * @param $type Client ou fournisseur (0:customer, 1:supplier)
* @return string Value if OK, '' if module not configured, <0 if KO * @return string Value if OK, '' if module not configured, <0 if KO
*/ */
function getNextValue($objsoc=0,$type=-1) function getNextValue($objsoc=0,$type=-1)
@ -274,7 +274,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
{ {
$sql = "SELECT code_client FROM ".MAIN_DB_PREFIX."societe"; $sql = "SELECT code_client FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE code_client = '".$code."'"; $sql.= " WHERE code_client = '".$code."'";
if ($soc->id > 0) $sql.= " AND rowid != ".$soc->id; if ($soc->id > 0) $sql.= " AND rowid <> ".$soc->id;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -213,12 +213,12 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
function verif_dispo($db, $code, $soc) function verif_dispo($db, $code, $soc)
{ {
global $conf, $mc; global $conf, $mc;
$sql = "SELECT code_client FROM ".MAIN_DB_PREFIX."societe"; $sql = "SELECT code_client FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE code_client = '".$code."'"; $sql.= " WHERE code_client = '".$code."'";
$sql.= " AND entity IN (".getEntity('societe', 1).")"; $sql.= " AND entity IN (".getEntity('societe', 1).")";
if ($soc->id > 0) $sql.= " AND rowid != ".$soc->id; if ($soc->id > 0) $sql.= " AND rowid <> ".$soc->id;
dol_syslog(get_class($this)."::verif_dispo sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::verif_dispo sql=".$sql, LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -150,8 +150,8 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$sql.= " WHERE "; $sql.= " WHERE ";
if ($type == 'customer') $sql.= "code_compta"; if ($type == 'customer') $sql.= "code_compta";
if ($type == 'supplier') $sql.= "code_compta_fournisseur"; if ($type == 'supplier') $sql.= "code_compta_fournisseur";
$sql.= " = '".$code."'"; $sql.= " = '".$this->db->escape($code)."'";
$sql.= " AND rowid != ".$societe->id; if ($societe->id > 0) $sql.= " AND rowid <> ".$societe->id;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -577,7 +577,7 @@ if ($step == 4 && $datatoimport)
$file = "import_".$model.".modules.php"; $file = "import_".$model.".modules.php";
$classname = "Import".ucfirst($model); $classname = "Import".ucfirst($model);
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db,$datatoimport);
// Load source fields in input file // Load source fields in input file
$fieldssource=array(); $fieldssource=array();
@ -1040,7 +1040,7 @@ if ($step == 5 && $datatoimport)
$file = "import_".$model.".modules.php"; $file = "import_".$model.".modules.php";
$classname = "Import".ucfirst($model); $classname = "Import".ucfirst($model);
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db,$datatoimport);
// Load source fields in input file // Load source fields in input file
$fieldssource=array(); $fieldssource=array();
@ -1369,7 +1369,7 @@ if ($step == 6 && $datatoimport)
$file = "import_".$model.".modules.php"; $file = "import_".$model.".modules.php";
$classname = "Import".ucfirst($model); $classname = "Import".ucfirst($model);
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db,$datatoimport);
// Load source fields in input file // Load source fields in input file
$fieldssource=array(); $fieldssource=array();

View File

@ -1658,9 +1658,12 @@ class Societe extends CommonObject
} }
/** /**
* Attribut un code client a partir du module de controle des codes. * Attribut un code client a partir du module de controle des codes.
* Return value is stored into this->code_client
* *
* @return code_client Code client automatique * @param Societe $objsoc Object thirdparty
* @param int $type Should be 0 to say customer
* @return void
*/ */
function get_codeclient($objsoc=0,$type=0) function get_codeclient($objsoc=0,$type=0)
{ {
@ -1684,9 +1687,12 @@ class Societe extends CommonObject
} }
/** /**
* Attribut un code fournisseur a partir du module de controle des codes. * Attribut un code fournisseur a partir du module de controle des codes.
* Return value is stored into this->code_fournisseur
* *
* @return code_fournisseur Code fournisseur automatique * @param Societe $objsoc Object thirdparty
* @param int $type Should be 1 to say supplier
* @return void
*/ */
function get_codefournisseur($objsoc=0,$type=1) function get_codefournisseur($objsoc=0,$type=1)
{ {
@ -1709,9 +1715,10 @@ class Societe extends CommonObject
} }
/** /**
* \brief Verifie si un code client est modifiable en fonction des parametres * Verifie si un code client est modifiable en fonction des parametres
* du module de controle des codes. * du module de controle des codes.
* \return int 0=Non, 1=Oui *
* @return int 0=Non, 1=Oui
*/ */
function codeclient_modifiable() function codeclient_modifiable()
{ {
@ -1743,8 +1750,9 @@ class Societe extends CommonObject
/** /**
* \brief Verifie si un code fournisseur est modifiable dans configuration du module de controle des codes * Verifie si un code fournisseur est modifiable dans configuration du module de controle des codes
* \return int 0=Non, 1=Oui *
* @return int 0=Non, 1=Oui
*/ */
function codefournisseur_modifiable() function codefournisseur_modifiable()
{ {
@ -1776,8 +1784,9 @@ class Societe extends CommonObject
/** /**
* \brief Check customer code * Check customer code
* \return int 0 if OK *
* @return int 0 if OK
* -1 ErrorBadCustomerCodeSyntax * -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired * -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed * -3 ErrorCustomerCodeAlreadyUsed
@ -1810,8 +1819,9 @@ class Societe extends CommonObject
} }
/** /**
* \brief Check supplier code * Check supplier code
* \return int 0 if OK *
* @return int 0 if OK
* -1 ErrorBadCustomerCodeSyntax * -1 ErrorBadCustomerCodeSyntax
* -2 ErrorCustomerCodeRequired * -2 ErrorCustomerCodeRequired
* -3 ErrorCustomerCodeAlreadyUsed * -3 ErrorCustomerCodeAlreadyUsed
@ -1844,11 +1854,12 @@ class Societe extends CommonObject
} }
/** /**
* \brief Renvoie un code compta, suivant le module de code compta. * Renvoie un code compta, suivant le module de code compta.
* Peut etre identique a celui saisit ou genere automatiquement. * Peut etre identique a celui saisit ou genere automatiquement.
* A ce jour seule la generation automatique est implementee * A ce jour seule la generation automatique est implementee
* \param type Type de tiers ('customer' ou 'supplier') *
* \return string Code compta si ok, 0 si aucun, <0 si ko * @param type Type of thirdparty ('customer' or 'supplier')
* @return string Code compta si ok, 0 si aucun, <0 si ko
*/ */
function get_codecompta($type) function get_codecompta($type)
{ {
@ -1864,7 +1875,6 @@ class Societe extends CommonObject
} }
$var = $conf->global->SOCIETE_CODECOMPTA_ADDON; $var = $conf->global->SOCIETE_CODECOMPTA_ADDON;
$mod = new $var; $mod = new $var;
// Defini code compta dans $mod->code // Defini code compta dans $mod->code
@ -1885,9 +1895,10 @@ class Societe extends CommonObject
} }
/** /**
* \brief Defini la societe mere pour les filiales * Defini la societe mere pour les filiales
* \param id id compagnie mere a positionner *
* \return int <0 si ko, >0 si ok * @param id id compagnie mere a positionner
* @return int <0 si ko, >0 si ok
*/ */
function set_parent($id) function set_parent($id)
{ {