Test date fin de contrat

This commit is contained in:
Michael RICOIS 2012-12-19 14:56:50 +00:00
parent 7b2eb49921
commit 27df43931e

View File

@ -99,23 +99,39 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
$identity->globalRNCS = 1;
}
if (isset($identity->preferences['filter']['rncs']) && $identity->preferences['filter']['rncs']==1) {
if (isset($identity->preferences['filter']['rncs'])
&& $identity->preferences['filter']['rncs']==1) {
$identity->globalRNCS = 1;
}
}
Zend_Registry::get('firebug')->info($identity);
//No contrat define
if ( $identity->dateContrat=='0000-00-00 00:00:00' ) {
//If no params are detected, display a message to contact support
$request->setModuleName('default')
->setControllerName('aide')
->setActionName('message')
->setParam('typeMsg', 'support');
->setControllerName('aide')
->setActionName('message')
->setParam('typeMsg', 'support');
}
//Check dateContrat and calculate end of contrat
else {
//@todo : Check dateContrat and calculate end of contrat
$hour = intval(substr($identity->dateContrat,11,2));
$min = intval(substr($identity->dateContrat,14,2));
$sec = intval(substr($identity->dateContrat,17,2));
$month = intval(substr($identity->dateContrat,5,2)) + $identity->periodContrat;
$day = intval(substr($identity->dateContrat,8,2));
$year = intval(substr($identity->dateContrat,0,4));
$dateFinContrat = mktime($hour,$min,$sec,$month,$day,$year);
if ( $dateFinContrat > time() ) {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('logout')
->setParam('message', "Votre Contrat est arrivé à expiration.");
}
}
$auth->getStorage()->write($identity);