Skip to content
Snippets Groups Projects
Commit c77eaeaa authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge pull request #4040 from atm-arnaud/3.6_fix_export_category_contact

FIX export with category contact extrafields
parents 350345ec 4233d24f
Branches
Tags
No related merge requests found
...@@ -229,6 +229,45 @@ class modCategorie extends DolibarrModules ...@@ -229,6 +229,45 @@ class modCategorie extends DolibarrModules
'p.note_private' => 'contact', 'p.note_private' => 'contact',
'p.note_public' => 'contact' 'p.note_public' => 'contact'
); // We define here only fields that use another picto ); // We define here only fields that use another picto
// Add extra fields
$sql="SELECT name, label, type, param 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);
$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;
case 'select':
$typeFilter="Select:".$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 '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_pays as country ON p.fk_pays = country.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_pays as country ON p.fk_pays = country.rowid';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment