fixed issue #0000064
This commit is contained in:
commit
c577ce3863
18
includes/portefeuille/function.php
Normal file
18
includes/portefeuille/function.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
function lienTri($tri, $vue, $source, $siret, $idEntreprise)
|
||||
{
|
||||
$output = './?page=portefeuille&vue='.$vue;
|
||||
$output.= isset($source) ? '&source='.$source : '' ;
|
||||
$output.= '&tri='.$tri.'&idEntreprise='.$idEntreprise.'&siret='.$siret;
|
||||
return $output;
|
||||
}
|
||||
|
||||
function lienPage($tri, $vue, $source, $siret, $idEntreprise, $position){
|
||||
$output = './?page=portefeuille&vue='.$vue;
|
||||
$output.= isset($tri) ? '&tri='.$tri : '';
|
||||
$output.= isset($source) ? '&source='.$source : '';
|
||||
$output.= '&idEntreprise='.$idEntreprise;
|
||||
$output.= '&siret='.$siret;
|
||||
$output.= '&p='.$position;
|
||||
return $output;
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
function assocSourceDroit()
|
||||
{
|
||||
function assocSourceDroit(){
|
||||
return array(
|
||||
'annonces' => 'survannonce',
|
||||
'insee' => 'survinsee',
|
||||
@ -13,16 +12,15 @@ function assocSourceDroit()
|
||||
);
|
||||
}
|
||||
|
||||
function assocSourceTxt()
|
||||
{
|
||||
function assocSourceTxt(){
|
||||
return array(
|
||||
'annonces' => 'les annonces légales',
|
||||
'insee' => 'les événements INSEE',
|
||||
'bilans' => 'les bilans',
|
||||
'annonces' => 'annonces légales',
|
||||
'insee' => 'événements INSEE',
|
||||
'bilans' => 'bilans',
|
||||
'score' => 'IndiScore',
|
||||
'actes' => 'les actes & status',
|
||||
'dirigeants' => 'les dirigeants',
|
||||
'privileges' => 'les privilèges (payant)',
|
||||
'actes' => 'actes & status',
|
||||
'dirigeants' => 'dirigeants',
|
||||
'privileges' => 'privilèges (payant)',
|
||||
);
|
||||
}
|
||||
|
||||
@ -35,6 +33,8 @@ function assocSourceTxt()
|
||||
* L'établissement à surveiller.
|
||||
* @param array $notEmail
|
||||
* Un tableau de login pour exclure l'affichage de l'adresse email
|
||||
* @param boolean $inDialog
|
||||
*
|
||||
* @return string
|
||||
* Retourne sous forme de chaine de caractère le fomulaire en HTML
|
||||
*/
|
||||
@ -47,16 +47,15 @@ function formSurveillance($source, $siret, $notEmail, $inDialog = false)
|
||||
|
||||
$output = '';
|
||||
|
||||
if($inDialog)
|
||||
{
|
||||
if($inDialog){
|
||||
$output.= '<style type="text/css">'.$style.'</style>'."\n";
|
||||
$output.= '<form id="frmSurv" name="frmSurv" '.
|
||||
'action="./pages/ajax_surveillance.php" method="post">'."\n";
|
||||
$output.= '<input name="q" type="hidden" value="setsurv"/>';
|
||||
$output.= '<input name="formSurv[siret]" type="hidden" value="'.
|
||||
$siret.'"/>'."\n";
|
||||
if( empty($source) )
|
||||
{
|
||||
|
||||
if( empty($source) ){
|
||||
$output.= '<div class="fieldgrp">'."\n";
|
||||
$output.= '<label>Types</label>'."\n";
|
||||
$output.= '<div class="field">'."\n";
|
||||
@ -153,20 +152,43 @@ function getSurveillance($source, $siret){
|
||||
$assocSourceDroit = assocSourceDroit();
|
||||
$return = '';
|
||||
$notEmail = array('testreunica', 'reunicacsf');
|
||||
|
||||
if (!empty($source) &&
|
||||
array_key_exists($source, $assocSourceDroit) &&
|
||||
hasPerm($assocSourceDroit[$source]) ){
|
||||
if( hasPref('voirsurv') && inSurveillance($source, $siret)){
|
||||
$return = '<br/>L\'entité est sous surveillance.'."\n";
|
||||
$listSurv = inSurveillance($source, $siret);
|
||||
if (hasPref('voirsurv') &&
|
||||
$listSurv!==FALSE){
|
||||
$return = dInfoSurveillance($listSurv);
|
||||
}else{
|
||||
$return = formSurveillance($source, $siret, $notEmail);
|
||||
}
|
||||
}else{
|
||||
$return = formSurveillance('', $siret, $notEmail);
|
||||
$listSurv = inSurveillance('', $siret);
|
||||
$return = dInfoSurveillance($listSurv);
|
||||
$return.= formSurveillance('', $siret, $notEmail);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function dInfoSurveillance($listSurv){
|
||||
$output = '';
|
||||
if (is_array($listSurv) && count($listSurv)>0){
|
||||
$output.= '<br/>L\'entité est sous surveillance';
|
||||
$sourceTxt = assocSourceTxt();
|
||||
$cSource = 0;
|
||||
foreach ($listSurv as $source => $info){
|
||||
$cSource++;
|
||||
$output.= ' <u>'.$sourceTxt[$source].'</u>';
|
||||
if ($cSource<count($listSurv)) $output.= ',';
|
||||
$ref = $info['ref'];
|
||||
}
|
||||
if (!empty($ref)) $output.= ' ('.$ref.')';
|
||||
$output.= ".\n";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'établissement est en surveillance
|
||||
*
|
||||
@ -179,13 +201,39 @@ function getSurveillance($source, $siret){
|
||||
*/
|
||||
function inSurveillance($source, $siret){
|
||||
global $client;
|
||||
try{
|
||||
try {
|
||||
$result = $client->getSurveillances($siret,$source);
|
||||
if(count($result['results']['reponses'])>0 ){
|
||||
$survSource = $result['results']['reponses'];
|
||||
if (count($survSource)>0 ){
|
||||
$find = FALSE;
|
||||
if(strlen($siret)>9) $siret = substr($siret, 0, 9);
|
||||
foreach($result['results']['reponses'] as $item){
|
||||
if($item['siren'] == $siret){ $find = TRUE; }
|
||||
if (!empty($source)){
|
||||
foreach($survSource as $item){
|
||||
if ($item['siren'] == $siret &&
|
||||
$item['source'] == $source)
|
||||
{
|
||||
$find[$item['source']] = array(
|
||||
'email' => $item['email'],
|
||||
'ref' => $item['ref'],
|
||||
'dateAjout' => $item['dateAjout'],
|
||||
'dateDerEnvoi' => $item['dateDerEnvoi'],
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$find = array();
|
||||
FB::log($survSource, 'SURV');
|
||||
foreach($survSource as $item){
|
||||
if ($item['siren'] == $siret){
|
||||
$find[$item['source']] = array(
|
||||
'email' => $item['email'],
|
||||
'ref' => $item['ref'],
|
||||
'dateAjout' => $item['dateAjout'],
|
||||
'dateDerEnvoi' => $item['dateDerEnvoi'],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $find;
|
||||
}else{ return false; }
|
||||
@ -224,10 +272,8 @@ function setSurveillance($tabForm)
|
||||
try{
|
||||
$result = $client->setSurveillance($siret, $email, $ref, $s,
|
||||
false, $encours);
|
||||
FB::log($s, 'Surveillance');
|
||||
$result = '';
|
||||
}catch(SoapFault $fault){
|
||||
FB::log($fault,'fault');
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
@ -237,10 +283,8 @@ function setSurveillance($tabForm)
|
||||
try{
|
||||
$result = $client->setSurveillance($siret, $email, $ref, $source,
|
||||
false, $encours);
|
||||
FB::log($source, 'Surveillance seul');
|
||||
$result = '';
|
||||
}catch (SoapFault $fault){
|
||||
FB::log($fault,'fault');
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ if (empty($type) == false) {
|
||||
case 'surveillance':
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
break;
|
||||
case 'portefeuille':
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
break;
|
||||
default:
|
||||
exit;
|
||||
break;
|
||||
|
@ -24,7 +24,7 @@ $tabScripts = array(
|
||||
),
|
||||
'scripts_telechargement' => array(
|
||||
'list' => array('telechargement.js'),
|
||||
'pages' => array('moncompte', 'administration'),
|
||||
'pages' => array('moncompte', 'administration', 'portefeuille'),
|
||||
),
|
||||
'scripts_portefeuille' => array(
|
||||
'list' => array('jquery.qtip.js', 'jquery.tablesorter.js'),
|
||||
|
@ -70,6 +70,14 @@ if ($start == 1) {
|
||||
$res = $client->
|
||||
getLogsClients($date, $detail, $idClient, $login, $tous);
|
||||
break;
|
||||
// ------------------------------------------------------------------- //
|
||||
// Portefeuille
|
||||
// ------------------------------------------------------------------- //
|
||||
case 'portefeuille':
|
||||
$login = $_SESSION['tabInfo']['login'];
|
||||
$idClient = $_SESSION['tabInfo']['idClient'];
|
||||
$res = $client->getPortefeuilleCsv($login, $idClient);
|
||||
break;
|
||||
}
|
||||
if (isset($res['result']['Url']) == true) {
|
||||
$return = $res['result']['Url'];
|
||||
|
@ -14,6 +14,7 @@ if(!hasPerm('portefeuille')){
|
||||
<h1 class="titre">PORTEFEUILLE</h1>
|
||||
<?php
|
||||
require_once 'common/dates.php';
|
||||
require_once 'portefeuille/function.php';
|
||||
|
||||
$idEntreprise = isset($_REQUEST['idEntreprise'])?
|
||||
$_REQUEST['idEntreprise'] : '';
|
||||
@ -32,12 +33,12 @@ switch($tri){
|
||||
case 'reference': $triws = 'ref'; break;
|
||||
case 'dateajout': $triws = 'dateAjout'; break;
|
||||
case 'datederenvoi': $triws = 'dateDerEnvoi'; break;
|
||||
case 'score' : $triws = 'indiScore'; break;
|
||||
}
|
||||
|
||||
//Liste des surveillances score de l'utilisateur
|
||||
try{
|
||||
$O = $client->getPortefeuille(0, $position, $nbAffichage, $triws);
|
||||
$firephp->log($O, 'O');
|
||||
$listSurveillance = $O['results']['reponses'];
|
||||
|
||||
$nbReponses = $O['results']['nbReponses'];
|
||||
@ -102,11 +103,47 @@ $(document).ready(function()
|
||||
<td><?=$nbSurveillances?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
// --------------------------------------------------------------------------- //
|
||||
// Extraction
|
||||
// --------------------------------------------------------------------------- //
|
||||
?>
|
||||
<h2>Exportation de votre portefeuille</h2>
|
||||
<p class="options">
|
||||
<input type="hidden" name="page" value="<?=$page?>"/>
|
||||
<a href="#" id="telechargementjs">Exporter votre portefeuille au format CSV</a>
|
||||
</p>
|
||||
<div id="telechargementjsMsg"></div>
|
||||
|
||||
|
||||
<h2>Options de tri</h2>
|
||||
<div class="options">
|
||||
<ul id="tri">
|
||||
<li>
|
||||
<a href="<?=lienTri('siren', $vue, $source, $siret, $idEntreprise)?>">
|
||||
Tri par Siren
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?=lienTri('rs', $vue, $source, $siret, $idEntreprise)?>">
|
||||
Tri par Raison sociale
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?=lienTri('reference', $vue, $source, $siret, $idEntreprise)?>">
|
||||
Tri par Référence
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?=lienTri('score', $vue, $source, $siret, $idEntreprise)?>">
|
||||
Tri par indiScore
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h2>Surveillance Score</h2>
|
||||
|
||||
<?php
|
||||
$firephp->log($totPage, 'totPage');
|
||||
if($totPage != 1)
|
||||
{
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user