checkModeEdition() && $user->getIdClient()!=1 ){ $this->_forward('perms', 'error'); } } /** * Affichage des différents liens d'administration */ public function indexAction() { $liens = array( 0 => array( 'libelle' => 'Gestion des clients', 'url' => $this->view->url(array('action'=>'clients')), ), ); $this->view->assign('Liens', $liens); } /** * Gestion des commandes de l'extranet * Type : greffes | kbis | graydon | giant */ public function commandesAction() { $this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript'); $request = $this->getRequest(); $type = $request->getParam('type', ''); $user = new Utilisateur(); $typesCommande = array('kbis', 'greffes'); if (in_array($type, $typesCommande)){ require_once 'Scores/GestionCommandes.php'; switch($type){ case 'kbis': $num = $request->getParam('num'); $num = str_replace(' ', '', $num); $etat = $request->getParam('etat'); $mode = $request->getParam('mode'); $date = $request->getParam('date'); $modeSelect = array( '-' => array('value'=>'-', 'select'=>'', 'affichage'=>''), 'G' => array('value'=>'G', 'select'=> '', 'affichage'=>'courrier infogreffe'), 'C' => array('value'=>'C', 'select'=> '', 'affichage'=>'courrier S&D'), 'E' => array('value'=>'E', 'select'=> '', 'affichage'=>'e-mail'), ); $modeSelect[$mode]['select'] = ' selected'; $gestionCommande = new GestionCommande(); $status = $gestionCommande->listStatus(); $etatSelect = array(); $etatSelect[] = array('value'=>0, 'select'=>'', 'affichage'=>''); foreach($status as $item){ $select = ''; if ($item['id']==$etat){ $select = ' selected'; } $etatSelect[] = array('value'=>$item['id'], 'select'=>$select, 'affichage'=>$item['libStatut']); } //Valeur pour la sélection des dates $dateSelect = array(); $dateToday = date('m'); $dateIntervalle = 12; if ($user->checkModeEdition()){ $dateIntervalle = 24; } for($i=$dateToday-$dateIntervalle; $i<=$dateToday; $i++) { $dateTime = mktime(0, 0, 0, $i+1, 0, date('Y')); $selected = ''; if ($date=='' && $i==$dateToday ){ $selected = 'selected'; } if ($date!='' && $dateTime==$date){ $selected = 'selected'; } $dateSelect[] = array( 'value' => $dateTime, 'select' => $selected, 'affichage' => date('m/Y', $dateTime) ); } $this->view->assign('dateSelect', $dateSelect); $this->view->assign('etatSelect', $etatSelect); $this->view->assign('modeSelect', $modeSelect); $this->view->assign('num', $num); if (!empty($num)){ if (preg_match('/[0-9]{9}/', $num)){ $listCommandes = $gestionCommande->listCommandesKbisBySiren($num); } elseif(substr($num,0,1)=='K'){ $listCommandes = $gestionCommande->listCommandesKbisByNum($num); } } elseif (!empty($date)) { $listCommandes = $gestionCommande->listCommandesKbis($date, $etat, $mode); } break; //Fin Gestion Kbis case 'greffes': $num = $request->getParam('num'); $num = str_replace(' ', '', $num); $etat = $request->getParam('etat'); $mode = $request->getParam('mode'); $date = $request->getParam('date'); $login = $request->getParam('login'); $modeSelect = array( '-' => array('value'=>'-', 'select'=>'', 'affichage'=>''), 'G' => array('value'=>'G', 'select'=> '', 'affichage'=>'courrier infogreffe'), 'C' => array('value'=>'C', 'select'=> '', 'affichage'=>'courrier S&D'), 'E' => array('value'=>'E', 'select'=> '', 'affichage'=>'e-mail'), ); $modeSelect[$mode]['select'] = ' selected'; $gestionCommande = new GestionCommande(); $status = $gestionCommande->listStatus(); $etatSelect = array(); $etatSelect[] = array('value'=>0, 'select'=>'', 'affichage'=>''); foreach($status as $item){ $select = ''; if ($item['id']==$etat){ $select = ' selected'; } $etatSelect[] = array('value'=>$item['id'], 'select'=>$select, 'affichage'=>$item['libStatut']); } //Valeur pour la sélection des dates $dateSelect = array(); $dateToday = date('m'); $dateIntervalle = 12; if ($user->checkModeEdition()){ $dateIntervalle = 24; } for($i=$dateToday-$dateIntervalle; $i<=$dateToday; $i++) { $dateTime = mktime(0, 0, 0, $i+1, 0, date('Y')); $selected = ''; if ($date=='' && $i==$dateToday ){ $selected = 'selected'; } if ($date!='' && $dateTime==$date){ $selected = 'selected'; } $dateSelect[] = array( 'value' => $dateTime, 'select' => $selected, 'affichage' => date('m/Y', $dateTime) ); } $this->view->assign('dateSelect', $dateSelect); $this->view->assign('etatSelect', $etatSelect); $this->view->assign('modeSelect', $modeSelect); $this->view->assign('num', $num); $this->view->assign('login', $login); if (!empty($num)){ if (preg_match('/[0-9]{9}/', $num)){ $listCommandes = $gestionCommande->listCommandesGreffeBySiren($num); } elseif(substr($num,0,1)=='G' || substr($num,0,1)=='C'){ $listCommandes = $gestionCommande->listCommandesGreffeByNum($num); } } elseif (!empty($login)) { $listCommandes = $gestionCommande->listCommandesGreffeByLogin($login); } elseif (!empty($date)) { $listCommandes = $gestionCommande->listCommandesGreffe($date, $etat, $mode); } //Parcours de la liste des commandes et vérification document existe if (count($listCommandes)>0) { for($i=0;$iview->url(array( 'controller' => 'pieces', 'action' => 'actes', 'siret' => $listCommandes[$i]['siren'], )); } elseif (preg_match('/^([0-9]{4}).*?$/', $listCommandes[$i]['refDocument'], $matches)){ $documentLien = $this->view->url(array( 'controller' => 'pieces', 'action' => 'bilans', 'siret' => $listCommandes[$i]['siren'], )); } break; } $listCommandes[$i]['documentLien'] = $documentLien; } } break; //Fin Gestion Greffes } $this->view->assign('commandes', $listCommandes); $this->renderScript('dashboard/commandes-'.$type.'.phtml'); } //Affichage des liens vers les différents types de commande $this->view->assign('typesCommande', $typesCommande); } public function rsAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $request = $this->getRequest(); $siren = $request->getParam('siren'); $ws = new WsScores(); $infos = $ws->getIdentite($siren); if ($infos==false) { echo 'Erreur'; } else { echo $infos->Nom; } } /** * Génération automatique du courrier PDF / ODT */ public function courrierAction() { } /** * Liste les clients */ public function clientsAction() { $this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript'); $ws = new WsScores(); $reponse = $ws->getListeClients(); $listeClients = $reponse->result->item; $reponse = $ws->getListeDroits(); $wsdroits = $reponse->item; $this->view->assign('ListeClients', $listeClients); $this->view->assign('wsdroits', $wsdroits); } /** * Edition ou création d'un nouveau client */ public function clientAction() { $request = $this->getRequest(); $idClient = $request->getParam('idClient', false); $titre = 'CREATION NOUVEAU CLIENT'; $submitValue = 'Créer le client'; if ($idClient!==false){ $ws = new WsScores(); $reponse = $ws->getListeClients($idClient); $InfosClient = $reponse->result->item[0]; $titre = 'EDITION CLIENT'; $submitValue = 'Modifier le client'; } $ws = new WsScores(); $reponse = $ws->getListeDroits(); $wsdroits = $reponse->item; $this->view->assign('idClient', $idClient); $this->view->assign('InfosClient', $InfosClient); $this->view->assign('titre', $titre); $this->view->assign('submitValue', $submitValue); $this->view->assign('wsdroits', $wsdroits); } /** * Enregistre les informations sur le client */ public function clientsaveAction() { $request = $this->getRequest(); $params = $request->getParams(); $infos = new stdClass(); $infos->idClient = $params['idClient']; $infos->nom = $params['nom']; $infos->siren = $params['siren']; $infos->nic = $params['nic']; $infos->racineLogin = $params['racineLogin']; $infos->test = $params['test']; $infos->actif = $params['actif']; $infos->dateSignature = $params['dateSignature']; $infos->typeContrat = $params['typeContrat']; $infos->apporteurAffaire = $params['apporteurAffaire']; $infos->typeAcces = $params['typeAcces']; $infos->remarque = $params['remarque']; $infos->tva = $params['tva']; //$infos->xxxx = $params['xxxx']; $infos->editerFacture = $params['editerFacture']; $infos->fact_detail = $params['fact_detail']; $infos->fac_dest = $params['fac_dest']; $infos->fac_adr1 = $params['fac_adr1']; $infos->fac_adr2 = $params['fac_adr2']; $infos->fac_adr3 = $params['fac_adr3']; $infos->fac_email = $params['fac_email']; $infos->fac_tel = $params['fac_tel']; $infos->fact_rib = $params['fact_rib']; $infos->liv_dest = $params['liv_dest']; $infos->liv_adr1 = $params['liv_adr1']; $infos->liv_adr2 = $params['liv_adr2']; $infos->liv_adr3 = $params['liv_adr3']; $infos->liv_email = $params['liv_email']; $infos->liv_tel = $params['liv_tel']; $infos->typeScore = $params['typeScore']; $infos->filtres_ip = $params['filtres_ip']; $infos->droits = $params['droits']; $infos->timeout = $params['timeout']; $infos->forfaitExtranetPeriode = $params['forfaitExtranetPeriode']; $infos->forfaitExtranetMontant = $params['forfaitExtranetMontant']; $infos->reconductionAuto = $params['reconductionAuto']; $infos->forfaitPiecesNb = $params['forfaitPiecesNb']; $infos->forfaitPiecesMt = $params['forfaitPiecesMt']; $infos->forfaitPiecesDep = $params['forfaitPiecesDep']; $infos->forfaitInvestigNb = $params['forfaitInvestigNb']; $infos->forfaitInvestigMt = $params['forfaitInvestigMt']; $infos->tarifIndiscore = $params['tarifIndiscore']; $infos->accesWS = $params['accesWS']; $infos->InterSudLogin = $params['InterSudLogin']; $infos->InterSudPass = $params['InterSudPass']; $ws = new WsScores(); $reponse = $ws->setClient($infos); if ($reponse->error->errnum==1) { $this->_forward('client', 'dashboard', null, array('infos' => $infos)); } $this->view->assign('infos', $request->getParams()); } }