issue #0001406 : Liens de direction

This commit is contained in:
Michael RICOIS 2012-12-03 15:08:06 +00:00
parent 538202314b
commit 12046d5878
3 changed files with 205 additions and 657 deletions

View File

@ -9,6 +9,7 @@ Type[] = "InseeReturn"
Type[] = "TvaReturn" Type[] = "TvaReturn"
Type[] = "LiensReturn" Type[] = "LiensReturn"
Type[] = "Lien" Type[] = "Lien"
Type[] = "LienDirection"
Type[] = "InfosRegReturn" Type[] = "InfosRegReturn"
Type[] = "ListeBilansReturn" Type[] = "ListeBilansReturn"
Type[] = "SetSurveillanceReturn" Type[] = "SetSurveillanceReturn"

View File

@ -653,385 +653,151 @@ class Entreprise extends WsScore
public function getLiens($siren, $type = null) public function getLiens($siren, $type = null)
{ {
$this->authenticate(); $this->authenticate();
//Connect to the database
try { try {
$db = Zend_Db::factory($this->dbConfig->db->jo); $db = Zend_Db::factory($this->dbConfig->db->jo);
$db->getConnection(); $db->getConnection();
} catch (Zend_Db_Adapter_Exception $e) { } catch (Zend_Db_Adapter_Exception $e) {
if ($this->tabInfoUser['idClient']!=1) { if ($this->tabInfoUser['idClient']==1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage()); throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
} }
} catch (Zend_Exception $e) { } catch (Zend_Exception $e) {
throw new SoapFault('ERR', "Application error"); throw new SoapFault('ERR', "Application error");
} }
//Select parent id
try { try {
$refM = new Application_Model_JoLiensRef($db); $countryM = new Application_Model_JoTabPays($db);
$sql = $refM->select()->where('siren=?',$siren); $sql = $countryM->select()->from($countryM, array('codPays3', 'libPays'));
$parent = $refM->fetchRow($sql); $result = $countryM->fetchAll($sql);
} catch (Zend_Db_Adapter_Exception $e) { } catch (Zend_Db_Adapter_Exception $e) {
if ($this->tabInfoUser['idClient']!=1) { if ($this->tabInfoUser['idClient']==1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage());
}
} catch (Zend_Exception $e) {
throw new SoapFault('ERR', "Application error");
}
if ($parent===null) {
throw new SoapFault('MSG', "Aucun résultat");
}
$tabAct = $tabPar = array();
$pays = array(
'FRA' => "France",
'AND' => "Andorre",
'ARE' => "Emirats Arabes Unis",
'AFG' => "Afghanistan",
'ATG' => "Antigua",
'AIA' => "Anguilla",
'ALB' => "Albanie",
'ARM' => "Arménie",
'ANT' => "Antilles Néerlandaises",
'AGO' => "Angola",
'ATA' => "Antarctique",
'ARG' => "Argentine",
'ASM' => "Samoa Américaines",
'AUT' => "Autriche",
'AUS' => "Australie",
'ABW' => "Aruba",
'AZE' => "Azerbaïdjan",
'BIH' => "Bosnie-Herzégovine",
'BRB' => "Barbade",
'BGD' => "Bangladesh",
'BEL' => "Belgique",
'BFA' => "Burkina Faso",
'BGR' => "Bulgarie",
'BHR' => "Bahreïn",
'BDI' => "Burundi",
'BEN' => "Bénin",
'BMU' => "Bermudes",
'BRN' => "Brunei",
'BOL' => "Bolivie",
'BRA' => "Brésil",
'BHS' => "Bahamas",
'BTN' => "Bhoutan",
'BVT' => "Iles Bouvet",
'BWA' => "Botswana",
'BLR' => "Biélorussie",
'BLZ' => "Bélize",
'CAN' => "Canada",
'CCK' => "Iles Cocos",
'CAF' => "République Centrafricaine",
'COG' => "Congo",
'CHE' => "Suisse",
'CIV' => "Côte d\'Ivoire",
'COK' => "Iles Cook",
'CHL' => "Chili",
'CMR' => "Cameroun",
'CHN' => "Chine",
'COL' => "Colombie",
'CRI' => "Costa Rica",
'CSK' => "Tchécoslovaquie",
'CUB' => "Cuba",
'CPV' => "Cap-Vert",
'CXR' => "Ile Christmas",
'CYP' => "Chypre",
'CZE' => "Rébublique Tchèque",
'DDR' => "République Démocratique Allemande",
'DEU' => "Allemagne",
'DJI' => "Djibouti",
'DNK' => "Danemark",
'DMA' => "Dominique",
'DOM' => "République Dominicaine",
'DZA' => "Algérie",
'ECU' => "Equateur",
'EST' => "Estonie",
'EGY' => "Egypte",
'ESH' => "Sahara Occidental",
'ERI' => "Eritrea",
'ESP' => "Espagne",
'ETH' => "Ethiopie",
'FIN' => "Finlande",
'FJI' => "Iles Fidji",
'FLK' => "Iles Malouines",
'FSM' => "Etats Fédérés de Micronésie",
'FRO' => "Iles Féroé",
'GAB' => "Gabon",
'GBR' => "Royaume-Uni",
'GRD' => "Grenade",
'GEO' => "Géorgie",
'GUF' => "Guinée française",
'GHA' => "Ghana",
'GIB' => "Gibraltar",
'GRL' => "Groënland",
'GMB' => "Gambie",
'GIN' => "Guinée",
'GLP' => "Guadeloupe",
'GNQ' => "Guinée Equatoriale",
'GRC' => "Grèce",
'SGS' => "Géorgie du sud & Iles Sandwich",
'GTM' => "Guatemala",
'GUM' => "Guam",
'GNB' => "Guinée-Bissau",
'GUY' => "Guyane",
'HKG' => "Hong Kong",
'HMD' => "Iles Heard et Mc Donald",
'HND' => "Honduras",
'HRV' => "Croatie",
'HTI' => "Haïti",
'HUN' => "Hongrie",
'IDN' => "Indonésie",
'IRL' => "Irlande",
'ISR' => "Israël",
'IND' => "Inde",
'IOT' => "Iles Vierges Britanniques",
'IRQ' => "Irak",
'IRN' => "Iran",
'ISL' => "Islande",
'ITA' => "Italie",
'JAM' => "Jamaïque",
'JOR' => "Jordanie",
'JPN' => "Japon",
'KEN' => "Kenya",
'KGZ' => "Kirghizistan",
'KHM' => "Cambodge",
'KIR' => "Kiribati",
'COM' => "Comores",
'KNA' => "Saint-Kitts",
'PRK' => "Corée",
'KOR' => "République de Corée",
'KWT' => "Koweït",
'CYM' => "Iles Caïman",
'KAZ' => "Kazakhstan",
'LAO' => "Laos",
'LBN' => "Liban",
'LCA' => "Sainte-Lucie",
'LIE' => "Liechtenstein",
'LKA' => "Sri Lanka",
'LBR' => "Libéria",
'LSO' => "Lesotho",
'LTU' => "Lithuanie",
'LUX' => "Luxembourg",
'LVA' => "Lettonie",
'LBY' => "Libye",
'MAR' => "Maroc",
'MCO' => "Monaco",
'MDA' => "Moldavie",
'MDG' => "Madagascar",
'MHL' => "Iles Marshall",
'MKD' => "Macédoine",
'MLI' => "Mali",
'MMR' => "Myanmar",
'MNG' => "Mongolie",
'MAC' => "Macao",
'MNP' => "Iles Mariannes",
'MTQ' => "Martinique",
'MRT' => "Mauritanie",
'MSR' => "Montserrat",
'MLT' => "Malte",
'MUS' => "Ile Maurice",
'MDV' => "Maldives",
'MWI' => "Malawi",
'MEX' => "Mexique",
'MYS' => "Malaisie",
'MOZ' => "Mozambique",
'NAM' => "Namibie",
'NCL' => "Nouvelle Calédonie",
'NER' => "Niger",
'NFK' => "Iles Norfolk",
'NGA' => "Nigeria",
'NIC' => "Nicaragua",
'NLD' => "Pays-Bas",
'NOR' => "Norvège",
'NPL' => "Népal",
'NRU' => "Nauru",
'NTZ' => "Zone Neutre",
'NIU' => "Niue",
'NZL' => "Nouvelle Zélande",
'OMN' => "Oman",
'PAN' => "Panama",
'PER' => "Pérou",
'PYF' => "Polynésie Francaise",
'PNG' => "Papouasie Nouvelle-Guinée",
'PHL' => "Philippines",
'PAK' => "Pakistan",
'POL' => "Pologne",
'SPM' => "Saint Pierre et Miquelon",
'PCN' => "Pitcairn",
'PRI' => "Porto Rico",
'PRT' => "Portugal",
'PLW' => "Palau",
'PRY' => "Paraguay",
'QAT' => "Qatar",
'REU' => "Ile de la Réunion",
'ROM' => "Roumanie",
'RUS' => "Russie",
'RWA' => "Rwanda",
'SAU' => "Arabie Saoudite",
'SLB' => "Iles Salomon",
'SYC' => "Seychelles",
'SDN' => "Soudan",
'SWE' => "Suède",
'SGP' => "Singapour",
'SHN' => "Sainte-Hélène",
'SVN' => "Slovénie",
'SJM' => "Spitsberg et lle Jan Mayen",
'SVK' => "Slovaquie",
'SLE' => "Sierra Leone",
'SMR' => "Saint-Marin",
'SEN' => "Sénégal",
'SOM' => "Somalie",
'SUR' => "Surinam",
'STP' => "São Tomé et Principe",
'SUN' => "URSS",
'SLV' => "Salvador",
'SYR' => "Syrie",
'SWZ' => "Swaziland",
'TCA' => "Iles Turques et Caïques",
'TCD' => "Tchad",
'ATF' => "Terres Australes Francaises",
'TGO' => "Togo",
'THA' => "Thaïlande",
'TJK' => "Tadjikistan",
'TKL' => "Iles Tokélaou",
'TKM' => "Turkménistan",
'TUN' => "Tunisie",
'TON' => "Tonga",
'TMP' => "Timor Oriental",
'TUR' => "Turquie",
'TTO' => "Trinité-et-Tobago",
'TUV' => "Tuvalu",
'TWN' => "Taïwan, République de Chine",
'TZA' => "Tanzanie",
'UKR' => "Ukraine",
'UGA' => "Ouganda",
'UMI' => "Iles mineures éloignées des E.U",
'USA' => "Etats Unis",
'URY' => "Uruguay",
'UZB' => "Ouzbékistan",
'VAT' => "Vatican",
'VCT' => "Saint Vincent et les Grenadines",
'VEN' => "Vénézuéla",
'VGB' => "Iles Vierges Britaniques",
'VIR' => "Iles Vierges U.S",
'VNM' => "Vietnam",
'VUT' => "Vanuatu",
'WLF' => "Wallis et Futuna",
'WSM' => "Samoa Américaines",
'XBA' => "Rép. Turque de Chypre",
'YMD' => "Yémen (République Démocratique)",
'YEM' => "Yemen",
'MYT' => "Mayotte",
'YUG' => "Yougoslavie",
'ZAF' => "Afrique du sud",
'ZMB' => "Zambie",
'ZAR' => "Zaïre",
'ZWE' => "Zimbabwe");
//Actionnaire
try {
$sql = $db->select()
->from(array('l'=>'liens2'),
array('id', 'idAct', 'PDetention', 'Pvote', 'MajMin', 'idPar',
'dateEffetLien', 'dateInsert'))
->where('idPar=?', $parent->id)
->where('l.actif=?',1)
->join(array('r'=>'liensRef'), 'l.idAct=r.id',
array('siren','PpPm', 'RS', 'civilite', 'nom', 'prenom', 'nom_usage',
'naissance_date', 'naissance_dept_pays', 'naissance_lieu', 'nat',
'adresse_num', 'adresse_btq', 'adresse_codvoie', 'adresse_libvoie',
'adresse_comp', 'adresse_cp', 'adresse_ville', 'adresse_pays'
))
->order('PDetention DESC');
$liens = $db->fetchAll($sql, null, Zend_Db::FETCH_OBJ);
} catch (Zend_Exception $e) {
if ($this->tabInfoUser['idClient']!=1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage()); throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
} }
} catch (Zend_Exception $e) {
throw new SoapFault('ERR', "Application error");
}
$tabPays = array();
if ( $result->count()>0 ) {
foreach ( $result as $item ) {
$tabPays[$item->codPays3] = $item->libPays;
}
} }
require_once 'Metier/partenaires/classMLiens2.php';
$liensM = new MLiens2($siren, 'siren');
$tabAct = $tabPar = $tabDir = array();
//Actionnaires
$liens = $liensM->getActionnaires(null, true);
if (count($liens)>0) { if (count($liens)>0) {
foreach ( $liens as $item ) { foreach ( $liens as $item ) {
$detail = new Lien(); $detail = new Lien();
$detail->id = $item->id; $detail->id = $item->id;
$detail->idFiche = $item->idAct; $detail->idFiche = $item->idAct;
$detail->nom = $item->RS; $detail->nom = $item->RS;
$detail->pays = $pays[$item->adresse_pays];
$libPays = '';
if ($item->adresse_pays!='') {
$libPays = array_key_exists($item->adresse_pays, $tabPays) ?
$tabPays[$item->adresse_pays] : $item->adresse_pays;
} else {
$libPays = $tabPays['FRA'];
}
$detail->pays = $libPays;
if ($item->PpPm=='PP') { if ($item->PpPm=='PP') {
$detail->nom = $item->civilite.' '.$item->nom.' '.$item->Prenom; $detail->nom = $item->civilite.' '.$item->nom.' '.$item->prenom;
$detail->pays = $pays[$item->nat]; if ($item->adresse_pays!='') {
$libPays = array_key_exists($item->nat, $tabPays) ?
$tabPays[$item->nat] : $item->$item->nat;
} else {
$libPays = $tabPays['FRA'];
}
$detail->pays = $libPays;
} }
$detail->siren = str_pad($item->siren, 9, "0", STR_PAD_LEFT); $detail->siren = str_pad($item->siren, 9, "0", STR_PAD_LEFT);
$detail->PDetention = $item->PDetention; $detail->PDetention = $item->PDetention;
$detail->Pvote = $item->Pvote; $detail->Pvote = $item->Pvote;
$detail->MajMin = $item->MajMin; $detail->MajMin = $item->MajMin;
$detail->date = $item->dateEffetLien;
$detail->docRef = $item->docRef;
$detail->docrefDate = $item->dateDocRef;
$tabAct[] = $detail; $tabAct[] = $detail;
} }
} }
//Participation //Participations
try { $liens = $liensM->getParticipations(null, true);
$sql = $db->select()
->from(array('l'=>'liens2'),
array('id', 'idAct', 'PDetention', 'Pvote', 'MajMin', 'idPar',
'dateEffetLien', 'dateInsert'))
->where('idAct=?', $parent->id)
->where('l.actif=?',1)
->join(array('r'=>'liensRef'), 'l.idPar=r.id',
array('siren','PpPm', 'RS', 'civilite', 'nom', 'prenom', 'nom_usage',
'naissance_date', 'naissance_dept_pays', 'naissance_lieu', 'nat',
'adresse_num', 'adresse_btq', 'adresse_codvoie', 'adresse_libvoie',
'adresse_comp', 'adresse_cp', 'adresse_ville', 'adresse_pays'
))
->order('PDetention DESC');
$liens = $db->fetchAll($sql, null, Zend_Db::FETCH_OBJ);
} catch (Zend_Exception $e) {
if ($this->tabInfoUser['idClient']!=1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage());
}
}
if (count($liens)>0) { if (count($liens)>0) {
foreach ( $liens as $item ) { foreach ( $liens as $item ) {
$detail = new Lien(); $detail = new Lien();
$detail->id = $item->id; $detail->id = $item->id;
$detail->idFiche = $item->idPar; $detail->idFiche = $item->idPar;
$detail->nom = $item->RS; $detail->nom = $item->RS;
$detail->pays = $pays[$item->adresse_pays];
if ($item->PpPm=='PP') { $libPays = '';
$detail->nom = $item->civilite.' '.$item->nom.' '.$item->Prenom; if ($item->adresse_pays!='') {
$detail->pays = $pays[$item->nat]; $libPays = array_key_exists($item->adresse_pays, $tabPays) ?
$tabPays[$item->adresse_pays] : $item->adresse_pays;
} else {
$libPays = $tabPays['FRA'];
} }
$detail->siren = str_pad($item->siren, 9, "0", STR_PAD_LEFT); $detail->pays = $libPays;
$detail->PDetention = $item->PDetention;
$detail->Pvote = $item->Pvote; if ($item->PpPm=='PP') {
$detail->MajMin = $item->MajMin; $detail->nom = $item->civilite.' '.$item->nom.' '.$item->prenom;
$detail->date = $item->dateEffetLien; if ($item->adresse_pays!='') {
//@todo : Think how to display documents $libPays = array_key_exists($item->nat, $tabPays) ?
$detail->docRef = $item->docRef; $tabPays[$item->nat] : $item->$item->nat;
$detail->docrefDate = $item->dateDocRef; } else {
$libPays = $tabPays['FRA'];
}
$detail->pays = $libPays;
}
$detail->siren = str_pad($item->siren, 9, "0", STR_PAD_LEFT);
$detail->PDetention = $item->PDetention;
$detail->Pvote = $item->Pvote;
$detail->MajMin = $item->MajMin;
$tabPar[] = $detail; $tabPar[] = $detail;
} }
} }
//Directions
$liens = $liensM->getDirections(true);
if (count($liens)>0) {
foreach ( $liens as $item ) {
$detail = new LienDirection();
$detail->siren = $item->siren;
$detail->nom = $item->raisonSociale;
$detail->fonction = $item->fonction_lib;
$detail->dirRS = $item->dirRS;
$nom = '';
if (!empty($item->civilite)) {
$nom.= $item->civilite.'. ';
}
if (!empty($item->nom)) {
$nom.= $item->nom.' ';
}
if (!empty($item->prenom)) {
$nom.= $item->prenom;
}
$detail->dirNom = $nom;
$detail->dirNaissLieu = $item->naissance_lieu;
$detail->dirNaissDate = $item->naissance_date;
$tabDir[] = $detail;
}
}
$output = new LiensReturn(); $output = new LiensReturn();
$output->actionnaires = $tabAct; $output->actionnaires = $tabAct;
$output->participations = $tabPar; $output->participations = $tabPar;
$output->directions = $tabDir;
return $output; return $output;
} }
@ -1043,360 +809,115 @@ class Entreprise extends WsScore
*/ */
public function getLiensById($id, $type = null) public function getLiensById($id, $type = null)
{ {
$this->authenticate(); $this->authenticate();
//Connect to the database
try {
$db = Zend_Db::factory($this->dbConfig->db->jo);
$db->getConnection();
} catch (Zend_Db_Adapter_Exception $e) {
if ($this->tabInfoUser['idClient']!=1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage());
}
} catch (Zend_Exception $e) {
throw new SoapFault('ERR', "Application error");
}
$tabAct = $tabPar = array();
$pays = array( try {
'FRA' => "France", $db = Zend_Db::factory($this->dbConfig->db->jo);
'AND' => "Andorre", $db->getConnection();
'ARE' => "Emirats Arabes Unis", } catch (Zend_Db_Adapter_Exception $e) {
'AFG' => "Afghanistan", if ($this->tabInfoUser['idClient']==1) {
'ATG' => "Antigua",
'AIA' => "Anguilla",
'ALB' => "Albanie",
'ARM' => "Arménie",
'ANT' => "Antilles Néerlandaises",
'AGO' => "Angola",
'ATA' => "Antarctique",
'ARG' => "Argentine",
'ASM' => "Samoa Américaines",
'AUT' => "Autriche",
'AUS' => "Australie",
'ABW' => "Aruba",
'AZE' => "Azerbaïdjan",
'BIH' => "Bosnie-Herzégovine",
'BRB' => "Barbade",
'BGD' => "Bangladesh",
'BEL' => "Belgique",
'BFA' => "Burkina Faso",
'BGR' => "Bulgarie",
'BHR' => "Bahreïn",
'BDI' => "Burundi",
'BEN' => "Bénin",
'BMU' => "Bermudes",
'BRN' => "Brunei",
'BOL' => "Bolivie",
'BRA' => "Brésil",
'BHS' => "Bahamas",
'BTN' => "Bhoutan",
'BVT' => "Iles Bouvet",
'BWA' => "Botswana",
'BLR' => "Biélorussie",
'BLZ' => "Bélize",
'CAN' => "Canada",
'CCK' => "Iles Cocos",
'CAF' => "République Centrafricaine",
'COG' => "Congo",
'CHE' => "Suisse",
'CIV' => "Côte d\'Ivoire",
'COK' => "Iles Cook",
'CHL' => "Chili",
'CMR' => "Cameroun",
'CHN' => "Chine",
'COL' => "Colombie",
'CRI' => "Costa Rica",
'CSK' => "Tchécoslovaquie",
'CUB' => "Cuba",
'CPV' => "Cap-Vert",
'CXR' => "Ile Christmas",
'CYP' => "Chypre",
'CZE' => "Rébublique Tchèque",
'DDR' => "République Démocratique Allemande",
'DEU' => "Allemagne",
'DJI' => "Djibouti",
'DNK' => "Danemark",
'DMA' => "Dominique",
'DOM' => "République Dominicaine",
'DZA' => "Algérie",
'ECU' => "Equateur",
'EST' => "Estonie",
'EGY' => "Egypte",
'ESH' => "Sahara Occidental",
'ERI' => "Eritrea",
'ESP' => "Espagne",
'ETH' => "Ethiopie",
'FIN' => "Finlande",
'FJI' => "Iles Fidji",
'FLK' => "Iles Malouines",
'FSM' => "Etats Fédérés de Micronésie",
'FRO' => "Iles Féroé",
'GAB' => "Gabon",
'GBR' => "Royaume-Uni",
'GRD' => "Grenade",
'GEO' => "Géorgie",
'GUF' => "Guinée française",
'GHA' => "Ghana",
'GIB' => "Gibraltar",
'GRL' => "Groënland",
'GMB' => "Gambie",
'GIN' => "Guinée",
'GLP' => "Guadeloupe",
'GNQ' => "Guinée Equatoriale",
'GRC' => "Grèce",
'SGS' => "Géorgie du sud & Iles Sandwich",
'GTM' => "Guatemala",
'GUM' => "Guam",
'GNB' => "Guinée-Bissau",
'GUY' => "Guyane",
'HKG' => "Hong Kong",
'HMD' => "Iles Heard et Mc Donald",
'HND' => "Honduras",
'HRV' => "Croatie",
'HTI' => "Haïti",
'HUN' => "Hongrie",
'IDN' => "Indonésie",
'IRL' => "Irlande",
'ISR' => "Israël",
'IND' => "Inde",
'IOT' => "Iles Vierges Britanniques",
'IRQ' => "Irak",
'IRN' => "Iran",
'ISL' => "Islande",
'ITA' => "Italie",
'JAM' => "Jamaïque",
'JOR' => "Jordanie",
'JPN' => "Japon",
'KEN' => "Kenya",
'KGZ' => "Kirghizistan",
'KHM' => "Cambodge",
'KIR' => "Kiribati",
'COM' => "Comores",
'KNA' => "Saint-Kitts",
'PRK' => "Corée",
'KOR' => "République de Corée",
'KWT' => "Koweït",
'CYM' => "Iles Caïman",
'KAZ' => "Kazakhstan",
'LAO' => "Laos",
'LBN' => "Liban",
'LCA' => "Sainte-Lucie",
'LIE' => "Liechtenstein",
'LKA' => "Sri Lanka",
'LBR' => "Libéria",
'LSO' => "Lesotho",
'LTU' => "Lithuanie",
'LUX' => "Luxembourg",
'LVA' => "Lettonie",
'LBY' => "Libye",
'MAR' => "Maroc",
'MCO' => "Monaco",
'MDA' => "Moldavie",
'MDG' => "Madagascar",
'MHL' => "Iles Marshall",
'MKD' => "Macédoine",
'MLI' => "Mali",
'MMR' => "Myanmar",
'MNG' => "Mongolie",
'MAC' => "Macao",
'MNP' => "Iles Mariannes",
'MTQ' => "Martinique",
'MRT' => "Mauritanie",
'MSR' => "Montserrat",
'MLT' => "Malte",
'MUS' => "Ile Maurice",
'MDV' => "Maldives",
'MWI' => "Malawi",
'MEX' => "Mexique",
'MYS' => "Malaisie",
'MOZ' => "Mozambique",
'NAM' => "Namibie",
'NCL' => "Nouvelle Calédonie",
'NER' => "Niger",
'NFK' => "Iles Norfolk",
'NGA' => "Nigeria",
'NIC' => "Nicaragua",
'NLD' => "Pays-Bas",
'NOR' => "Norvège",
'NPL' => "Népal",
'NRU' => "Nauru",
'NTZ' => "Zone Neutre",
'NIU' => "Niue",
'NZL' => "Nouvelle Zélande",
'OMN' => "Oman",
'PAN' => "Panama",
'PER' => "Pérou",
'PYF' => "Polynésie Francaise",
'PNG' => "Papouasie Nouvelle-Guinée",
'PHL' => "Philippines",
'PAK' => "Pakistan",
'POL' => "Pologne",
'SPM' => "Saint Pierre et Miquelon",
'PCN' => "Pitcairn",
'PRI' => "Porto Rico",
'PRT' => "Portugal",
'PLW' => "Palau",
'PRY' => "Paraguay",
'QAT' => "Qatar",
'REU' => "Ile de la Réunion",
'ROM' => "Roumanie",
'RUS' => "Russie",
'RWA' => "Rwanda",
'SAU' => "Arabie Saoudite",
'SLB' => "Iles Salomon",
'SYC' => "Seychelles",
'SDN' => "Soudan",
'SWE' => "Suède",
'SGP' => "Singapour",
'SHN' => "Sainte-Hélène",
'SVN' => "Slovénie",
'SJM' => "Spitsberg et lle Jan Mayen",
'SVK' => "Slovaquie",
'SLE' => "Sierra Leone",
'SMR' => "Saint-Marin",
'SEN' => "Sénégal",
'SOM' => "Somalie",
'SUR' => "Surinam",
'STP' => "São Tomé et Principe",
'SUN' => "URSS",
'SLV' => "Salvador",
'SYR' => "Syrie",
'SWZ' => "Swaziland",
'TCA' => "Iles Turques et Caïques",
'TCD' => "Tchad",
'ATF' => "Terres Australes Francaises",
'TGO' => "Togo",
'THA' => "Thaïlande",
'TJK' => "Tadjikistan",
'TKL' => "Iles Tokélaou",
'TKM' => "Turkménistan",
'TUN' => "Tunisie",
'TON' => "Tonga",
'TMP' => "Timor Oriental",
'TUR' => "Turquie",
'TTO' => "Trinité-et-Tobago",
'TUV' => "Tuvalu",
'TWN' => "Taïwan, République de Chine",
'TZA' => "Tanzanie",
'UKR' => "Ukraine",
'UGA' => "Ouganda",
'UMI' => "Iles mineures éloignées des E.U",
'USA' => "Etats Unis",
'URY' => "Uruguay",
'UZB' => "Ouzbékistan",
'VAT' => "Vatican",
'VCT' => "Saint Vincent et les Grenadines",
'VEN' => "Vénézuéla",
'VGB' => "Iles Vierges Britaniques",
'VIR' => "Iles Vierges U.S",
'VNM' => "Vietnam",
'VUT' => "Vanuatu",
'WLF' => "Wallis et Futuna",
'WSM' => "Samoa Américaines",
'XBA' => "Rép. Turque de Chypre",
'YMD' => "Yémen (République Démocratique)",
'YEM' => "Yemen",
'MYT' => "Mayotte",
'YUG' => "Yougoslavie",
'ZAF' => "Afrique du sud",
'ZMB' => "Zambie",
'ZAR' => "Zaïre",
'ZWE' => "Zimbabwe");
//Actionnaire
try {
$sql = $db->select()
->from(array('l'=>'liens2'),
array('id', 'idAct', 'PDetention', 'Pvote', 'MajMin', 'idPar',
'dateEffetLien', 'dateInsert'))
->where('idPar=?', $id)
->where('l.actif=?',1)
->join(array('r'=>'liensRef'), 'l.idAct=r.id',
array('siren','PpPm', 'RS', 'civilite', 'nom', 'prenom', 'nom_usage',
'naissance_date', 'naissance_dept_pays', 'naissance_lieu', 'nat',
'adresse_num', 'adresse_btq', 'adresse_codvoie', 'adresse_libvoie',
'adresse_comp', 'adresse_cp', 'adresse_ville', 'adresse_pays'
))
->order('PDetention DESC');
$liens = $db->fetchAll($sql, null, Zend_Db::FETCH_OBJ);
} catch (Zend_Exception $e) {
if ($this->tabInfoUser['idClient']!=1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage()); throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
} catch (Zend_Exception $e) {
throw new SoapFault('ERR', "Application error");
}
try {
$countryM = new Application_Model_JoTabPays($db);
$sql = $countryM->select()->from($countryM, array('codPays3', 'libPays'));
$result = $countryM->fetchAll($sql);
} catch (Zend_Db_Adapter_Exception $e) {
if ($this->tabInfoUser['idClient']==1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
} catch (Zend_Exception $e) {
throw new SoapFault('ERR', "Application error");
}
$tabPays = array();
if ( $result->count()>0 ) {
foreach ( $result as $item ) {
$tabPays[$item->codPays3] = $item->libPays;
} }
} }
require_once 'Metier/partenaires/classMLiens2.php';
$liensM = new MLiens2($id);
$tabAct = $tabPar = array();
//Actionnaires
$liens = $liensM->getActionnaires(null, true);
if (count($liens)>0) { if (count($liens)>0) {
foreach ( $liens as $item ) { foreach ( $liens as $item ) {
$detail = new Lien(); $detail = new Lien();
$detail->id = $item->id; $detail->id = $item->id;
$detail->idFiche = $item->idAct; $detail->idFiche = $item->idAct;
$detail->nom = $item->RS; $detail->nom = $item->RS;
$detail->pays = $pays[$item->adresse_pays]; $libPays = '';
if ($item->adresse_pays!='') {
$libPays = array_key_exists($item->adresse_pays, $tabPays) ?
$tabPays[$item->adresse_pays] : $item->adresse_pays;
} else {
$libPays = $tabPays['FRA'];
}
$detail->pays = $libPays;
if ($item->PpPm=='PP') { if ($item->PpPm=='PP') {
$detail->nom = $item->civilite.' '.$item->nom.' '.$item->Prenom; $detail->nom = $item->civilite.' '.$item->nom.' '.$item->prenom;
$detail->pays = $pays[$item->nat]; if ($item->adresse_pays!='') {
$libPays = array_key_exists($item->nat, $tabPays) ?
$tabPays[$item->nat] : $item->$item->nat;
} else {
$libPays = $tabPays['FRA'];
}
$detail->pays = $libPays;
} }
$detail->siren = str_pad($item->siren, 9, "0", STR_PAD_LEFT); $detail->siren = str_pad($item->siren, 9, "0", STR_PAD_LEFT);
$detail->PDetention = $item->PDetention; $detail->PDetention = $item->PDetention;
$detail->Pvote = $item->Pvote; $detail->Pvote = $item->Pvote;
$detail->MajMin = $item->MajMin; $detail->MajMin = $item->MajMin;
$detail->date = $item->dateEffetLien;
$detail->docRef = $item->docRef;
$detail->docrefDate = $item->dateDocRef;
$tabAct[] = $detail; $tabAct[] = $detail;
} }
} }
//Participation //Participations
try { $liens = $liensM->getParticipations(null, true);
$sql = $db->select()
->from(array('l'=>'liens2'),
array('id', 'idAct', 'PDetention', 'Pvote', 'MajMin', 'idPar',
'dateEffetLien', 'dateInsert'))
->where('idAct=?', $id)
->where('l.actif=?',1)
->join(array('r'=>'liensRef'), 'l.idPar=r.id',
array('siren','PpPm', 'RS', 'civilite', 'nom', 'prenom', 'nom_usage',
'naissance_date', 'naissance_dept_pays', 'naissance_lieu', 'nat',
'adresse_num', 'adresse_btq', 'adresse_codvoie', 'adresse_libvoie',
'adresse_comp', 'adresse_cp', 'adresse_ville', 'adresse_pays'
))
->order('PDetention DESC');
$liens = $db->fetchAll($sql, null, Zend_Db::FETCH_OBJ);
} catch (Zend_Exception $e) {
if ($this->tabInfoUser['idClient']!=1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage());
}
}
if (count($liens)>0) { if (count($liens)>0) {
foreach ( $liens as $item ) { foreach ( $liens as $item ) {
$detail = new Lien(); $detail = new Lien();
$detail->id = $item->id; $detail->id = $item->id;
$detail->idFiche = $item->idPar; $detail->idFiche = $item->idPar;
$detail->nom = $item->RS; $detail->nom = $item->RS;
$detail->pays = $pays[$item->adresse_pays]; $libPays = '';
if ($item->adresse_pays!='') {
$libPays = array_key_exists($item->adresse_pays, $tabPays) ?
$tabPays[$item->adresse_pays] : $item->adresse_pays;
} else {
$libPays = $tabPays['FRA'];
}
$detail->pays = $libPays;
if ($item->PpPm=='PP') { if ($item->PpPm=='PP') {
$detail->nom = $item->civilite.' '.$item->nom.' '.$item->Prenom; $detail->nom = $item->civilite.' '.$item->nom.' '.$item->prenom;
$detail->pays = $pays[$item->nat]; if ($item->adresse_pays!='') {
$libPays = array_key_exists($item->nat, $tabPays) ?
$tabPays[$item->nat] : $item->$item->nat;
} else {
$libPays = $tabPays['FRA'];
}
$detail->pays = $libPays;
} }
$detail->siren = str_pad($item->siren, 9, "0", STR_PAD_LEFT); $detail->siren = str_pad($item->siren, 9, "0", STR_PAD_LEFT);
$detail->PDetention = $item->PDetention; $detail->PDetention = $item->PDetention;
$detail->Pvote = $item->Pvote; $detail->Pvote = $item->Pvote;
$detail->MajMin = $item->MajMin; $detail->MajMin = $item->MajMin;
$detail->date = $item->dateEffetLien;
//@todo : Think how to display documents
$detail->docRef = $item->docRef;
$detail->docrefDate = $item->dateDocRef;
$tabPar[] = $detail; $tabPar[] = $detail;
} }
} }

View File

@ -1741,6 +1741,32 @@ class LiensReturn
public $actionnaires; public $actionnaires;
/** @var Lien[] */ /** @var Lien[] */
public $participations; public $participations;
/** @var LienDirection[] */
public $directions;
}
class LienDirection
{
/** @var string */
public $siren;
/** @var string */
public $nom;
/** @var string */
public $fonction;
/** @var string */
public $dirRS;
/** @var string */
public $dirNom;
/** @var string */
public $dirNaissDate;
/** @var string */
public $dirNaissLieu;
} }
class Lien class Lien