Remove the use of WDate

This commit is contained in:
Michael RICOIS 2013-10-28 15:31:00 +00:00
parent b14f5d76a5
commit 44471aed30

View File

@ -1,8 +1,6 @@
<?php
class SaisieController extends Zend_Controller_Action
{
protected $wDate;
protected $countries;
protected $currencies;
@ -85,10 +83,8 @@ class SaisieController extends Zend_Controller_Action
require_once 'Scores/WsScores.php';
require_once 'Scores/SessionEntreprise.php';
require_once 'Scores/IdentiteEntreprise.php';
require_once 'common/dates.php';
$ws = new WsScores();
$this->wDate = new WDate();
//codPays3 (index), libPays, devise
$countries = json_decode($ws->getCatalogCountry(),true);
if ($countries!==false) {
@ -663,19 +659,23 @@ class SaisieController extends Zend_Controller_Action
}
if ( $isEditable && in_array($idanResult->source, array('JT', 'ANTE')))
{
$dateParution = new Zend_Date(substr($idanResult->dateSource,0,10), 'yyyy-MM-dd');
$dateJugement = new Zend_Date($idanResult->dateEffetFinP, 'yyyy-MM-dd');
$dateFinPeriode = new Zend_Date($idanResult->dateJugement, 'yyyy-MM-dd');
//Mapper idanResult dans le tableau de saisie
$saisie = array(
'source' => isset($_SESSION['source']) ? $_SESSION['source'] : $idanResult->source,
'dateParution' => isset($_SESSION['dateParution']) ? $_SESSION['dateParution'] :
$this->wDate->dateT('Y-m-d', 'd/m/Y', substr($idanResult->dateSource,0,10)),
$dateParution->toString('dd/MM/yyyy'),
'numParution' => isset($_SESSION['numParution']) ? $_SESSION['numParution'] : '',
'dateJugement' => $this->wDate->dateT('Y-m-d', 'd/m/Y', $idanResult->dateEffetFinP),
'dateJugement' => $dateJugement->toString('dd/MM/yyyy'),
'tribunal' => $idanResult->tribunal,
'even' => $idanResult->even->item,
'eventNum' => $eventLimit,
'comp' => $idanResult->complement,
'montant' => $idanResult->montant,
'dateFinPeriode' => $this->wDate->dateT('Y-m-d', 'd/m/Y', $idanResult->dateJugement),
'dateFinPeriode' => $dateFinPeriode->toString('dd/MM/yyyy'),
);
$intervenants = array();
@ -1612,6 +1612,27 @@ class SaisieController extends Zend_Controller_Action
$params['nat'] = '';
}
if (empty($params['dateCapital'])) {
$dateCapital = '';
} else {
$date = new Zend_Date($params['dateCapital'], 'dd/MM/yyyy');
$dateCapital = $date->toString('yyyyMMdd');
}
if (empty($params['naissance_date'])) {
$dateNaissance = '';
} else {
$date = new Zend_Date($params['naissance_date'], 'dd/MM/yyyy');
$dateNaissance = $date->toString('yyyyMMdd');
}
if (empty($params['dateNbActions'])) {
$dateNbActions = '';
} else {
$date = new Zend_Date($params['dateNbActions'], 'dd/MM/yyyy');
$dateNbActions = $date->toArray('yyyyMMdd');
}
$infos = array(
'siren' => $params['siren'],
'actif' => 1,
@ -1621,7 +1642,7 @@ class SaisieController extends Zend_Controller_Action
'nom' => strtoupper(trim($params['nom'])),
'prenom' => ucfirst(trim($params['prenom'])),
'nom_usage' => strtoupper(trim($params['nom_usage'])),
'naissance_date' => empty($params['naissance_date']) ? '' : $this->wDate->dateT('d/m/Y','Ymd',$params['naissance_date']),
'naissance_date' => $dateNaissance,
'naissance_dept_pays' => $params['naissance_dept_pays'],
'naissance_lieu' => $params['naissance_lieu'],
'nat' => $params['nat'],
@ -1640,9 +1661,9 @@ class SaisieController extends Zend_Controller_Action
'dateSaisie' => date('YmdHis'),
'capital' => empty($params['capital']) ? '' : trim($params['capital']),
'deviseCapital' => empty($params['deviseCapital']) ? 'EUR' : $params['deviseCapital'],
'dateCapital' => empty($params['dateCapital']) ? '' : $this->wDate->dateT('d/m/Y', 'Ymd', $params['dateCapital']),
'dateCapital' => $dateCapital,
'nbActions' => empty($params['nbActions']) ? '' : $params['nbActions'],
'dateNbActions' => empty($params['dateNbActions']) ? '' : $this->wDate->dateT('d/m/Y', 'Ymd', $params['dateNbActions']),
'dateNbActions' => $dateNbActions,
'isin' => empty($params['isin']) ? '' : trim($params['isin']),
'idLoc1Type' => $params['idLoc1Type'],
'idLoc1Num' => trim($params['idLoc1Num']),
@ -1712,9 +1733,17 @@ class SaisieController extends Zend_Controller_Action
$params = $this->getRequest()->getParams();
if ($params['mode']=='delete') {
if (empty($params['dateEffetLien'])) {
$dateEffetLien = '';
} else {
$date = new Zend_Date($params['dateEffetLien'], 'dd/MM/yyyy');
$dateEffetLien = $date->toString('yyyyMMdd');
}
$infos = array(
'actif' => 0,
'dateEffetLien' => empty($params['dateEffetLien']) ? date('Ymd') : $this->wDate->dateT('d/m/Y', 'Ymd', $params['dateEffetLien']),
'dateEffetLien' => $dateEffetLien,
'motifUpdate' => empty($params['motifUpdate']) ? '' : $params['motifUpdate'],
);
} else {
@ -1727,6 +1756,12 @@ class SaisieController extends Zend_Controller_Action
$idAct = $params['id1'];
}
if (empty($params['dateEffetLien'])) {
$date = new Zend_Date();
} else {
$date = new Zend_Date($params['dateEffetLien'], 'dd/MM/yyyy');
}
$infos = array(
'idAct' => $idAct,
'actif' => 1,
@ -1734,7 +1769,7 @@ class SaisieController extends Zend_Controller_Action
'Pvote' => ($params['Pvote']=='') ? null : $params['Pvote'],
'MajMin' => $params['MajMin'],
'idPar' => $idPar,
'dateEffetLien' => empty($params['dateEffetLien']) ? date('Ymd') : $this->wDate->dateT('d/m/Y', 'Ymd', $params['dateEffetLien']),
'dateEffetLien' => $date->toString('yyyyMMdd'),
'motifUpdate' => empty($params['motifUpdate']) ? '' : $params['motifUpdate'],
);
}
@ -1780,6 +1815,13 @@ class SaisieController extends Zend_Controller_Action
} else {
$ws = new WsScores();
$identite = $ws->getIdentite($siren);
if (empty($identite->Bilan->Cloture)) {
$dateCapital = '';
} else {
$date = new Zend_Date($identite->Bilan->Cloture, 'yyyyMMdd');
$dateCapital = $date->toString('dd/MM/yyyy');
}
$infos = array(
'siren' => $siren,
'actif' => 1,
@ -1804,8 +1846,7 @@ class SaisieController extends Zend_Controller_Action
'dateSaisie' => date('YmdHis'),
'capital' => $identite->Bilan->Capital,
'deviseCapital' => 'EUR',
'dateCapital' => empty($identite->Bilan->Cloture) ? '' :
$this->wDate->dateT('Ymd','d/m/Y',$identite->Bilan->Cloture),
'dateCapital' => $dateCapital,
'nbActions' => '',
'idLoc1Type' => '',
'idLoc1Num' => '',
@ -1855,8 +1896,8 @@ class SaisieController extends Zend_Controller_Action
if (!file_exists($path)) { mkdir($path); }
$date = $this->wDate->dateT('d/m/Y', 'Ymd', $params['fileDate']);
$name = 'INTERNE-'.$params['idNum'].'-'.$params['fileType'].'-'.$date;
$date = new Zend_Date($params['fileDate'],'yyyyMMdd');
$name = 'INTERNE-'.$params['idNum'].'-'.$params['fileType'].'-'.$date->toString('dd/MM/yyyy');
$n = $_FILES['fichier']['name'];
$s = $_FILES['fichier']['size'];
@ -1973,7 +2014,8 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('ape',$result->NafEnt);
$this->view->assign('capital',$result->Bilan->Capital);
$this->view->assign('deviseCapital', 'EUR');
$this->view->assign('dateCapital', $this->wDate->dateT('Ymd','d/m/Y',$result->Bilan->Cloture));
$date = new Zend_Date($result->Bilan->Cloture, 'yyyyMMdd');
$this->view->assign('dateCapital', $date->toString('dd/MM/yyyy'));
$this->view->assign('bilDev', 'EUR');
$this->view->assign('bilMillesime', $result->Bilan->Millesime);
$this->view->assign('bilFL', $result->Bilan->CA);
@ -2030,8 +2072,10 @@ class SaisieController extends Zend_Controller_Action
case 'dateCapital':
case 'dateNbActions':
case 'naissance_date':
if (!empty($val) && $val!='0000-00-00')
$this->view->assign($key, $this->wDate->dateT('Y-m-d', 'd/m/Y', $val));
if (!empty($val) && $val!='0000-00-00') {
$date = new Zend_Date($val, 'yyyy-MM-dd');
$this->view->assign($key, $date->toString('dd/MM/yyyy'));
}
break;
default:
$this->view->assign($key, $val);