diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 6775ff49fce9b913f9047bed44e1b90ad17bf3f7..beeb073e60ddf3c9c1941c144cce5ed1d27e70ee 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -109,18 +109,23 @@ class Export //print $i.'-'.$filter.'-'.$modulename.'-'.join(',',$module->export_code).'<br>'; 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]<br>"); - if ($perm[2]) + // Test si permissions ok + $bool=true; + foreach($module->export_permission[$r] as $val) { - $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; + $perm=$val; + //print_r("$perm[0]-$perm[1]-$perm[2]<br>"); + if ($perm[2]) + { + $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; + } + else + { + $bool=$user->rights->$perm[0]->$perm[1]; + } + if ($perm[0]=='user' && $user->admin) $bool=true; + if (! $bool) break; } - else - { - $bool=$user->rights->$perm[0]->$perm[1]; - } - if ($perm[0]=='user' && $user->admin) $bool=true; //print $bool." $perm[0]"."<br>"; // Permissions ok diff --git a/htdocs/includes/modules/modCategorie.class.php b/htdocs/includes/modules/modCategorie.class.php index c781b0edbd9e4a85ef35c39ec79e4b406ede7388..dcb97588d9037928bbd974b4da001831eb535f39 100644 --- a/htdocs/includes/modules/modCategorie.class.php +++ b/htdocs/includes/modules/modCategorie.class.php @@ -109,7 +109,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r]='category_'.$r; $this->export_label[$r]='CatSupList'; $this->export_icon[$r]='category'; - $this->export_permission[$r]=array(array("categorie","lire")); + $this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire")); $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'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.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note"); $this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.libelle'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company"); // We define here only fields that use another picto $this->export_sql_start[$r]='SELECT DISTINCT '; @@ -121,7 +121,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r]='category_'.$r; $this->export_label[$r]='CatCusList'; $this->export_icon[$r]='category'; - $this->export_permission[$r]=array(array("categorie","lire")); + $this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire")); $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'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.email'=>"Email",'s.siret'=>"IdProf1",'s.siren'=>"IdProf2",'s.ape'=>"IdProf3",'s.idprof4'=>"IdProf4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus'); $this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.cp'=>"company",'s.ville'=>"company",'p.libelle'=>"company",'p.code'=>"company",'s.tel'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note'=>"company",'s.fk_prospectlevel'=>'company','s.fk_stcomm'=>'company'); // We define here only fields that use another picto $this->export_sql_start[$r]='SELECT DISTINCT '; @@ -133,7 +133,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r]='category_'.$r; $this->export_label[$r]='CatProdList'; $this->export_icon[$r]='category'; - $this->export_permission[$r]=array(array("categorie","lire")); + $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire")); $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref'); $this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto $this->export_sql_start[$r]='SELECT DISTINCT '; @@ -145,7 +145,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r]='category_'.$r; $this->export_label[$r]='CatMemberList'; $this->export_icon[$r]='category'; - $this->export_permission[$r]=array(array("categorie","lire")); + $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.nom'=>'Name','p.prenom'=>'Firstname'); $this->export_entities_array[$r]=array('p.rowid'=>'member','p.nom'=>'member','p.prenom'=>'member'); // We define here only fields that use another picto $this->export_sql_start[$r]='SELECT DISTINCT ';