Preparation Plugin proxy id

This commit is contained in:
Michael RICOIS 2016-05-12 16:35:52 +02:00
parent 248cef6ffd
commit d2174d00c6

View File

@ -0,0 +1,67 @@
<?php
class Application_Controller_Plugin_Proxid extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
if ($module != 'legal') {
return;
}
/**
* Gestion du CompanyId - Proxy
*/
$layout = Zend_Layout::getMVCInstance();
$view = $layout->getView();
// --- Identifiant Interne
$cId = $request->getParam('cid');
$cType = $request->getParam('ctype', 'INTERNAL');
// --- Identifiants secondaires
$siret = $request->getParam('siret');
$listId = array();
if ($cId === null) {
if (intval($siret) != 0 ) {
// --- Recherche de l'identifiant interne
if (strlen($siret) == 9) {
$id = new stdClass();
$id->Id = $siret;
$id->Type = 'SIREN';
$listId[] = $id;
} elseif (strlen(siret) == 14) {
$id = new stdClass();
$id->Id = $siret;
$id->Type = 'SIRET';
$listId[] = $id;
$id = new stdClass();
$id->Id = substr($siret, 0, 9);
$id->Type = 'SIREN';
$listId[] = $id;
}
// getIdentiteLight - siren / siret
}
} else {
// getIdentiteLight - cId
}
// --- Affectation Id
if ($cId !== null) {
$company = new stdClass();
$company->Name;
$company->Id = $cId;
$company->IdList = $listId;
$view->Company = $company;
}
}
}