Merge
This commit is contained in:
commit
946445189a
@ -71,113 +71,88 @@ function commentaires_lien($content){
|
||||
return $content;
|
||||
}
|
||||
|
||||
function commentaires_graph($id, $titre, $ratios = array() ){
|
||||
function commentaires_graphique($content){
|
||||
$pattern = '/\[GRAPHIQUE id=(.*?) titre=\'(.*?)\',(.*)]/';
|
||||
if( preg_match($pattern, $content, $matches) ){
|
||||
FB::log($matches,'graphique');
|
||||
$image_id = $matches[1];
|
||||
$titre = $matches[2];
|
||||
//Génération id/nom fichier graphique
|
||||
if (($siret*1)==0 || ($siren*1)<100){
|
||||
$id = 'gcomment-'.$idEntreprise.'-'.$image_id;
|
||||
}else{
|
||||
$id = 'gcomment-'.$siret.'-'.$image_id;
|
||||
}
|
||||
|
||||
//Determine le type du graphique
|
||||
$type = '';
|
||||
$typePattern = array(
|
||||
'histo' => '/(Rs?\[.*]#H,?){1,}/',
|
||||
'radar' => '/(R\[.*]#R,?){1,}/',
|
||||
'stacked' => '/(R\[.*],?){1,};(R\[.*],?){1,}/',
|
||||
);
|
||||
foreach($typePattern as $type => $pattern){
|
||||
if (preg_match($pattern,$matches[3], $match_type)>0){
|
||||
FB::log($match_type, $type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch($type){
|
||||
case 'histo':
|
||||
$image_file = commentaires_graph_histo($id, $titre, $matches[3]);
|
||||
break;
|
||||
case 'radar':
|
||||
$image_file= commentaires_graph_radar($id, $titre, $matches[3]);
|
||||
break;
|
||||
case 'stacked':
|
||||
$image_file = commentaires_graph_stacked($id, $titre, $matches[3]);
|
||||
break;
|
||||
default:
|
||||
$content = str_replace(
|
||||
$matches[0],
|
||||
'Erreur génération graphique',
|
||||
$content);
|
||||
break;
|
||||
}
|
||||
|
||||
//Le fichier image existe
|
||||
if( file_exists(PATH_SITE.'/cache/imgcache/'.$image_file) ){
|
||||
$content = str_replace(
|
||||
$matches[0],
|
||||
'<img src="./imgcache/'.$image_file.'" />',
|
||||
$content);
|
||||
}else{
|
||||
$content = str_replace(
|
||||
$matches[0],
|
||||
'Erreur génération graphique',
|
||||
$content);
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
function commentaires_graph_histo($id, $titre, $strRatios){
|
||||
$ratios = explode(',', $strRatios);
|
||||
$data = array();
|
||||
$pattern = '/(Rs?)\[(.*)]#(.{1})/';
|
||||
foreach($ratios as $ratio){
|
||||
//FB::log($ratio, 'ratio');
|
||||
if( preg_match($pattern, $ratio, $matches) ){
|
||||
$typeRatio = $matches[1];
|
||||
$numRatio = $matches[2];
|
||||
$typeElement = $matches[3];
|
||||
$titreRatio = commentaires_graph_lib($numRatio);
|
||||
if ($typeElement != 'R'){
|
||||
switch($typeRatio){
|
||||
case 'R' : $titreRatio.= ' - Entreprise'; break;
|
||||
case 'Rs' : $titreRatio.= ' - Secteur'; break;
|
||||
}
|
||||
}else{
|
||||
$supPattern = '/\(.*?\)/';
|
||||
$titreRatio = preg_replace($supPattern, '', $titreRatio);
|
||||
$supPattern = '/[ ]/';
|
||||
$titreRatio = preg_replace($supPattern, '<*br*>', $titreRatio);
|
||||
switch($typeRatio){
|
||||
case 'R' : $titreRatio.= ' - Entreprise'; break;
|
||||
case 'Rs' : $titreRatio.= ' - Secteur'; break;
|
||||
}
|
||||
$data['y'][] = array(
|
||||
'titre' => $titreRatio,
|
||||
'data' => commentaires_graph_y($typeRatio, $numRatio),
|
||||
'style' => $typeElement,
|
||||
);
|
||||
//FB::log($data['y'], 'data');
|
||||
}
|
||||
}
|
||||
$data['x'] = commentaires_graph_x();
|
||||
if ($typeElement == 'R'){
|
||||
$output = commentaires_graph_radar($id, $titre, $data);
|
||||
} else {
|
||||
$output = commentaires_graph_xy($id, $titre, $data);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function commentaires_graph_lib($numRatio){
|
||||
global $ratiosInfos;
|
||||
return htmlspecialchars_decode(
|
||||
$ratiosInfos['r'.$numRatio]['libelle'],
|
||||
ENT_QUOTES);
|
||||
}
|
||||
|
||||
function commentaires_graph_x(){
|
||||
global $bilansInfos;
|
||||
$output = array();
|
||||
foreach($bilansInfos as $bilan){
|
||||
$output[] = $bilan['dateCloture'];
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function commentaires_graph_y($typeRatio, $numRatio){
|
||||
global $ratiosEntrep, $ratiosSecteur;
|
||||
//FB::log($typeRatio, 'typeRatio');
|
||||
switch($typeRatio){
|
||||
case 'R' : $tabRatio = $ratiosEntrep; break;
|
||||
case 'Rs' : $tabRatio = $ratiosSecteur; break;
|
||||
}
|
||||
$output = array();
|
||||
foreach($tabRatio as $key => $val){
|
||||
//FB::log($val['r'.$numRatio], 'val');
|
||||
$output[$key] = $val['r'.$numRatio];
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function commentaires_graph_radar($id, $titre, $data){
|
||||
require_once 'phpchartdir/phpchartdir.php';
|
||||
$path = PATH_SITE.'/cache/imgcache/';
|
||||
$file = $id.'.png';
|
||||
if(count($data)<=1){
|
||||
$output = 0;
|
||||
}else{
|
||||
//Tri des données
|
||||
foreach($data['y'] as $yKey => $y){
|
||||
$i = 0;
|
||||
foreach($y['data'] as $val){
|
||||
$dataTri[$data['x'][$i]] = $val;
|
||||
$i++;
|
||||
}
|
||||
ksort($dataTri);
|
||||
$data['y'][$yKey]['data'] = array_values($dataTri);
|
||||
}
|
||||
sort($data['x']);
|
||||
foreach($data['y'] as $val){
|
||||
$num = count($val['data'])-1;
|
||||
$gdata[] = $val['data'][$num];
|
||||
$labels[] = $val['titre'];
|
||||
}
|
||||
}
|
||||
$c = new PolarChart(548, 480);
|
||||
$c->setPlotArea(270, 240, 150);
|
||||
$c->addAreaLayer($gdata, 0x9999ff);
|
||||
$c->angularAxis->setLabels($labels);
|
||||
if( $c->makeChart($path.$file) === true ){
|
||||
$output = $file;
|
||||
}else{
|
||||
$output = false;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function commentaires_graph_xy($id, $titre, $data){
|
||||
//Graphique
|
||||
require_once 'phpchartdir/phpchartdir.php';
|
||||
$path = PATH_SITE.'/cache/imgcache/';
|
||||
$file = $id.'.png';
|
||||
@ -214,39 +189,13 @@ function commentaires_graph_xy($id, $titre, $data){
|
||||
$jour = substr($x, 6, 2);
|
||||
$labelsX[] = $annee;
|
||||
}
|
||||
//Détection multi-bar
|
||||
$graphStyleMH = false;
|
||||
$precStyle = '';
|
||||
|
||||
$layer = $c->addBarLayer2(Side);
|
||||
$color = array(0xff8080, 0x80ff80, 0x8080ff);
|
||||
$i = 0;
|
||||
foreach($data['y'] as $ydata){
|
||||
if($ydata['style']=='H' && $precStyle == 'H'){
|
||||
$graphStyleMH = true;
|
||||
}
|
||||
$precStyle = $ydata['style'];
|
||||
}
|
||||
//Affichage standard
|
||||
if(!$graphStyleMH){
|
||||
foreach($data['y'] as $ydata){
|
||||
switch($ydata['style']){
|
||||
case 'L':
|
||||
$lineLayer = $c->addLineLayer(
|
||||
$ydata['data'], -1, $ydata['titre']);
|
||||
$lineLayer->setLineWidth(2);
|
||||
break;
|
||||
case 'H':
|
||||
$c->addBarLayer(
|
||||
$ydata['data'], -1, $ydata['titre']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Affichage multibar
|
||||
}else{
|
||||
$layer = $c->addBarLayer2(Side);
|
||||
$color = array(0xff8080, 0x80ff80, 0x8080ff);
|
||||
$i = 0;
|
||||
foreach($data['y'] as $ydata){
|
||||
$layer->addDataSet($ydata['data'], $color[$i], $ydata['titre']);
|
||||
$i++;
|
||||
}
|
||||
$layer->addDataSet($ydata['data'], $color[$i], $ydata['titre']);
|
||||
$i++;
|
||||
}
|
||||
$c->xAxis->setLabels($labelsX);
|
||||
if( $c->makeChart($path.$file) === true ){
|
||||
@ -258,3 +207,89 @@ function commentaires_graph_xy($id, $titre, $data){
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function commentaires_graph_radar($id, $titre, $strRatios){
|
||||
$ratios = explode(',', $strRatios);
|
||||
$data = array();
|
||||
$pattern = '/(Rs?)\[(.*)]#(.{1})/';
|
||||
foreach($ratios as $ratio){
|
||||
if( preg_match($pattern, $ratio, $matches) ){
|
||||
$typeRatio = $matches[1];
|
||||
$numRatio = $matches[2];
|
||||
$titreRatio = commentaires_graph_lib($numRatio);
|
||||
$supPattern = '/\(.*?\)/';
|
||||
$titreRatio = preg_replace($supPattern, '', $titreRatio);
|
||||
$supPattern = '/[ ]/';
|
||||
$titreRatio = preg_replace($supPattern, '<*br*>', $titreRatio);
|
||||
$data['y'][] = array(
|
||||
'titre' => $titreRatio,
|
||||
'data' => commentaires_graph_y($typeRatio, $numRatio),
|
||||
);
|
||||
}
|
||||
}
|
||||
$data['x'] = commentaires_graph_x();
|
||||
|
||||
//Graphique
|
||||
require_once 'phpchartdir/phpchartdir.php';
|
||||
$path = PATH_SITE.'/cache/imgcache/';
|
||||
$file = $id.'.png';
|
||||
if(count($data)<=1){
|
||||
$output = 0;
|
||||
}else{
|
||||
//Tri des données
|
||||
foreach($data['y'] as $yKey => $y){
|
||||
$i = 0;
|
||||
foreach($y['data'] as $val){
|
||||
$dataTri[$data['x'][$i]] = $val;
|
||||
$i++;
|
||||
}
|
||||
ksort($dataTri);
|
||||
$data['y'][$yKey]['data'] = array_values($dataTri);
|
||||
}
|
||||
sort($data['x']);
|
||||
foreach($data['y'] as $val){
|
||||
$num = count($val['data'])-1;
|
||||
$gdata[] = $val['data'][$num];
|
||||
$labels[] = $val['titre'];
|
||||
}
|
||||
}
|
||||
$c = new PolarChart(548, 480);
|
||||
$c->setPlotArea(270, 240, 150);
|
||||
$c->addAreaLayer($gdata, 0x9999ff);
|
||||
$c->angularAxis->setLabels($labels);
|
||||
if( $c->makeChart($path.$file) === true ){
|
||||
$output = $file;
|
||||
}else{
|
||||
$output = false;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function commentaires_graph_lib($numRatio){
|
||||
global $ratiosInfos;
|
||||
return htmlspecialchars_decode(
|
||||
$ratiosInfos['r'.$numRatio]['libelle'],
|
||||
ENT_QUOTES);
|
||||
}
|
||||
|
||||
function commentaires_graph_x(){
|
||||
global $bilansInfos;
|
||||
$output = array();
|
||||
foreach($bilansInfos as $bilan){
|
||||
$output[] = $bilan['dateCloture'];
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function commentaires_graph_y($typeRatio, $numRatio){
|
||||
global $ratiosEntrep, $ratiosSecteur;
|
||||
switch($typeRatio){
|
||||
case 'R' : $tabRatio = $ratiosEntrep; break;
|
||||
case 'Rs' : $tabRatio = $ratiosSecteur; break;
|
||||
}
|
||||
$output = array();
|
||||
foreach($tabRatio as $key => $val){
|
||||
$output[$key] = $val['r'.$numRatio];
|
||||
}
|
||||
return $output;
|
||||
}
|
@ -418,6 +418,8 @@ function syntheseRatioMin()
|
||||
'r7' => array('total'=>'r5', 'total_info'=>'% ca', 'op' => 1000, 'titre'=>'RESULTAT COURANT'),
|
||||
'r10' => array('total'=>'r5', 'total_info'=>'% ca', 'op' => 1000, 'titre'=>'RESULTAT NET'),
|
||||
'r70' => array('total'=>'r22', 'total_info'=>'% bilan', 'op' => 1000, 'titre'=>'FONDS PROPRES'),
|
||||
'r231' => array('total'=>'r22', 'total_info'=>'% bilan', 'op' => 1000, 'titre'=>'FONDS DE ROULEMENT'),
|
||||
'r232' => array('total'=>'r22', 'total_info'=>'% bilan', 'op' => 1000, 'titre'=>'BESOIN EN FONDS DE ROULEMENT'),
|
||||
'r63' => array('total'=>'', 'total_info'=>'', 'op' => 1000, 'titre'=>'TRESORERIE NETTE'),
|
||||
'r20' => array('total'=>'r5', 'total_info'=>'% ca', 'op' => 1000, 'titre'=>'FRAIS FINANCIER'),
|
||||
);
|
||||
|
@ -203,7 +203,7 @@ if (isset($O['03'])){
|
||||
?>
|
||||
Greffe du <?=$priv['greffeLib']?> en date du <?=WDate::dateT('Y-m-d','d/m/Y',$priv['dateFraiche'])?><br/>
|
||||
<br/>
|
||||
<?=$priv['nb']?> inscription(s) pour un montant conservé de <?=$priv['insCumul']?> €<br/>
|
||||
<?=$priv['nb']?> inscription(s) pour un montant conservé de <?=number_format($priv['insCumul'], 2, ',', ' ')?> €<br/>
|
||||
Dernière inscription par <?=$priv['nomDerCre']?> faîtes le <?=WDate::dateT('Y-m-d','d/m/Y',$priv['dateDerInsc'])?><br/>
|
||||
<br/>
|
||||
<a href="./?page=privileges&siret=<?=$siret?>&vue=03">Voir le détail des inscriptions</a>
|
||||
@ -227,7 +227,7 @@ if (isset($O['04'])){
|
||||
?>
|
||||
Greffe du <?=$priv['greffeLib']?> en date du <?=WDate::dateT('Y-m-d','d/m/Y',$priv['dateFraiche'])?><br/>
|
||||
<br/>
|
||||
<?=$priv['nb']?> inscription(s) pour un montant conservé de <?=$priv['insCumul']?> €<br/>
|
||||
<?=$priv['nb']?> inscription(s) pour un montant conservé de <?=number_format($priv['insCumul'], 2, ',', ' ')?> €<br/>
|
||||
Dernière inscription par <?=$priv['nomDerCre']?> faîtes le <?=WDate::dateT('Y-m-d','d/m/Y',$priv['dateDerInsc'])?><br/>
|
||||
<br/>
|
||||
<a href="./?page=privileges&siret=<?=$siret?>&vue=04">Voir le détail des inscriptions</a>
|
||||
|
@ -59,6 +59,7 @@ TPRE = $(TDIR)/test-
|
||||
PHP_UI = php $(PWD)/update-investigation-tests.php
|
||||
PHP_CD = php test-credit-data.php
|
||||
PHP_ME = php monitor-events.php
|
||||
SIRET = 55214450300018
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
@ -102,10 +103,10 @@ test-suite:
|
||||
sed 's/$(SRC)/$(DST)/g' | \
|
||||
sed 's/$(TST)/$(DST)/g' | \
|
||||
sed 's/$(SRV)\/credit-data\/v1/$(DST)\/credit-data\/v1\//g' | \
|
||||
sed 's/0406952018/55214450300018/g' | \
|
||||
sed 's/533885/55214450300018/g' | \
|
||||
sed 's/0406952018/55214450300018/g' | \
|
||||
sed 's/<CompanyId>34/<CompanyId>55214450300018/g' | \
|
||||
sed 's/0406952018/$(SIRET)/g' | \
|
||||
sed 's/533885/$(SIRET)/g' | \
|
||||
sed 's/0406952018/$(SIRET)/g' | \
|
||||
sed 's/<CompanyId>34/<CompanyId>$(SIRET)/g' | \
|
||||
sed 's/<con:value>BE/<con:value>FR/g' | \
|
||||
sed 's/<con:value>NL/<con:value>FR/g' | \
|
||||
sed 's/<con:value>nl/<con:value>fr/g' | \
|
||||
@ -163,7 +164,7 @@ tests: $(TESTS1) $(TESTS2) $(TESTS3) $(TESTS4)
|
||||
|
||||
.PHONY: $(TESTS1)
|
||||
$(TESTS1):
|
||||
$(PHP_CD) CompanyId=55214450300018 action=$@ > $(TPRE)$@.txt
|
||||
$(PHP_CD) CompanyId=$(SIRET) action=$@ > $(TPRE)$@.txt
|
||||
|
||||
.PHONY: $(TESTS2)
|
||||
$(TESTS2):
|
||||
|
@ -56,8 +56,8 @@ function modeTestUniquement()
|
||||
// Serveur
|
||||
// --------------------------------------------------------------------------- //
|
||||
abstract class AccountItem { }
|
||||
class AmountAccountItem extends AccountItem { }
|
||||
class NumberAccountItem extends AccountItem { }
|
||||
class AmountAccountItem extends AccountItem { }
|
||||
class NumberAccountItem extends AccountItem { }
|
||||
if (NDEBUG) {
|
||||
$serveur =
|
||||
new SoapServer(SERVICES_URL.
|
||||
@ -851,7 +851,7 @@ function Ping($o)
|
||||
if (isset($addr[2]) == true) {
|
||||
$port = str_replace('/', '', $addr[2]);
|
||||
} else {
|
||||
$port = -1;
|
||||
$port = 80;
|
||||
}
|
||||
$fp = fsockopen($hote, $port);
|
||||
if ($fp != false) {
|
||||
@ -978,6 +978,10 @@ function getDataSet($company_id, $data_set_type)
|
||||
if ($identite == false) {
|
||||
throw technicalError(1, 'scoresws_identite');
|
||||
}
|
||||
if (empty($identite['Siret']) == true) {
|
||||
throw functionalError(3000, $o->CompanyId);
|
||||
}
|
||||
|
||||
$indiscore = scoresws_indiscore($company_id, $siren, 0);
|
||||
if ($indiscore == false) {
|
||||
throw technicalError(1, 'scoresws_indiscore');
|
||||
|
@ -38,7 +38,7 @@ $gServiceHeader = new StdClass;
|
||||
$gServiceHeader->ConsumerId = 'a1234';
|
||||
//$gServiceHeader->CustomerId = 'a1234';
|
||||
$gServiceHeader->Provider = new StdClass;
|
||||
$gServiceHeader->Provider->ProviderId = 'SD';
|
||||
$gServiceHeader->Provider->ProviderId = 'SED';
|
||||
$gServiceHeader->Provider->CountryCode = 'FR';
|
||||
$gServiceHeader->TimeStamp = date('Y-m-d\TH:i:s');
|
||||
$gServiceHeader->TestIndication = true;
|
||||
@ -130,10 +130,10 @@ print_r($o);
|
||||
print '<br/>';
|
||||
if (NDEBUG) {
|
||||
print_r($soap_client->__call($fonction, array($o)));
|
||||
print '<br/>';
|
||||
print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
|
||||
print '<br/>';
|
||||
print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
|
||||
//print '<br/>';
|
||||
//print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
|
||||
//print '<br/>';
|
||||
//print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
|
||||
} else {
|
||||
require_once 'credit-data/v1/index.php';
|
||||
print_r(call_user_func($fonction, $o));
|
||||
|
Loading…
x
Reference in New Issue
Block a user