$this->export_dependencies_array[$r]=array('payment'=>'p.rowid');// To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture'";
...
...
@@ -295,6 +295,7 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
$this->export_sql_end[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid';
$this->export_sql_end[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement';
$this->export_sql_end[$r].=' WHERE f.fk_soc = s.rowid';
$this->export_sql_end[$r].=' AND f.entity IN ('.getEntity('facture',1).')';