Merge pull request #6066 from atm-florian/dev_exportthirdparty
NEW : Can export thirdparty with sale representative that is a subordinate (Need hidden option SOCIETE_EXPORT_SUBORDINATES_CHILDS)
This commit is contained in:
commit
25dcb10c1d
@ -281,7 +281,14 @@ class modSociete extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id';
|
||||
$this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe', 1).')';
|
||||
if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id;
|
||||
if(!$user->rights->societe->client->voir) {
|
||||
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
|
||||
if ($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS) {
|
||||
$subordinatesids = $user->getAllChildIds();
|
||||
$this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : '';
|
||||
}
|
||||
$this->export_sql_end[$r] .=')';
|
||||
}
|
||||
|
||||
// Export list of contacts and attributes
|
||||
$r++;
|
||||
@ -311,7 +318,14 @@ class modSociete extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity("societe", 1).')';
|
||||
if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id;
|
||||
if(!$user->rights->societe->client->voir) {
|
||||
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
|
||||
if ($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS) {
|
||||
$subordinatesids = $user->getAllChildIds();
|
||||
$this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : '';
|
||||
}
|
||||
$this->export_sql_end[$r] .=')';
|
||||
}
|
||||
|
||||
|
||||
// Imports
|
||||
|
||||
Loading…
Reference in New Issue
Block a user