Don't get parameter on each request in database
This commit is contained in:
parent
e59403cf84
commit
070894f087
@ -49,7 +49,6 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
} else {
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$session = new Zend_Session_Namespace($storage->getNamespace());
|
||||
//$session->setExpirationSeconds(86400);
|
||||
$auth->setStorage($storage);
|
||||
}
|
||||
|
||||
@ -77,9 +76,8 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
$identity->time = time() + $identity->timeout;
|
||||
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
|
||||
if ($layout->isEnabled()) {
|
||||
|
||||
if ( !empty($identity->dateContrat) && $layout->isEnabled() )
|
||||
{
|
||||
//Get customer's params
|
||||
$paramsM = new Application_Model_CustomerParams();
|
||||
$sql = $paramsM->select()
|
||||
@ -98,33 +96,8 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
$identity->periodContrat = $params[0]['periodContrat'];
|
||||
$identity->priceLine = $params[0]['priceLine'];
|
||||
$identity->forfait = $params[0]['forfait'];
|
||||
}
|
||||
|
||||
//If no params are detected, display a message to contact support
|
||||
if (count($params)==0) {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('aide')
|
||||
->setActionName('message')
|
||||
->setParam('typeMsg', 'support');
|
||||
}
|
||||
|
||||
//@todo : Check dateContrat and calculate end of contrat
|
||||
|
||||
|
||||
//Is user declare in app's profils
|
||||
$profilM = new Application_Model_EnrichissementProfils();
|
||||
$sql = $profilM->select()
|
||||
->where("actif=1")
|
||||
->where('login=?', $identity->username);
|
||||
$params = $profilM->fetchAll($sql)->toArray();
|
||||
|
||||
if (count($params)==0) {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('aide')
|
||||
->setActionName('message')
|
||||
->setParam('typeMsg', 'support');
|
||||
}
|
||||
|
||||
|
||||
//Get user's preference
|
||||
$prefsM = new Application_Model_Prefs();
|
||||
$pref = $prefsM->find($identity->username)->current();
|
||||
@ -141,6 +114,17 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
$identity->globalRNCS = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//No contrat define
|
||||
if ( empty($identity->dateContrat) ) {
|
||||
//If no params are detected, display a message to contact support
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('aide')
|
||||
->setActionName('message')
|
||||
->setParam('typeMsg', 'support');
|
||||
}
|
||||
|
||||
//@todo : Check dateContrat and calculate end of contrat
|
||||
|
||||
$auth->getStorage()->write($identity);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user