2011-02-21 08:45:13 +00:00
|
|
|
<?php
|
|
|
|
class DashboardController extends Zend_Controller_Action
|
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
protected $typeActes= array(
|
2011-12-07 09:13:40 +00:00
|
|
|
'a00' => 'MODIFICATION',
|
|
|
|
'a01' => 'MODIFICATION',
|
|
|
|
'a02' => 'DISSOLUTION',
|
|
|
|
'a03' => 'CONSTITUTION',
|
|
|
|
'a04' => 'STATUTS CONSTITUTIFS',
|
|
|
|
'a06' => 'STATUTS A JOUR',
|
|
|
|
'a07' => 'STATUTS A JOUR',
|
|
|
|
'a08' => 'STATUTS A JOUR ET DECLARATION DE CONFORMITE',
|
|
|
|
'a09' => 'STATUTS APRES TRANSFERT DE SIEGE',
|
|
|
|
'a1D' => 'AUGMENTATION ET REDUCTION CAPITAL',
|
|
|
|
'a25' => 'AUGMENTATION DE CAPITAL',
|
|
|
|
'a26' => 'REDUCTION DE CAPITAL',
|
2012-09-13 14:43:14 +00:00
|
|
|
'a31' => 'TRANSFERT SIEGE SOCIAL HORS RESSORT',
|
2011-12-07 09:13:40 +00:00
|
|
|
'a33' => 'CHANGEMENT DE GERANT',
|
|
|
|
'a39' => 'CHANGEMENT DE COMMISSAIRE AUX COMPTES',
|
|
|
|
'a77' => 'CONTINUATION MALGRE LA PERTE DE LA MOITIE DU CAPITAL',
|
|
|
|
'aA1' => 'STATUTS',
|
|
|
|
'aAA' => 'ACTE',
|
|
|
|
'aAB' => 'ACTE MODIFICATIF',
|
|
|
|
'aAC' => 'ACTE RECTIFICATIF',
|
|
|
|
'aAD' => 'ACTE SOUS SEING PRIVE',
|
|
|
|
'aAE' => 'AMPLIATION',
|
|
|
|
'aAG' => 'AVENANT',
|
|
|
|
'aAH' => 'AVENANT AUX STATUTS',
|
|
|
|
'aAI' => 'ATTESTATION',
|
|
|
|
'aAJ' => 'ANNEXES',
|
|
|
|
'aAK' => 'ATTESTATION BANCAIRE',
|
|
|
|
'aAP' => 'PROJET APPORT PARTIEL D",ACTIF',
|
|
|
|
'aAT' => 'DELIVRANCE DE L",INFORMATION FAITE AU CONJOINT SUR LES CONSEQUENCES DES DETTES',
|
|
|
|
'aCA' => 'CERTIFICAT',
|
|
|
|
'aCB' => 'COMPTES DE CLOTURE DE LIQUIDATION',
|
|
|
|
'aCD' => 'CONTRAT',
|
|
|
|
'aCE' => 'CONVENTION',
|
|
|
|
'aCF' => 'CERTIFICAT DE SOUSCRIPTION D",ACTIONS',
|
|
|
|
'aDA' => 'DECISION DE GERANCE',
|
|
|
|
'aDB' => 'DECISION DE L",ASSOCIE UNIQUE',
|
|
|
|
'aDC' => 'DECISION DES ASSOCIES',
|
|
|
|
'aDE' => 'DECLARATION DE CONFORMITE',
|
|
|
|
'aDF' => 'DECLARATION DE SOUSCRIPTION ET DE VERSEMENT',
|
|
|
|
'aDH' => 'DECLARATION DE CONFORMITE (ART.374 L24/07/1966)',
|
|
|
|
'aDI' => 'DECISION DE L",ACTIONNAIRE UNIQUE',
|
|
|
|
'aDP' => 'DECISION DU PRESIDENT',
|
|
|
|
'aEA' => 'EXPEDITION',
|
|
|
|
'aEB' => 'EXPEDITION NOTARIEE',
|
|
|
|
'aEC' => 'EXTRAIT DU PROCES-VERBAL',
|
|
|
|
'aFU' => 'PROJET DE FUSION',
|
|
|
|
'aIF' => 'PROJET APPORT PARTIEL D",ACTIF',
|
|
|
|
'aJA' => 'JUGEMENT',
|
|
|
|
'aLA' => 'LETTRE',
|
|
|
|
'aLB' => 'LISTE DES SIEGES SOCIAUX ANTERIEURS',
|
|
|
|
'aLC' => 'LETTRE DE DEMISSION',
|
|
|
|
'aLD' => 'LETTRE DE NOMINATION',
|
|
|
|
'aLF' => 'LISTE DES SOUSCRIPTEURS',
|
|
|
|
'aLS' => 'CERTIFICAT DE DEPOT DES FONDS AVEC LISTE DES SOUSCRIPTEURS',
|
|
|
|
'aNA' => 'NOMINATION DE REPRESENTANT',
|
|
|
|
'aO9' => 'NOMINATION DE GERANT(S)',
|
|
|
|
'aOA' => 'ORDONNANCE',
|
|
|
|
'aOB' => 'ORDONNANCE DE REFERE',
|
|
|
|
'aOC' => 'ORDONNANCE DU PRESIDENT',
|
|
|
|
'aOD' => 'ORDONNANCE SUR REQUETE',
|
|
|
|
'aOE' => 'ORDONNANCE',
|
|
|
|
'aPA' => 'PROCES VERBAL',
|
|
|
|
'aPC' => 'PROCES VERBAL D",ASSEMBLEE CONSTITUTIVE',
|
|
|
|
'aPD' => 'PROCES VERBAL D",ASSEMBLEE DU DIRECTOIRE',
|
|
|
|
'aPE' => 'PROCES VERBAL D",ASSEMBLEE GENERALE',
|
|
|
|
'aPF' => 'PROCES VERBAL D",ASSEMBLEE GENERALE EXTRAORDINAIRE',
|
|
|
|
'aPG' => 'PROCES VERBAL D",ASSEMBLEE GENERALE ORDINAIRE',
|
|
|
|
'aPH' => 'PROCES VERBAL D",ASSEMBLEE MIXTE',
|
|
|
|
'aPI' => 'PROCES VERBAL D",ASSEMBLEES ORDINAIRE ET EXTRAORDINAIRE',
|
|
|
|
'aPL' => 'PROCES VERBAL DIRIGEANT SOCIAL',
|
|
|
|
'aPM' => 'PROCES VERBAL DU CONSEIL D",ADMINISTRATION',
|
|
|
|
'aPN' => 'PROCES VERBAL DU CONSEIL DE SURVEILLANCE',
|
|
|
|
'aPO' => 'PROCES VERBAL DE LA GERANCE',
|
|
|
|
'aPT' => 'PROJET DE TRAITE D",APPORT',
|
|
|
|
'aPU' => 'PROJET DE FUSION',
|
|
|
|
'aPV' => 'PV D",ASSEMBLEE',
|
|
|
|
'aQ2' => 'CONSTITUTION DE LA SOCIETE',
|
|
|
|
'aR1' => 'CESSION DE PARTS (OU DONATION)',
|
|
|
|
'aR4' => 'TRAITE DE FUSION',
|
|
|
|
'aRA' => 'RAPPORT',
|
|
|
|
'aRB' => 'RAPPORT COMMISSAIRE AUX COMPTES',
|
|
|
|
'aRC' => 'RAPPORT COMMISSAIRE FUSION',
|
|
|
|
'aRE' => 'RAPPORT CR/CPTES TRANSFORM. STE',
|
|
|
|
'aRG' => 'RAPPORT DU COMMISSAIRE A LA FUSION',
|
|
|
|
'aRH' => 'RAPPORT DU COMMISSAIRE A LA SCISSION',
|
|
|
|
'aRI' => 'RAPPORT DU COMMISSAIRE A LA TRANSFORMATION',
|
|
|
|
'aRK' => 'RAPPORT DU COMMISSAIRE AUX APPORTS',
|
|
|
|
'aRL' => 'RAPPORT DU COMMISSAIRE AUX APPORTS ET A LA FUSION',
|
|
|
|
'aRQ' => 'RAPPORT GERANCE',
|
|
|
|
'aRS' => 'RAPPORT SPECIAL DU CONSEIL D",ADMINISTRATION',
|
|
|
|
'aRU' => 'PROJET',
|
|
|
|
'aTA' => 'TRAITE',
|
|
|
|
'aTB' => 'TRAITE D",APPORT-FUSION',
|
|
|
|
'aTC' => 'TRAITE DE FUSION',
|
|
|
|
'aUA' => 'ATTESTATION DU CONJOINT COMMUN EN BIENS',
|
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-06-17 13:38:59 +00:00
|
|
|
/**
|
|
|
|
* Return a ramdom password
|
|
|
|
* @param int $length
|
|
|
|
* Length of the string
|
|
|
|
* @param int $strength
|
|
|
|
* $strength = 1:- 0-9
|
|
|
|
* $strength = 2:- A-Z0-9
|
|
|
|
* $strength = 3:- A-Za-z0-9
|
|
|
|
* $strength = 4:- A-Za-z0-9 and # $ % &
|
|
|
|
* $strength = 5:- A-Za-z0-9 and # $ % & = > ? @
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
protected function randomPassword($length,$strength)
|
|
|
|
{
|
|
|
|
$char_sets=array('48-57','65-90','97-122','35-38','61-64');
|
|
|
|
$new_password='';
|
|
|
|
srand(microtime()*10000000);
|
|
|
|
for($i=0;$i<$length;$i++){
|
|
|
|
$random=rand(0,$strength-1);
|
|
|
|
list($start,$end)=explode('-',$char_sets[$random]);
|
|
|
|
$new_password.=chr(rand($start,$end));
|
|
|
|
}
|
|
|
|
return $new_password;
|
|
|
|
}
|
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
require_once 'Scores/WsScores.php';
|
2011-12-07 09:13:40 +00:00
|
|
|
require_once 'common/dates.php';
|
2011-05-17 12:42:57 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-17 12:42:57 +00:00
|
|
|
public function preDispatch()
|
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2011-05-17 12:42:57 +00:00
|
|
|
if (!$user->checkModeEdition() && $user->getIdClient()!=1 ){
|
|
|
|
$this->_forward('perms', 'error');
|
|
|
|
}
|
2011-05-10 09:52:12 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
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(
|
|
|
|
'libelle' => 'Gestion des commandes',
|
|
|
|
'url' => $this->view->url(array('action'=>'commandes')),
|
|
|
|
),
|
2012-11-19 15:53:10 +00:00
|
|
|
2 => array(
|
|
|
|
'libelle' => 'Gestion des fichiers nouveautés',
|
|
|
|
'url' => $this->view->url(array('action'=>'newform')),
|
2012-03-14 08:23:19 +00:00
|
|
|
),
|
2013-05-14 09:32:08 +00:00
|
|
|
3 => array(
|
|
|
|
'libelle' => 'Statistiques',
|
|
|
|
'url' => $this->view->url(array('action'=>'stat')),
|
|
|
|
),
|
2011-05-18 06:36:14 +00:00
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-18 06:36:14 +00:00
|
|
|
$this->view->assign('Liens', $liens);
|
|
|
|
}
|
2013-05-15 18:45:06 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
/**
|
|
|
|
* Créer des graphiques pour les statistiques
|
|
|
|
* @param array $data
|
|
|
|
* @param array $labels
|
|
|
|
* @param string $name
|
|
|
|
*/
|
|
|
|
protected function statChart($data, $labels, $name)
|
|
|
|
{
|
|
|
|
require_once("Vendors/ChartDirector/phpchartdir.php");
|
2013-05-15 18:45:06 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
$hChart = 210;
|
2013-05-15 18:45:06 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
$c = new PieChart($hChart*3, $hChart);
|
|
|
|
$c->setPieSize($hChart/2, $hChart/2, $hChart/3);
|
|
|
|
$c->set3D(10);
|
|
|
|
$c->setData($data, $labels);
|
|
|
|
$c->setSectorStyle(LocalGradientShading);
|
|
|
|
$c->setLabelLayout(SideLayout, 16);
|
|
|
|
$c->setLabelFormat("{={sector}+1}");
|
|
|
|
|
|
|
|
$textBoxObj = $c->setLabelStyle("arial.ttf", 10);
|
|
|
|
$textBoxObj->setBackground(Transparent);
|
2013-05-15 18:45:06 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
$b = $c->addLegend($hChart*1.5, $hChart/2, true, "arial.ttf", 10);
|
|
|
|
$b->setAlignment(Left);
|
|
|
|
$b->setBackground(Transparent, 0xaaaaaa);
|
|
|
|
$b->setRoundedCorners();
|
|
|
|
$b->setMargin(16);
|
|
|
|
$b->setKeySpacing(0, 4);
|
|
|
|
$b->setKeyBorder(SameAsMainColor);
|
|
|
|
$b->setText(
|
|
|
|
"<*block,valign=top*>{={sector}+1}.<*advanceTo=22*><*block,width=120*>{label}".
|
|
|
|
"<*/*><*block,width=40,halign=right*>{percent}<*/*>%");
|
2013-05-15 18:45:06 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
$fChart = fopen('themes/default/images/charts/chart-'.$name.'.png', "w");
|
|
|
|
fwrite($fChart, $c->makeChart2('png'));
|
|
|
|
fclose($fChart);
|
|
|
|
}
|
2013-05-15 18:45:06 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
/**
|
|
|
|
* Affichage des statistiques des clients
|
|
|
|
*/
|
|
|
|
public function statAction()
|
|
|
|
{
|
|
|
|
$client_stat = new Application_Model_ClientStat();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
$statTypes = array('Navigateur'=>'browserName', 'Résolution d\'écran'=>'screenSize', 'Type d\'appareil'=>'isMobile');
|
2013-05-15 18:45:06 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
while($statType = current($statTypes)) {
|
|
|
|
$sql = $client_stat->select($statType)
|
|
|
|
->group($statType);
|
|
|
|
$rows = $client_stat->fetchAll($sql);
|
2013-05-15 18:45:06 +00:00
|
|
|
$i=0;
|
2013-05-14 09:32:08 +00:00
|
|
|
$values = array();
|
|
|
|
$keys = array();
|
|
|
|
foreach ($rows as $item) {
|
|
|
|
$isMobile = ($statType=='isMobile')?(($item->$statType==0)?'Ordinateur':'Mobile'):$item->$statType;
|
|
|
|
$values[$i] = $isMobile;
|
|
|
|
$keys[$i] = $client_stat->statCnt($statType, $item->$statType);
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
$this->statChart($keys, $values, $statType);
|
2013-05-15 18:45:06 +00:00
|
|
|
|
2013-05-14 09:32:08 +00:00
|
|
|
next($statTypes);
|
|
|
|
}
|
|
|
|
$this->view->assign('statTypes', $statTypes);
|
|
|
|
}
|
2013-05-15 18:45:06 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
/**
|
|
|
|
* Gestion des commandes de l'extranet
|
|
|
|
* Type : greffes | kbis | graydon | giant
|
|
|
|
*/
|
|
|
|
public function commandesAction()
|
|
|
|
{
|
2012-11-20 07:33:06 +00:00
|
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
|
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$type = $request->getParam('type', '');
|
2011-12-13 11:29:10 +00:00
|
|
|
$date = $request->getParam('date', mktime(0, 0, 0, date('n'), 1, date('Y')));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
$user = new Scores_Utilisateur();
|
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$typesCommande = array('kbis', 'greffes');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-13 11:29:10 +00:00
|
|
|
if (in_array($type, $typesCommande))
|
|
|
|
{
|
2011-06-27 16:08:18 +00:00
|
|
|
require_once 'Scores/GestionCommandes.php';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-13 11:29:10 +00:00
|
|
|
//Valeur pour la sélection des dates
|
|
|
|
$dateSelect = array();
|
|
|
|
$dateToday = date('m');
|
|
|
|
$dateIntervalle = 12;
|
|
|
|
if ($user->checkModeEdition()){
|
|
|
|
$dateIntervalle = 24;
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
for($i=$dateToday-$dateIntervalle; $i<=$dateToday; $i++)
|
2011-12-13 11:29:10 +00:00
|
|
|
{
|
|
|
|
$dateTime = mktime(0, 0, 0, $i, 1, date('Y'));
|
|
|
|
$selected = '';
|
|
|
|
if ($dateTime==$date){
|
|
|
|
$selected = 'selected';
|
|
|
|
}
|
|
|
|
$dateSelect[] = array(
|
|
|
|
'value' => $dateTime,
|
|
|
|
'select' => $selected,
|
|
|
|
'affichage' => date('m/Y', $dateTime)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
$this->view->assign('dateSelect', $dateSelect);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-13 11:29:10 +00:00
|
|
|
switch($type)
|
|
|
|
{
|
2011-06-27 16:08:18 +00:00
|
|
|
case 'kbis':
|
|
|
|
$num = $request->getParam('num');
|
2011-12-15 09:32:15 +00:00
|
|
|
$num = str_replace(' ', '', strtoupper($num));
|
2011-06-27 16:08:18 +00:00
|
|
|
$etat = $request->getParam('etat');
|
2011-12-13 11:29:10 +00:00
|
|
|
$mode = $request->getParam('mode', 'M');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$modeSelect = array(
|
2011-12-13 11:29:10 +00:00
|
|
|
'C' => array('value' => 'C', 'select' => '', 'affichage' => 'courrier S&D'),
|
|
|
|
'M' => array('value' => 'M', 'select' => '', 'affichage' => 'e-mail'),
|
2011-06-27 16:08:18 +00:00
|
|
|
);
|
|
|
|
$modeSelect[$mode]['select'] = ' selected';
|
|
|
|
$gestionCommande = new GestionCommande();
|
2011-12-13 11:29:10 +00:00
|
|
|
$status = $gestionCommande->listStatus($mode);
|
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';
|
|
|
|
}
|
|
|
|
$etatSelect[] = array('value'=>$item['id'], 'select'=>$select, 'affichage'=>$item['libStatut']);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-13 11:29:10 +00:00
|
|
|
${'status'.$mode} = $gestionCommande->listStatus($mode);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$this->view->assign('etatSelect', $etatSelect);
|
|
|
|
$this->view->assign('modeSelect', $modeSelect);
|
|
|
|
$this->view->assign('num', $num);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
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);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-07 12:34:01 +00:00
|
|
|
//Parcours de la liste des commandes et vérification document existe
|
|
|
|
if (count($listCommandes)>0) {
|
|
|
|
for($i=0;$i<count($listCommandes);$i++)
|
|
|
|
{
|
|
|
|
//Etat de la commande
|
|
|
|
$cmdEtatSelect = array();
|
|
|
|
$cmdEtatSelect[] = array('value'=>0, 'select'=>'', 'affichage'=>'');
|
|
|
|
$typeCommande = $listCommandes[$i]->type;
|
|
|
|
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,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$listCommandes[$i]->cmdEtatSelect = $cmdEtatSelect;
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
break; //Fin Gestion Kbis
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
case 'greffes':
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$num = $request->getParam('num');
|
2011-12-15 09:32:15 +00:00
|
|
|
$num = str_replace(' ', '', strtoupper($num));
|
2011-06-27 16:08:18 +00:00
|
|
|
$etat = $request->getParam('etat');
|
2011-12-13 11:29:10 +00:00
|
|
|
$mode = $request->getParam('mode', 'G');
|
2011-06-27 16:08:18 +00:00
|
|
|
$login = $request->getParam('login');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-12 07:41:15 +00:00
|
|
|
if (empty($mode) && !empty($num)) $mode = substr($num,0,1);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$modeSelect = array(
|
2011-12-13 11:29:10 +00:00
|
|
|
'G' => array('value' => 'G', 'select' => '', 'affichage' => 'courrier infogreffe'),
|
|
|
|
'C' => array('value' => 'C', 'select' => '', 'affichage' => 'courrier S&D'),
|
|
|
|
'M' => array('value' => 'M', 'select' => '', 'affichage' => 'e-mail'),
|
2011-06-27 16:08:18 +00:00
|
|
|
);
|
|
|
|
$modeSelect[$mode]['select'] = ' selected';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$gestionCommande = new GestionCommande();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-12 07:41:15 +00:00
|
|
|
//Liste des états possible pour les commandes
|
2011-12-13 11:29:10 +00:00
|
|
|
$status = $gestionCommande->listStatus($mode);
|
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(
|
2012-05-20 16:31:28 +00:00
|
|
|
'value' => $item['id'],
|
|
|
|
'select' => $select,
|
2011-12-07 09:44:35 +00:00
|
|
|
'affichage' => $item['libStatut']
|
2011-07-12 07:41:15 +00:00
|
|
|
);
|
2011-06-27 16:08:18 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$this->view->assign('etatSelect', $etatSelect);
|
|
|
|
$this->view->assign('modeSelect', $modeSelect);
|
|
|
|
$this->view->assign('num', $num);
|
|
|
|
$this->view->assign('login', $login);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
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)) {
|
2011-08-22 07:59:00 +00:00
|
|
|
$listCommandes = $gestionCommande->listCommandesGreffeByLogin($login, $date);
|
2011-06-27 16:08:18 +00:00
|
|
|
} elseif (!empty($date)) {
|
|
|
|
$listCommandes = $gestionCommande->listCommandesGreffe($date, $etat, $mode);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-12 07:41:15 +00:00
|
|
|
//Liste des différents états pour les commandes
|
2011-12-13 11:29:10 +00:00
|
|
|
${'status'.$mode} = $gestionCommande->listStatus($mode);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
//Parcours de la liste des commandes et vérification document existe
|
2012-05-20 16:31:28 +00:00
|
|
|
if (count($listCommandes)>0)
|
2011-12-13 11:29:10 +00:00
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
for($i=0;$i<count($listCommandes);$i++)
|
|
|
|
{
|
2011-08-04 16:00:20 +00:00
|
|
|
//Etat de la commande
|
|
|
|
$cmdEtatSelect = array();
|
|
|
|
$cmdEtatSelect[] = array('value'=>0, 'select'=>'', 'affichage'=>'');
|
2011-12-07 08:26:18 +00:00
|
|
|
$typeCommande = $listCommandes[$i]->typeCommande;
|
2011-08-04 16:00:20 +00:00
|
|
|
if (isset(${'status'.$typeCommande})){
|
|
|
|
foreach(${'status'.$typeCommande} as $item){
|
|
|
|
$select = '';
|
2011-12-07 08:26:18 +00:00
|
|
|
if ($item['id']==$listCommandes[$i]->statutCommande){
|
2012-05-20 16:31:28 +00:00
|
|
|
$select = ' selected';
|
2011-08-04 16:00:20 +00:00
|
|
|
}
|
|
|
|
$cmdEtatSelect[] = array(
|
2012-05-20 16:31:28 +00:00
|
|
|
'value' => $item['id'],
|
2011-08-04 16:00:20 +00:00
|
|
|
'affichage' => $item['libStatut'],
|
|
|
|
'select' => $select,
|
|
|
|
);
|
|
|
|
}
|
2011-06-27 16:08:18 +00:00
|
|
|
}
|
2011-12-07 08:26:18 +00:00
|
|
|
$listCommandes[$i]->cmdEtatSelect = $cmdEtatSelect;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-04 16:00:20 +00:00
|
|
|
//Lien vers le fichier
|
2011-06-27 16:08:18 +00:00
|
|
|
$documentLien = '';
|
2011-12-07 09:13:40 +00:00
|
|
|
$document = '';
|
2011-12-07 09:44:35 +00:00
|
|
|
$sirenLien = '';
|
2011-08-04 16:00:20 +00:00
|
|
|
switch($type)
|
|
|
|
{
|
2011-12-07 09:13:40 +00:00
|
|
|
case 'greffes':
|
2012-06-12 08:43:21 +00:00
|
|
|
if (preg_match('/^([0-9a-zA-Z]{2,}-).*?$/', $listCommandes[$i]->refDocument, $matches)){
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-07 09:13:40 +00:00
|
|
|
if (substr($listCommandes[$i]->refDocument,0,3)=='ST-'){
|
|
|
|
$document = 'DERNIER STATUS À JOUR';
|
|
|
|
} else {
|
|
|
|
$explodedRef = explode('-', $listCommandes[$i]->refDocument);
|
|
|
|
$dateref = WDate::dateT('Ymd','d/m/Y',$explodedRef[1]);
|
|
|
|
$depot = ', Dépôt n°'.$explodedRef[6].' au '.$dateref;
|
|
|
|
$document = $this->typeActes['a'.substr($listCommandes[$i]->refDocument,0,2)].$depot;
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-05 15:33:01 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
2012-11-16 14:12:03 +00:00
|
|
|
$refFile = realpath($c->profil->path->data).'/pdf/acte-'.
|
2011-12-07 09:44:35 +00:00
|
|
|
$listCommandes[$i]->siren.'-'.
|
|
|
|
trim($listCommandes[$i]->refDocument).'.pdf';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-07 09:44:35 +00:00
|
|
|
if (file_exists($refFile)) {
|
2012-11-05 14:35:10 +00:00
|
|
|
$document = '<a href="/fichier/pdf/acte-'.
|
2011-12-07 09:44:35 +00:00
|
|
|
$listCommandes[$i]->siren.'-'.
|
|
|
|
trim($listCommandes[$i]->refDocument).'.pdf'.
|
2012-05-20 16:31:28 +00:00
|
|
|
'" target="_blank">'.$document.'</a>';
|
2011-12-07 09:44:35 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-07 09:44:35 +00:00
|
|
|
$sirenLien = $this->view->url(array(
|
2011-06-27 16:08:18 +00:00
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'actes',
|
2011-12-07 09:13:40 +00:00
|
|
|
'siret' => $listCommandes[$i]->siren,
|
2011-12-07 09:44:35 +00:00
|
|
|
), null, true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-07 08:26:18 +00:00
|
|
|
} elseif (preg_match('/^([0-9]{4}).*?$/', $listCommandes[$i]->refDocument, $matches)){
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
$document = 'Bilan de '.$matches[1];
|
|
|
|
|
2012-11-02 21:45:08 +00:00
|
|
|
require_once 'Infogreffe/Infogreffe.php';
|
2012-11-02 20:26:44 +00:00
|
|
|
$infogreffe = new Infogreffe();
|
|
|
|
$path = $infogreffe->bilanPath($listCommandes[$i]->refDocument);
|
|
|
|
$fichier = $infogreffe->bilanFilename($listCommandes[$i]->siren, $listCommandes[$i]->refDocument);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-13 11:38:22 +00:00
|
|
|
if(file_exists($refFile)){
|
2012-11-05 14:35:10 +00:00
|
|
|
$document = '<a href="/fichier/pdf/'.$fichier.'" target="_blank">'.$document.'</a>';
|
2011-12-07 09:44:35 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-07 09:44:35 +00:00
|
|
|
$sirenLien = $this->view->url(array(
|
2011-06-27 16:08:18 +00:00
|
|
|
'controller' => 'pieces',
|
|
|
|
'action' => 'bilans',
|
2011-12-07 09:13:40 +00:00
|
|
|
'siret' => $listCommandes[$i]->siren,
|
2011-12-07 09:44:35 +00:00
|
|
|
), null, true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2011-12-07 09:13:40 +00:00
|
|
|
$listCommandes[$i]->document = $document;
|
2011-12-07 08:26:18 +00:00
|
|
|
$listCommandes[$i]->documentLien = $documentLien;
|
2011-12-07 09:44:35 +00:00
|
|
|
$listCommandes[$i]->sirenLien = $sirenLien;
|
2011-06-27 16:08:18 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
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);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +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);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-04 16:00:20 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$etat = $request->getParam('etat');
|
|
|
|
$idCommande = $request->getParam('idCommande');
|
2011-12-13 15:42:00 +00:00
|
|
|
$mode = $request->getParam('mode', 'C');
|
|
|
|
$type = $request->getParam('type');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-12-13 15:42:00 +00:00
|
|
|
require_once 'Scores/GestionCommandes.php';
|
2012-05-20 16:31:28 +00:00
|
|
|
$commande = new GestionCommande();
|
2011-12-13 15:42:00 +00:00
|
|
|
if ($type == 'kbis'){
|
2012-05-20 16:31:28 +00:00
|
|
|
echo $commande->changeEtatKbis($idCommande, $etat, $mode);
|
2011-12-13 15:42:00 +00:00
|
|
|
} elseif ($type == 'greffe') {
|
|
|
|
echo $commande->changeEtatGreffe($idCommande, $etat, $mode);
|
|
|
|
}
|
2011-08-04 16:00:20 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
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);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$siren = $request->getParam('siren');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-27 16:08:18 +00:00
|
|
|
$ws = new WsScores();
|
|
|
|
$infos = $ws->getIdentite($siren);
|
|
|
|
if ($infos==false) {
|
|
|
|
echo 'Erreur';
|
|
|
|
} else {
|
|
|
|
echo $infos->Nom;
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
/**
|
|
|
|
* Génération automatique du courrier PDF / ODT
|
|
|
|
*/
|
|
|
|
public function courrierAction()
|
|
|
|
{
|
2011-08-22 07:59:00 +00:00
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-22 13:30:32 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$numCommande = $request->getParam('commande');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-22 13:30:32 +00:00
|
|
|
require_once 'GenCourrier/GenCourrier.php';
|
2012-05-20 16:31:28 +00:00
|
|
|
$courrier = new GenCourrier($numCommande);
|
|
|
|
|
2011-08-22 13:30:32 +00:00
|
|
|
$courrier->computeOdt();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
/**
|
|
|
|
* Liste les clients
|
|
|
|
*/
|
|
|
|
public function clientsAction()
|
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2011-10-27 10:10:30 +00:00
|
|
|
if ( !$user->isSuperAdmin() ){
|
|
|
|
$this->_forward('perms', 'error');
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2013-03-06 10:04:28 +00:00
|
|
|
$this->view->headScript()
|
|
|
|
->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
|
2012-11-20 07:33:06 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
$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;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
$reponse = $ws->getListeDroits();
|
|
|
|
$wsdroits = $reponse->item;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
$this->view->assign('ListeClients', $listeClients);
|
|
|
|
$this->view->assign('wsdroits', $wsdroits);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
/**
|
|
|
|
* Edition ou création d'un nouveau client
|
|
|
|
*/
|
|
|
|
public function clientAction()
|
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2012-06-17 13:38:59 +00:00
|
|
|
if ( !$user->isSuperAdmin() ) {
|
2011-10-27 10:10:30 +00:00
|
|
|
$this->_forward('perms', 'error');
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-23 10:55:01 +00:00
|
|
|
$this->view->headScript()->appendFile('/libs/checkbox/jquery.checkbox.js', 'text/javascript');
|
|
|
|
$this->view->headLink()->appendStylesheet('/libs/checkbox/jquery.checkbox.css', 'all');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
$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';
|
2012-09-21 14:07:41 +00:00
|
|
|
$ws = new WsScores();
|
2011-06-08 12:13:31 +00:00
|
|
|
if ($idClient!==false){
|
2011-05-10 09:52:12 +00:00
|
|
|
$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';
|
|
|
|
}
|
|
|
|
$reponse = $ws->getListeDroits();
|
2012-09-21 14:07:41 +00:00
|
|
|
$wsdroits = array();
|
|
|
|
foreach ($reponse->item as $tmp) {
|
|
|
|
$wsdroits[$tmp->code] = $tmp->desc;
|
|
|
|
}
|
|
|
|
$this->view->assign('wsdroits', $wsdroits);
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-09-21 14:07:41 +00:00
|
|
|
$reponse = $ws->getCategory();
|
|
|
|
$wscategory = $reponse->item;
|
|
|
|
$this->view->assign('wscategory', $wscategory);
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
$this->view->assign('idClient', $idClient);
|
|
|
|
$this->view->assign('InfosClient', $InfosClient);
|
|
|
|
$this->view->assign('titre', $titre);
|
|
|
|
$this->view->assign('submitValue', $submitValue);
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-10 09:52:12 +00:00
|
|
|
/**
|
|
|
|
* Enregistre les informations sur le client
|
|
|
|
*/
|
|
|
|
public function clientsaveAction()
|
|
|
|
{
|
2011-06-29 08:18:24 +00:00
|
|
|
$request = $this->getRequest();
|
2011-10-06 15:05:22 +00:00
|
|
|
$infos = $request->getParams();
|
2011-06-29 08:18:24 +00:00
|
|
|
$ws = new WsScores();
|
2012-05-20 16:31:28 +00:00
|
|
|
$reponse = $ws->setClient($infos);
|
2011-06-29 08:18:24 +00:00
|
|
|
if ($reponse->error->errnum==1) {
|
2011-10-06 15:05:22 +00:00
|
|
|
$this->_forward('client', 'dashboard', null, array('idClient' => $infos['idClient']));
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
2011-06-29 08:18:24 +00:00
|
|
|
$this->view->assign('infos', $request->getParams());
|
2011-05-10 09:52:12 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-06-17 13:38:59 +00:00
|
|
|
public function usersAction()
|
|
|
|
{
|
|
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/user.css', 'all');
|
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$idClient = $request->getParam('idClient', $user->getIdClient());
|
2013-01-15 17:14:31 +00:00
|
|
|
$service = $request->getParam('service', null);
|
2012-11-19 15:53:10 +00:00
|
|
|
|
|
|
|
if (!$user->isSuperAdmin() && !$user->isAdmin()) {
|
|
|
|
$this->renderScript('error/perms.phtml');
|
|
|
|
}
|
|
|
|
if ($user->isAdmin()){
|
|
|
|
$idClient = $user->getIdClient();
|
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
$ws = new WsScores();
|
2013-01-15 17:14:31 +00:00
|
|
|
|
|
|
|
$services = $ws->getServices($idClient);
|
2013-05-15 18:45:06 +00:00
|
|
|
if (is_array($services)) {
|
|
|
|
$this->view->assign('services', $services->item);
|
|
|
|
} else {
|
|
|
|
$this->view->assign('services', array());
|
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
if ( null === $service ) {
|
|
|
|
$infos = $ws->getListeUtilisateurs($user->getLogin(), $idClient);
|
|
|
|
$utilisateurs = $infos->result->item;
|
|
|
|
} else {
|
|
|
|
$infos = $ws->getServiceUsers($idClient, $service);
|
|
|
|
$utilisateurs = $infos->item;
|
|
|
|
$this->view->assign('service', $service);
|
|
|
|
}
|
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
$this->view->assign('utilisateurs', $utilisateurs);
|
2012-06-17 13:38:59 +00:00
|
|
|
$this->view->assign('idClient', $idClient);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function userAction()
|
|
|
|
{
|
|
|
|
$this->view->headLink()
|
|
|
|
->appendStylesheet('/themes/default/styles/user.css', 'all')
|
2012-11-19 15:53:10 +00:00
|
|
|
->appendStylesheet('/themes/default/styles/form.css', 'all');
|
2012-06-17 13:38:59 +00:00
|
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/user.js', 'text/javascript');
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-06-17 13:38:59 +00:00
|
|
|
$op = $request->getParam('op');
|
|
|
|
$idClient = $request->getParam('idClient');
|
|
|
|
$login = $request->getParam('login');
|
|
|
|
|
2013-02-18 16:41:40 +00:00
|
|
|
if ($op=='save') {
|
|
|
|
|
|
|
|
$options = $request->getParam('frmOptions', '');
|
|
|
|
$action = $options['action'];
|
|
|
|
$idClient = $options['idClient'];
|
|
|
|
$login = $options['login'];
|
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
$ws = new WsScores();
|
|
|
|
$result = $ws->setInfosLogin($login, $action, $options);
|
|
|
|
if (is_string($result)) {
|
|
|
|
$this->view->assign('message',$result);
|
|
|
|
switch($action) {
|
|
|
|
case 'new': $op = 'new'; break;
|
|
|
|
case 'update': $op = 'edit'; break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$this->_redirect('/dashboard/users/idClient/'.$idClient);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-06-17 13:38:59 +00:00
|
|
|
switch($op) {
|
2013-02-18 16:41:40 +00:00
|
|
|
|
2012-06-17 13:38:59 +00:00
|
|
|
case 'new':
|
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
$ws = new WsScores();
|
|
|
|
|
2012-09-21 14:07:41 +00:00
|
|
|
//Liste des catégories d'accès
|
2012-11-19 15:53:10 +00:00
|
|
|
$reponse = $ws->getCategory();
|
|
|
|
$wscategory = $reponse->item;
|
2012-09-21 14:07:41 +00:00
|
|
|
$this->view->assign('wscategory', $wscategory);
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
//Liste de tous les droits
|
|
|
|
$listeDroits = $ws->getListeDroits();
|
|
|
|
$droitsLib = array();
|
|
|
|
foreach($listeDroits->item as $droit) {
|
|
|
|
$droitsLib[strtoupper($droit->code)] = $droit->desc;
|
|
|
|
}
|
|
|
|
$this->view->assign('droitsLib', $droitsLib);
|
|
|
|
|
|
|
|
//Liste de toutes les préférences
|
|
|
|
$listePrefs = $ws->getListePrefs();
|
|
|
|
$prefsLib = array();
|
|
|
|
foreach($listePrefs->item as $pref) {
|
|
|
|
$prefsLib[strtoupper($pref->code)] = $pref->desc;
|
|
|
|
}
|
2012-06-17 13:38:59 +00:00
|
|
|
$this->view->assign('prefsLib', $prefsLib);
|
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
$options['idClient'] = $idClient;
|
2012-06-17 13:38:59 +00:00
|
|
|
$this->view->assign('options', $options);
|
|
|
|
|
|
|
|
//Customer informations
|
2012-11-19 15:53:10 +00:00
|
|
|
$reponse = $ws->getNextLogin($idClient);
|
|
|
|
$this->view->assign('loginNew', $reponse->result->racine);
|
2012-08-16 11:37:59 +00:00
|
|
|
$this->view->assign('droitsClients', explode(' ', strtolower($reponse->result->droitsClients)));
|
2012-06-17 13:38:59 +00:00
|
|
|
|
|
|
|
$this->view->assign('password', $this->randomPassword(10, 3));
|
|
|
|
|
|
|
|
$this->view->assign('action', 'new');
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'edit':
|
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
$ws = new WsScores();
|
2012-09-21 14:07:41 +00:00
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
//Liste des catégories d'accès
|
|
|
|
$reponse = $ws->getCategory();
|
|
|
|
$wscategory = $reponse->item;
|
2012-09-21 14:07:41 +00:00
|
|
|
$this->view->assign('wscategory', $wscategory);
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
//Liste de tous les droits
|
|
|
|
$listeDroits = $ws->getListeDroits();
|
|
|
|
$droitsLib = array();
|
|
|
|
foreach($listeDroits->item as $droit) {
|
|
|
|
$droitsLib[strtoupper($droit->code)] = $droit->desc;
|
|
|
|
}
|
|
|
|
$this->view->assign('droitsLib', $droitsLib);
|
|
|
|
|
|
|
|
//Liste de toutes les préférences
|
|
|
|
$listePrefs = $ws->getListePrefs();
|
|
|
|
$prefsLib = array();
|
|
|
|
foreach($listePrefs->item as $pref) {
|
|
|
|
$prefsLib[strtoupper($pref->code)] = $pref->desc;
|
|
|
|
}
|
|
|
|
$this->view->assign('prefsLib', $prefsLib);
|
|
|
|
|
|
|
|
$options->idClient = $idClient;
|
|
|
|
$this->view->assign('options', $options);
|
|
|
|
|
|
|
|
//Customer informations
|
|
|
|
$reponse = $ws->getListeClients($idClient);
|
|
|
|
$InfosClient = $reponse->result->item[0];
|
|
|
|
$this->view->assign('loginNew', $InfosClient->racineLogin);
|
|
|
|
$this->view->assign('droitsClients', explode(' ', strtolower($InfosClient->droits)));
|
|
|
|
|
|
|
|
//User informations
|
2012-06-17 13:38:59 +00:00
|
|
|
$user = $ws->getUser($login);
|
|
|
|
$options = json_decode($user, true);
|
|
|
|
|
|
|
|
Zend_Registry::get('firebug')->info($user);
|
|
|
|
|
|
|
|
$this->view->assign('droits', explode(' ',$options['droits']));
|
|
|
|
$this->view->assign('prefs', explode(' ',$options['pref']));
|
2012-11-19 15:53:10 +00:00
|
|
|
$this->view->assign('options', $options);
|
|
|
|
|
2012-08-07 09:44:27 +00:00
|
|
|
$this->view->assign('action', 'update');
|
2012-06-17 13:38:59 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
case 'delete':
|
|
|
|
$action = 'delete';
|
2012-06-17 13:38:59 +00:00
|
|
|
require_once 'Scores/WsScores.php';
|
2012-11-19 15:53:10 +00:00
|
|
|
$ws = new WsScores();
|
|
|
|
$ws->setInfosLogin($login, $action);
|
2012-06-17 13:38:59 +00:00
|
|
|
//Redirect
|
|
|
|
$this->_redirect('/dashboard/users/idClient/'.$idClient);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'enable':
|
2012-11-19 15:53:10 +00:00
|
|
|
$action = 'enable';
|
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
$ws = new WsScores();
|
|
|
|
$ws->setInfosLogin($login, $action);
|
|
|
|
//Redirect
|
2012-06-17 13:38:59 +00:00
|
|
|
$this->_redirect('/dashboard/users/idClient/'.$idClient);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'disable':
|
2012-11-19 15:53:10 +00:00
|
|
|
$action = 'disable';
|
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
$ws = new WsScores();
|
|
|
|
$ws->setInfosLogin($login, $action);
|
|
|
|
//Redirect
|
2012-06-17 13:38:59 +00:00
|
|
|
$this->_redirect('/dashboard/users/idClient/'.$idClient);
|
|
|
|
break;
|
|
|
|
}
|
2013-03-06 10:04:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function userserviceAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$submit = $request->getParam('submit', null);
|
|
|
|
$idClient = $request->getParam('idClient');
|
|
|
|
|
|
|
|
$service = $request->getParam('service');
|
|
|
|
$this->view->assign('service', $service);
|
|
|
|
|
|
|
|
$login = $request->getParam('login');
|
|
|
|
$this->view->assign('login', $login);
|
|
|
|
|
|
|
|
$ws = new WsScores();
|
|
|
|
if ( $request->isPost() && null!==$submit ) {
|
|
|
|
$ws->setUserService($login, $service);
|
|
|
|
} else {
|
|
|
|
$services = $ws->getServices($idClient);
|
|
|
|
$this->view->assign('services', $services->item);
|
|
|
|
}
|
|
|
|
}
|
2012-06-17 13:38:59 +00:00
|
|
|
|
2013-01-15 17:14:31 +00:00
|
|
|
public function usersearchAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$idClient = $request->getParam('idClient');
|
|
|
|
$query = $request->getParam('q');
|
|
|
|
|
|
|
|
$ws = new WsScores();
|
|
|
|
$result = $ws->searchLogin($idClient, $query);
|
|
|
|
|
|
|
|
$items = json_decode($result);
|
|
|
|
|
|
|
|
$output = array();
|
|
|
|
if (count($items)>0){
|
|
|
|
$separator = ", ";
|
|
|
|
foreach ($items as $item) {
|
|
|
|
$output[] = array(
|
|
|
|
'label' => $item->login,
|
|
|
|
'value' => $item->login,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Zend_Registry::get('firebug')->info($output);
|
|
|
|
|
|
|
|
$this->view->assign('output', $output);
|
|
|
|
}
|
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
/**
|
|
|
|
* Affichage du formulaire pour l'envoi des fichiers concernant les nouveautées
|
|
|
|
*/
|
|
|
|
public function newformAction()
|
|
|
|
{
|
2012-06-17 13:38:59 +00:00
|
|
|
//Only the view
|
2012-03-14 08:23:19 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
/**
|
|
|
|
* Réception du fichier des nouveautés et enregistrement des informations
|
|
|
|
*/
|
|
|
|
public function newuploadAction()
|
|
|
|
{
|
2012-11-19 15:53:10 +00:00
|
|
|
$this->_helper->layout()->disableLayout();
|
2012-03-28 13:32:44 +00:00
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
if ( isset($_FILES) && count($_FILES)==1 ) {
|
2012-11-05 15:33:01 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
2012-11-19 15:53:10 +00:00
|
|
|
$path = realpath($c->profil->path->data).'/nouveautes';
|
2012-03-14 08:23:19 +00:00
|
|
|
if(!file_exists($path)) mkdir($path);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
$tmp_name = $_FILES['fichier']['tmp_name'];
|
|
|
|
$n = $_FILES['fichier']['name'];
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
$name = uniqid('new');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
$extValide = array('pdf');
|
|
|
|
$extension = strrchr($n,'.');
|
2013-03-11 16:49:57 +00:00
|
|
|
$extension = strtolower(substr($extension,1));
|
2012-03-14 08:23:19 +00:00
|
|
|
//Vérifier l'extension du fichier
|
2012-05-20 16:31:28 +00:00
|
|
|
if(!in_array($extension, $extValide)){
|
2012-03-14 08:23:19 +00:00
|
|
|
echo "Extension de fichier incorrect !";
|
|
|
|
} elseif (move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension)){
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
$request = $this->getRequest();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
//Enregistrement des informations
|
|
|
|
$data = array(
|
|
|
|
'categorie' => $request->getParam('categorie'),
|
|
|
|
'intitule' => $request->getParam('intitule'),
|
|
|
|
'date' => $request->getParam('date'),
|
2012-05-20 16:31:28 +00:00
|
|
|
'fichier' => $name.'.'.$extension,
|
2012-03-14 08:23:19 +00:00
|
|
|
);
|
|
|
|
$new = new Application_Model_Nouveautes();
|
2012-03-28 13:32:44 +00:00
|
|
|
try {
|
|
|
|
$new->insert($data);
|
2012-03-14 08:23:19 +00:00
|
|
|
echo "Fichier enregistré";
|
2012-05-20 16:31:28 +00:00
|
|
|
} catch(Exception $e) {
|
2012-11-19 15:53:10 +00:00
|
|
|
echo "Erreur lors de l'enregistrement";
|
2012-03-28 13:32:44 +00:00
|
|
|
if ( file_exists($path.'/'.$name.'.'.$extension) ) unlink($path.'/'.$name.'.'.$extension);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
} else {
|
|
|
|
echo "Erreur";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-03-14 08:23:19 +00:00
|
|
|
public function newprogressAction()
|
|
|
|
{
|
2012-11-19 15:53:10 +00:00
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$key = $request->getParam('key', '');
|
|
|
|
if (!empty($key)) {
|
|
|
|
//$rep sera égal à false si la clef n'existe pas dans le cache apc
|
|
|
|
$rep = apc_fetch('upload_'.$key);
|
|
|
|
echo json_encode($rep);
|
2012-03-14 08:23:19 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-09-25 14:59:49 +00:00
|
|
|
public function prestationsAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$idClient = $request->getParam('idClient');
|
|
|
|
$this->view->assign('idClient', $idClient);
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-09-25 14:59:49 +00:00
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-09-25 14:59:49 +00:00
|
|
|
public function prestationAction()
|
|
|
|
{
|
2012-11-19 15:53:10 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$idClient = $request->getParam('idClient');
|
2012-09-25 14:59:49 +00:00
|
|
|
$this->view->assign('idClient', $idClient);
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-09-25 14:59:49 +00:00
|
|
|
$submitValue = "Créer";
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-09-25 14:59:49 +00:00
|
|
|
$id = $request->getParam('id');
|
|
|
|
if ($id!=null) {
|
|
|
|
//Recup param prestation
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-09-25 14:59:49 +00:00
|
|
|
$submitValue = "Modifier";
|
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-09-25 14:59:49 +00:00
|
|
|
$this->view->assign('submitValue', $submitValue);
|
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-09-25 14:59:49 +00:00
|
|
|
public function prestationsaveAction(){}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-10-17 07:52:44 +00:00
|
|
|
public function tarifsAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$idClient = $request->getParam('idClient');
|
2013-03-07 15:54:21 +00:00
|
|
|
$this->view->assign('idClient', $idClient);
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-10-17 07:52:44 +00:00
|
|
|
$ws = new WsScores();
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2013-03-07 15:54:21 +00:00
|
|
|
//Liste des periodes de facturation
|
|
|
|
$contrats = $ws->getClientTarifs($idClient);
|
|
|
|
Zend_Registry::get('firebug')->info($contrats);
|
|
|
|
$this->view->assign('contrats', $contrats->item);
|
|
|
|
|
|
|
|
//Liste des services
|
|
|
|
$services = $ws->getServices($idClient);
|
|
|
|
$this->view->assign('services', $services->item);
|
|
|
|
|
|
|
|
//Liste des logs
|
|
|
|
$logs = $ws->getLogs();
|
|
|
|
$this->view->assign('logs', $logs->item);
|
2012-10-17 07:52:44 +00:00
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-10-17 07:52:44 +00:00
|
|
|
public function tarifAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$idClient = $request->getParam('idClient');
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2013-03-06 10:04:28 +00:00
|
|
|
$ws = new WsScores();
|
|
|
|
|
2013-07-02 09:45:41 +00:00
|
|
|
if ( $request->isXmlHttpRequest() ) {
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
if ( $request->isPost() ) {
|
|
|
|
$log = $request->getParam('log');
|
|
|
|
$service = $request->getParam('service');
|
|
|
|
$type = $request->getParam('type');
|
|
|
|
$priceUnit = $request->getParam('priceUnit');
|
|
|
|
$limit = $request->getParam('limit');
|
|
|
|
$date = $request->getParam('date');
|
|
|
|
$duree = $request->getParam('duree');
|
|
|
|
$doublon = $request->getParam('doublon');
|
|
|
|
$result = $ws->setClientTarif($idClient, $log, $service, $type, $priceUnit, $limit, $date, $duree, $doublon);
|
|
|
|
if(is_int($result)) {
|
|
|
|
//OK
|
|
|
|
} else {
|
|
|
|
$this->view->assign('log', $log);
|
|
|
|
$this->view->assign('service', $service);
|
|
|
|
$this->view->assign('type', $type);
|
|
|
|
$this->view->assign('priceUnit', $priceUnit);
|
|
|
|
$this->view->assign('date', $date);
|
|
|
|
$this->view->assign('duree', $duree);
|
|
|
|
$this->view->assign('doublon', $doublon);
|
|
|
|
$this->view->assign('error', $result);
|
|
|
|
}
|
2012-10-17 07:52:44 +00:00
|
|
|
}
|
|
|
|
}
|
2013-03-06 10:04:28 +00:00
|
|
|
|
|
|
|
$services = $ws->getServices($idClient);
|
|
|
|
$this->view->assign('services', $services->item);
|
|
|
|
|
|
|
|
$logs = $ws->getLogs();
|
|
|
|
$this->view->assign('logs', $logs->item);
|
|
|
|
|
2012-10-17 07:52:44 +00:00
|
|
|
$this->view->assign('idClient', $idClient);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function serviceAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$idClient = $request->getParam('idClient');
|
2013-01-15 17:14:31 +00:00
|
|
|
|
|
|
|
$ws = new WsScores();
|
|
|
|
|
|
|
|
if ( $request->isPost() ) {
|
|
|
|
|
2012-10-17 07:52:44 +00:00
|
|
|
$code = $request->getParam('code');
|
|
|
|
$label = $request->getParam('label');
|
2013-01-15 17:14:31 +00:00
|
|
|
$droitsP = $request->getParam('droits');
|
|
|
|
$droits = join(' ', $droitsP);
|
|
|
|
$infos = array(
|
|
|
|
'code' => $code,
|
|
|
|
'label' => $label,
|
|
|
|
'droits' => $droits,
|
|
|
|
);
|
|
|
|
$result = $ws->setService($idClient, json_encode($infos));
|
2012-10-17 07:52:44 +00:00
|
|
|
if(is_int($result)) {
|
2013-01-15 17:14:31 +00:00
|
|
|
$this->view->assign('message', 'Service crée.');
|
2012-10-17 07:52:44 +00:00
|
|
|
} else {
|
2013-01-15 17:14:31 +00:00
|
|
|
$this->view->assign('message', $result);
|
2012-10-17 07:52:44 +00:00
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//Droits du client
|
|
|
|
|
|
|
|
//Liste des catégories d'accès
|
|
|
|
$reponse = $ws->getCategory();
|
|
|
|
$wscategory = $reponse->item;
|
|
|
|
$this->view->assign('wscategory', $wscategory);
|
|
|
|
|
|
|
|
//Liste de tous les droits
|
|
|
|
$listeDroits = $ws->getListeDroits();
|
|
|
|
$droitsLib = array();
|
|
|
|
foreach($listeDroits->item as $droit) {
|
|
|
|
$droitsLib[strtoupper($droit->code)] = $droit->desc;
|
|
|
|
}
|
|
|
|
$this->view->assign('droitsLib', $droitsLib);
|
|
|
|
|
|
|
|
//Customer informations
|
|
|
|
$reponse = $ws->getNextLogin($idClient);
|
|
|
|
$this->view->assign('droitsClients', explode(' ', strtolower($reponse->result->droitsClients)));
|
|
|
|
|
2012-10-17 07:52:44 +00:00
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2012-10-17 07:52:44 +00:00
|
|
|
$this->view->assign('idClient', $idClient);
|
|
|
|
}
|
2013-01-15 17:14:31 +00:00
|
|
|
|
2011-02-21 08:45:13 +00:00
|
|
|
}
|