2011-02-21 08:45:13 +00:00
|
|
|
<?php
|
|
|
|
class DashboardController extends Zend_Controller_Action
|
|
|
|
{
|
2011-05-10 09:52:12 +00:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
require_once 'Scores/WsScores.php';
|
2011-05-17 12:42:57 +00:00
|
|
|
require_once 'Scores/Utilisateur.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function preDispatch()
|
|
|
|
{
|
|
|
|
$user = new Utilisateur();
|
|
|
|
if (!$user->checkModeEdition() && $user->getIdClient()!=1 ){
|
|
|
|
$this->_forward('perms', 'error');
|
|
|
|
}
|
2011-05-10 09:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Affichage des différents liens d'administration
|
|
|
|
*/
|
2011-05-18 06:36:14 +00:00
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
$liens = array(
|
|
|
|
0 => array(
|
|
|
|
'libelle' => 'Gestion des clients',
|
|
|
|
'url' => $this->view->url(array('action'=>'clients')),
|
|
|
|
),
|
2011-07-11 09:46:40 +00:00
|
|
|
1 => array(
|
2011-08-08 09:24:05 +00:00
|
|
|
'libelle' => 'Créer un client',
|
|
|
|
'url' => $this->view->url(array('action'=>'client')),
|
2011-08-05 10:31:11 +00:00
|
|
|
),
|
|
|
|
2 => array(
|
2011-07-11 09:46:40 +00:00
|
|
|
'libelle' => 'Gestion des commandes',
|
|
|
|
'url' => $this->view->url(array('action'=>'commandes')),
|
|
|
|
),
|
2011-05-18 06:36:14 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$this->view->assign('Liens', $liens);
|
|
|
|
}
|
2011-05-10 09:52:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gestion des commandes de l'extranet
|
|
|
|
* Type : greffes | kbis | graydon | giant
|
|
|
|
*/
|
|
|
|
public function commandesAction()
|
|
|
|
{
|
2011-06-27 16:08:18 +00:00
|
|
|
$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');
|
2011-08-04 16:00:20 +00:00
|
|
|
$mode = $request->getParam('mode', '-');
|
2011-06-27 16:08:18 +00:00
|
|
|
$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');
|
2011-08-04 16:00:20 +00:00
|
|
|
$mode = $request->getParam('mode', '-');
|
2011-06-27 16:08:18 +00:00
|
|
|
$date = $request->getParam('date');
|
|
|
|
$login = $request->getParam('login');
|
|
|
|
|
2011-07-12 07:41:15 +00:00
|
|
|
if (empty($mode) && !empty($num)) $mode = substr($num,0,1);
|
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$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';
|
2011-07-12 07:41:15 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$gestionCommande = new GestionCommande();
|
2011-07-12 07:41:15 +00:00
|
|
|
|
|
|
|
//Liste des états possible pour les commandes
|
|
|
|
$status = $gestionCommande->listAllStatus();
|
2011-06-27 16:08:18 +00:00
|
|
|
$etatSelect = array();
|
|
|
|
$etatSelect[] = array('value'=>0, 'select'=>'', 'affichage'=>'');
|
|
|
|
foreach($status as $item){
|
|
|
|
$select = '';
|
|
|
|
if ($item['id']==$etat){
|
|
|
|
$select = ' selected';
|
|
|
|
}
|
2011-07-12 07:41:15 +00:00
|
|
|
$etatSelect[] = array(
|
|
|
|
'value'=>$item['id'],
|
|
|
|
'select'=>$select,
|
|
|
|
'affichage'=>$item['libStatut']
|
|
|
|
);
|
2011-06-27 16:08:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//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);
|
|
|
|
}
|
|
|
|
|
2011-07-12 07:41:15 +00:00
|
|
|
//Liste des différents états pour les commandes
|
2011-08-04 16:00:20 +00:00
|
|
|
if ($mode!='-'){
|
|
|
|
${'status'.$mode} = $gestionCommande->listStatus($mode);
|
|
|
|
} else {
|
|
|
|
foreach ($modeSelect as $item){
|
|
|
|
if($item['value']!='-'){
|
|
|
|
${'status'.$item['value']} = $gestionCommande->listStatus($item['value']);
|
|
|
|
}
|
|
|
|
}
|
2011-07-12 07:41:15 +00:00
|
|
|
}
|
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
//Parcours de la liste des commandes et vérification document existe
|
|
|
|
if (count($listCommandes)>0) {
|
2011-08-04 16:00:20 +00:00
|
|
|
for($i=0;$i<count($listCommandes);$i++)
|
|
|
|
{
|
|
|
|
//Etat de la commande
|
|
|
|
$cmdEtatSelect = array();
|
|
|
|
$cmdEtatSelect[] = array('value'=>0, 'select'=>'', 'affichage'=>'');
|
|
|
|
$typeCommande = $listCommandes[$i]['typeCommande'];
|
|
|
|
Zend_Registry::get('firebug')->info($typeCommande);
|
|
|
|
if (isset(${'status'.$typeCommande})){
|
|
|
|
foreach(${'status'.$typeCommande} as $item){
|
|
|
|
$select = '';
|
|
|
|
if ($item['id']==$listCommandes[$i]['statutCommande']){
|
|
|
|
$select = ' selected';
|
|
|
|
}
|
|
|
|
$cmdEtatSelect[] = array(
|
|
|
|
'value' => $item['id'],
|
|
|
|
'affichage' => $item['libStatut'],
|
|
|
|
'select' => $select,
|
|
|
|
);
|
|
|
|
}
|
2011-06-27 16:08:18 +00:00
|
|
|
}
|
2011-08-04 16:00:20 +00:00
|
|
|
$listCommandes[$i]['cmdEtatSelect'] = $cmdEtatSelect;
|
2011-06-27 16:08:18 +00:00
|
|
|
|
2011-08-04 16:00:20 +00:00
|
|
|
//Lien vers le fichier
|
2011-06-27 16:08:18 +00:00
|
|
|
$documentLien = '';
|
2011-08-04 16:00:20 +00:00
|
|
|
switch($type)
|
|
|
|
{
|
2011-06-27 16:08:18 +00:00
|
|
|
case 'greffe':
|
|
|
|
if (preg_match('/^([0-9a-zA-Z]{2}-).*?$/', $listCommandes[$i]['refDocument'], $matches)){
|
|
|
|
$documentLien = $this->view->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);
|
2011-05-10 09:52:12 +00:00
|
|
|
|
|
|
|
}
|
2011-08-19 15:32:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Modification de l'état d'une commande infogreffe
|
|
|
|
*/
|
2011-08-04 16:00:20 +00:00
|
|
|
public function commandesetatchangeAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$etat = $request->getParam('etat');
|
|
|
|
$idCommande = $request->getParam('idCommande');
|
|
|
|
|
|
|
|
require_once 'Scores/GestionCommandes.php';
|
|
|
|
$commande = new GestionCommande();
|
|
|
|
echo $commande->changeEtat($idCommande, $etat);
|
|
|
|
}
|
|
|
|
|
2011-08-19 15:32:48 +00:00
|
|
|
/**
|
|
|
|
* Affichage de la raison sociale à partir du siren
|
|
|
|
*/
|
2011-06-27 16:08:18 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
/**
|
|
|
|
* 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();
|
2011-06-08 12:13:31 +00:00
|
|
|
$reponse = $ws->getListeClients();
|
2011-05-10 09:52:12 +00:00
|
|
|
$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();
|
2011-06-08 12:13:31 +00:00
|
|
|
$idClient = $request->getParam('idClient', false);
|
2011-05-10 09:52:12 +00:00
|
|
|
$titre = 'CREATION NOUVEAU CLIENT';
|
|
|
|
$submitValue = 'Créer le client';
|
2011-06-08 12:13:31 +00:00
|
|
|
if ($idClient!==false){
|
2011-05-10 09:52:12 +00:00
|
|
|
$ws = new WsScores();
|
|
|
|
$reponse = $ws->getListeClients($idClient);
|
2011-06-08 12:13:31 +00:00
|
|
|
$InfosClient = $reponse->result->item[0];
|
2011-05-10 09:52:12 +00:00
|
|
|
$titre = 'EDITION CLIENT';
|
|
|
|
$submitValue = 'Modifier le client';
|
|
|
|
}
|
2011-06-08 12:13:31 +00:00
|
|
|
$ws = new WsScores();
|
2011-05-10 09:52:12 +00:00
|
|
|
$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()
|
|
|
|
{
|
2011-06-29 08:18:24 +00:00
|
|
|
$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());
|
2011-05-10 09:52:12 +00:00
|
|
|
}
|
|
|
|
|
2011-02-21 08:45:13 +00:00
|
|
|
|
|
|
|
}
|