diff --git a/htdocs/exports/export.class.php b/htdocs/exports/export.class.php index b8eb67ce3f6..0e8aac583b9 100644 --- a/htdocs/exports/export.class.php +++ b/htdocs/exports/export.class.php @@ -69,53 +69,53 @@ class Export $i=0; while (($file = readdir($handle))!==false) { - if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') + if (eregi("^(mod.*)\.class\.php",$file,$reg)) { - if (eregi("^(mod.*)\.class\.php",$file,$reg)) + $modulename=$reg[1]; + + // Chargement de la classe + $file = $dir."/".$modulename.".class.php"; + $classname = $modulename; + require_once($file); + $module = new $classname($db); + + if (is_array($module->export_code)) { - $modulename=$reg[1]; - - // Chargement de la classe - $file = $dir."/".$modulename.".class.php"; - $classname = $modulename; - require_once($file); - $module = new $classname($db); - - if (is_array($module->export_code)) + foreach($module->export_code as $r => $value) { - foreach($module->export_code as $r => $value) + if ($filter && ($filter != $module->export_code[$r])) continue; + + // Test si permissions ok \todo tester sur toutes permissions + $perm=$module->export_permission[$r][0]; + //print_r("$perm[0]-$perm[1]-$perm[2]
"); + if ($perm[2]) { - if ($filter && $filter != $module->export_code[$r]) next; - // Test si permissions ok \todo tester sur toutes permissions - $perm=$module->export_permission[$r][0]; - if (strlen($perms[2]) > 0) - { - $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; - } - else - { - $bool=$user->rights->$perm[0]->$perm[1]; - } - - // Permissions ok - if ($bool) - { - // Nom module - $this->array_export_module[$i]=$module; - // Code du dataset export - $this->array_export_code[$i]=$module->export_code[$r]; - // Libellé du dataset export - $this->array_export_label[$i]=$module->export_label[$r]; - // Tableau des champ à exporter (clé=champ, valeur=libellé) - $this->array_export_fields[$i]=$module->export_fields_array[$r]; - // Requete sql du dataset - $this->array_export_sql[$i]=$module->export_sql[$r]; + $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; + } + else + { + $bool=$user->rights->$perm[0]->$perm[1]; + } + //print("$bool
"); + + // Permissions ok + if ($bool) + { + // Nom module + $this->array_export_module[$i]=$module; + // Code du dataset export + $this->array_export_code[$i]=$module->export_code[$r]; + // Libellé du dataset export + $this->array_export_label[$i]=$module->export_label[$r]; + // Tableau des champ à exporter (clé=champ, valeur=libellé) + $this->array_export_fields[$i]=$module->export_fields_array[$r]; + // Requete sql du dataset + $this->array_export_sql[$i]=$module->export_sql[$r]; - dolibarr_syslog("Export chargé pour le module ".$modulename." en index ".$i.", dataset=".$module->export_code[$r].", nbre de champs=".sizeof($module->export_fields_code[$r])); - $i++; - } - } - } + dolibarr_syslog("Export chargé pour le module ".$modulename." en index ".$i.", dataset=".$module->export_code[$r].", nbre de champs=".sizeof($module->export_fields_code[$r])); + $i++; + } + } } } } diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php index 150531ca333..4e8d1333e4d 100644 --- a/htdocs/includes/modules/modSociete.class.php +++ b/htdocs/includes/modules/modSociete.class.php @@ -82,45 +82,85 @@ class modSociete extends DolibarrModules // Permissions $this->rights = array(); $this->rights_class = 'societe'; - - $this->rights[1][0] = 121; // id de la permission - $this->rights[1][1] = 'Lire les societes'; // libelle de la permission - $this->rights[1][2] = 'r'; // type de la permission (déprécié à ce jour) - $this->rights[1][3] = 1; // La permission est-elle une permission par défaut - $this->rights[1][4] = 'lire'; + $r=0; + + $r++; + $this->rights[$r][0] = 121; // id de la permission + $this->rights[$r][1] = 'Lire les societes'; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 1; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'lire'; - $this->rights[2][0] = 122; // id de la permission - $this->rights[2][1] = 'Créer modifier les societes'; // libelle de la permission - $this->rights[2][2] = 'w'; // type de la permission (déprécié à ce jour) - $this->rights[2][3] = 0; // La permission est-elle une permission par défaut - $this->rights[2][4] = 'creer'; + $r++; + $this->rights[$r][0] = 122; // id de la permission + $this->rights[$r][1] = 'Créer modifier les societes'; // libelle de la permission + $this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'creer'; - $this->rights[3][0] = 129; // id de la permission - $this->rights[3][1] = 'Supprimer les sociétés'; // libelle de la permission - $this->rights[3][2] = 'd'; // type de la permission (déprécié à ce jour) - $this->rights[3][3] = 0; // La permission est-elle une permission par défaut - $this->rights[3][4] = 'supprimer'; + $r++; + $this->rights[$r][0] = 125; // id de la permission + $this->rights[$r][1] = 'Supprimer les sociétés'; // libelle de la permission + $this->rights[$r][2] = 'd'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'supprimer'; + + $r++; + $this->rights[$r][0] = 126; // id de la permission + $this->rights[$r][1] = 'Exporter les sociétés'; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'export'; - $this->rights[4][0] = 281; // id de la permission - $this->rights[4][1] = 'Lire les contacts'; // libelle de la permission - $this->rights[4][2] = 'r'; // type de la permission (déprécié à ce jour) - $this->rights[4][3] = 1; // La permission est-elle une permission par défaut - $this->rights[4][4] = 'contact'; - $this->rights[4][5] = 'lire'; + $r++; + $this->rights[$r][0] = 281; // id de la permission + $this->rights[$r][1] = 'Lire les contacts'; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 1; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'contact'; + $this->rights[$r][5] = 'lire'; - $this->rights[5][0] = 282; // id de la permission - $this->rights[5][1] = 'Créer modifier les contacts'; // libelle de la permission - $this->rights[5][2] = 'w'; // type de la permission (déprécié à ce jour) - $this->rights[5][3] = 0; // La permission est-elle une permission par défaut - $this->rights[5][4] = 'contact'; - $this->rights[5][5] = 'creer'; + $r++; + $this->rights[$r][0] = 282; // id de la permission + $this->rights[$r][1] = 'Créer modifier les contacts'; // libelle de la permission + $this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'contact'; + $this->rights[$r][5] = 'creer'; - $this->rights[6][0] = 283; // id de la permission - $this->rights[6][1] = 'Supprimer les contacts'; // libelle de la permission - $this->rights[6][2] = 'd'; // type de la permission (déprécié à ce jour) - $this->rights[6][3] = 0; // La permission est-elle une permission par défaut - $this->rights[6][4] = 'contact'; - $this->rights[6][5] = 'supprimer'; + $r++; + $this->rights[$r][0] = 283; // id de la permission + $this->rights[$r][1] = 'Supprimer les contacts'; // libelle de la permission + $this->rights[$r][2] = 'd'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'contact'; + $this->rights[$r][5] = 'supprimer'; + + $r++; + $this->rights[$r][0] = 286; // id de la permission + $this->rights[$r][1] = 'Exporter les contacts'; // libelle de la permission + $this->rights[$r][2] = 'd'; // type de la permission (déprécié à ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut + $this->rights[$r][4] = 'contact'; + $this->rights[$r][5] = 'export'; + + // Exports + //-------- + $r=0; + + $r++; + $this->export_code[$r]=$this->numero.'_'.$r; + $this->export_label[$r]='Liste des societes et attributs'; + $this->export_fields_array[$r]=array('s.idp'=>"Id",'s.nom'=>"Name",'s.prefix'=>"Prefix",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note"); + $this->export_sql[$r]="select ".join(',',array_keys($this->export_fields_array[$r])).' from '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'c_pays as p where s.fk_pays = p.rowid'; + $this->export_permission[$r]=array(array("societe","export")); + + $r++; + $this->export_code[$r]=$this->numero.'_'.$r; + $this->export_label[$r]='Liste des contacts et attributs'; + $this->export_fields_array[$r]=array('s.civilite'=>"CivilityCode",'c.name'=>'Lastname','c.firstname'=>'Firstname','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.address'=>"Address",'c.cp'=>"Zip",'c.ville'=>"Town",'c.tel'=>"Phone",'s.fax'=>"Fax",'s.email'=>"EMail",'s.note'=>"Note",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.idp'=>"IdCompany",'s.nom'=>"CompanyName"); + $this->export_sql[$r]="select ".join(',',array_keys($this->export_fields_array[$r])).' from '.MAIN_DB_PREFIX.'contact as c, '.MAIN_DB_PREFIX.'c_pays as p where c.fk_pays = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON c.fk_soc = s.idp'; + $this->export_permission[$r]=array(array("societe","contact","export")); } diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 0d2d4d93c87..6a664f55eec 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -13,9 +13,12 @@ NewCompany=New company (prospect, customer, supplier) NewSocGroup=Nouveau companies group ProspectionArea=Prospection area SocGroup=Group of companies +IdCompany=Company Id Company=Company +CompanyName=Company name Companies=Companies ParentCompany=Parent company +CivilityCode=Civility code Name=Name Lastname=Lastname Firstname=Firstname @@ -25,11 +28,13 @@ Address=Address State=State/Canton Region=Region Country=Country +CountryCode=Country code Phone=Phone Fax=Fax Zip=Zip Code Town=Town Web=Web +Birthday=Birthday ##### Professionnal ID ##### ProfId1=Professional ID 1 ProfId2=Professional ID 2 diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 60bba3d657d..825ba726e16 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -13,9 +13,12 @@ NewCompany=Nouvelle soci NewSocGroup=Nouveau groupement de sociétés ProspectionArea=Espace prospection SocGroup=Groupement de sociétés +IdCompany=Id société Company=Société +CompanyName=Nom société Companies=Sociétés ParentCompany=Maison mère +CivilityCode=Code civilité Name=Nom Lastname=Nom Firstname=Prénom @@ -25,11 +28,13 @@ Address=Adresse State=Département/Canton Region=Région Country=Pays +CountryCode=Code pays Phone=Téléphone Fax=Fax Zip=Code postal Town=Ville Web=Web +Birthday=Date de naissance ##### Professionnal ID ##### ProfId1=ID professionnel 1 ProfId2=ID professionnel 2