New: Permet export des sociétés et contacts

This commit is contained in:
Laurent Destailleur 2006-01-09 19:58:46 +00:00
parent 492ad9d704
commit 1248ab77d4
4 changed files with 126 additions and 76 deletions

View File

@ -68,8 +68,6 @@ class Export
$var=True; $var=True;
$i=0; $i=0;
while (($file = readdir($handle))!==false) 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))
{ {
@ -85,10 +83,12 @@ class Export
{ {
foreach($module->export_code as $r => $value) foreach($module->export_code as $r => $value)
{ {
if ($filter && $filter != $module->export_code[$r]) next; if ($filter && ($filter != $module->export_code[$r])) continue;
// Test si permissions ok \todo tester sur toutes permissions // Test si permissions ok \todo tester sur toutes permissions
$perm=$module->export_permission[$r][0]; $perm=$module->export_permission[$r][0];
if (strlen($perms[2]) > 0) //print_r("$perm[0]-$perm[1]-$perm[2]<br>");
if ($perm[2])
{ {
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; $bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
} }
@ -96,6 +96,7 @@ class Export
{ {
$bool=$user->rights->$perm[0]->$perm[1]; $bool=$user->rights->$perm[0]->$perm[1];
} }
//print("$bool<br>");
// Permissions ok // Permissions ok
if ($bool) if ($bool)
@ -118,7 +119,6 @@ class Export
} }
} }
} }
}
closedir($handle); closedir($handle);
} }

View File

@ -82,45 +82,85 @@ class modSociete extends DolibarrModules
// Permissions // Permissions
$this->rights = array(); $this->rights = array();
$this->rights_class = 'societe'; $this->rights_class = 'societe';
$r=0;
$this->rights[1][0] = 121; // id de la permission $r++;
$this->rights[1][1] = 'Lire les societes'; // libelle de la permission $this->rights[$r][0] = 121; // id de la permission
$this->rights[1][2] = 'r'; // type de la permission (déprécié à ce jour) $this->rights[$r][1] = 'Lire les societes'; // libelle de la permission
$this->rights[1][3] = 1; // La permission est-elle une permission par défaut $this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
$this->rights[1][4] = 'lire'; $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 $r++;
$this->rights[2][1] = 'Créer modifier les societes'; // libelle de la permission $this->rights[$r][0] = 122; // id de la permission
$this->rights[2][2] = 'w'; // type de la permission (déprécié à ce jour) $this->rights[$r][1] = 'Créer modifier les societes'; // libelle de la permission
$this->rights[2][3] = 0; // La permission est-elle une permission par défaut $this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
$this->rights[2][4] = 'creer'; $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 $r++;
$this->rights[3][1] = 'Supprimer les sociétés'; // libelle de la permission $this->rights[$r][0] = 125; // id de la permission
$this->rights[3][2] = 'd'; // type de la permission (déprécié à ce jour) $this->rights[$r][1] = 'Supprimer les sociétés'; // libelle de la permission
$this->rights[3][3] = 0; // La permission est-elle une permission par défaut $this->rights[$r][2] = 'd'; // type de la permission (déprécié à ce jour)
$this->rights[3][4] = 'supprimer'; $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
$this->rights[$r][4] = 'supprimer';
$this->rights[4][0] = 281; // id de la permission $r++;
$this->rights[4][1] = 'Lire les contacts'; // libelle de la permission $this->rights[$r][0] = 126; // id de la permission
$this->rights[4][2] = 'r'; // type de la permission (déprécié à ce jour) $this->rights[$r][1] = 'Exporter les sociétés'; // libelle de la permission
$this->rights[4][3] = 1; // La permission est-elle une permission par défaut $this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
$this->rights[4][4] = 'contact'; $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
$this->rights[4][5] = 'lire'; $this->rights[$r][4] = 'export';
$this->rights[5][0] = 282; // id de la permission $r++;
$this->rights[5][1] = 'Créer modifier les contacts'; // libelle de la permission $this->rights[$r][0] = 281; // id de la permission
$this->rights[5][2] = 'w'; // type de la permission (déprécié à ce jour) $this->rights[$r][1] = 'Lire les contacts'; // libelle de la permission
$this->rights[5][3] = 0; // La permission est-elle une permission par défaut $this->rights[$r][2] = 'r'; // type de la permission (déprécié à ce jour)
$this->rights[5][4] = 'contact'; $this->rights[$r][3] = 1; // La permission est-elle une permission par défaut
$this->rights[5][5] = 'creer'; $this->rights[$r][4] = 'contact';
$this->rights[$r][5] = 'lire';
$this->rights[6][0] = 283; // id de la permission $r++;
$this->rights[6][1] = 'Supprimer les contacts'; // libelle de la permission $this->rights[$r][0] = 282; // id de la permission
$this->rights[6][2] = 'd'; // type de la permission (déprécié à ce jour) $this->rights[$r][1] = 'Créer modifier les contacts'; // libelle de la permission
$this->rights[6][3] = 0; // La permission est-elle une permission par défaut $this->rights[$r][2] = 'w'; // type de la permission (déprécié à ce jour)
$this->rights[6][4] = 'contact'; $this->rights[$r][3] = 0; // La permission est-elle une permission par défaut
$this->rights[6][5] = 'supprimer'; $this->rights[$r][4] = 'contact';
$this->rights[$r][5] = 'creer';
$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"));
} }

View File

@ -13,9 +13,12 @@ NewCompany=New company (prospect, customer, supplier)
NewSocGroup=Nouveau companies group NewSocGroup=Nouveau companies group
ProspectionArea=Prospection area ProspectionArea=Prospection area
SocGroup=Group of companies SocGroup=Group of companies
IdCompany=Company Id
Company=Company Company=Company
CompanyName=Company name
Companies=Companies Companies=Companies
ParentCompany=Parent company ParentCompany=Parent company
CivilityCode=Civility code
Name=Name Name=Name
Lastname=Lastname Lastname=Lastname
Firstname=Firstname Firstname=Firstname
@ -25,11 +28,13 @@ Address=Address
State=State/Canton State=State/Canton
Region=Region Region=Region
Country=Country Country=Country
CountryCode=Country code
Phone=Phone Phone=Phone
Fax=Fax Fax=Fax
Zip=Zip Code Zip=Zip Code
Town=Town Town=Town
Web=Web Web=Web
Birthday=Birthday
##### Professionnal ID ##### ##### Professionnal ID #####
ProfId1=Professional ID 1 ProfId1=Professional ID 1
ProfId2=Professional ID 2 ProfId2=Professional ID 2

View File

@ -13,9 +13,12 @@ NewCompany=Nouvelle soci
NewSocGroup=Nouveau groupement de sociétés NewSocGroup=Nouveau groupement de sociétés
ProspectionArea=Espace prospection ProspectionArea=Espace prospection
SocGroup=Groupement de sociétés SocGroup=Groupement de sociétés
IdCompany=Id société
Company=Société Company=Société
CompanyName=Nom société
Companies=Sociétés Companies=Sociétés
ParentCompany=Maison mère ParentCompany=Maison mère
CivilityCode=Code civilité
Name=Nom Name=Nom
Lastname=Nom Lastname=Nom
Firstname=Prénom Firstname=Prénom
@ -25,11 +28,13 @@ Address=Adresse
State=Département/Canton State=Département/Canton
Region=Région Region=Région
Country=Pays Country=Pays
CountryCode=Code pays
Phone=Téléphone Phone=Téléphone
Fax=Fax Fax=Fax
Zip=Code postal Zip=Code postal
Town=Ville Town=Ville
Web=Web Web=Web
Birthday=Date de naissance
##### Professionnal ID ##### ##### Professionnal ID #####
ProfId1=ID professionnel 1 ProfId1=ID professionnel 1
ProfId2=ID professionnel 2 ProfId2=ID professionnel 2