Diverses corrections

This commit is contained in:
Michael RICOIS 2015-09-11 14:38:16 +00:00
parent 8ef3d03e11
commit 8dd8df9503
12 changed files with 91 additions and 40 deletions

View File

@ -214,10 +214,10 @@ class GestionController extends Zend_Controller_Action
{ {
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity(); $identity = $auth->getIdentity();
$id = $this->getRequest()->getParam('id'); $id = $this->getRequest()->getParam('id');
$table = new Application_Model_CiblageEnrichissementIdentifiants(); $table = new Application_Model_CiblageEnrichissementIdentifiants();
@ -559,4 +559,33 @@ class GestionController extends Zend_Controller_Action
} }
} }
public function consoAction()
{
$request = $this->getRequest();
$idClient= $request->getParam('idClient', null);
$this->view->assign('idClient', $idClient);
// --- Contrat
$paramsM = new Application_Model_CiblageCustomerParams();
$sql = $paramsM->select()->where('idClient = ?', $idClient);
$params = $paramsM->fetchRow($sql);
$contratDebut = new Zend_Date($params->dateContrat, 'yy-MM-dd');
$contratFin = new Zend_Date($params->dateContrat, 'yy-MM-dd');
$contratFin->addMonth($params->periodContrat)->subDay(1);
$this->view->ContratDateDebut = $contratDebut->toString('yyyy-MM-dd');
$this->view->ContratDateFin = $contratFin->toString('yyyy-MM-dd');
// --- Création du tableau pour la consomation
// --- Recherche tous les idProfil - login
// --- Recherche des fichiers pour chaque id
}
} }

View File

@ -320,9 +320,13 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$session = new Scores_Fields(); $session = new Scores_Fields();
$valeur = $session->getCritere($name); $valeur = $session->getCritere($name);
$class = '';
if (array_key_exists('class', $field)) {
$class = $field['class'];
}
$return = '<div class="interval" >'; $return = '<div class="interval" >';
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'1" value="'.$valeur[0].'" /> '.$this->view->translate('à').' '; $return .= '<input class="'.$class.'" type="text" name="'.$name.'1" value="'.$valeur[0].'" /> '.$this->view->translate('à').' ';
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'2" value="'.$valeur[1].'" />'; $return .= '<input class="'.$class.'" type="text" name="'.$name.'2" value="'.$valeur[1].'" />';
$return .= ' <a href="" class="interval" id="'.$name.'">'.$this->view->translate('Valider').'</a>'; $return .= ' <a href="" class="interval" id="'.$name.'">'.$this->view->translate('Valider').'</a>';
$return .= '</div>'; $return .= '</div>';

View File

@ -14,7 +14,7 @@ $Years = date('Y') - $YearBegin;
<select name="month"> <select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?> <?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?php $select=''; if ($i==$this->month) $select = ' selected';?> <?php $select=''; if ($i==$this->month) $select = ' selected';?>
<option value="<?=$i?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option> <option value="<?=str_pad($i, 2, '0', STR_PAD_LEFT)?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option>
<?php }?> <?php }?>
</select> </select>
<input type="submit" name="submit" value="Ok"/> <input type="submit" name="submit" value="Ok"/>

View File

@ -0,0 +1,19 @@
<div id="dashboard">
<div>
<p>Date de contrat : <?=$this->ContratDateDebut?> à <?=$this->ContratDateFin?></p>
</div>
<h2>Consommation</h2>
<div>
<table>
<thead>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>

View File

@ -24,7 +24,10 @@
<?=$login?><br/> <?=$login?><br/>
<?php }?> <?php }?>
</td> </td>
<td><a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'customerparam', 'idClient'=>$item['idClient']))?>">Détail</a></td> <td>
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'customerparam', 'idClient'=>$item['idClient']))?>">Détail</a>
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'conso', 'idClient'=>$item['idClient']))?>">Conso</a>
</td>
</tr> </tr>
<?php }?> <?php }?>

View File

@ -13,7 +13,7 @@ $Years = date('Y') - $YearBegin;
<select name="month"> <select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?> <?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?php $select=''; if ($i==$this->month) $select = ' selected';?> <?php $select=''; if ($i==$this->month) $select = ' selected';?>
<option value="<?=$i?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option> <option value="<?=str_pad($i, 2, '0', STR_PAD_LEFT)?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option>
<?php }?> <?php }?>
</select> </select>
<input type="submit" name="submit" value="Ok"/> <input type="submit" name="submit" value="Ok"/>

View File

@ -7,6 +7,4 @@
<h2>Facturation</h2> <h2>Facturation</h2>
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'customerparams'))?>">Gestion des paramètres clients</a><br/> <a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'customerparams'))?>">Gestion des paramètres clients</a><br/>
<a href="#">Extraction Logs</a>
</div> </div>

View File

@ -1,6 +1,6 @@
<div id="header-logo"> <div id="header-logo">
<div id="logo"> <div id="logo">
<img alt="ODEA" src="./themes/default/images/logos/logo.png" style="float:left;"> <img alt="ODEA" src="/themes/default/images/logos/logo.png" style="float:left;">
<h1>Outils D'Extraction Automatique</h1> <h1>Outils D'Extraction Automatique</h1>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@ class Enrichissement
* @todo : Trier l'ordre des colonnes * @todo : Trier l'ordre des colonnes
*/ */
protected $fields = array( protected $fields = array(
'siege' => array( 'siege' => array(
'label' => "Type d'établissement", 'label' => "Type d'établissement",
'column' => 'siege', 'column' => 'siege',
'values' => array( 'values' => array(
@ -96,41 +96,41 @@ class Enrichissement
'creaent' => array( 'creaent' => array(
'label' => "Date de création de l'entreprise", 'label' => "Date de création de l'entreprise",
'column' => 'dateCrea_ent', 'column' => 'dateCrea_ent',
'sql' => "IF(dateCrea_ent = 0,'',CONCAT_WS('-',SUBSTRING(dateCrea_ent,0,4),SUBSTRING(dateCrea_ent,4,2),SUBSTRING(dateCrea_ent,6,2))) AS dateCrea_ent", 'sql' => "IF(dateCrea_ent=0,'',CONCAT_WS('-',SUBSTRING(dateCrea_ent,0,4),SUBSTRING(dateCrea_ent,4,2),SUBSTRING(dateCrea_ent,6,2))) AS dateCrea_ent",
), ),
'dateimmat' => array( 'dateimmat' => array(
'label' => "Date d'immatriculation de l'entreprise", 'label' => "Date d'immatriculation de l'entreprise",
'column' => 'dateImmat', 'column' => 'dateImmat',
'sql' => "IF(dateImmat = 0,'',CONCAT_WS('-',SUBSTRING(dateImmat,0,4),SUBSTRING(dateImmat,4,2),SUBSTRING(dateImmat,6,2))) AS dateImmat", 'sql' => "IF(dateImmat=0,'',CONCAT_WS('-',SUBSTRING(dateImmat,0,4),SUBSTRING(dateImmat,4,2),SUBSTRING(dateImmat,6,2))) AS dateImmat",
), ),
'cj' => array( 'cj' => array(
'label' => "Code Forme juridique", 'label' => "Code Forme juridique",
'column' => 'cj', 'column' => 'cj',
'join' => array( 'join' => array(
'label' => 'Forme juridique', 'label' => 'Forme juridique',
'column' => 'libelle', 'column' => 'libelle',
'table' => 'jo.tabFJur', 'table' => 'jo.tabFJur',
'cond' => 'jo.etablissements_act.cj = cjL.code' 'cond' => 'jo.etablissements_act.cj = cjL.code'
) )
), ),
'nafetablissement' => array( 'nafetablissement' => array(
'label' => "Code NAF Etablissement", 'label' => "Code NAF Etablissement",
'column' => 'ape_etab', 'column' => 'ape_etab',
'join' => array( 'join' => array(
'label' => 'NAF Etablissement - Libelle', 'label' => 'NAF Etablissement - Libelle',
'column' => 'libNaf5', 'column' => 'libNaf5',
'table' => 'jo.tabNaf5', 'table' => 'jo.tabNaf5',
'cond' => 'jo.etablissements_act.ape_etab = nafetablissementL.codNaf5' 'cond' => 'jo.etablissements_act.ape_etab = nafetablissementL.codNaf5'
) )
), ),
'nafentreprise' => array( 'nafentreprise' => array(
'label' => "Code NAF Entreprise", 'label' => "Code NAF Entreprise",
'column' => 'ape_entrep', 'column' => 'ape_entrep',
'join' => array( 'join' => array(
'label' => 'NAF Entreprise - Libelle', 'label' => 'NAF Entreprise - Libelle',
'column' => 'libNaf5', 'column' => 'libNaf5',
'table' => 'jo.tabNaf5', 'table' => 'jo.tabNaf5',
'cond' => 'jo.etablissements_act.ape_entrep = nafentrepriseL.codNaf5' 'cond' => 'jo.etablissements_act.ape_entrep = nafentrepriseL.codNaf5'
) )
), ),
'nbetab' => array( 'nbetab' => array(

File diff suppressed because one or more lines are too long

View File

@ -23,8 +23,7 @@ autoloaderNamespaces[] = "Scores_"
; Scores configuration ; Scores configuration
profil.server.name = Odea profil.server.name = Odea
profil.webservice.location = celeste profil.webservice.location = celeste
profil.mail.method = smtp profil.mail.method = sendmail
profil.mail.smtp_host = smtp.free.fr
profil.mail.email.support = supportdev@scores-decisions.com profil.mail.email.support = supportdev@scores-decisions.com
profil.mail.email.supportdev = supportdev@scores-decisions.com profil.mail.email.supportdev = supportdev@scores-decisions.com
profil.mail.email.contact = supportdev@scores-decisions.com profil.mail.email.contact = supportdev@scores-decisions.com

View File

@ -62,7 +62,7 @@ $id = null;
if ($opts->cron) if ($opts->cron)
{ {
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants(); $commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $commandesM->select() $sql = $commandesM->select()
->where('idProfil != ?', 0) ->where('idProfil != ?', 0)
->where("dateStart != '0000-00-00 00:00:00'") ->where("dateStart != '0000-00-00 00:00:00'")
@ -71,7 +71,7 @@ if ($opts->cron)
if (count($result)>0){ if (count($result)>0){
exit; exit;
} }
//Si pas de traitement en cours alors on lance //Si pas de traitement en cours alors on lance
$sql = $commandesM->select() $sql = $commandesM->select()
->where('idProfil != ?', 0) ->where('idProfil != ?', 0)
@ -144,7 +144,7 @@ foreach ( $dataProfil as $item ) {
// --- Construction de la requete SQL // --- Construction de la requete SQL
if ( array_key_exists('sql', $field) ) { if ( array_key_exists('sql', $field) ) {
$columns[] = $field['sql']; $columns[] = new Zend_Db_Expr($field['sql']);
} else { } else {
$columns[] = $field['column'].' AS '.$item; $columns[] = $field['column'].' AS '.$item;
} }
@ -191,7 +191,7 @@ if ($opts->verbose) echo "Nb Lines :".$nbLineTotal."\n";
foreach ($identifiants as $siret) foreach ($identifiants as $siret)
{ {
if ($opts->verbose) echo "Line $row / $nbLineTotal : "; if ($opts->verbose) echo "Line $row / $nbLineTotal : ";
$sql = $db->select()->from('etablissements_act', $columns, 'jo'); $sql = $db->select()->from('etablissements_act', $columns, 'jo');
$sql->where("siren='".substr($siret,0,9)."' AND nic='".substr($siret,9,5)."'"); $sql->where("siren='".substr($siret,0,9)."' AND nic='".substr($siret,9,5)."'");
if (count($joins)) { if (count($joins)) {
@ -199,20 +199,20 @@ foreach ($identifiants as $siret)
$sql->joinLeft($join['name'], $join['cond'], $join['col']); $sql->joinLeft($join['name'], $join['cond'], $join['col']);
} }
} }
$tabData = null; $tabData = null;
// --- Get data in database // --- Get data in database
try { try {
$tabData = $db->fetchRow($sql, null, Zend_Db::FETCH_ASSOC); $tabData = $db->fetchRow($sql, null, Zend_Db::FETCH_ASSOC);
} catch(Exception $e) { } catch(Exception $e) {
echo date('Y-m-d H:i:s') . ' - Ligne '. $row . ' : Erreur ' . $sql . " : " . $e->getMessage() ."\n"; echo date('Y-m-d H:i:s') . ' - Ligne '. $row . ' : Erreur ' . $sql . " : " . $e->getMessage() ."\n";
} }
if ($opts->verbose) { if ($opts->verbose) {
echo "IN=".$siret." : OUT=".$tabData['siren']; echo "IN=".$siret." : OUT=".$tabData['siren'];
} }
// --- Ligne vide // --- Ligne vide
if ( $tabData === false ) { if ( $tabData === false ) {
if ($opts->verbose) { if ($opts->verbose) {
@ -251,7 +251,7 @@ foreach ($identifiants as $siret)
// --- Order data for CSV file // --- Order data for CSV file
$tabSortie[] = isset($tabData[$key]) ? $tabData[$key] : ''; $tabSortie[] = isset($tabData[$key]) ? $tabData[$key] : '';
} }
fputcsv($fp, $tabSortie, ',', '"'); fputcsv($fp, $tabSortie, ',', '"');
} }
@ -259,11 +259,11 @@ foreach ($identifiants as $siret)
if ( $id !== null ) { if ( $id !== null ) {
$commandesM->update(array('nbLigneTraites'=>$row), "id = ".$commande->id); $commandesM->update(array('nbLigneTraites'=>$row), "id = ".$commande->id);
} }
if ( $opts->verbose ) { if ( $opts->verbose ) {
echo "\n"; echo "\n";
} }
$row++; $row++;
} }
fclose($fp); fclose($fp);