"1756", "triCode"=>"AIXPRL", "triNom"=>"Cour d'Appel d'Aix-en-Provence", "triCP"=>"13616" ), array( "triId"=>"1757", "triCode"=>"AMIENL", "triNom"=>"Cour d'Appel d'Amiens", "triCP"=>"80027" ), array( "triId"=>"1758", "triCode"=>"ANGERL", "triNom"=>"Cour d'Appel d'Angers", "triCP"=>"49043" ), array( "triId"=>"1759", "triCode"=>"BASSEL", "triNom"=>"Cour d'Appel de Basse-Terre", "triCP"=>"97109" ), array( "triId"=>"1760", "triCode"=>"BASTIL", "triNom"=>"Cour d'Appel de Bastia", "triCP"=>"20407" ), array( "triId"=>"1761", "triCode"=>"BESANL", "triNom"=>"Cour d'Appel de Besançon", "triCP"=>"25017" ), array( "triId"=>"1762", "triCode"=>"BORDEL", "triNom"=>"Cour d'Appel de Bordeaux", "triCP"=>"33077" ), array( "triId"=>"1763", "triCode"=>"BOURGL", "triNom"=>"Cour d'Appel de Bourges", "triCP"=>"18023" ), array( "triId"=>"1764", "triCode"=>"CAENL", "triNom"=>"Cour d'Appel de Caen", "triCP"=>"14050" ), array( "triId"=>"1765", "triCode"=>"CHAMBL", "triNom"=>"Cour d'Appel de Chambéry", "triCP"=>"73018" ), array( "triId"=>"1766", "triCode"=>"COLMAL", "triNom"=>"Cour d'Appel de Colmar", "triCP"=>"68027" ), array( "triId"=>"1767", "triCode"=>"DIJONL", "triNom"=>"Cour d'Appel de Dijon", "triCP"=>"21034" ), array( "triId"=>"1768", "triCode"=>"DOUAIL", "triNom"=>"Cour d'Appel de Douai", "triCP"=>"59507" ), array( "triId"=>"1769", "triCode"=>"FORTFL", "triNom"=>"Cour d'Appel de Fort-de-France", "triCP"=>"97200" ), array( "triId"=>"1770", "triCode"=>"GRENOL", "triNom"=>"Cour d'Appel de Grenoble", "triCP"=>"38019" ), array( "triId"=>"1771", "triCode"=>"LIMOGL", "triNom"=>"Cour d'Appel de Limoges", "triCP"=>"87031" ), array( "triId"=>"1772", "triCode"=>"LYONL", "triNom"=>"Cour d'Appel de Lyon", "triCP"=>"69321" ), array( "triId"=>"1773", "triCode"=>"METZL", "triNom"=>"Cour d'Appel de Metz", "triCP"=>"57036" ), array( "triId"=>"1774", "triCode"=>"MONTPL", "triNom"=>"Cour d'Appel de Montpellier", "triCP"=>"34023" ), array( "triId"=>"1775", "triCode"=>"NANCYL", "triNom"=>"Cour d'Appel de Nancy", "triCP"=>"54035" ), array( "triId"=>"1776", "triCode"=>"NIMESL", "triNom"=>"Cour d'Appel de Nîmes", "triCP"=>"30031" ), array( "triId"=>"1777", "triCode"=>"NOUMEL", "triNom"=>"Cour d'Appel de Nouméa", "triCP"=>"98848" ), array( "triId"=>"1778", "triCode"=>"PAPEEL", "triNom"=>"Cour d'Appel de Papeete", "triCP"=>"98714" ), array( "triId"=>"1779", "triCode"=>"PARISL", "triNom"=>"Cour d'Appel de Paris", "triCP"=>"75055" ), array( "triId"=>"1780", "triCode"=>"PAUL", "triNom"=>"Cour d'Appel de Pau", "triCP"=>"64034" ), array( "triId"=>"1781", "triCode"=>"POITIL", "triNom"=>"Cour d'Appel de Poitiers", "triCP"=>"86020" ), array( "triId"=>"1782", "triCode"=>"REIMSL", "triNom"=>"Cour d'Appel de Reims", "triCP"=>"51096" ), array( "triId"=>"1783", "triCode"=>"RENNEL", "triNom"=>"Cour d'Appel de Rennes", "triCP"=>"35064" ), array( "triId"=>"1784", "triCode"=>"RIOML", "triNom"=>"Cour d'Appel de Riom", "triCP"=>"63201" ), array( "triId"=>"1785", "triCode"=>"ROUENL", "triNom"=>"Cour d'Appel de Rouen", "triCP"=>"76037" ), array( "triId"=>"1786", "triCode"=>"STDENL", "triNom"=>"Cour d'Appel de Saint-Denis-de-La Réunion", "triCP"=>"97488" ), array( "triId"=>"1787", "triCode"=>"TOULOL", "triNom"=>"Cour d'Appel de Toulouse", "triCP"=>"31068" ), array( "triId"=>"1788", "triCode"=>"VERSAL", "triNom"=>"Cour d'Appel de Versailles", "triCP"=>"78011" ), array( "triId"=>"1789", "triCode"=>"ORLEAL", "triNom"=>"Cour d'Appel d'Orléans", "triCP"=>"45044" ), array( "triId"=>"1790", "triCode"=>"CAYENL", "triNom"=>"Chambre Détachée de la Cour d'Appel de Fort de France à Cayenne", "triCP"=>"97300" ), array( "triId"=>"1798", "triCode"=>"AGENL", "triNom"=>"Cour d'Appel d'Agen", "triCP"=>"47916" ), ); /** * Retourne Fonctions de direction */ protected function fctDir() { $fctdir = new Application_Model_FctDir(); $sql = $fctdir->select('codeFct, libelle'); $selectDir['0000'] = '-'; $rows = $fctdir->fetchAll($sql); if ( count($rows)>0 ) { foreach ($rows as $item) { $index = str_pad($item->codeFct, 4, "0", STR_PAD_LEFT); $selectDir[$index] = $item->libelle; } } return $selectDir; } /** * Genre * @var array */ protected $selectGenre = array( '' => '-', 'M.' => 'M', 'Mme' => 'Mme', 'Mlle' => 'Mlle', 'Societe' => 'STE' ); public function init() { require_once 'Scores/WsScores.php'; require_once 'Scores/IdentiteEntreprise.php'; $ws = new WsScores(); //codPays3 (index), libPays, devise $countries = json_decode($ws->getCatalogCountry(),true); if ($countries!==false) { $lib = array(); foreach ($countries as $key => $row) { $lib[$key] = $row['libPays']; } array_multisort($lib, SORT_ASC, SORT_STRING, $countries); $this->countries = $countries; } //devIso (index), devNom $currencies = json_decode($ws->getCatalogCurrency(),true); if ($currencies!==false) { $lib = array(); foreach ($currencies as $key => $row) { $lib[$key] = $row['devNom']; } array_multisort($lib, SORT_ASC, SORT_STRING, $currencies); $this->currencies = $currencies; } $this->view->headLink()->appendStylesheet('/themes/default/styles/saisie.css', 'all'); } /** * Index */ public function indexAction() { //Do nothing } /** * Affichage du formulaire de saisie * @todo : Enregistrement des informations en session pour récupération */ public function ficheAction() { $this->view->headScript() ->appendFile('/themes/default/scripts/saisie.js', 'text/javascript') ->appendFile('/libs/form/jquery.form.js', 'text/javascript'); $request = $this->getRequest(); $siret = $request->getParam('siret'); $id = $request->getParam('id', 0); $this->view->headTitle()->append('Saisie - '.$siret); $ws = new WsScores(); $infos = $ws->getIdentite($siret, $id); $devisesReponse = $ws->getDevises(); $devises = $devisesReponse->result->item; //Mise en session $session = new Scores_Session_Entreprise($siret, $id, true); $session->setInfoEntrep($infos); $sessionSaisie = new Zend_Session_Namespace('saisie'); $sessionSaisie->tabSaisie['tribunal'] = $infos->TribunalCode; //@todo : Change $this->view->assign('selectPays', $this->countries); $this->view->assign('siret', $siret); $this->view->assign('id', $id); $this->view->assign('devises', $devises); $this->view->assign('etab', $infos); } /** * Sauvegarde des informations de saisie * @todo : Sauvegarder en mémoire la saisie */ public function saveAction() { //$this->_helper->layout()->disableLayout(); //$this->_helper->viewRenderer->setNoRender(true); $request = $this->getRequest(); $siret = $request->getParam('siret'); $id = $request->getParam('id', 0); $tabSaisie = $request->getParam('frmSaisie'); $tabJugement = $request->getParam('jugement'); $tabActionna = $request->getParam('actionnaire'); $tabParticip = $request->getParam('particip'); $tabScore = $request->getParam('score'); $perimetreVente = $request->getParam('perimetreVente'); $etablissement5500 = $request->getParam('etablissement5500'); $etabnic = $request->getParam('etabnic'); //Vente et Cession evénement 5500 if ($perimetreVente!=null){ foreach($perimetreVente as $k => $p){ if ( $p=='-' ){ array_splice($perimetreVente, $k, 1); } } if ( isset($perimetreVente) && count($perimetreVente)>0 ){ $tabJugement['even'] = array_merge( $tabJugement['even'], $perimetreVente); } } //Liste établissements concernées if ( $etablissement5500!=null && count($etablissement5500)>0 ) { $countEtab = 0; $txtEtab = ''; foreach($etablissement5500 as $etab){ $txtEtab.= $etab; $countEtab++; if($countEtab>10) break; if( count($etablissement5500) > $countEtab ) { $txtEtab.=', '; } } if ( count($etablissement5500)>1 ){ $txt = 'Etablissement(s) concerné(s) : '; } else { $txt = 'Etablissement concerné : '; } if ( $tabJugement['comp']!='' ) { $tabJugement['comp'].= ' '.$txt.$txtEtab; } else { $tabJugement['comp'] = ' '.$txt.$txtEtab; } } //Sélection nic pour établissement concerné if ( $etabnic!=null && $etabnic != '' ) { if ( isset($txtEtab) && $txtEtab!='' ) { $tabJugement['comp'].= ', '.$etabnic; } else { $tabJugement['comp'].= 'Etablissement concerné : '.$etabnic; } } //Opposition à l'adresse if ( $tabJugement['oppo'] == 'adresse' ) { if ( $tabJugement['comp']!='' ) { $tabJugement['comp'].= ' Opposition : A l\'adresse du bien vendu'; } else { $tabJugement['comp'] = 'Opposition : A l\'adresse du bien vendu'; } } $tabInfos = array(); $tabInfos['identite'] = $tabSaisie; $tabInfos['jugement'] = $tabJugement; $tabInfos['actionnaire'] = $tabActionna; $tabInfos['participation'] = $tabParticip; $tabInfos['scores'] = $tabScore; $ws = new WsScores(); $O = $ws->setInfosEntrep($siret, $id, $tabInfos); //Enregistrement en session pour saisie supplémentaire ou lors d'erreur $tabSaisie = array( 'source' => $tabJugement['source'], 'dateParution' => $tabJugement['dateParution'], 'numParution' => $tabJugement['numParution'] ); $session = new Zend_Session_Namespace('saisie'); $session->tabSaisie = $tabSaisie; if ($O->error->errNum!=0){ $message = 'Erreur lors de l\'enregistrement !'; $this->_helper->getHelper('Redirector')->setGotoSimple('fiche', 'saisie', null, array( 'siret' => $siret, 'id' => $id, 'message' => $message )); } else { $message = 'Saisie enregistrée !'; $this->view->assign('params', $request->getParams()); $this->view->assign('tabInfos', $tabInfos); $this->view->assign('O', $O); $this->view->assign('siret', $siret); $this->view->assign('id', $id); $this->view->assign('message', $message); } } /** * Retourne le formulaire bodacc */ public function formAction() { $request = $this->getRequest(); $siret = $request->getParam('siret'); $id = $request->getParam('id', 0); $session = new Scores_Session_Entreprise($siret, $id); $ws = new WsScores(); $reponse = $ws->getListeJalCollecte(); $listeJalCollecte = $reponse->result->item; $this->view->assign('ListeJalCollecte', $listeJalCollecte); if (Zend_Session::sessionExists()){ if(Zend_Session::namespaceIsset('saisie')){ $sessionSaisie = new Zend_Session_Namespace('saisie'); $saisie = $sessionSaisie->tabSaisie; $this->view->assign('saisie', $saisie); } } $eventNum = isset($saisie['eventNum']) ? $saisie['eventNum'] : '0000' ; $this->view->assign('eventNum', $eventNum); //Si le code tribunal n'est pas défini dans la fiche identité //alors en sélectionner un par défault suivant le code INSEE $tribunal = isset($saisie['tribunal']) ? $saisie['tribunal'] : '' ; $this->view->assign('codeTribunalCmp', $tribunal); $listeCompetences = array(); if ($tribunal=='') { $siret = $session->getSiret(); $codeCommune = $session->getCodeCommune(); $reponse = $ws->getListeCompetences($siret, 'tri', $codeCommune); $listeCompetences = $reponse->result->item; } $this->view->assign('ListeCompetences', $listeCompetences); $reponse = $ws->getTribunaux( array('C','I','G','M','P') ); $listeTribunaux = array(); if (count($reponse->result->item)>0) { foreach($reponse->result->item as $item) { $listeTribunaux[$item->code] = $item->nom; } asort($listeTribunaux); } $this->view->assign('ListeTribunaux', $listeTribunaux); $selectEvent = array( '1100', '1101' , '1200', '1201', '1300', '1301', '1302', '1303', '1304', '1305', '1306', '1307', '1308', '1309', '1310', '1311', '1312', '1408', '1411', '1412', '1413', '1414', '1415', '1511', '1502', '1506', '1503', '1512', '1600', '1601', '1999', '2102', '2100', '2202', '2206', '2319', '2315', '2313', '2305', '2307', '2303', '2306', '2901', '5500', '6700', '1010', '1050', '1055', '2203', '2204', '2210', '2212', ); $eventM = new Application_Model_TabEvenements(); $sql = $eventM->select() ->where('codEven IN ('.join(',',$selectEvent).')') ->order('libEven ASC'); $rows = $eventM->fetchAll($sql); $tabEvent = array(); if ($rows->count()>0) { foreach($rows as $row){ $tabEvent[$row->codEven] = $row->libEven; } } $this->view->assign('tabEvent', $tabEvent); $this->view->assign('siret', $siret); } /** * Retourne le formulaire correspondant à l'évenement */ public function evenAction() { $request = $this->getRequest(); if ( $request->isPost() ){ $this->_helper->layout->disableLayout(); } $num = $request->getParam('num', '0000'); $siren = $request->getParam('siren', ''); $nic = $request->getParam('nic', ''); $tribunal = $request->getParam('tribunal', ''); $selectDir = $this->fctDir(); if (Zend_Session::sessionExists()){ /*if(Zend_Session::namespaceIsset('saisie')){ $sessionSaisie = new Zend_Session_Namespace('saisie'); $this->view->assign('saisie', $sessionSaisie->tabSaisie); $num = $sessionSaisie->tabSaisie['eventNum']; $tribunal = $sessionSaisie->tabSaisie['tribunal']; $siren = substr($siren, 0, 9); $nic = substr($siren, 9, 5); }*/ } switch($num) { case '5500': //Liste des établissements $ws = new WsScores(); $reponse = $ws->getListeEtablissements($siren); $listeEtablissements = $reponse->result->item; $this->view->assign('ListeEtablissements', $listeEtablissements); break; case '6700': //Liste des établissements $ws = new WsScores(); $reponse = $ws->getListeEtablissements($siren); $listeEtablissements = $reponse->result->item; //Zend_Registry::get('firebug')->info(count($listeEtablissements)); $this->view->assign('ListeEtablissements', $listeEtablissements); //Assign constantes $this->view->assign('selectDir', $selectDir); $this->view->assign('selectGenre',$this->selectGenre); break; case '2202': case '2203': case '2204': case '2210': case '2212': case '2315': //Assign constantes $this->view->assign('selectDir', $selectDir); $this->view->assign('selectGenre',$this->selectGenre); break; } $this->view->assign('siren', $siren); $this->view->assign('nic', $nic); $this->view->assign('tribunal', $tribunal); $this->renderScript('saisie/even/'.$num.'.phtml'); } /** * Affiche un champ de formulaire */ public function champsAction() { $request = $this->getRequest(); $champ = $request->getParam('champ', ''); $this->renderScript('saisie/champs/'.$champ.'.phtml'); } /** * Retourne les informations de l'établissements */ public function etabnicAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); $siret = $request->getParam('siret', ''); if($siret!='') { $ws = new WsScores(); $etab = $ws->getIdentite($siret); if($etab->Siret==$siret){ echo $etab->Adresse.' '.$etab->CP.' '.$etab->Ville.' ('. $etab->Nic.')'; } } } public function listetabAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); $siren = $this->getParam('siren'); $p = $request->getParam('p', 0); if (!empty($p)) { $ws = new WsScores(); $reponse = $ws->getListeEtablissements($siren, -1, $p); $liste = array(); if (count($reponse->result->item)>0) { foreach ($reponse->result->item as $item) { $liste[] = array( 'value' => $item->Nic, 'label' => $siren.$item->Nic.' - '.$item->Adresse.' '.$item->CP.' '.$item->Ville, ); } } if ($p < $reponse->nbReponses) { $p = $p+200; } $output = array( 'p' => $p, 'list' => $liste ); } echo json_encode($output); } /** * Retourne le formulaire d'opposition insee */ public function oppositioninseeAction() { $this->_helper->layout->disableLayout(); } /** * Retourne le formulaire de refus rncs */ public function refusrncsAction() { $this->_helper->layout->disableLayout(); } /** * Suppression / Copie et Edition des annonces * @todo : Faire l'edition des annonces */ public function annonceAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); $source = $request->getParam('source'); $op = $request->getParam('op'); switch($op) { case 'delete': $siret = str_replace(' ', '', $request->getParam('siret')); $idan = $request->getParam('idan'); $sourceNum = false; $source = strtoupper($source); if (in_array($source, array('BODA', 'BODB', 'BODC'))){ $sourceNum = 1; } elseif ($source == 'BALO') { $sourceNum = 2; } elseif ($source == 'ASSO') { $sourceNum = 3; } elseif (in_array($source, array('BOMP A', 'BOMP B', 'BOMP C', 'MAPA'))) { $sourceNum = 4; } elseif (!empty($source)){ $sourceNum = 0; } if ($sourceNum === false) { echo "Source inconnu"; exit; } $ws = new WsScores(); $reponse = $ws->supprAnnonce($sourceNum, $idan, $siret); $error = $reponse->error; if ( isset($error) && $error->errnum == 0 ){ $output = 'Annonce '.$idan.' supprimé !'; } elseif ( isset($error) && $error->errnum != 0 ) { $output = 'Erreur lors de la suppression.'; } else { $output = "Une erreur est survenue..."; } echo $output; break; case 'copy': $siretIn = str_replace(' ', '', $request->getParam('siretIn')); $siretOut = str_replace(' ', '', $request->getParam('siretOut')); $idan = $request->getParam('idan'); $sourceNum = false; $source = strtoupper($source); if (in_array($source, array('BODA', 'BODB', 'BODC'))){ $sourceNum = 1; } elseif ($source == 'BALO') { $sourceNum = 2; } elseif ($source == 'ASSO') { $sourceNum = 3; } elseif (in_array($source, array('BOMP A', 'BOMP B', 'BOMP C', 'MAPA'))) { $sourceNum = 4; } elseif (!empty($source)){ $sourceNum = 0; } if ($sourceNum === false) { echo "Source inconnu"; exit; } $ws = new WsScores(); $reponse = $ws->dupliqueAnnonce($sourceNum, $idan, $siretIn, $siretOut); $error = $reponse->error; if ( isset($error) && $error->errnum == 0 ){ $output = 'Annonce '.$idan.' dupliqué sur '.$siretOut.'!'; } elseif ( isset($error) && $error->errnum != 0 ) { $output = 'Erreur lors de la duplication.'; } else { $output = "Une erreur est survenue..."; } echo $output; break; case 'edit': //@todo : sauvegarder $siret = $request->getParam('siret'); $idan = $request->getParam('idan'); print_r($request->getParams()); /* echo saisie_save($siret, '', $tabInfo); echo '
'; */ break; case 'even': $siret = str_replace(' ', '', $request->getParam('siret')); $idan = $request->getParam('idan'); $codeEven = $request->getParam('even'); $siren = substr($siret,0,9); $ws = new WsScores(); $result = $ws->setAnnonceEven($siren, $idan, $codeEven); if ($result===true) { echo "Modification effectué"; } else { echo "Erreur !"; } break; default: echo 'Error !'; break; } } /** * Affiche le fomulaire d'edition/suppression/copie d'annonce */ public function annoncedialogAction() { $this->_helper->layout->disableLayout(); $request = $this->getRequest(); $siret = $request->getParam('siret'); $op = $request->getParam('op'); $idan = $request->getParam('idAnn'); $source = $request->getParam('code'); if ($op == 'edit') { $siret = $request->getParam('siret'); $siren = substr($siret,0,9); $nic = substr($siret,10,5); if ( !empty($idan) ) { $ws = new WsScores(); $reponse = $ws->getAnnonceCollecte($idan, $siret); if ($reponse->error->errnum>0) { $message = $reponse->error->errmsg; $this->view->assign('message', $message); } else { $idanResult = $reponse->result; //Limitation des événements $eventLimits = array('5500'); foreach ( $eventLimits as $eventLimit ) { $isEditable = false; if (count($idanResult->even->item)>0){ foreach($idanResult->even->item as $even){ if ($eventLimit == $even->CodeEven){ $isEditable = true; break; } } } if ( $isEditable && in_array($idanResult->source, array('JT', 'ANTE'))) { $dateParution = new Zend_Date(substr($idanResult->dateSource,0,10), 'yyyy-MM-dd'); $dateJugement = new Zend_Date($idanResult->dateEffetFinP, 'yyyy-MM-dd'); $dateFinPeriode = new Zend_Date($idanResult->dateJugement, 'yyyy-MM-dd'); //Mapper idanResult dans le tableau de saisie $saisie = array( 'source' => isset($_SESSION['source']) ? $_SESSION['source'] : $idanResult->source, 'dateParution' => isset($_SESSION['dateParution']) ? $_SESSION['dateParution'] : $dateParution->toString('dd/MM/yyyy'), 'numParution' => isset($_SESSION['numParution']) ? $_SESSION['numParution'] : '', 'dateJugement' => $dateJugement->toString('dd/MM/yyyy'), 'tribunal' => $idanResult->tribunal, 'even' => $idanResult->even->item, 'eventNum' => $eventLimit, 'comp' => $idanResult->complement, 'montant' => $idanResult->montant, 'dateFinPeriode' => $dateFinPeriode->toString('dd/MM/yyyy'), ); $intervenants = array(); for ( $i=0 ; $i<3 ; $i++ ) { $intervenants[$i] = array( 'type' => $idanResult->{'inter'.($i+1).'type'}, 'id' => $idanResult->{'inter'.($i+1).'id'}, 'nom' => $idanResult->{'inter'.($i+1).'nom'}, ); } $sessionSaisie = new Zend_Session_Namespace('saisie'); $sessionSaisie->tabSaisie = $saisie; //require_once realpath(dirname(__FILE__)).'/constantes.php'; //require_once realpath(dirname(__FILE__)).'/saisie_form_event.php'; break; } else { $message = "Source : ".$idanResult->source."
"; $message.= "Evénement(s) non éditable :
"; foreach($idanResult->even->item as $even){ $message.= $even->CodeEven." - "; $eventM = new Application_Model_TabEvenements(); $row = $eventM->find($even->CodeEven); if (null !== row) { $message.= $row->current()->libEven; } $message.= "
"; } $this->view->assign('message', $message); } } } } } elseif ($op == 'even') { $eventM = new Application_Model_TabEvenements(); $sql = $eventM->select()->order('libEven ASC'); $rows = $eventM->fetchAll($sql); $tabEvent = array(); if ($rows->count()>0) { foreach($rows as $row){ $tabEvent[$row->codEven] = $row->libEven; } } $this->view->assign('evens', $tabEvent); } $this->view->assign('op', $op); $this->view->assign('idan', $idan); $this->view->assign('source', $source); $this->view->assign('siret', $siret); } public function associationAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $type = $request->getParam('type'); $siren = $request->getParam('siren'); $waldec = $request->getParam('waldec'); //Téléchargement du fichier if ( isset($_FILES) && count($_FILES)==1 ) { $this->_helper->viewRenderer->setNoRender(true); if ( empty($siren) ) { echo "Pas d'identifiant!"; } else { $c = Zend_Registry::get('config'); $path = $c->profil->path->data.'/association'; if ( $type=='bilan' ){ $dateCloture = $request->getParam('dateCloture'); if (strlen($dateCloture)!=8) { echo "Erreur format date cloture"; } $path.= '/bilans'; $name = $siren.'_'.$dateCloture; } elseif ( $type=='acte' ) { $date = $request->getParam('date'); if (strlen($date)!=8) { echo "Erreur format date"; } $name = 'ST-'.$siren.'-'.$date; $path.= '/actes'; } $n = $_FILES['fichier']['name']; $s = $_FILES['fichier']['size']; $tmp_name = $_FILES['fichier']['tmp_name']; $extValide = array('pdf'); $extension = strrchr($n,'.'); $extension = strtolower(substr($extension,1)); //Vérifier l'extension du fichier if( !in_array($extension, $extValide) ){ echo "Extension de fichier incorrect !"; } elseif ( move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension) ){ $result = true; //Send info to webservice if ( $type='acte' ) { $ws = new WsScores(); $info = $ws->setActeAsso($siren, $waldec, 'ST', 'Statut', $date); if (is_string($info)) { $result = false; } } //Display message if ($result) { echo "Fichier envoyé, view->url(array( 'controller' => 'fichier', 'action' => 'pdfassociation', 'file' => $name.'.'.$extension, ), null , true)."\">Cliquez pour voir le fichier"; } } else { echo "Erreur lors du déplacement du fichier !"; } } //Affichage formulaire } else { $this->view->inlineScript()->appendFile('/libs/form/jquery.form.js'); if ( intval($siren)==0 ) { $session = new Scores_Session_Entreprise(); $siren = ''; if ( substr($session->AutreId,0,1)=='W' ) { $siren = $session->AutreId; } } $this->view->assign('siren', $siren); $this->view->assign('type', $type); } } public function liasseAction() { $request = $this->getRequest(); $siret = $request->getParam('siret'); $id = $request->getParam('id'); $siren = substr($siret,0,9); $this->view->assign('siren', $siren); $session = new Scores_Session_Entreprise($siret, $id); $this->view->assign('siret', $siret); $this->view->assign('raisonSociale', $session->getRaisonSociale()); require_once 'Scores/WsScores.php'; $ws = new WsScores(); $selection = $request->getParam('selection', ''); if ( !empty($selection) ) { list($date, $type) = explode(':', $selection); if ($date!='NEW') { $milDate = $milDatePre = null; $listBilans = $ws->getListeBilans($siren); if ( count($listBilans->result->item) > 0 ) { foreach ($listBilans->result->item as $item) { if ($type == $item->typeBilan) { if ($item->dateExercice == $date) { $milDate = $item->dateExercice; } if (substr($item->dateExercice,0,4) == intval(substr($date,0,4))-1) { $milDatePre = $item->dateExercice; } } } } if ( null !== $milDate ) { Zend_Registry::get('firebug')->info('milDate'); $response = $ws->getBilan($siren, $milDate, $type, true); $infos = new stdClass(); $infos->siren = $response->siren; $infos->dateCloture = $response->DATE_CLOTURE; $infos->dateCloturePre = $response->DATE_CLOTURE_PRE; $infos->dureeMois = $response->DUREE_MOIS; $infos->dureeMoisPre = $response->DUREE_MOIS_PRE; $infos->unite = empty($response->MONNAIE_LIV_UNITE) ? 'U' : $response->MONNAIE_LIV_UNITE; $postes = array(); foreach ($response->POSTES->item as $item) { $postes[$item->id] = $item->val; } } elseif ( null === $milDate && null !== $milDatePre ) { Zend_Registry::get('firebug')->info('milDatePre'); $response = $ws->getBilan($siren, $milDatePre, $type, true); Zend_Registry::get('firebug')->info($response); $infos = new stdClass(); $infos->siren = $response->siren; $infos->dateCloturePre = $response->DATE_CLOTURE; $infos->dureeMoisPre = $response->DUREE_MOIS; $infos->unite = empty($response->MONNAIE_LIV_UNITE) ? 'U' : $response->MONNAIE_LIV_UNITE; $postesN1 = array(); foreach ($response->POSTES->item as $item) { $postesN1[$item->id] = $item->val; } $postes = array(); /** Reprises des valeures N-1 si l'information est absente en base **/ if ($type=='N' || $type=='C') { // Actif if (!isset($postes['AA3']) && isset($postesN1['AA2'])) $postes['AA3']=$postesN1['AA2']; if (!isset($postes['AC2']) && isset($postesN1['AC1'])) $postes['AC2']=$postesN1['AC1']; if (!isset($postes['AE2']) && isset($postesN1['AE1'])) $postes['AE2']=$postesN1['AE1']; if (!isset($postes['AG2']) && isset($postesN1['AG1'])) $postes['AG2']=$postesN1['AG1']; if (!isset($postes['AI2']) && isset($postesN1['AI1'])) $postes['AI2']=$postesN1['AI1']; if (!isset($postes['AK2']) && isset($postesN1['AK1'])) $postes['AK2']=$postesN1['AK1']; if (!isset($postes['AM2']) && isset($postesN1['AM1'])) $postes['AM2']=$postesN1['AM1']; if (!isset($postes['AO2']) && isset($postesN1['AO1'])) $postes['AO2']=$postesN1['AO1']; if (!isset($postes['AQ2']) && isset($postesN1['AQ1'])) $postes['AQ2']=$postesN1['AQ1']; if (!isset($postes['AS2']) && isset($postesN1['AS1'])) $postes['AS2']=$postesN1['AS1']; if (!isset($postes['AU2']) && isset($postesN1['AU1'])) $postes['AU2']=$postesN1['AU1']; if (!isset($postes['AW2']) && isset($postesN1['AW1'])) $postes['AW2']=$postesN1['AW1']; if (!isset($postes['AY2']) && isset($postesN1['AY1'])) $postes['AY2']=$postesN1['AY1']; if (!isset($postes['CT2']) && isset($postesN1['CT1'])) $postes['CT2']=$postesN1['CT1']; if (!isset($postes['CV2']) && isset($postesN1['CV1'])) $postes['CV2']=$postesN1['CV1']; if (!isset($postes['BC2']) && isset($postesN1['BC1'])) $postes['BC2']=$postesN1['BC1']; if (!isset($postes['BE2']) && isset($postesN1['BE1'])) $postes['BE2']=$postesN1['BE1']; if (!isset($postes['BG2']) && isset($postesN1['BG1'])) $postes['BG2']=$postesN1['BG1']; if (!isset($postes['BI2']) && isset($postesN1['BI1'])) $postes['BI2']=$postesN1['BI1']; if (!isset($postes['BK2']) && isset($postesN1['BK1'])) $postes['BK2']=$postesN1['BK1']; if (!isset($postes['BM2']) && isset($postesN1['BM1'])) $postes['BM2']=$postesN1['BM1']; if (!isset($postes['BO2']) && isset($postesN1['BO1'])) $postes['BO2']=$postesN1['BO1']; if (!isset($postes['BQ2']) && isset($postesN1['BQ1'])) $postes['BQ2']=$postesN1['BQ1']; if (!isset($postes['BS2']) && isset($postesN1['BS1'])) $postes['BS2']=$postesN1['BS1']; if (!isset($postes['BU2']) && isset($postesN1['BU1'])) $postes['BU2']=$postesN1['BU1']; if (!isset($postes['BW2']) && isset($postesN1['BW1'])) $postes['BW2']=$postesN1['BW1']; if (!isset($postes['BY2']) && isset($postesN1['BY1'])) $postes['BY2']=$postesN1['BY1']; if (!isset($postes['CA2']) && isset($postesN1['CA1'])) $postes['CA2']=$postesN1['CA1']; if (!isset($postes['CC2']) && isset($postesN1['CC1'])) $postes['CC2']=$postesN1['CC1']; if (!isset($postes['CE2']) && isset($postesN1['CE1'])) $postes['CE2']=$postesN1['CE1']; if (!isset($postes['CG2']) && isset($postesN1['CG1'])) $postes['CG2']=$postesN1['CG1']; if (!isset($postes['CI2']) && isset($postesN1['CI1'])) $postes['CI2']=$postesN1['CI1']; if (!isset($postes['CK2']) && isset($postesN1['CK1'])) $postes['CK2']=$postesN1['CK1']; if (!isset($postes['CL3']) && isset($postesN1['CL2'])) $postes['CL3']=$postesN1['CL2']; if (!isset($postes['CM3']) && isset($postesN1['CM2'])) $postes['CM3']=$postesN1['CM2']; if (!isset($postes['CN3']) && isset($postesN1['CN2'])) $postes['CN3']=$postesN1['CN2']; if (!isset($postes['1A2']) && isset($postesN1['1A1'])) $postes['1A2']=$postesN1['1A1']; // Passif if (!isset($postes['DA1']) && isset($postesN1['DA'])) $postes['DA1']=$postesN1['DA']; if (!isset($postes['DB1']) && isset($postesN1['DB'])) $postes['DB1']=$postesN1['DB']; if (!isset($postes['DC1']) && isset($postesN1['DC'])) $postes['DC1']=$postesN1['DC']; if (!isset($postes['DD1']) && isset($postesN1['DD'])) $postes['DD1']=$postesN1['DD']; if (!isset($postes['DE1']) && isset($postesN1['DE'])) $postes['DE1']=$postesN1['DE']; if (!isset($postes['DF1']) && isset($postesN1['DF'])) $postes['DF1']=$postesN1['DF']; if (!isset($postes['DG1']) && isset($postesN1['DG'])) $postes['DG1']=$postesN1['DG']; if (!isset($postes['DH1']) && isset($postesN1['DH'])) $postes['DH1']=$postesN1['DH']; if (!isset($postes['DI1']) && isset($postesN1['DI'])) $postes['DI1']=$postesN1['DI']; if (!isset($postes['DJ1']) && isset($postesN1['DJ'])) $postes['DJ1']=$postesN1['DJ']; if (!isset($postes['DK1']) && isset($postesN1['DK'])) $postes['DK1']=$postesN1['DK']; if (!isset($postes['DL1']) && isset($postesN1['DL'])) $postes['DL1']=$postesN1['DL']; if (!isset($postes['DM1']) && isset($postesN1['DM'])) $postes['DM1']=$postesN1['DM']; if (!isset($postes['DN1']) && isset($postesN1['DN'])) $postes['DN1']=$postesN1['DN']; if (!isset($postes['DO1']) && isset($postesN1['DO'])) $postes['DO1']=$postesN1['DO']; if (!isset($postes['DP1']) && isset($postesN1['DP'])) $postes['DP1']=$postesN1['DP']; if (!isset($postes['DQ1']) && isset($postesN1['DQ'])) $postes['DQ1']=$postesN1['DQ']; if (!isset($postes['DR1']) && isset($postesN1['DR'])) $postes['DR1']=$postesN1['DR']; if (!isset($postes['DS1']) && isset($postesN1['DS'])) $postes['DS1']=$postesN1['DS']; if (!isset($postes['DT1']) && isset($postesN1['DT'])) $postes['DT1']=$postesN1['DT']; if (!isset($postes['DU1']) && isset($postesN1['DU'])) $postes['DU1']=$postesN1['DU']; if (!isset($postes['DV1']) && isset($postesN1['DV'])) $postes['DV1']=$postesN1['DV']; if (!isset($postes['DW1']) && isset($postesN1['DW'])) $postes['DW1']=$postesN1['DW']; if (!isset($postes['DX1']) && isset($postesN1['DX'])) $postes['DX1']=$postesN1['DX']; if (!isset($postes['DY1']) && isset($postesN1['DY'])) $postes['DY1']=$postesN1['DY']; if (!isset($postes['DZ1']) && isset($postesN1['DZ'])) $postes['DZ1']=$postesN1['DZ']; if (!isset($postes['EA1']) && isset($postesN1['EA'])) $postes['EA1']=$postesN1['EA']; if (!isset($postes['EB1']) && isset($postesN1['EB'])) $postes['EB1']=$postesN1['EB']; if (!isset($postes['EC1']) && isset($postesN1['EC'])) $postes['EC1']=$postesN1['EC']; if (!isset($postes['ED1']) && isset($postesN1['ED'])) $postes['ED1']=$postesN1['ED']; if (!isset($postes['EE1']) && isset($postesN1['EE'])) $postes['EE1']=$postesN1['EE']; if (!isset($postes['1B1']) && isset($postesN1['1B'])) $postes['1B1']=$postesN1['1B']; if (!isset($postes['1C1']) && isset($postesN1['1C'])) $postes['1C1']=$postesN1['1C']; if (!isset($postes['1D1']) && isset($postesN1['1D'])) $postes['1D1']=$postesN1['1D']; if (!isset($postes['1E1']) && isset($postesN1['1E'])) $postes['1E1']=$postesN1['1E']; if (!isset($postes['EF1']) && isset($postesN1['EF'])) $postes['EF1']=$postesN1['EF']; if (!isset($postes['EG1']) && isset($postesN1['EG'])) $postes['EG1']=$postesN1['EG']; if (!isset($postes['EH1']) && isset($postesN1['EH'])) $postes['EH1']=$postesN1['EH']; // Compte de Résultats if (!isset($postes['FC1']) && isset($postesN1['FC'])) $postes['FC1']=$postesN1['FC']; if (!isset($postes['FF1']) && isset($postesN1['FF'])) $postes['FF1']=$postesN1['FF']; if (!isset($postes['FI1']) && isset($postesN1['FI'])) $postes['FI1']=$postesN1['FI']; if (!isset($postes['FL1']) && isset($postesN1['FL'])) $postes['FL1']=$postesN1['FL']; if (!isset($postes['FM1']) && isset($postesN1['FM'])) $postes['FM1']=$postesN1['FM']; if (!isset($postes['FN1']) && isset($postesN1['FN'])) $postes['FN1']=$postesN1['FN']; if (!isset($postes['FO1']) && isset($postesN1['FO'])) $postes['FO1']=$postesN1['FO']; if (!isset($postes['FP1']) && isset($postesN1['FP'])) $postes['FP1']=$postesN1['FP']; if (!isset($postes['FQ1']) && isset($postesN1['FQ'])) $postes['FQ1']=$postesN1['FQ']; if (!isset($postes['FR1']) && isset($postesN1['FR'])) $postes['FR1']=$postesN1['FR']; if (!isset($postes['FS1']) && isset($postesN1['FS'])) $postes['FS1']=$postesN1['FS']; if (!isset($postes['FT1']) && isset($postesN1['FT'])) $postes['FT1']=$postesN1['FT']; if (!isset($postes['FU1']) && isset($postesN1['FU'])) $postes['FU1']=$postesN1['FU']; if (!isset($postes['FV1']) && isset($postesN1['FV'])) $postes['FV1']=$postesN1['FV']; if (!isset($postes['FW1']) && isset($postesN1['FW'])) $postes['FW1']=$postesN1['FW']; if (!isset($postes['FX1']) && isset($postesN1['FX'])) $postes['FX1']=$postesN1['FX']; if (!isset($postes['FY1']) && isset($postesN1['FY'])) $postes['FY1']=$postesN1['FY']; if (!isset($postes['FZ1']) && isset($postesN1['FZ'])) $postes['FZ1']=$postesN1['FZ']; if (!isset($postes['GA1']) && isset($postesN1['GA'])) $postes['GA1']=$postesN1['GA']; if (!isset($postes['GB1']) && isset($postesN1['GB'])) $postes['GB1']=$postesN1['GB']; if (!isset($postes['GC1']) && isset($postesN1['GC'])) $postes['GC1']=$postesN1['GC']; if (!isset($postes['GD1']) && isset($postesN1['GD'])) $postes['GD1']=$postesN1['GD']; if (!isset($postes['GE1']) && isset($postesN1['GE'])) $postes['GE1']=$postesN1['GE']; if (!isset($postes['GF1']) && isset($postesN1['GF'])) $postes['GF1']=$postesN1['GF']; if (!isset($postes['GG1']) && isset($postesN1['GG'])) $postes['GG1']=$postesN1['GG']; if (!isset($postes['GH1']) && isset($postesN1['GH'])) $postes['GH1']=$postesN1['GH']; if (!isset($postes['GI1']) && isset($postesN1['GI'])) $postes['GI1']=$postesN1['GI']; if (!isset($postes['GJ1']) && isset($postesN1['GJ'])) $postes['GJ1']=$postesN1['GJ']; if (!isset($postes['GK1']) && isset($postesN1['GK'])) $postes['GK1']=$postesN1['GK']; if (!isset($postes['GL1']) && isset($postesN1['GL'])) $postes['GL1']=$postesN1['GL']; if (!isset($postes['GM1']) && isset($postesN1['GM'])) $postes['GM1']=$postesN1['GM']; if (!isset($postes['GN1']) && isset($postesN1['GN'])) $postes['GN1']=$postesN1['GN']; if (!isset($postes['GO1']) && isset($postesN1['GO'])) $postes['GO1']=$postesN1['GO']; if (!isset($postes['GP1']) && isset($postesN1['GP'])) $postes['GP1']=$postesN1['GP']; if (!isset($postes['GQ1']) && isset($postesN1['GQ'])) $postes['GQ1']=$postesN1['GQ']; if (!isset($postes['GR1']) && isset($postesN1['GR'])) $postes['GR1']=$postesN1['GR']; if (!isset($postes['GS1']) && isset($postesN1['GS'])) $postes['GS1']=$postesN1['GS']; if (!isset($postes['GT1']) && isset($postesN1['GT'])) $postes['GT1']=$postesN1['GT']; if (!isset($postes['GU1']) && isset($postesN1['GU'])) $postes['GU1']=$postesN1['GU']; if (!isset($postes['GV1']) && isset($postesN1['GV'])) $postes['GV1']=$postesN1['GV']; if (!isset($postes['GW1']) && isset($postesN1['GW'])) $postes['GW1']=$postesN1['GW']; if (!isset($postes['HA1']) && isset($postesN1['HA'])) $postes['HA1']=$postesN1['HA']; if (!isset($postes['HB1']) && isset($postesN1['HB'])) $postes['HB1']=$postesN1['HB']; if (!isset($postes['HC1']) && isset($postesN1['HC'])) $postes['HC1']=$postesN1['HC']; if (!isset($postes['HD1']) && isset($postesN1['HD'])) $postes['HD1']=$postesN1['HD']; if (!isset($postes['HE1']) && isset($postesN1['HE'])) $postes['HE1']=$postesN1['HE']; if (!isset($postes['HF1']) && isset($postesN1['HF'])) $postes['HF1']=$postesN1['HF']; if (!isset($postes['HG1']) && isset($postesN1['HG'])) $postes['HG1']=$postesN1['HG']; if (!isset($postes['HH1']) && isset($postesN1['HH'])) $postes['HH1']=$postesN1['HH']; if (!isset($postes['HI1']) && isset($postesN1['HI'])) $postes['HI1']=$postesN1['HI']; if (!isset($postes['HJ1']) && isset($postesN1['HJ'])) $postes['HJ1']=$postesN1['HJ']; if (!isset($postes['HK1']) && isset($postesN1['HK'])) $postes['HK1']=$postesN1['HK']; if (!isset($postes['HL1']) && isset($postesN1['HL'])) $postes['HL1']=$postesN1['HL']; if (!isset($postes['HM1']) && isset($postesN1['HM'])) $postes['HM1']=$postesN1['HM']; if (!isset($postes['HN1']) && isset($postesN1['HN'])) $postes['HN1']=$postesN1['HN']; if (!isset($postes['HO1']) && isset($postesN1['HO'])) $postes['HO1']=$postesN1['HO']; if (!isset($postes['HY1']) && isset($postesN1['HY'])) $postes['HY1']=$postesN1['HY']; if (!isset($postes['1G1']) && isset($postesN1['1G'])) $postes['1G1']=$postesN1['1G']; if (!isset($postes['HP1']) && isset($postesN1['HP'])) $postes['HP1']=$postesN1['HP']; if (!isset($postes['HQ1']) && isset($postesN1['HQ'])) $postes['HQ1']=$postesN1['HQ']; if (!isset($postes['1H1']) && isset($postesN1['1H'])) $postes['1H1']=$postesN1['1H']; if (!isset($postes['1J1']) && isset($postesN1['1J'])) $postes['1J1']=$postesN1['1J']; if (!isset($postes['1K1']) && isset($postesN1['1K'])) $postes['1K1']=$postesN1['1K']; if (!isset($postes['HX1']) && isset($postesN1['HX'])) $postes['HX1']=$postesN1['HX']; if (!isset($postes['A11']) && isset($postesN1['A1'])) $postes['A11']=$postesN1['A1']; if (!isset($postes['A21']) && isset($postesN1['A2'])) $postes['A21']=$postesN1['A2']; if (!isset($postes['A31']) && isset($postesN1['A3'])) $postes['A31']=$postesN1['A3']; if (!isset($postes['A41']) && isset($postesN1['A4'])) $postes['A41']=$postesN1['A4']; } elseif ($type=='S') { // Calcul des chiffres net N-1 si absent 2033 if (!isset($postesN1['013']) && (isset($postesN1['010'])||isset($postesN1['012'])))$postesN1['013']=$postesN1['010']-$postesN1['012']; if (!isset($postesN1['017']) && (isset($postesN1['014'])||isset($postesN1['016'])))$postesN1['017']=$postesN1['014']-$postesN1['016']; if (!isset($postesN1['031']) && (isset($postesN1['028'])||isset($postesN1['030'])))$postesN1['031']=$postesN1['028']-$postesN1['030']; if (!isset($postesN1['043']) && (isset($postesN1['040'])||isset($postesN1['042'])))$postesN1['043']=$postesN1['040']-$postesN1['042']; if (!isset($postesN1['049']) && (isset($postesN1['044'])||isset($postesN1['048'])))$postesN1['049']=$postesN1['044']-$postesN1['048']; if (!isset($postesN1['053']) && (isset($postesN1['050'])||isset($postesN1['052'])))$postesN1['053']=$postesN1['050']-$postesN1['052']; if (!isset($postesN1['063']) && (isset($postesN1['060'])||isset($postesN1['062'])))$postesN1['063']=$postesN1['060']-$postesN1['062']; if (!isset($postesN1['067']) && (isset($postesN1['064'])||isset($postesN1['066'])))$postesN1['067']=$postesN1['064']-$postesN1['066']; if (!isset($postesN1['071']) && (isset($postesN1['068'])||isset($postesN1['070'])))$postesN1['071']=$postesN1['068']-$postesN1['070']; if (!isset($postesN1['075']) && (isset($postesN1['072'])||isset($postesN1['074'])))$postesN1['075']=$postesN1['072']-$postesN1['074']; if (!isset($postesN1['083']) && (isset($postesN1['080'])||isset($postesN1['082'])))$postesN1['083']=$postesN1['080']-$postesN1['082']; if (!isset($postesN1['087']) && (isset($postesN1['084'])||isset($postesN1['086'])))$postesN1['087']=$postesN1['084']-$postesN1['086']; if (!isset($postesN1['091']) && (isset($postesN1['088'])||isset($postesN1['090'])))$postesN1['091']=$postesN1['088']-$postesN1['090']; if (!isset($postesN1['095']) && (isset($postesN1['092'])||isset($postesN1['094'])))$postesN1['095']=$postesN1['092']-$postesN1['094']; if (!isset($postesN1['099']) && (isset($postesN1['096'])||isset($postesN1['098'])))$postesN1['099']=$postesN1['096']-$postesN1['098']; if (!isset($postesN1['113']) && (isset($postesN1['110'])||isset($postesN1['112'])))$postesN1['113']=$postesN1['110']-$postesN1['112']; // Récupération des chiffres N-1 si absent du bilan N // ACTIF 2033 if (!isset($postes['N00']) && isset($postesN1['013'])) $postes['N00']=$postesN1['013']; if (!isset($postes['N01']) && isset($postesN1['017'])) $postes['N01']=$postesN1['017']; if (!isset($postes['N02']) && isset($postesN1['031'])) $postes['N02']=$postesN1['031']; if (!isset($postes['N03']) && isset($postesN1['043'])) $postes['N03']=$postesN1['043']; if (!isset($postes['N04']) && isset($postesN1['049'])) $postes['N04']=$postesN1['049']; if (!isset($postes['N05']) && isset($postesN1['053'])) $postes['N05']=$postesN1['053']; if (!isset($postes['N06']) && isset($postesN1['063'])) $postes['N06']=$postesN1['063']; if (!isset($postes['N07']) && isset($postesN1['067'])) $postes['N07']=$postesN1['067']; if (!isset($postes['N08']) && isset($postesN1['071'])) $postes['N08']=$postesN1['071']; if (!isset($postes['N09']) && isset($postesN1['075'])) $postes['N09']=$postesN1['075']; if (!isset($postes['N10']) && isset($postesN1['083'])) $postes['N10']=$postesN1['083']; if (!isset($postes['N11']) && isset($postesN1['087'])) $postes['N11']=$postesN1['087']; if (!isset($postes['N12']) && isset($postesN1['091'])) $postes['N12']=$postesN1['091']; if (!isset($postes['N13']) && isset($postesN1['095'])) $postes['N13']=$postesN1['095']; if (!isset($postes['N14']) && isset($postesN1['099'])) $postes['N14']=$postesN1['099']; if (!isset($postes['N15']) && isset($postesN1['113'])) $postes['N15']=$postesN1['113']; // PASSIF 2033 if (!isset($postes['N16']) && isset($postesN1['120'])) $postes['N16']=$postesN1['120']; if (!isset($postes['N17']) && isset($postesN1['124'])) $postes['N17']=$postesN1['124']; if (!isset($postes['N18']) && isset($postesN1['126'])) $postes['N18']=$postesN1['126']; if (!isset($postes['N19']) && isset($postesN1['130'])) $postes['N19']=$postesN1['130']; if (!isset($postes['N20']) && isset($postesN1['132'])) $postes['N20']=$postesN1['132']; if (!isset($postes['N21']) && isset($postesN1['134'])) $postes['N21']=$postesN1['134']; if (!isset($postes['N22']) && isset($postesN1['136'])) $postes['N22']=$postesN1['136']; if (!isset($postes['N23']) && isset($postesN1['140'])) $postes['N23']=$postesN1['140']; if (!isset($postes['N24']) && isset($postesN1['142'])) $postes['N24']=$postesN1['142']; if (!isset($postes['N25']) && isset($postesN1['154'])) $postes['N25']=$postesN1['154']; if (!isset($postes['N26']) && isset($postesN1['156'])) $postes['N26']=$postesN1['156']; if (!isset($postes['N27']) && isset($postesN1['164'])) $postes['N27']=$postesN1['164']; if (!isset($postes['N28']) && isset($postesN1['166'])) $postes['N28']=$postesN1['166']; if (!isset($postes['N29']) && isset($postesN1['172'])) $postes['N29']=$postesN1['172']; if (!isset($postes['N30']) && isset($postesN1['174'])) $postes['N30']=$postesN1['174']; if (!isset($postes['N31']) && isset($postesN1['176'])) $postes['N31']=$postesN1['176']; if (!isset($postes['N32']) && isset($postesN1['180'])) $postes['N32']=$postesN1['180']; // COMPTE DE RESULTAT 2033 if (!isset($postes['N33']) && isset($postesN1['210'])) $postes['N33']=$postesN1['210']; if (!isset($postes['N34']) && isset($postesN1['214'])) $postes['N34']=$postesN1['214']; if (!isset($postes['N35']) && isset($postesN1['218'])) $postes['N35']=$postesN1['218']; if (!isset($postes['N36']) && isset($postesN1['222'])) $postes['N36']=$postesN1['222']; if (!isset($postes['N37']) && isset($postesN1['224'])) $postes['N37']=$postesN1['224']; if (!isset($postes['N38']) && isset($postesN1['226'])) $postes['N38']=$postesN1['226']; if (!isset($postes['N39']) && isset($postesN1['230'])) $postes['N39']=$postesN1['230']; if (!isset($postes['N40']) && isset($postesN1['232'])) $postes['N40']=$postesN1['232']; if (!isset($postes['N41']) && isset($postesN1['234'])) $postes['N41']=$postesN1['234']; if (!isset($postes['N42']) && isset($postesN1['236'])) $postes['N42']=$postesN1['236']; if (!isset($postes['N43']) && isset($postesN1['238'])) $postes['N43']=$postesN1['238']; if (!isset($postes['N44']) && isset($postesN1['240'])) $postes['N44']=$postesN1['240']; if (!isset($postes['N45']) && isset($postesN1['242'])) $postes['N45']=$postesN1['242']; if (!isset($postes['N46']) && isset($postesN1['244'])) $postes['N46']=$postesN1['244']; if (!isset($postes['N47']) && isset($postesN1['250'])) $postes['N47']=$postesN1['250']; if (!isset($postes['N48']) && isset($postesN1['252'])) $postes['N48']=$postesN1['252']; if (!isset($postes['N49']) && isset($postesN1['254'])) $postes['N49']=$postesN1['254']; if (!isset($postes['N50']) && isset($postesN1['256'])) $postes['N50']=$postesN1['256']; if (!isset($postes['N51']) && isset($postesN1['262'])) $postes['N51']=$postesN1['262']; if (!isset($postes['N52']) && isset($postesN1['264'])) $postes['N52']=$postesN1['264']; if (!isset($postes['N53']) && isset($postesN1['270'])) $postes['N53']=$postesN1['270']; if (!isset($postes['N54']) && isset($postesN1['280'])) $postes['N54']=$postesN1['280']; if (!isset($postes['N55']) && isset($postesN1['290'])) $postes['N55']=$postesN1['290']; if (!isset($postes['N56']) && isset($postesN1['294'])) $postes['N56']=$postesN1['294']; if (!isset($postes['N57']) && isset($postesN1['300'])) $postes['N57']=$postesN1['300']; if (!isset($postes['N58']) && isset($postesN1['306'])) $postes['N58']=$postesN1['306']; if (!isset($postes['N59']) && isset($postesN1['310'])) $postes['N59']=$postesN1['310']; } elseif ($type=='A' || $type=='B') { // BANQUES if (!isset($postes['NA1']) && isset($postesN1['AA1'])) $postes['NA1']=$postesN1['AA1']; if (!isset($postes['NA2']) && isset($postesN1['AA2'])) $postes['NA2']=$postesN1['AA2']; if (!isset($postes['NA3']) && isset($postesN1['AA3'])) $postes['NA3']=$postesN1['AA3']; if (!isset($postes['NP1']) && isset($postesN1['AP1'])) $postes['NP1']=$postesN1['AP1']; if (!isset($postes['NP2']) && isset($postesN1['AP2'])) $postes['NP2']=$postesN1['AP2']; if (!isset($postes['NP3']) && isset($postesN1['AP3'])) $postes['NP3']=$postesN1['AP3']; if (!isset($postes['NP4']) && isset($postesN1['AP4'])) $postes['NP4']=$postesN1['AP4']; if (!isset($postes['NP5']) && isset($postesN1['AP5'])) $postes['NP5']=$postesN1['AP5']; if (!isset($postes['NP6']) && isset($postesN1['AP6'])) $postes['NP6']=$postesN1['AP6']; if (!isset($postes['NP7']) && isset($postesN1['AP7'])) $postes['NP7']=$postesN1['AP7']; if (!isset($postes['NP8']) && isset($postesN1['AP8'])) $postes['NP8']=$postesN1['AP8']; if (!isset($postes['NP9']) && isset($postesN1['AP9'])) $postes['NP9']=$postesN1['AP9']; if (!isset($postes['NR1']) && isset($postesN1['AR1'])) $postes['NR1']=$postesN1['AR1']; if (!isset($postes['NR2']) && isset($postesN1['AR2'])) $postes['NR2']=$postesN1['AR2']; if (!isset($postes['NR3']) && isset($postesN1['AR3'])) $postes['NR3']=$postesN1['AR3']; // ASSURANCE if (!isset($postes['NR4']) && isset($postesN1['AR4'])) $postes['AR4']=$postesN1['AR4']; } } else { $infos = 'NEW'; } } else { $infos = 'NEW'; } } $ancres = array( 'C' => array( 'actif' => 'Actif', 'passif' => 'Passif', 'compteDeResultat' => 'Compte de résultat', //+ Poste YP pour l'effectif du groupe ), 'N' => array( 'actif' => 'Actif', 'passif' => 'Passif', 'compteDeResultat' => 'Compte de résultat', 'immobilisations' => 'Immobilisations', 'amortissements' => 'Amortissements', 'provisions' => 'Provisions', 'creancesDettes' => 'Créances, Dettes', 'resultatfiscal' => 'Détermination du résultat fiscal', 'deficit' => 'DÉFICITS, INDEMNITÉS POUR CONGÉS À PAYER ET PROVISIONS NON DÉDUCTIBLES', 'affectation' => 'Affectation', 'annexe16' => 'DÉTERMINATION DE LA VALEUR AJOUTÉE PRODUITE AU COURS DE L\'EXERCICE', ), 'S' => array( 'actif' => 'Actif', 'passif' => 'Passif', 'compteDeResultat' => 'Compte de résultat', 'immobilisations' => 'Immobilisations', 'amortissements' => 'Amortissements', 'provisions' => 'Provisions', 'creancesDettes' => 'Créances, Dettes', 'affectation' => 'Affectation' ), 'A' => array( 'actif' => 'Actif', 'passif' => 'Passif', 'compteDeResultat' => 'Compte de résultat', ), 'B' => array( 'actif' => 'Actif', 'passif' => 'Passif', 'compteDeResultat' => 'Compte de résultat', ), ); if (!empty($infos)) { //Default value if ( is_string($infos) && $infos == 'NEW' ) { $dateCloture = (date('Y')-1).'1231'; $dureeMois = '12'; $dateCloturePre = 'AAAAMMJJ'; $dureeMoisPre = '0'; $unite = 'U'; } else { $dateCloture = ($infos->dateCloture!='') ? $infos->dateCloture : $date; $dureeMois = ($infos->dureeMois!='') ? $infos->dureeMois : '12'; $dateCloturePre = empty($infos->dateCloturePre) ? 'AAAAMMJJ' : $infos->dateCloturePre ; $dureeMoisPre = empty($infos->dureeMoisPre) ? '0' : $infos->dureeMoisPre; $unite = $infos->unite; $this->view->assign('liasse', $postes); } //Formattage date $dateCloture = substr($dateCloture,6,2).'/'.substr($dateCloture,4,2).'/'.substr($dateCloture,0,4); $dateCloturePre = substr($dateCloturePre,6,2).'/'.substr($dateCloturePre,4,2).'/'.substr($dateCloturePre,0,4); $this->view->assign('dateCloture', $dateCloture); $this->view->assign('dateCloturePre', $dateCloturePre); $this->view->assign('dureeMois', $dureeMois); $this->view->assign('dureeMoisPre', $dureeMoisPre); $this->view->assign('unite', $unite); $this->view->assign('typeBilan', $type); $this->view->assign('ancres', $ancres[$type]); $this->view->inlineScript()->appendFile('/libs/editable/jquery.jeditable.js'); $this->view->assign('infos', $infos); } } /** * Sauvegarde de la liasse saisie */ public function liassesaveAction() { $this->_helper->layout()->disableLayout(); //Renvoyer flux json STATUS : OK ou ERR, MESSAGE : TEXTE, POSTE : ARRAY ou vide $request = $this->getRequest(); $params = $request->getParams(); $dateCloture = substr($params['dateCloture'],6,4). substr($params['dateCloture'],3,2). substr($params['dateCloture'],0,2); $dateCloturePre = substr($params['dateCloturePre'],6,4). substr($params['dateCloturePre'],3,2). substr($params['dateCloturePre'],0,2); $ws = new WsScores(); $response = $ws->setBilan( $params['siren'], $params['unite'], $dateCloture, $params['dureeMois'], $dateCloturePre, $params['dureeMoisPre'], $params['typeBilan'], $params['postes'], $params['step'] ); Zend_Registry::get('firebug')->info($response); if (is_int($response)) { $this->view->assign('result', array('status'=>'OK')); } else { if ( preg_match_all('/([A-Z0-9]{2,});?/', $response, $postes) ) { Zend_Registry::get('firebug')->info($postes[1]); $this->view->assign('result', array( 'status'=>'ERR', 'message'=>'Erreur valeur', 'postes' => $postes[1], )); } else { $this->view->assign('result', array( 'status'=>'ERR', 'message'=>$response, 'postes'=>array(), )); } } } /** * Affichage du formulaire pour les liens */ public function lienAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $siren = $request->getParam('siren', null); $mode = $request->getParam('mode'); $type = $request->getParam('type'); $idLien = $request->getParam('idLien', null); $lienRef = $request->getParam('lienref', null); $createFiche = $request->getParam('createfiche', null); $ws = new WsScores(); Zend_Registry::get('firebug')->info('createfiche:'.$createFiche); $id2 = null; if ($createFiche) { //Get identite $result = $ws->getIdentiteLight($createFiche); //Compute informations $infos = array( 'siren' => $result->Siren, 'actif' => 1, 'PpPm' => 'PM', 'RS' => $result->Nom, 'civilite' => '', 'nom' => '', 'prenom' => '', 'nom_usage' => '', 'naissance_date' => '', 'naissance_dept_pays' => '', 'naissance_lieu' => '', 'nat' => '', 'adresse_num' => $result->AdresseNum, 'adresse_btq' => $result->AdresseBtq, 'adresse_codvoie' => $result->AdresseVoie, 'adresse_libvoie' => $result->AdresseRue, 'adresse_comp' => '', 'adresse_cp' => $result->CP, 'adresse_ville' => $result->Ville, 'adresse_pays' => 'FRA', 'dateSaisie' => date('YmdHis'), 'capital' => $result->CapitalDev, 'deviseCapital' => $result->CapitalDev, 'nbActions' => '', 'idLoc1Type' => '', 'idLoc1Num' => '', 'idLoc2Type' => '', 'idLoc2Num' => '', 'idLoc3Type' => '', 'idLoc3Num' => '', ); $id2 = $ws->setLienRef(json_encode($infos)); if (is_int($id2)) { Zend_Registry::get('firebug')->info('id2:'.$id2); $this->view->assign('id2', $id2); $this->view->assign('id2Nom', $result->Nom); } } if ( $lienRef !== null ) { Zend_Registry::get('firebug')->info('lienRef:'.$lienRef); $result = $ws->getLienRef($lienRef); Zend_Registry::get('firebug')->info($result); $rs = $result->raisonSociale; //Override session session if ( intval($result->siren) != 0 ) { $siren = $result->siren; $session = new Scores_Session_Entreprise($siren); } } elseif ($siren !== null) { $session = new Scores_Session_Entreprise($siren); $rs = $session->getRaisonSociale(); } $detention = array( '+' => 'Major.', '-' => 'Minor.', 'C' => 'Contrôle', 'S' => 'Scission', 'F' => 'Fusion', 'P' => 'Projet de fusion', 'T' => 'TUP', 'L' => 'Tutelle', 'E' => 'Franchise', ); $this->view->assign('detention', $detention); //Mode = delete /* id du lien pour récupérer les informations - rs1, siren1, rs2, siren2 */ if ($mode == 'delete') { $result = $ws->getSaisieLien($idLien); $infos = json_decode($result, true); Zend_Registry::get('firebug')->info($infos); if ($type=='actionnaire') { $this->view->assign('id1', $infos['idPar']); $this->view->assign('id2', $infos['idAct']); $idFiche = $infos['idAct']; } elseif ($type=='participation') { $this->view->assign('id2', $infos['idPar']); $this->view->assign('id1', $infos['idAct']); $idFiche = $infos['idPar']; } if ($idFiche) { $result = $ws->getLienRef($idFiche); if ($result->raisonSociale!='') { $this->view->assign('rs2', $result->raisonSociale); } else { $this->view->assign('rs2', $result->nom); } $this->view->assign('siren2', $result->siren); } $this->view->assign('PDetention', $infos['PDetention']); $this->view->assign('Pvote', $infos['Pvote']); $this->view->assign('MajMin', $infos['MajMin']); $dateEffetLien = new Zend_Date($infos['dateEffetLien'], 'yyyy-MM-dd'); $this->view->assign('dateEffetLien', $dateEffetLien->toString('dd/MM/yyyy')); } //Mode = edit / add /* id du lien pour récupérer les informations - siren, rs actuel - Liste des documents de référence - Liste des types d'identifiant par pays sdv1.tabIdLocal */ elseif ($mode == 'edit') { $result = $ws->getSaisieLien($idLien); $infos = json_decode($result, true); Zend_Registry::get('firebug')->info($infos); if ($type=='actionnaire') { $this->view->assign('id1', $infos['idPar']); $this->view->assign('id2', $infos['idAct']); } elseif ($type=='participation') { $this->view->assign('id2', $infos['idPar']); $this->view->assign('id1', $infos['idAct']); } $dateEffetLien = new Zend_Date($infos['dateEffetLien'], 'yyyy-MM-dd'); $doc = ($siren) ? $ws->getLienDoc($siren, 'Siren') : $ws->getLienDoc($lienRef, 'Entreprise'); if ( $doc->item[0]->date ) { $date = new Zend_Date($doc->item[0]->date, 'yyyy-MM-dd'); $dateEffetLienDoc = $date->toString('dd/MM/yyyy'); } else { $dateEffetLienDoc = $dateEffetLien->toString('dd/MM/yyyy'); } $this->view->assign('PDetention', $infos['PDetention']); $this->view->assign('Pvote', $infos['Pvote']); $this->view->assign('MajMin', $infos['MajMin']); $this->view->assign('dateEffetLien', $dateEffetLien->toString('dd/MM/yyyy')); $this->view->assign('dateEffetLienDoc', $dateEffetLienDoc); } else { $date = $request->getParam('date'); if ($date) { $this->view->assign('dateEffetLien', substr($date,8,2).'/'.substr($date,5,2).'/'.substr($date,0,4)); } if ( $lienRef ) { $this->view->assign('id1', $lienRef); } else { //Création de la première référence lien $infos = array( 'siren' => $siren, 'actif' => 1, 'PpPm' => 'PM', 'RS' => $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' => '', 'dateSaisie' => date('YmdHis'), 'capital' => '', 'deviseCapital' => 'EUR', 'nbActions' => '', 'idLoc1Type' => '', 'idLoc1Num' => '', 'idLoc2Type' => '', 'idLoc2Num' => '', 'idLoc3Type' => '', 'idLoc3Num' => '', ); $idNewLien = $ws->setLienRef(json_encode($infos)); Zend_Registry::get('firebug')->info('idNewLien:'.$idNewLien); if (is_int($idNewLien)) { $this->view->assign('id1', $idNewLien); } } $this->view->assign('countries', $this->countries); } //Affichage $this->view->assign('rs', $rs); $this->view->assign('siren', $siren); $this->view->assign('mode', $mode); $this->view->assign('type', $type); $this->view->assign('idLien', $idLien); } public function liensearchAction() { $this->_helper->layout()->disableLayout(); $query = $this->getRequest()->getParam('q'); $type = $this->getRequest()->getParam('type', null); //Some transformation if ( $type == 'siren' || $type == 'id' ) { $query = str_replace(array(' ','.','-',','), array('','','',''), $query); } $ws = new WsScores(); $result = $ws->searchLienRef($query, $type); Zend_Registry::get('firebug')->info($result); $output = array(); if (count($result->item)>0) { foreach ($result->item as $item) { $output[] = array( 'value' => $item->id, 'label' => $item->lib, ); } } $this->view->assign('output', $output); } /** * Gestion des liens étrangers */ public function lienetrangerAction() { $request = $this->getRequest(); $mode = $request->getParam('mode', null); $this->view->assign('mode', $mode); Zend_Registry::get('firebug')->info($mode); if ($mode === null) { $this->_helper->layout()->disableLayout(); } $this->view->assign('currencies', $this->currencies); $this->view->assign('countries', $this->countries); $this->view->assign('type', $this->getRequest()->getParam('type')); } /** * Gestion des liens étrangers */ public function lienppAction() { $this->_helper->layout()->disableLayout(); $this->view->assign('countries', $this->countries); } public function lienrefsaveAction() { $this->_helper->layout()->disableLayout(); $params = $this->getRequest()->getParams(); //Construct reference informations $params['PpPm'] = 'PM'; //Check params if ( empty($params['nom']) || $params['pp']==1 && empty($params['prenom']) || empty($params['adresse_pays']) || empty($params['adresse_ville']) ) { $this->view->assign('error', 'Champs non saisi !'); } else { //Personne Physique if ($params['pp']==1) { //Fill data $params['PpPm'] = 'PP'; $params['RS'] = $params['civilite'].' '.$params['nom'].' '.$params['prenom'].' '.$params['nom_usage']; //Personne Morale } elseif (!empty($params['siren'])) { //Fill data $params['RS'] = $params['nom']; $params['civilite'] = ''; $params['nom'] = ''; $params['prenom'] = ''; $params['nom_usage'] = ''; $params['naissance_date'] = ''; $params['naissance_dept_pays'] = ''; $params['naissance_lieu'] = ''; $params['nat'] = ''; } else { //Fill data $params['siren'] = '000000000'; $params['RS'] = $params['nom']; $params['civilite'] = ''; $params['nom'] = ''; $params['prenom'] = ''; $params['nom_usage'] = ''; $params['naissance_date'] = ''; $params['naissance_dept_pays'] = ''; $params['naissance_lieu'] = ''; $params['nat'] = ''; } if (empty($params['dateCapital'])) { $dateCapital = ''; } else { $date = new Zend_Date($params['dateCapital'], 'dd/MM/yyyy'); $dateCapital = $date->toString('yyyyMMdd'); } if (empty($params['naissance_date'])) { $dateNaissance = ''; } else { $date = new Zend_Date($params['naissance_date'], 'dd/MM/yyyy'); $dateNaissance = $date->toString('yyyyMMdd'); } if (empty($params['dateNbActions'])) { $dateNbActions = ''; } else { $date = new Zend_Date($params['dateNbActions'], 'dd/MM/yyyy'); $dateNbActions = $date->toString('yyyyMMdd'); } $infos = array( 'siren' => $params['siren'], 'actif' => 1, 'PpPm' => $params['PpPm'], 'RS' => strtoupper(trim($params['RS'])), 'civilite' => $params['civilite'], 'nom' => strtoupper(trim($params['nom'])), 'prenom' => ucfirst(trim($params['prenom'])), 'nom_usage' => strtoupper(trim($params['nom_usage'])), 'naissance_date' => $dateNaissance, 'naissance_dept_pays' => $params['naissance_dept_pays'], 'naissance_lieu' => $params['naissance_lieu'], 'nat' => $params['nat'], 'adresse_num' => empty($params['adresse_num']) ? '' : trim($params['adresse_num']), 'adresse_btq' => empty($params['adresse_btq']) ? '' : trim($params['adresse_btq']), 'adresse_codvoie' => empty($params['adresse_codvoie']) ? '' : strtoupper(trim($params['adresse_codvoie'])), 'adresse_libvoie' => empty($params['adresse_libvoie']) ? '' : strtoupper(trim($params['adresse_libvoie'])), 'adresse_comp' => empty($params['adresse_comp']) ? '' : strtoupper(trim($params['adresse_comp'])), 'adresse_cp' => empty($params['adresse_cp']) ? '' : trim($params['adresse_cp']), 'adresse_ville' => empty($params['adresse_ville']) ? '' : trim($params['adresse_ville']), 'adresse_pays' => empty($params['adresse_pays']) ? '' : trim($params['adresse_pays']), 'actif' => $params['actif'], 'tel' => empty($params['tel']) ? '' : trim($params['tel']), 'fax' => empty($params['fax']) ? '' : trim($params['fax']), 'web' => empty($params['web']) ? '' : trim($params['web']), 'email' => empty($params['email']) ? '' : trim($params['email']), 'dateSaisie' => date('YmdHis'), 'capital' => empty($params['capital']) ? '' : trim($params['capital']), 'deviseCapital' => empty($params['deviseCapital']) ? 'EUR' : $params['deviseCapital'], 'dateCapital' => $dateCapital, 'nbActions' => empty($params['nbActions']) ? '' : $params['nbActions'], 'dateNbActions' => $dateNbActions, 'isin' => empty($params['isin']) ? '' : trim($params['isin']), 'idLoc1Type' => $params['idLoc1Type'], 'idLoc1Num' => trim($params['idLoc1Num']), 'idLoc2Type' => $params['idLoc2Type'], 'idLoc2Num' => trim($params['idLoc2Num']), 'idLoc3Type' => $params['idLoc3Type'], 'idLoc3Num' => trim($params['idLoc3Num']), 'bilMillesime' => $params['bilMillesime'], 'bilDev' => empty($params['bilDev']) ? 'EUR' : $params['bilDev'], 'bilFL' => $params['bilFL'], 'bilHN' => $params['bilHN'], 'bilFPr' => $params['bilFPr'], 'bilEE' => $params['bilEE'], ); Zend_Registry::get('firebug')->info($params); $ws = new WsScores(); $idNewLien = $ws->setLienRef(json_encode($infos), $params['idLien']); $this->view->assign('idNewLien', $idNewLien); $rs = empty($infos['RS']) ? $infos['nom'] : $infos['RS']; $this->view->assign('RS', $rs); $this->view->assign('error', ''); if (!is_int($idNewLien) || $idNewLien==0){ $this->view->assign('error', $idNewLien); } } } public function checkisinAction() { $this->_helper->layout()->disableLayout(); $isin = $this->getRequest()->getParam('isin', ''); $letters = array( 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34, 'Z' => 35); $digitIsin = strtr($isin, $letters); $tmpIsin = str_split($digitIsin); $checkDigit = end($tmpIsin); unset($tmpIsin[count($tmpIsin)-1]); $firstGroup = ''; $secondGroup = ''; $split = range(0, count($tmpIsin)-1, 2); foreach ($split as $i) { $firstGroup .= $tmpIsin[$i]+$tmpIsin[$i]*(count($tmpIsin)%2); $secondGroup .= $tmpIsin[$i+1]+$tmpIsin[$i+1]*((count($tmpIsin)+1)%2); } $firstGroupSum = array_sum(str_split($firstGroup)); $secondGroupSum = array_sum(str_split($secondGroup)); $cmp = (10 - ($firstGroupSum + $secondGroupSum)%10)%10 - $checkDigit; if ($cmp != 0) $this->view->assign('error', true); } /** * Sauvegarde */ public function liensaveAction() { $this->_helper->layout()->disableLayout(); $params = $this->getRequest()->getParams(); if ($params['mode']=='delete') { if (empty($params['dateEffetLien'])) { $dateEffetLien = ''; } else { $date = new Zend_Date($params['dateEffetLien'], 'dd/MM/yyyy'); $dateEffetLien = $date->toString('yyyyMMdd'); } $infos = array( 'actif' => 0, 'dateEffetLien' => $dateEffetLien, 'motifUpdate' => empty($params['motifUpdate']) ? '' : $params['motifUpdate'], ); } else { if ($params['type']=='actionnaire') { $idAct = $params['id2']; $idPar = $params['id1']; } elseif ($params['type']=='participation') { $idPar = $params['id2']; $idAct = $params['id1']; } if (empty($params['dateEffetLien'])) { $date = new Zend_Date(); } else { $date = new Zend_Date($params['dateEffetLien'], 'dd/MM/yyyy'); } $infos = array( 'idAct' => $idAct, 'actif' => 1, 'PDetention' => $params['PDetention'], 'Pvote' => ($params['Pvote']=='') ? null : $params['Pvote'], 'MajMin' => $params['MajMin'], 'idPar' => $idPar, 'dateEffetLien' => $date->toString('yyyyMMdd'), 'motifUpdate' => empty($params['motifUpdate']) ? '' : $params['motifUpdate'], ); } Zend_Registry::get('firebug')->info($infos); $ws = new WsScores(); $idNewLien = $ws->setLien(json_encode($infos), $params['idLien']); if (!is_int($idNewLien)){ $this->view->assign('error', $idNewLien); } else { $this->view->assign('id', $idNewLien); $this->view->assign('mode', $params['mode']); } } public function liendocAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $mode = $request->getParam('mode'); if ($mode == 'delete') { $this->view->assign('mode', $mode); $id = $request->getParam('id'); $this->view->assign('idNum', $id); //Get Infos $ws = new WsScores(); $docs = $ws->getLienDoc($id); if (count($docs->item)==1) { $this->view->assign('doc', $docs->item[0]); } } else { $siren = $request->getParam('siren', null); $idLien = $request->getParam('idLien', null); $type = $request->getParam('type', null); $this->view->assign('idType', $type); if ($siren===null) { $this->view->assign('idNum', $idLien); } else { $ws = new WsScores(); $identite = $ws->getIdentite($siren); if (empty($identite->Bilan->Cloture)) { $dateCapital = ''; } else { $date = new Zend_Date($identite->Bilan->Cloture, 'yyyyMMdd'); $dateCapital = $date->toString('dd/MM/yyyy'); } $infos = array( 'siren' => $siren, 'actif' => 1, 'PpPm' => 'PP', 'RS' => $identite->Nom, 'civilite' => '', 'nom' => '', 'prenom' => '', 'nom_usage' => '', 'naissance_date' => '', 'naissance_dept_pays' => '', 'naissance_lieu' => '', 'nat' => '', 'adresse_num' => $identite->AdresseNum, 'adresse_btq' => $identite->AdresseBtq, 'adresse_codvoie' => $identite->AdresseVoie, 'adresse_libvoie' => $identite->AdresseRue, 'adresse_comp' => $identite->Adresse2, 'adresse_cp' => $identite->CP, 'adresse_ville' => $identite->Ville, 'adresse_pays' => 'FRA', 'dateSaisie' => date('YmdHis'), 'capital' => $identite->Bilan->Capital, 'deviseCapital' => 'EUR', 'dateCapital' => $dateCapital, 'nbActions' => '', 'idLoc1Type' => '', 'idLoc1Num' => '', 'idLoc2Type' => '', 'idLoc2Num' => '', 'idLoc3Type' => '', 'idLoc3Num' => '', 'bilMillesime' => $identite->Bilan->Millesime, 'bilDev' => 'EUR', 'bilFL' => $identite->Bilan->CA, 'bilHN' => $identite->Bilan->Resultat, 'bilFPr' => '', 'bilEE' => '', ); $idNum = $ws->setLienRef(json_encode($infos)); $this->view->assign('idNum', $idNum); } } } public function liendocsaveAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $request = $this->getRequest(); $params = $request->getParams(); if (empty($params['idNum'])) { echo "Erreur"; } // elseif ($params['mode']=='delete') { $ws = new WsScores(); $result = $ws->setLienDoc(json_encode(array()), $params['idNum']); if ($result) { echo "Fichier supprimé"; } else { echo "Erreur lors de la suppression"; } } //Téléchargement du fichier elseif ( isset($_FILES) && count($_FILES)==1 ) { $c = Zend_Registry::get('config'); $path = realpath($c->profil->path->data).'/groupes'; if (!file_exists($path)) { mkdir($path); } $date = new Zend_Date($params['fileDate'],'dd/MM/yyyy'); $name = 'INTERNE-'.$params['idNum'].'-'.$params['fileType'].'-'.$date->toString('yyyyMMdd'); $n = $_FILES['fichier']['name']; $s = $_FILES['fichier']['size']; $tmp_name = $_FILES['fichier']['tmp_name']; $extValide = array('pdf'); $extension = strrchr($n,'.'); $extension = substr($extension,1); //Vérifier l'extension du fichier if( !in_array($extension, $extValide) ){ echo "Extension de fichier incorrect !"; } elseif ( move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension) ){ $result = false; //Send info to webservice $infos = array( 'idType' => $params['idType'], 'idNum' => $params['idNum'], 'periDoc' => $params['periDoc'], 'docRef' => $name, 'dateDocRef' => $date->toString('yyyyMMdd'), ); $ws = new WsScores(); $result = $ws->setLienDoc(json_encode($infos)); //Display message if ($result) { echo "Fichier envoyé"; } else { //Delete file unlink($path.'/'.$name.'.'.$extension); echo "Erreur lors de l'enregistrement des informations !"; } } else { echo "Erreur lors du déplacement du fichier !"; } } //Greffe else { echo "Greffe"; } } public function countryidAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $code = $request->getParam('code'); $ws = new WsScores(); $result = $ws->getCountryId($code); $this->view->assign('identifiant', $result->item); } public function bourseAction() { $request = $this->getRequest(); $siret = $request->getParam('siret'); $id = $request->getParam('id', 0); $this->view->headTitle()->append('Saisie - '.$siret); $session = new Scores_Session_Entreprise($siret, $id); $isin = $session->getIsin(); $ws = new WsScores(); $result = $ws->getSaisieBourse($isin); $infos = json_decode($result, true); if ( $infos === null ) { $this->view->assign('error', $result); } else { foreach ( $infos as $key => $val ) { $this->view->assign($key, $val); } } $this->view->assign('raisonSociale', $session->getRaisonSociale()); $this->view->assign('siren', $session->getSiren()); } public function boursesaveAction() { } public function lienidentiteAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $this->view->assign('type', $request->getParam('type')); $siren = $request->getParam('siren'); $ws = new WsScores(); $result = $ws->getIdentite($siren); Zend_Registry::get('firebug')->info($result); $this->view->assign('nom',$result->Nom); $this->view->assign('adresse_num',$result->AdresseNum); $this->view->assign('adresse_btq',$result->AdresseBtq); $this->view->assign('adresse_codvoie',$result->AdresseVoie); $this->view->assign('adresse_libvoie',$result->AdresseRue); $this->view->assign('adresse_comp',$result->Adresse2); $this->view->assign('adresse_cp',$result->CP); $this->view->assign('adresse_ville',$result->Ville); $this->view->assign('actif',$result->Actif); $this->view->assign('tel',$result->Tel); $this->view->assign('fax',$result->Fax); $this->view->assign('web',$result->Web); $this->view->assign('mail',$result->Mail); $this->view->assign('cj',$result->FJ); $this->view->assign('ape',$result->NafEnt); $this->view->assign('capital',$result->Bilan->Capital); $this->view->assign('deviseCapital', 'EUR'); $date = new Zend_Date($result->Bilan->Cloture, 'yyyyMMdd'); $this->view->assign('dateCapital', $date->toString('dd/MM/yyyy')); $this->view->assign('bilDev', 'EUR'); $this->view->assign('bilMillesime', $result->Bilan->Millesime); $this->view->assign('bilFL', $result->Bilan->CA); $this->view->assign('bilHN', $result->Bilan->Resultat); $this->view->assign('currencies', $this->currencies); //Special legal form, go to other display if ( ($result->FJ>=1000 && $result->FJ<=1999) || ($result->FJ>=10 && $result->FJ<=19) ) { $this->view->assign('countries', $this->countries); $this->renderScript('saisie/lienpp.phtml'); } } public function lienficheAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $id = $request->getParam('idFiche', null); $ws = new WsScores(); if ($id===null) { $siren = $request->getParam('siren'); $result = $ws->searchLienRef($siren, 'siren'); if (count($result->item)>0) { foreach ($result->item as $item) { $id = $item->id; break; } } } $this->view->assign('edit', $id); $this->view->assign('currencies', $this->currencies); $this->view->assign('countries', $this->countries); $result = $ws->getSaisieLienRef($id); $items = json_decode($result, true); //Get country code if ($items->adresse_pays!='FRA') { $result = $ws->getCountryId($items['adresse_pays']); $this->view->assign('identifiant', $result->item); } Zend_Registry::get('firebug')->info($items); if (count($items)>0) { foreach( $items as $key => $val ) { switch ($key) { case 'dateCapital': case 'dateNbActions': case 'naissance_date': if (!empty($val) && $val!='0000-00-00') { $date = new Zend_Date($val, 'yyyy-MM-dd'); $this->view->assign($key, $date->toString('dd/MM/yyyy')); } break; default: $this->view->assign($key, $val); break; } } } if ($items['PpPm']=='PM') { $this->view->assign('nom', $items['RS']); } else { $this->view->assign('nom', $items['nom']); } } public function lienchangeAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $mode = $request->getParam('mode'); $this->view->assign('mode', $mode); $lienref = $request->getParam('lienref'); $this->view->assign('lienref', $lienref); $idLien = $request->getParam('idLien'); $this->view->assign('idLien', $idLien); $ws = new WsScores(); //Save data if ( $request->isPost() ){ $id = $request->getParam('id'); $result = $ws->setLienChange($mode, $idLien, $id); if (true === $result) { $this->view->assign('message', 'Déplacement effectué.'); } else { $this->view->assign('message', 'Erreur : '.$result); } } else { $this->view->assign('countries', $this->countries); //Obtain LienRef $result = $ws->getSaisieLienRef($lienref); $infos = json_decode($result,true); if ($infos['PpPm']=='PM') { $this->view->assign('nom', $infos['RS']); } else { $this->view->assign('nom', $infos['nom'].' '.$infos['prenom']); } } } public function scorecutoffAction() { $ws = new WsScores(); $user = new Scores_Utilisateur(); $request = $this->getRequest(); $siren = $request->getParam('siren'); $refresh = 0; $message = ''; if ( $request->isXmlHttpRequest() ) { $this->_helper->layout()->disableLayout(); if ( $request->isPost() ) { $params = $request->getParams(); // check values one more time $paramlist = array( 'siren' => 'Siren', 'encours' => 'Encours', 'scoreSolv' => 'Indiscore', 'scoreDir' => 'Score dirigeance', 'scoreConf' => 'Score de conformité', 'remarque' => 'Remarque', ); foreach ($paramlist as $item => $val) { if (!isset($params[$item])) { $message .= "Valeur $val vide !
"; } if ($params['encours']<0 || $params['encours']>500 ) { $message = "Encours : Erreur borne"; } } // end checking values if ($message == '') { $message = $ws->setScoreCutoff($params['siren'], $params['encours']*1000, $params['scoreSolv'], $params['scoreDir'], $params['scoreConf'], $params['remarque'], $params['delete']); if (is_int($message)){ $message = "Cut-off mis à jour."; $refresh = 1; } } if ($message == '' && $params['delete'] == 1) { $message = "Cut-off est supprimé. Aucun Cut-off est défini, merci de remplir toutes les valeurs"; $refresh = 1; } } } else { $this->view->assign('name', "Définir un Cut-off"); $this->view->assign('href', $this->view->url(array('controller'=>'saisie','action'=>'scorecutoff','siren'=>$siren))); } $getcutoff = json_decode($ws->getScoreCutoff($siren), true); if(!$getcutoff) { if ($message == '') { $message = "Aucun Cut-off est défini, merci de remplir toutes les valeurs"; $refresh = 0; } $getcutoff = array( 'siren' => '', 'encours' => '', 'scoreSolv' => '', 'scoreDir' => '', 'scoreConf' => '', 'remarque' => '', 'dateInsert' => '', 'dateUpdate' => '' ); } $this->view->assign('getcutoff', $getcutoff); $this->view->assign('siren', $siren); $this->view->assign('typescore', $user->getTypeScore()); $this->view->assign('message', $message); $this->view->assign('refresh', $refresh); } public function citysearchAction() { $this->_helper->layout()->disableLayout(); $cpVille = $this->getRequest()->getParam('cpville', null); $output = array(); if ( null !== $cpVille) { $city = new Application_Model_City(); $sql = $city->select('code, libelle'); if (is_numeric($cpVille) && strlen($cpVille)<6) { $sql->where("code LIKE '".$cpVille."%'"); } else { $sql->where("libelle LIKE '%".$cpVille."%'"); } $rows = $city->fetchAll($sql); if ( count($rows)>0 ) { foreach ($rows as $item) { $output[] = array( 'label' => str_pad($item->code, 5, 0, STR_PAD_LEFT).": ".$item->libelle, 'value' => str_pad($item->code, 5, 0, STR_PAD_LEFT), ); } } } $this->view->assign('output', $output); } }