Merge from branch 2.4

This commit is contained in:
Michael RICOIS 2013-10-04 12:41:24 +00:00
parent de20a05968
commit 201a2b45e4
23 changed files with 271 additions and 97 deletions

View File

@ -33,17 +33,17 @@ class DirigeantController extends Zend_Controller_Action
}
$dirigeants = $infos->result->item;
$user = new Scores_Utilisateur();
$session = new SessionEntreprise($this->siret, $this->id);
if ($user->checkPerm('dirigeantsop')){
$href = $this->view->url(array('controller'=>'dirigeant', 'action'=>'op', 'siret'=>$this->siret));
$this->view->assign('dirigeantsop', $href);
}
$this->view->assign('edition', $user->checkModeEdition());
$this->view->assign('permission', $user->checkPerm('WORLDCHECK'));
$this->view->assign('accessWorldCheck', $user->checkPerm('WORLDCHECK'));
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);

View File

@ -169,7 +169,7 @@ class IdentiteController extends Zend_Controller_Action
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('infos', $infos);
$this->view->assign('siret', $infos->Siret);
$this->view->assign('permission', $user->checkPerm('WORLDCHECK'));
$this->view->assign('accessWorldCheck', $user->checkPerm('WORLDCHECK'));
$survDroits = array('survannonce', 'survinsee', 'survbilan', 'survscore', 'survactes', 'survdirigeants', 'survpriv');
$countSurvDroits = 0;

View File

@ -376,7 +376,7 @@ class PiecesController extends Zend_Controller_Action
{
$infosBilan = array();
$infosBilan['date'] = $item['date_cloture'];
$infosBilan['type'] = 'Comptes millésime '.$item['millesime'];
$infosBilan['type'] = 'Comptes '.$item['type'].' millésime '.$item['millesime'];
$infosBilan['mode'] = $item['mode'];
$infos = array(
'date_cloture' => $item['date_cloture'],

View File

@ -81,6 +81,9 @@ class PrintController extends Zend_Controller_Action
break;
}
break;
case 'worldcheck':
$params['matchIdentifier'] = $elements[2];
break;
default:
return false;
break;

View File

@ -1,10 +1,16 @@
<?php
class WorldcheckController extends Zend_Controller_Action
{
protected $wcConfig;
public function init()
{
require_once 'WorldCheck/WsWorldCheck.php';
require_once 'WorldCheck/SessionWorldcheck.php';
require_once 'Scores/Cache.php';
$configWC = new Zend_Config_Ini(APPLICATION_PATH . '/../library/WorldCheck/applicationWC.ini');
$this->wcConfig = $configWC->worldcheck->toArray();
}
/**
@ -44,12 +50,10 @@ class WorldcheckController extends Zend_Controller_Action
$summary = new stdClass();
$summary->nameIdentifier = $nameIdentifier;
$summary->matchType = 'WATCHLIST';
//get results by lastName
$unfilteredWC = new stdClass();
$unfilteredWC = $wc->getSummariesArr($summary);
//end
$cache = new Cache();
$unfilteredWC = $cache->wcCache($this->wcConfig['cachedir'], $wc, "getSummariesArr", $summary, $nameIdentifier);
//check if display all results (search by lastName), or filtered results (search by fullName)
$filtre = $request->getParam('filtre', 'tout');
$resultWC = $unfilteredWC;
@ -86,30 +90,15 @@ class WorldcheckController extends Zend_Controller_Action
$this->view->assign('filtres', $filtres);
//end
$configWC = new Zend_Config_Ini(APPLICATION_PATH . '/../library/WorldCheck/applicationWC.ini');
$cacheConfig = $configWC->worldcheck->toArray();
/*$frontendOptions = array(
'lifetime' => $cacheConfig['cachedir']['lifetime'],
'automatic_serialization' => true
);
$backendOptions = array('cache_dir' => $cacheConfig['cachedir']['path'].$cacheConfig['cachedir']['name']);
$cache = Zend_Cache::factory('Output','File',$frontendOptions,$backendOptions);*/
//paginate results list
Zend_View_Helper_PaginationControl::setDefaultViewPartial('worldcheck/controls.phtml');
$paginator = Zend_Paginator::factory($resultWC);
$this->view->paginator = $paginator;
$itemCount = $cacheConfig['page']['items'];
$itemCount = $this->wcConfig['page']['items'];
$page = $this->_getParam('page', 1);
$ol_number = ($page-1)*$itemCount+1;
/*if(!($cache->load('page_'.$page))) {
$cache->save($paginator, 'page_'.$page);
}*/
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($itemCount);
@ -157,10 +146,13 @@ class WorldcheckController extends Zend_Controller_Action
$param->nameType = $session->getNameType();
$wc = new WsWorldCheck();
$content = $wc->getDetailsContent($param);
$cache = new Cache();
$content = $cache->wcCache($this->wcConfig['cachedir'], $wc, "getDetailsContent", $param, $param->matchIdentifier);
$this->view->assign('matchIdentifier', $param->matchIdentifier);
$this->view->assign('content', $content);
$this->view->assign('nameType', $param->nameType);
$this->view->assign('exportObjet', $content);
}
}

View File

@ -101,7 +101,7 @@ table.data td { border:1px solid #ccc; padding:5px; }
<?php }?>
</td>
<?php if (empty($this->AutrePage)) { ?>
<?php if( $this->permission ) { ?>
<?php if( $this->accessWorldCheck ) { ?>
<td>
<?php if ($dir->Societe != '') { ?>
<img class="wcheck" id="<?='/dirType/ORGANISATION/dirSociete/'.$dir->Societe;?>" src='/themes/default/images/worldcheck/wc.png'/>
@ -166,7 +166,7 @@ $('img.wcheck').each(function(){
show: { solo: true, delay: 1000 },
content: { title: {button: true}, text: "Chargement...",
ajax: { url: '<?=$this->url(array('controller'=>'worldcheck','action'=>'occurence','siren'=>substr($this->siret, 0, 9)),null,true);?>'+$(this).attr('id') } },
position: { my: "bottom left", at: "top left" }
position: { my: "bottom left", at: "top center" }
});
});
</script>

View File

@ -3,16 +3,14 @@
<script type="text/javascript">
<?php echo 'var marks = '.$this->marks.';'?>
$(document).ready(function(){
var min_lat = 51.0889618;
var max_lat = 41.3423276;
var min_lng = 9.560067799999999;
var max_lng = -5.141227900000001;
var zoneMarker = new google.maps.LatLngBounds();
//Create the map
var geocoder = new google.maps.Geocoder();
var initCenter = new google.maps.LatLng(46.227638,2.213749);
var mapOptions = {
zoom: 8,
zoom: 10,
center: initCenter,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
@ -23,10 +21,7 @@ $(document).ready(function(){
codeAddress(marks, i);
}
/*map.fitBounds(new google.maps.LatLngBounds(
new google.maps.LatLng(min_lat, min_lng),
new google.maps.LatLng(max_lat, max_lng))
);*/
map.fitBounds(zoneMarker);
//Bounds the maps
function codeAddress(marks, position) {
@ -46,6 +41,7 @@ $(document).ready(function(){
title: marks[position]['title'],
icon: marks[position]['icon'],
});
zoneMarker.extend(marker.getPosition());
//Create event marker
google.maps.event.addListener(marker, 'click', function() {

View File

@ -58,7 +58,9 @@ echo $this->partial('identite/fiche-item.phtml', $this->dBlock['AutreSiren']);
<h2>Raison sociale &amp; Coordonnées</h2>
<div class="paragraph">
<?php if($this->permission) { ?>
<?php if ( empty($this->AutrePage) ) {?>
<?php if($this->accessWorldCheck) { ?>
<div style="float:right;">
<img class="wcheck" src='/themes/default/images/worldcheck/wc.png'/>
</div>
@ -69,11 +71,13 @@ $('img.wcheck').each(function(){
show: { solo: true, delay: 1000 },
content: { title: {button: true}, text: "Chargement...",
ajax: { url: '<?=$this->url(array('controller'=>'worldcheck','action'=>'occurence', 'dirSociete'=>$this->infos->Nom, 'dirType' =>'ORGANISATION', 'siren'=>substr($this->siret, 0, 9)),null,true);?>' } },
position: { my: "bottom left", at: "top left" }
position: { my: "bottom left", at: "top center" }
});
});
</script>
<?php }?>
<?php }?>
<table>
<?php
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['RaisonSociale']);

View File

@ -29,11 +29,13 @@
</tr>
<?php }?>
</table>
</div>
<div style="margin:5px;" class="ui-state-highlight ui-corner-all">
<p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
Les éléments disponibles ci-dessous en téléchargement ou commande peuvent faire l'objet d'une facturation selon vos accords contractuels.
</p></div>
</p>
</div>
<h2>Actes & Status</h2>
<div class="paragraph">

View File

@ -6,9 +6,9 @@ $form = $this->form;
<h3>RECHERCHE WORLDCHECK</h3>
<form class="recherche" name="<?php echo $form->getName()?>"
method="<?php echo $form->getMethod()?>" action="<?php echo $form->getAction()?>">
<?php echo $form->type?>
<div class="row"><?php echo $form->dirType?></div>
<?=$form->type?>
<div class="row"><?php echo $form->dirType?>
<img src="/themes/default/images/info.gif" title="Recherche de personne physique ou de sociétés. Les champs 'TYPE' et 'NOM' sont obligatoirs à remplir" /></div>
<div class="row" id='nom'><?php echo $form->dirNom?></div>
<div class="row" id='prenom'><?php echo $form->dirPrenom?></div>

View File

@ -3,28 +3,20 @@
<!-- First page link -->
<?php if (isset($this->previous)) { ?>
<a href="<?php echo $this->url(array('page' => $this->first)); ?>"><img src="/themes/default/images/worldcheck/first.png" title='Première page'/></a>
<?php } else { ?>
<span class="disabled"><img src="/themes/default/images/worldcheck/first.png" /></span>
<?php } ?>
<!-- Previous page link -->
<?php if (isset($this->previous)) { ?>
<a href="<?php echo $this->url(array('page' => $this->previous)); ?>"><img src="/themes/default/images/worldcheck/prev.png" title='Page précédente'/></a>
<?php } else { ?>
<span class="disabled"><img src="/themes/default/images/worldcheck/prev.png" /></span>
<?php } ?>
&nbsp;
<!-- Next page link -->
<?php if (isset($this->next)) { ?>
<a href="<?php echo $this->url(array('page' => $this->next)); ?>"><img src="/themes/default/images/worldcheck/next.png" title='Page suivante'/></a>
<?php } else { ?>
<span class="disabled"><img src="/themes/default/images/worldcheck/next.png" /></span>
<?php } ?>
<!-- Last page link -->
<?php if (isset($this->next)) { ?>
<a href="<?php echo $this->url(array('page' => $this->last)); ?>"><img src="/themes/default/images/worldcheck/last.png" title='Dernière page'/></a>
<?php } else { ?>
<span class="disabled"><img src="/themes/default/images/worldcheck/last.png" /></span>
<?php } ?>
<?php } ?>

View File

@ -218,7 +218,7 @@ $('img.wcheck').each(function(){
show: { solo: true, delay: 1000 },
content: { title: {button: true}, text: "Chargement...",
ajax: { url: '<?=$this->url(array('controller'=>'worldcheck','action'=>'occurence'));?>'+$(this).attr('id') } },
position: { my: "bottom left", at: "top left" }
position: { my: "bottom left", at: "top center" }
});
});
</script>

View File

@ -34,15 +34,15 @@ class Liasse
//Affectaction des postes
foreach ($data->POSTES->item as $element){
if (in_array(array(
if (in_array($element->id, array(
'YP', 'YP1', '376', // Effectifs 2033 et 2050
'M2G', 'M2H', // Autres effectifs
'ZK', 'ZK1', // Taux
'IJ', 'JG', 'JH', 'JJ', 'ZR', // pour holding/ste mere
'XP' //numero de centre de gestion agréé
), $element->id))
)))
{
$this->postes[$element->id] = $element->val;
$this->postes[$element->id] = number_format($element->val, 0, '', ' ');
} else {
$this->postes[$element->id] = $this->dMontant($element->val);
}
@ -177,10 +177,10 @@ class Liasse
'YY'=>'374',
'YZ'=>'378',
'YP'=>'376',
//@todo : Traiter N-1
//@todo : Traiter N-1
);
$bilanRN=array();

View File

@ -547,13 +547,15 @@ class Infogreffe
$bilan['mode_diffusion'][] = $mode->getAttribute('type');
}
Zend_Registry::get('firebug')->info('Bilan : '.$bilan['date_cloture'].' '.$bilan['type_comptes']);
//Génération de l'index pour le tri
$date = $bilan['date_cloture_iso'];
if(!empty($date))
{
$datef = substr($date,0,4).substr($date,5,2).substr($date,8,2);
$key = substr($date,0,4).substr($date,5,2).substr($date,8,2).'-'.$bilan['num_depot'];
//Affectation liste générale avec un index permettant le tri
$bilans[$datef] = $bilan;
$bilans[$key] = $bilan;
}
}
krsort($bilans);

View File

@ -124,4 +124,36 @@ class Cache
fclose($fp);
return $result;
}
/**
* Caching WorldCheck Data using Zend_cache
*
* @param array $config (elements: path, name, lifetime)
* @param object $class (object of calling class)
* @param string $function (name of member function)
* @param array $param (arguments of member function)
* @param string $file_name (cache filename)
* @return mixed (array object)
*/
public function wcCache($config, $class, $function, $param, $file_name)
{
//caching
$cache_dir = $config['path'].$config['name'];
if (!is_dir($cache_dir)) mkdir($cache_dir, 0777, true);
$frontendOptions = array(
'lifetime' => $config['lifetime'],
'automatic_serialization' => true
);
$backendOptions = array('cache_dir' => $cache_dir);
$cache = Zend_Cache::factory('Output','File',$frontendOptions,$backendOptions);
if(!($cache_data = $cache->load($file_name))) {
$cache_data = new stdClass();
$cache_data = call_user_func_array(array($class, $function), array($param));
$cache->save($cache_data, $file_name);
}
//end
return $cache_data;
}
}

View File

@ -75,7 +75,7 @@ class Menu
'permission' => 'SEARCHACT',
),
array(
'label' => "Rechercher WorldCheck",
'label' => "Recherche WorldCheck",
'controller' => 'recherche',
'action' => 'worldcheck',
'forceVisible' => false,
@ -331,6 +331,7 @@ class Menu
'label' => "Valorisation",
'controller' => 'evaluation',
'action' => 'valorisation',
'permission' => array('VALORISATION'),
),
array(
'label' => "Scoring Credit Safe",
@ -829,13 +830,6 @@ class Menu
break;
case 'evaluation':
switch($action){
case 'valorisation':
$user = new Scores_Utilisateur();
if ($user->getIdClient()==1) {
return true;
}
return false;
break;
case 'indiscore':
$siretSiege = substr($this->siret, 0,9);
if (!empty($siretSiege) && intval($siretSiege)!=0 ){

View File

@ -34,6 +34,7 @@ class PagePrint
'giant-compact' => 'Pays,Type,CompanyId',
'giant-creditrecommendation' => 'Pays,Type,CompanyId',
'surveillance-fichier' => 'nomFic,filtre',
'worldcheck-matchcontent' => 'matchIdentifier',
);
protected $pagePDF = array(
@ -65,6 +66,7 @@ class PagePrint
'giant-full' => 'Pays,Type,CompanyId',
'giant-compact' => 'Pays,Type,CompanyId',
'giant-creditrecommendation' => 'Pays,Type,CompanyId',
'worldcheck-matchcontent' => 'matchIdentifier',
);
protected $pageXML = array(
@ -89,6 +91,7 @@ class PagePrint
'evaluation-indiscore2' => 'siret,id',
'evaluation-indiscore3' => 'siret,id',
'evaluation-valorisation' => 'siret,id',
'worldcheck-matchcontent' => 'matchIdentifier',
);
public function __construct($controller, $action)
@ -141,24 +144,15 @@ class PagePrint
public function objectToXML($object, $params)
{
require_once 'XML/Serializer.php';
$options = array (
'addDecl' => TRUE,
'encoding' => 'UTF-8',
'indent' => ' ',
'rootName' => 'root',
'defaultTagName' => 'element',
);
// Instantiate the serializer with the options
$Serializer = new XML_Serializer($options);
// Serialize the data structure
$result = $Serializer->serialize($object);
if($result === true) {
$content = $Serializer->getSerializedData();
$serializer = new Scores_Serializer_Adapter_Xml();
try {
$content = $serializer->serialize($object);
$filename = $this->filename('xml', $params);
$c = Zend_Registry::get('config');
$path = realpath($c->profil->path->files).'/';
file_put_contents($path.$filename.'.xml', $content);
} catch (Zend_Serializer_Exception $e) {
//Error
}
}
}

View File

@ -0,0 +1,164 @@
<?php
class Scores_Serializer_Adapter_Xml extends Zend_Serializer_Adapter_AdapterAbstract
{
/**
* @var array Default options
*/
protected $_options = array(
'rootNode' => 'root',
);
/**
* Serialize PHP value to XML
*
* @param mixed $value
* @param array $opts
* @return string
* @throws Zend_Serializer_Exception on XML encoding exception
*/
public function serialize($value, array $opts = array())
{
$opts = $opts + $this->_options;
try {
$dom = new DOMDocument('1.0', 'utf-8');
$root = $dom->appendChild($dom->createElement($opts['rootNode']));
$this->createNodes($dom, $value, $root, false);
return $dom->saveXml();
} catch (Exception $e) {
require_once 'Zend/Serializer/Exception.php';
throw new Zend_Serializer_Exception('Serialization failed', 0, $e);
}
}
/**
* Deserialize XML to PHP value
*
* @param string $json
* @param array $opts
* @return mixed
*/
public function unserialize($xml, array $opts = array())
{
try {
Zend_Json::fromXml($xml);
return (array) Zend_Json::decode($json, Zend_Json::TYPE_OBJECT);
} catch (Exception $e) {
require_once 'Zend/Serializer/Exception.php';
throw new Zend_Serializer_Exception('Unserialization failed by previous error', 0, $e);
}
}
private function createNodes($dom, $data, &$parent)
{
switch (gettype($data)) {
case 'string':
case 'integer':
case 'double':
$parent->appendChild($dom->createTextNode($data));
break;
case 'boolean':
switch ($data) {
case true:
$value = 'true';
break;
case false:
$value = 'false';
break;
}
$parent->appendChild($dom->createTextNode($value));
break;
case 'object':
case 'array':
foreach ($data as $key => $value) {
if (is_object($value) and $value instanceOf DOMDocument and !empty($value->firstChild)) {
$node = $dom->importNode($value->firstChild, true);
$parent->appendChild($node);
} else {
$attributes = null;
// SimpleXMLElements can contain key with @attribute as the key name
// which indicates an associated array that should be applied to the xml element
if (is_object($value) and $value instanceOf SimpleXMLElement) {
$attributes = $value->attributes();
$value = (array) $value;
}
// don't emit @attribute as an element of it's own
if ($key[0] !== '@')
{
if (gettype($value) == 'array' and !is_numeric($key)) {
$child = $parent->appendChild($dom->createElement($key));
if ($attributes)
{
foreach ($attributes as $attrKey => $attrValue)
{
$child->setAttribute($attrKey, $attrValue);
}
}
$this->createNodes($dom, $value, $child);
} else {
if (is_numeric($key)) {
$key = sprintf('%s', $this->depluralize($parent->tagName));
}
$child = $parent->appendChild($dom->createElement($key));
if ($attributes)
{
foreach ($attributes as $attrKey => $attrValue)
{
$child->setAttribute($attrKey, $attrValue);
}
}
$this->createNodes($dom, $value, $child);
}
}
}
}
break;
}
}
private function depluralize($word) {
$rules = array(
'ss' => false,
'os' => 'o',
'ies' => 'y',
'xes' => 'x',
'oes' => 'o',
'ies' => 'y',
'ves' => 'f',
's' => null
);
// Loop through all the rules
foreach(array_keys($rules) as $key) {
// If the end of the word doesn't match the key, it's not a candidate for replacement.
if (substr($word, (strlen($key) * -1)) != $key) {
continue;
}
// If the value of the key is false, stop looping and return the original version of the word.
if ($key === false) {
return $word;
}
// apply the rule
return substr($word, 0, strlen($word) - strlen($key)) . $rules[$key];
}
return $word;
}
}

View File

@ -2876,9 +2876,10 @@ class WsScores
$message.= "Detail :\n".$fault->getTraceAsString();
$message.= "\n\n";
$controller = Zend_Controller_Front::getInstance();
$message.= "Request Parameters :\n ".print_r($controller->getRequest()->getParams(), true);
$message.= "\n\n";
if ( $controller = Zend_Controller_Front::getInstance() ) {
$message.= "Request Parameters :\n ".print_r($controller->getRequest()->getParams(), true);
$message.= "\n\n";
}
$message.= "Referer : ".$_SERVER['HTTP_REFERER']."\n\n";

View File

@ -49,7 +49,6 @@ class WsWorldCheck
} catch (Exception $e) {
throw new Exception('Application Error');
}
return $client;
}
@ -89,8 +88,8 @@ class WsWorldCheck
$client = $this->loadClientWC('screener');
try {
$response = $client->screen($params);
echo $client->__getLastRequest();
echo $client->__getLastResponse();
//echo $client->__getLastRequest();
//echo $client->__getLastResponse();
return $response->return;
} catch (SoapFault $fault) {

View File

@ -10,4 +10,4 @@ wsworldcheck.response.start = 0
worldcheck.page.items = 15
worldcheck.cachedir.path = ../data/cache/
worldcheck.cachedir.name = worldcheck
worldcheck.cachedir.lifetime = 7200
worldcheck.cachedir.lifetime = 86400

View File

@ -657,12 +657,11 @@ input[type="checkbox"] { margin:0 5px 0 5px; border:0; }
.submit {text-align:center;}
.noborder {border:none;}
#message {margin:10px 0 10px 30px;}
table.greffe {width:95%; margin:5px 10px;border-collapse:collapse;}
table.greffe th {border:1px solid #000000;padding:8px 4px 8px 4px;background-color:#eeeeee;text-align: center; }
table.greffe .date { text-align: center; }
table.greffe td.date { background-color:#2b2b8b;color:white;font-weight:bold;}
table.greffe {width:100%;border-collapse:collapse;}
table.greffe th {border:1px solid #000000;padding:8px 4px 8px 4px;background-color:#eeeeee;text-align:center; }
table.greffe td.date {text-align:center;background-color:#2b2b8b;color:white;font-weight:bold;width:90px;}
table.greffe td { border:1px solid #000000;padding:8px 4px 8px 4px;}
table.greffe td.decision { width:50%; }
table.greffe td.decision {}
table.greffe td.type {text-align:center;}
/* Kbis

View File

@ -57,7 +57,7 @@ $logins = array(
'efood' => 'c04a8b5249ed0deaac0b55c8c7719dd6',
'groupmsurv' => '7405a5afba5a1e5f27982eb22d2bf542',
'initialadm' => '041c15646e425682859e396734ec2240',
'paprec1' => 'e8854054f29792d67a5c43bbb764653e',
'paprec1' => '582a6470d2fb8a44c8c7ad6387f56bd4',
);
if ( $opts->get ) {