Issue #0001653: updates (not finished)

This commit is contained in:
Aram HARUTYUNYAN 2013-08-23 13:41:36 +00:00
parent 2319e1f136
commit 546e4d4d75
16 changed files with 622 additions and 88 deletions

View File

@ -33,7 +33,10 @@ class DirigeantController extends Zend_Controller_Action
} }
$dirigeants = $infos->result->item; $dirigeants = $infos->result->item;
$wcLocal = new Application_Model_Worldcheck();
$allOccurrences = $wcLocal->getCounts($dirigeants);
$session = new SessionEntreprise($this->siret, $this->id); $session = new SessionEntreprise($this->siret, $this->id);
$user = new Scores_Utilisateur(); $user = new Scores_Utilisateur();
@ -43,6 +46,8 @@ class DirigeantController extends Zend_Controller_Action
} }
$this->view->assign('edition', $user->checkModeEdition()); $this->view->assign('edition', $user->checkModeEdition());
$this->view->assign('allOccurrences', $allOccurrences);
$this->view->assign('siren', $siren); $this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret); $this->view->assign('siret', $this->siret);

View File

@ -1,8 +1,8 @@
<?php <?php
class WorldcheckController extends Zend_Controller_Action class WorldcheckController extends Zend_Controller_Action
{ {
protected $siret; protected $identity = null;
protected $id; protected $nameIdentifier;
public function init() public function init()
{ {
@ -14,47 +14,120 @@ class WorldcheckController extends Zend_Controller_Action
*/ */
public function indexAction() public function indexAction()
{ {
$message = '';
$this->_helper->layout()->disableLayout();
$request = $this->getRequest(); $request = $this->getRequest();
$param = new stdClass();
$param->dirNom = 'HOLLANDE'; //$request->getParam('dirNom'); $param->dirNom = $request->getParam('dirNom');
$param->dirPrenom = ''; //$request->getParam('dirPrenom'); $param->dirPrenom = $request->getParam('dirPrenom');
$param->dirNaissJJ = $request->getParam('dirNaissJJ'); $param->dirType = $request->getParam('dirType');
$param->dirDateNaissMM = $request->getParam('dirDateNaissMM');
$param->dirDateNaissAAAA = $request->getParam('dirDateNaissAAAA'); $data = new stdClass();
$param->dirCpVille = $request->getParam('dirCpVille'); $data->name = $param->dirNom;
$data->nameType = $param->dirType;
$user = new Scores_Utilisateur();
$wc = new WsWorldCheck();
$wcLocal = new Application_Model_Worldcheck();
if (!$user->getScreenerName() || $user->getScreenerName()!=$param->dirNom)
{
$idClient = $user->getIdClient();
$localDBParams = $wcLocal->getScreenerId($idClient, $data);
$this->nameIdentifier = $localDBParams->nameIdentifier;
//Save nameIdentifier, name, matchCount into session
$wcheck = new stdClass();
$wcheck->screenerNameIdentifier = $this->nameIdentifier;
$wcheck->screenerName = $param->dirNom;
$wcheck->matchCount = $localDBParams->matchCount;
$data->customId1 = '1'; $auth = Zend_Auth::getInstance();
$data->customId2 = '2'; if ( $auth->hasIdentity() ) {
$data->name = $param->dirNom.' '.$param->dirPrenom; $this->identity = $auth->getIdentity();
$data->nameType = 'INDIVIDUAL'; }
$this->identity->wcheck = $wcheck;
$auth->getStorage()->write($this->identity);
//end
}
$this->nameIdentifier = $user->getScreenerNameIdentifier();
$matchCount = $user->getMatchCount();
$wc = new WsWorldCheck(); if ($matchCount!=0)
$nameIdentifier = $wc->getScreener($data); {
$summary = new stdClass();
$matchCount = new stdClass(); $summary->nameIdentifier = $this->nameIdentifier;
$matchCount = $wc->getDetailsName($nameIdentifier); $summary->matchType = 'WATCHLIST';
if ($matchCount->unresolvedMatchCount == 0) //get results by lastName
{ $unfilteredWC = new stdClass();
$message = 'Aucun résultat.'; $unfilteredWC = $wc->getSummariesArr($summary);
} //end
else
{ //get results by fullName (lastName and givenName)
$message = 'Résultats de recherche'; $filteredWC = array();
$matches = $wc->getMatchesName($nameIdentifier, 'WATCHLIST', 0, $matchCount->unresolvedMatchCount); foreach ($unfilteredWC as $entityId=>$shortData)
} {
if (stripos($shortData->lastName, $param->dirNom)!==false || stripos($param->dirNom, $shortData->lastName)!==false) {
$this->view->assign('message', $message); if (stripos($shortData->givenName, $param->dirPrenom)!==false || stripos($param->dirPrenom, $shortData->givenName)!==false) {
$this->view->assign('param', $param); $filteredWC[$entityId] = $shortData;
$this->view->assign('matches', $matches); }
$this->view->assign('nameIdentifier', $nameIdentifier); }
}
//end
//check if display all results (search by lastName), or filtered results (search by fullName)
$filtre = $request->getParam('filtre', 'tout');
$resultWC = ($filtre=='filtered')?$filteredWC:$unfilteredWC;
$filtres = array(
'tout' => array(
'txt'=>'Résultats par Nom',
'select'=>'',
'value' => 2,
),
'filtered' => array(
'txt'=>'Résultats par Nom et Prénom',
'select'=>'',
'value' => 1,
)
);
$filtres[$filtre]['select'] = ' selected';
$this->view->assign('filtres', $filtres);
//end
//paginate results list
Zend_View_Helper_PaginationControl::setDefaultViewPartial('worldcheck/controls.phtml');
$paginator = Zend_Paginator::factory($resultWC);
$this->view->paginator = $paginator;
$itemCount = 15;
$page = $this->_getParam('page', 1);
$ol_number = ($page-1)*$itemCount+1;
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($itemCount);
$this->view->assign('ol_number', $ol_number);
$this->view->assign('itemCount', $itemCount);
//end
$this->view->assign('resultWC', $resultWC);
$this->view->assign('allMatches', $wc->getMatchesArrName($summary));
$this->view->assign('param', $param);
}
} }
public function matchresultAction() public function matchcontentAction()
{ {
$request = $this->getRequest();
$param = new stdClass();
$param->matchIdentifier = $request->getParam('matchIdentifier');
$wc = new WsWorldCheck();
$content = $wc->getDetailsContent($param->matchIdentifier);
$this->view->assign('matchIdentifier', $param->matchIdentifier);
$this->view->assign('content', $content);
} }
} }

View File

@ -0,0 +1,65 @@
<?php
class Application_Model_Worldcheck extends Zend_Db_Table_Abstract
{
protected $_name = 'worldcheck';
/**
* Return nameIdentifier and matchCount from local DB if found.
* Otherwise get nameIdentifier and matchCount from WorldCheck
* @param string $idClient
* @param object $data
* @return object
*/
public function getScreenerId($idClient, $data)
{
$result = new stdClass();
$sql = $this->select()
->where("idClient='".$idClient."' AND name='".$data->name."'")
->order('dateInsert DESC');
if ($this->fetchRow($sql))
{
$result->nameIdentifier = $this->fetchRow($sql)->nameIdentifier;
$result->matchCount = $this->fetchRow($sql)->matchCount;
}
else {
$wc = new WsWorldCheck();
$result->nameIdentifier = $wc->getScreener($data);
$result->matchCount = $wc->getDetailsName($result->nameIdentifier)->unresolvedMatchCount;
$param = array(
'idClient' => $idClient,
'nameIdentifier' => $result->nameIdentifier,
'matchCount' => $result->matchCount,
'name' => $data->name,
'dateInsert' => date('Y-m-d')
);
$sql = $this->insert($param);
}
return $result;
}
/**
* Return array of names with matchCount
* @param object $dirigeants
* @return array
*/
public function getCounts($dirigeants)
{
$allOccurences = array();
foreach ($dirigeants as $dir)
{
$sql = $this->select()
->where("name='".$dir->Nom."'")
->group('name');
$matchCount = NULL;
if ($this->fetchRow($sql))
{
$result=$this->fetchRow($sql);
$matchCount = $result->matchCount;
}
$allOccurences[$dir->Nom] = $matchCount;
}
return $allOccurences;
}
}

View File

@ -44,6 +44,7 @@
<?php if ( count($this->dirigeants)>0 ) { ?> <?php if ( count($this->dirigeants)>0 ) { ?>
<style> <style>
table.data td { border:1px solid #ccc; padding:5px; } table.data td { border:1px solid #ccc; padding:5px; }
div.img {background:url(/themes/default/images/worldcheck/wc.png) no-repeat; height:25px; width:25px;}
</style> </style>
<table class="data"> <table class="data">
<?php foreach ($this->dirigeants as $dir) {?> <?php foreach ($this->dirigeants as $dir) {?>
@ -87,18 +88,35 @@ table.data td { border:1px solid #ccc; padding:5px; }
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
</td> </td>
<td><?php if($this->idClient==1) { ?> <td><?php if($this->idClient==1) { ?>
<a class='wcheck' href="<?=$this->url(array( <?php
if ($this->allOccurrences[$dir->Nom]===NULL) {
$qtipContent = "WorldCheck<br/>Cliquez sur l&rsquo;icone WorldCheck";
} else {
$qtipContent = "WorldCheck<br/>Occurrences: ".$this->allOccurrences[$dir->Nom];
}
?>
<?php if ($dir->Societe != '') {?>
<a class='wcheck' tooltip='<?=$qtipContent ?>' href="<?=$this->url(array(
'controller' => 'worldcheck',
'action' => 'index',
'dirNom' => $dir->Societe,
'dirType' => 'ORGANISATION'), null, true)?>" style="cursor: pointer;" >
<div id='<?=$this->allOccurrences[$dir->Nom];?>' class='img'></div></a><br/>
<?php } ?>
<?php if ($dir->Nom != '') { ?>
<a class='wcheck' tooltip='<?=$qtipContent ?>' href="<?=$this->url(array(
'controller' => 'worldcheck', 'controller' => 'worldcheck',
'action' => 'index', 'action' => 'index',
'dirNom' => $dir->Nom, 'dirNom' => $dir->Nom,
'dirPrenom' => $dir->Prenom, 'dirPrenom' => $dir->Prenom,
'dirNaissJJ' => substr($dir->NaissDate,0,2), 'dirType' => 'INDIVIDUAL'), null, true)?>" style="cursor: pointer;" >
'dirDateNaissMM' => substr($dir->NaissDate,3,2), <div id='<?=$this->allOccurrences[$dir->Nom];?>' class='img'></div></a>
'dirDateNaissAAAA' => substr($dir->NaissDate,6,4), <?php } ?>
'dirCpVille' => $dir->NaissVille))?>" title="WorldCheck" style="cursor: pointer;" > <?php }?>
<img src="/themes/default/images/worldcheck/wc.png" /></a> </td>
<?php }?></td>
<td class="StyleInfoData" width="100" valign="top"> <td class="StyleInfoData" width="100" valign="top">
<?php if ($dir->Siren!='') {?> <?php if ($dir->Siren!='') {?>
<a title="Consulter la fiche identité" href="<?=$this->url(array('controller'=>'identite', 'action'=>'fiche', 'siret'=>$dir->Siren))?>"> <a title="Consulter la fiche identité" href="<?=$this->url(array('controller'=>'identite', 'action'=>'fiche', 'siret'=>$dir->Siren))?>">
@ -162,15 +180,19 @@ $('a.dialog').on('click', function(){
} }
}); });
$(document).ready(function(){
$('a.wcheck').qtip({ $('a.wcheck div').each(function(){
content: 'WorldCheck', if ($(this).attr('id')=='0') {
position: { $(this).css("backgroundImage", 'url(/themes/default/images/worldcheck/wc0.png)');
corner: { }
target: 'topRight',
tooltip: 'topLeft'
}
}
}); });
});
$('a.wcheck').each(function(){
$(this).qtip({
content: $(this).attr('tooltip'),
position: { at: "right center", my: "bottom left" }
});
});
</script> </script>
<?php }?> <?php }?>

View File

@ -1,21 +1,64 @@
<?php <div id="center">
print_r($this->message); <h1>World-Check</h1>
?> <div id="center-recherche" style='margin-left: 10px; margin-right:10px'>
<br/> <?php if ($this->filtres) { ?>
<div style='float:right;'>
<select name="filtre">
<?php foreach ($this->filtres as $k => $filtre) {?>
<option value="<?=$this->url(array('filtre'=>$k, 'page'=>''))?>"<?=$filtre['select']?>><?=$filtre['txt']?></option>
<?php }?>
</select>
</div>
<script type="text/javascript">
$('select[name=filtre]').change(function(e){
window.location = $(this).val();
});
</script>
</div>
<?php }?>
<?php <?php
$result = array(); if (!$this->resultWC)
foreach ($this->matches->match as $key => $value)
{ {
echo '<p>'.$this->param->dirNom.' '.$this->param->dirPrenom.'</p>';
$result[$key] = $value;
echo 'Match Found by: '.$result[$key]->matchFoundBy.'<br/>';
echo 'Match Resolution: '.$result[$key]->matchResolution.'<br/>';
echo 'Match Risk: '.$result[$key]->matchRisk.'<br/>';
echo 'Match Score: '.$result[$key]->matchScore.'<br/>';
}
//print_r($this->params);
//print_r($this->nameIdentifier);
?> ?>
<div>Aucun résultat.</div>
<h1></h1> <? }
else
{
require_once 'common/dates.php';
$wdate = new WDate();
$resultWC = $this->resultWC;
$reponse = count($resultWC)==1?'réponse':'réponses';
$title = count($resultWC).' '.$reponse.' avec les critères "'.$this->param->dirNom.' '.$this->param->dirPrenom.'"';
?>
<div style='float:left; margin-left:15px;'><?=$title;?></div>
<br/>
<div>
<ol start=<?=$this->ol_number; ?>>
<?php
foreach ($this->paginator as $entityId=>$shortData)
{
?>
<li>
<strong><a href="<?=$this->url(array('controller'=>'worldcheck', 'action'=>'matchcontent', 'matchIdentifier'=>$this->allMatches[$entityId]), null, true)?>"><?= $shortData->lastName.' '.$shortData->givenName;?></a></strong><br/>
<table>
<?php if (isset($shortData->description) && $shortData->description!='') {?>
<tr>
<td class="StyleInfoLib" width="150">Description</td>
<td class="StyleInfoData" width="450"><?=$shortData->description;?></td>
</tr>
<?php } ?>
<?php if (isset($shortData->country) && $shortData->country!='') {?>
<tr>
<td class="StyleInfoLib" width="150">Country</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($shortData->country));?></td>
</tr>
<?php } ?>
</table>
</li>
<?php } ?>
</ol>
</div>
<p><div id="center-recherche"><?php if (count($resultWC)>$this->itemCount) { echo $this->paginator; } ?></div></p>
<?php } ?>
</div>

View File

@ -0,0 +1,169 @@
<div id="center">
<h1>World-Check</h1>
<?php
require_once 'common/dates.php';
$wdate = new WDate();
$content = array();
if (!$this->content)
{
?>
<p><div style='margin-left: 10px;'>Aucune Information</div></p>
<?php
}
else
{
$content = $this->content;
?>
<h2><?=$this->content[0]->names->name[0]->fullName;?></h2>
<div class="paragraph">
<table cellpadding=3>
<?php if (isset($content[0]->category)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Category</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($content[0]->category));?></td>
</tr>
<?php } ?>
<?php if (isset($content[0]->gender)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Gender</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($content[0]->gender));?></td>
</tr>
<?php } ?>
<?php if (isset($content[0]->events->event) && ($content[0]->events->event[0]->day>0) && ($content[0]->events->event[0]->month>0) && ($content[0]->events->event[0]->year>0)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Birthday</td>
<td class="StyleInfoData" width="450"><?=$wdate->dateT('Y-m-d', 'd/m/Y', $content[0]->events->event[0]->fullDate);?></td>
</tr>
<?php } ?>
<?php if (isset($content[0]->events->event[0]->address->region)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Birth place</td>
<td class="StyleInfoData" width="450"><?=$content[0]->events->event[0]->address->region;?></td>
</tr>
<?php } ?>
<?php if (isset($content[0]->countryLinks->countryLink[0]->countryText)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Nationality</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($content[0]->countryLinks->countryLink[0]->countryText));?></td>
</tr>
<?php } ?>
<?php
foreach($content[0]->details->detail as $detail)
{ ?>
<?php if (isset($detail->text)) { ?>
<tr>
<td class="StyleInfoLib" width="150"><?=ucfirst(strtolower($detail->detailType));?></td>
<td class="StyleInfoData" width="450"><?=$detail->text;?></td>
</tr>
<?php } ?>
<?php } ?>
<tr>
<td class="StyleInfoLib" width="150">Address</td>
<?php
$address = array();
if (isset($content[0]->addresses->address[0]->city)) { $address[] = $content[0]->addresses->address[0]->city;}
if (isset($content[0]->addresses->address[0]->region)) { $address[] = $content[0]->addresses->address[0]->region;}
if (isset($content[0]->addresses->address[0]->country)) { $address[] = ucfirst(strtolower($content[0]->addresses->address[0]->country->name));}
?>
<td class="StyleInfoData" width="450"><?=implode(', ', $address);?></td>
</tr>
<?php
if (isset($content[0]->roles->role)){
foreach($content[0]->roles->role as $role)
{ ?>
<?php if (isset($role->title)) { ?>
<tr>
<td class="StyleInfoLib" width="150"><?=$role->type?></td>
<td class="StyleInfoData" width="450"><?=$role->title;?></td>
</tr>
<?php } ?>
<?php }} ?>
<?php if (isset($content[0]->weblinks->weblink)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Weblinks</td>
<td class="StyleInfoData" width="450">
<?php foreach($content[0]->weblinks->weblink as $weblink)
{ ?>
<a href="<?=$weblink->URI;?>" target="_blank"><?=$weblink->URI;?></a><br/>
<?php } ?>
</td>
</tr>
<?php } ?>
</table>
</div>
<?php
if (isset($content[0]->associates->associate)) {
foreach($content[0]->associates->associate as $associate)
{ ?>
<h2>
Associate: <?=$associate->targetEntity->names->name[0]->fullName;?>
<?php $dirType = ($associate->associatetype=='ASSOCIATE')?'INDIVIDUAL':'ORGANISATION';?>
<a href="<?=$this->url(array(
'controller' => 'worldcheck',
'action' => 'index',
'dirNom' => $associate->targetEntity->names->name[0]->lastName,
'dirPrenom' => $associate->targetEntity->names->name[0]->givenName,
'dirType' => $dirType), null, true)?>" title="WorldCheck" style="cursor: pointer;" >
<div style='float:right;'><img src="/themes/default/images/worldcheck/wc-blanc.png" /></div></a>
</h2>
<div class="paragraph">
<table cellpadding=3>
<?php if (isset($associate->targetEntity->category)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Category</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($associate->targetEntity->category));?></td>
</tr>
<?php } ?>
<?php if (isset($associate->targetEntity->gender)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Gender</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($associate->targetEntity->gender));?></td>
</tr>
<?php } ?>
<?php if (isset($associate->targetEntity->events->event) && ($associate->targetEntity->events->event[0]->day>0) && ($associate->targetEntity->events->event[0]->month>0) && ($associate->targetEntity->events->event[0]->year>0)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Birthday</td>
<td class="StyleInfoData" width="450"><?=$wdate->dateT('Y-m-d', 'd/m/Y', $associate->targetEntity->events->event[0]->fullDate);?></td>
</tr>
<?php } ?>
<?php if (isset($associate->targetEntity->countryLinks->countryLink[0]->countryText)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Nationality</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($associate->targetEntity->countryLinks->countryLink[0]->countryText));?></td>
</tr>
<?php } ?>
<?php
foreach($associate->targetEntity->details->detail as $detailAssoc)
{ ?>
<?php if (isset($detailAssoc->text)) { ?>
<tr>
<td class="StyleInfoLib" width="150"><?=ucfirst(strtolower($detailAssoc->detailType)); ?></td>
<td class="StyleInfoData" width="450"><?=$detailAssoc->text;?></td>
</tr>
<?php } ?>
<?php } ?>
<tr>
<td class="StyleInfoLib" width="150">Adresse</td>
<?php
$address = array();
if (isset($associate->targetEntity->addresses->address[0]->city)) { $address[] = $associate->targetEntity->addresses->address[0]->city;}
if (isset($associate->targetEntity->addresses->address[0]->region)) { $address[] = $associate->targetEntity->addresses->address[0]->region;}
if (isset($associate->targetEntity->addresses->address[0]->country)) { $address[] = ucfirst(strtolower($associate->targetEntity->addresses->address[0]->country->name));}
?>
<td class="StyleInfoData" width="450"><?=implode(', ', $address);?></td>
</tr>
<?php if (isset($associate->targetEntity->weblinks->weblink)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Weblinks</td>
<td class="StyleInfoData" width="450">
<?php foreach($associate->targetEntity->weblinks->weblink as $weblink)
{ ?>
<a href="<?=$weblink->URI;?>" target="_blank"><?=$weblink->URI;?></a><br/>
<?php } ?>
</td>
</tr>
<?php } ?>
</table></div>
<?php }}} ?>
</div>

View File

@ -280,6 +280,51 @@ class Scores_Utilisateur
public function getLangTmp() public function getLangTmp()
{ {
return $this->identity->langtmp; return $this->identity->langtmp;
}
/**
* Retourne nameIdentifier of WorldCheck screener
*/
public function getScreenerNameIdentifier()
{
if (isset($this->identity->wcheck))
{
return $this->identity->wcheck->screenerNameIdentifier;
}
else
{
return false;
}
}
/**
* Retourne name of WorldCheck screener
*/
public function getScreenerName()
{
if (isset($this->identity->wcheck))
{
return $this->identity->wcheck->screenerName;
}
else
{
return false;
}
}
/**
* Retourne match count of WorldCheck search by lastName
*/
public function getMatchCount()
{
if (isset($this->identity->wcheck))
{
return $this->identity->wcheck->matchCount;
}
else
{
return false;
}
} }
/** /**

View File

@ -70,9 +70,10 @@ class WsWorldCheck
//**** SCREENER WSDL ****// //**** SCREENER WSDL ****//
/** /**
* getScreener * The initial request of Worldcheck to get nameIdentifier.
* nameType available values: 'INDIVIDUAL', 'ORGANISATION'
* @param object $data * @param object $data
* @return NameIdentifier * @return NameIdentifier (Unique for each request)
*/ */
public function getScreener($data) public function getScreener($data)
{ {
@ -80,6 +81,8 @@ class WsWorldCheck
$params->screenRequest = $data; $params->screenRequest = $data;
$params->screenRequest->groupIdentifier = $this->wcData['groupIdentifier']; $params->screenRequest->groupIdentifier = $this->wcData['groupIdentifier'];
$params->screenRequest->assigneeIdentifier = $this->wcData['assigneeIdentifier']; $params->screenRequest->assigneeIdentifier = $this->wcData['assigneeIdentifier'];
$params->screenRequest->customId1 = '1';
$params->screenRequest->customId2 = '2';
$client = $this->loadClientWC('screener'); $client = $this->loadClientWC('screener');
try { try {
return $client->screen($params)->return; return $client->screen($params)->return;
@ -125,7 +128,7 @@ class WsWorldCheck
$param = new stdClass(); $param = new stdClass();
$param->matchIdentifier = $matchIdentifier; $param->matchIdentifier = $matchIdentifier;
try { try {
return $client->getDetails($param)->return; return $client->getDetails($param)->return->entitySet->entities->individual;
} catch (SoapFault $fault) { } catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){ if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring; return $fault->faultstring;
@ -145,10 +148,10 @@ class WsWorldCheck
{ {
$client = $this->loadClientWC('content'); $client = $this->loadClientWC('content');
$param = new stdClass(); $param = new stdClass();
$param->matchIdentifier = $data->matchIdentifier; $param->nameIdentifier = $data->nameIdentifier;
$param->matchType = $data->matchType; // value must be watchlist $param->matchType = $data->matchType; // value must be watchlist
$param->start = $data->start; $param->start = $this->wcData['response']['start'];
$param->limit = $data->limit; $param->limit = $this->wcData['response']['limit'];
try { try {
return $client->getSummaries($param)->return; return $client->getSummaries($param)->return;
@ -162,6 +165,49 @@ class WsWorldCheck
} }
} }
/**
* return an array, where key=entityId, and value=fullName according to nameIdentifier
* @param object
* @return array
*/
public function getSummariesArr($data)
{
$allMatches = array();
$client = $this->loadClientWC('content');
$param = new stdClass();
$param->nameIdentifier = $data->nameIdentifier;
$param->matchType = $data->matchType; // value must be watchlist
$param->start = $this->wcData['response']['start'];
$param->limit = $this->wcData['response']['limit'];
try {
$category = $client->getSummaries($param)->return->entitySummaries->categories;
foreach ($category->category as $category)
{
foreach($category->summaries->summary as $summary)
{
$key = $summary->entityId->entityId;
$shortData = new stdClass();
$shortData->givenName = $summary->names->name[0]->givenName;
$shortData->lastName = $summary->names->name[0]->lastName;
$shortData->description = $summary->groups->group[0]->details->detail[0]->description;
if (isset($summary->countryLinks->countryLink)){
$shortData->country = $summary->countryLinks->countryLink[0]->countryText;
}
$allMatches[$key] = $shortData;
}
}
return $allMatches;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
return false;
}
}
}
/** /**
* getSummariesForMatch * getSummariesForMatch
* @param string matchIdentifier * @param string matchIdentifier
@ -184,6 +230,31 @@ class WsWorldCheck
} }
} }
/**
* return object with entityId and fullName according to matchIdentifier
* @param string matchIdentifier
* @return object
*/
public function getSummariesForMatchEntityId($matchIdentifier)
{
$data = new stdClass();
$client = $this->loadClientWC('content');
$param = new stdClass();
$param->matchIdentifier = $matchIdentifier;
try {
$data->entityId = $client->getSummariesForMatch($param)->return->entitySummaries->categories->category[0]->summaries->summary[0]->entityId->entityId;
$data->fullName = $client->getSummariesForMatch($param)->return->entitySummaries->categories->category[0]->summaries->summary[0]->names->name[0]->fullName;
return $data;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
return false;
}
}
}
/** /**
* getTitles * getTitles
* @param object * @param object
@ -195,8 +266,8 @@ class WsWorldCheck
$param = new stdClass(); $param = new stdClass();
$param->matchIdentifier = $data->matchIdentifier; $param->matchIdentifier = $data->matchIdentifier;
$param->matchType = $data->matchType; // value must be watchlist $param->matchType = $data->matchType; // value must be watchlist
$param->start = $data->start; $param->start = $this->wcData['response']['start'];
$param->limit = $data->limit; $param->limit = $this->wcData['response']['limit'];
try { try {
return $client->getTitles($param)->return; return $client->getTitles($param)->return;
@ -629,18 +700,16 @@ class WsWorldCheck
* getMatches * getMatches
* @param string nameIdentifier * @param string nameIdentifier
* @param string matchType * @param string matchType
* @param int start
* @param int limit
* @return object * @return object
*/ */
public function getMatchesName($nameIdentifier, $matchType, $start, $limit) public function getMatchesName($nameIdentifier, $matchType)
{ {
$client = $this->loadClientWC('name'); $client = $this->loadClientWC('name');
$param = new stdClass(); $param = new stdClass();
$param->nameIdentifier = $nameIdentifier; $param->nameIdentifier = $nameIdentifier;
$param->matchType = $matchType; $param->matchType = $matchType;
$param->start = $start; $param->start = $this->wcData['response']['start'];
$param->limit = $limit; $param->limit = $this->wcData['response']['limit'];
try { try {
return $client->getMatches($param)->return->matches; return $client->getMatches($param)->return->matches;
@ -654,6 +723,38 @@ class WsWorldCheck
} }
} }
/**
* Returns array where key=entityId, and value=matchIdentifier according to nameIdentifier
* @param object data (contains nameIdentifier, matchType)
* @return array
*/
public function getMatchesArrName($data)
{
$allMatches = array();
$client = $this->loadClientWC('name');
$param = new stdClass();
$param->nameIdentifier = $data->nameIdentifier;
$param->matchType = $data->matchType; // value must be watchlist
$param->start = $this->wcData['response']['start'];
$param->limit = $this->wcData['response']['limit'];
try {
$matches = $client->getMatches($param)->return->matches;
foreach ($matches->match as $matchData)
{
$allMatches[$matchData->matchEntityIdentifier] = $matchData->matchIdentifier;
}
return $allMatches;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
return false;
}
}
}
/** /**
* getSelectableAssignees * getSelectableAssignees
* @param string groupIdentifier * @param string groupIdentifier

View File

@ -4,4 +4,6 @@ worldcheck.passwordType = http://docs.oasis-open.org/wss/2004/01/oasis-200401-ws
worldcheck.namespace = http://screening.complinet.com/ worldcheck.namespace = http://screening.complinet.com/
worldcheck.securityType = Security worldcheck.securityType = Security
worldcheck.groupIdentifier = cng_so_64 worldcheck.groupIdentifier = cng_so_64
worldcheck.assigneeIdentifier = cnu_so_77 worldcheck.assigneeIdentifier = cnu_so_77
worldcheck.response.limit = 1000
worldcheck.response.start = 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS `worldcheck` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idClient` char(5) NOT NULL,
`nameIdentifier` varchar(23) NOT NULL,
`name` varchar(50) NOT NULL,
`matchCount` int(4) DEFAULT NULL,
`dateInsert` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='worldcheck v1 2013-08-01' ;