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->viewRenderer->setNoRender(true);
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$id = $this->getRequest()->getParam('id');
$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();
$valeur = $session->getCritere($name);
$class = '';
if (array_key_exists('class', $field)) {
$class = $field['class'];
}
$return = '<div class="interval" >';
$return .= '<input class="'.$field['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.'1" value="'.$valeur[0].'" /> '.$this->view->translate('à').' ';
$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 .= '</div>';

View File

@ -14,7 +14,7 @@ $Years = date('Y') - $YearBegin;
<select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?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 }?>
</select>
<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/>
<?php }?>
</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>
<?php }?>

View File

@ -13,7 +13,7 @@ $Years = date('Y') - $YearBegin;
<select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?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 }?>
</select>
<input type="submit" name="submit" value="Ok"/>

View File

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

View File

@ -1,6 +1,6 @@
<div id="header-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>
</div>
</div>

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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