integrate Eldy remarks

This commit is contained in:
florian HENRY 2016-12-09 16:14:43 +01:00
parent e48d65120d
commit 1e39805945

View File

@ -281,7 +281,11 @@ 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.' OR sc.fk_user IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'user where fk_user= '.$user->id.'))';
if(!$user->rights->societe->client->voir) {
$subordinatesids = $user->getAllChildIds();
var_dump($subordinatesids);
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '.count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).'))' : '';
}
// Export list of contacts and attributes
$r++;
@ -311,7 +315,10 @@ 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.' OR sc.fk_user IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'user where fk_user= '.$user->id.'))';
if(!$user->rights->societe->client->voir) {
$subordinatesids = $user->getAllChildIds();
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '.count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).'))' : '';
}
// Imports