|
@@ -321,17 +321,37 @@ class modSociete extends DolibarrModules
|
|
|
unset($this->export_entities_array[$r]['s.code_fournisseur']);
|
|
|
}
|
|
|
// Add extra fields
|
|
|
- $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'contact'";
|
|
|
+ $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
|
|
|
$resql=$this->db->query($sql);
|
|
|
if ($resql) // This can fail when class is used on old database (during migration for example)
|
|
|
{
|
|
|
- while ($obj=$this->db->fetch_object($resql))
|
|
|
- {
|
|
|
- $fieldname='extra.'.$obj->name;
|
|
|
- $fieldlabel=ucfirst($obj->label);
|
|
|
- $this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
|
|
- $this->export_entities_array[$r][$fieldname]='contact';
|
|
|
- }
|
|
|
+ while ($obj=$this->db->fetch_object($resql))
|
|
|
+ {
|
|
|
+ $fieldname='extra.'.$obj->name;
|
|
|
+ $fieldlabel=ucfirst($obj->label);
|
|
|
+ $typeFilter="Text";
|
|
|
+ switch($obj->type)
|
|
|
+ {
|
|
|
+ case 'int':
|
|
|
+ case 'double':
|
|
|
+ case 'price':
|
|
|
+ $typeFilter="Numeric";
|
|
|
+ break;
|
|
|
+ case 'date':
|
|
|
+ case 'datetime':
|
|
|
+ $typeFilter="Date";
|
|
|
+ break;
|
|
|
+ case 'boolean':
|
|
|
+ $typeFilter="Boolean";
|
|
|
+ break;
|
|
|
+ case 'sellist':
|
|
|
+ $typeFilter="List:".$obj->param;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
|
|
+ $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
|
|
+ $this->export_entities_array[$r][$fieldname]='contact';
|
|
|
+ }
|
|
|
}
|
|
|
// End add axtra fields
|
|
|
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
|
@@ -355,7 +375,7 @@ class modSociete extends DolibarrModules
|
|
|
$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.code_compta'=>"CustomerAccountancyCode",'s.code_compta_fournisseur'=>"SupplierAccountancyCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note_private'=>"NotePrivate",'s.note_public'=>"NotePublic",'s.fk_typent'=>"ThirdPartyType",'s.fk_effectif'=>"Staff","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
|
|
|
- $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company' AND entity = ".$conf->entity;
|
|
|
+ $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity = ".$conf->entity;
|
|
|
$resql=$this->db->query($sql);
|
|
|
if ($resql) // This can fail when class is used on old database (during migration for example)
|
|
|
{
|
|
@@ -390,7 +410,7 @@ class modSociete extends DolibarrModules
|
|
|
$this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'socpeople','extra'=>MAIN_DB_PREFIX.'socpeople_extrafields'); // List of tables to insert into (insert done in same order)
|
|
|
$this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName*','s.civilite'=>'UserTitle','s.lastname'=>"Name*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note_private'=>"Note",'s.note_public'=>"Note",'s.datec'=>"DateCreation");
|
|
|
// Add extra fields
|
|
|
- $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'contact' AND entity = ".$conf->entity;
|
|
|
+ $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity = ".$conf->entity;
|
|
|
$resql=$this->db->query($sql);
|
|
|
if ($resql) // This can fail when class is used on old database (during migration for example)
|
|
|
{
|