72 lines
2.0 KiB
PHP
72 lines
2.0 KiB
PHP
<?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;
|
|
}
|
|
|
|
/*$ws = new Scores_Ws_Client('interne', '0.6');
|
|
$params = new stdClass();
|
|
$ws->getIdentiteLight();*/
|
|
|
|
// 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;
|
|
}
|
|
|
|
}
|
|
} |