diff --git a/includes/portefeuille/function.php b/includes/portefeuille/function.php new file mode 100644 index 000000000..763f48dda --- /dev/null +++ b/includes/portefeuille/function.php @@ -0,0 +1,18 @@ + '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.= ''."\n"; $output.= '
'."\n"; $output.= ''; $output.= ''."\n"; - if( empty($source) ) - { + + if( empty($source) ){ $output.= '
'."\n"; $output.= ''."\n"; $output.= '
'."\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 = '
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.= '
L\'entité est sous surveillance'; + $sourceTxt = assocSourceTxt(); + $cSource = 0; + foreach ($listSurv as $source => $info){ + $cSource++; + $output.= ' '.$sourceTxt[$source].''; + if ($cSourcegetSurveillances($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; } } diff --git a/www/datafile.php b/www/datafile.php index 607443eab..8869fe680 100644 --- a/www/datafile.php +++ b/www/datafile.php @@ -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; diff --git a/www/includejs.php b/www/includejs.php index a968912e7..5c921453b 100644 --- a/www/includejs.php +++ b/www/includejs.php @@ -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'), diff --git a/www/pages/ajax/telechargement.php b/www/pages/ajax/telechargement.php index 5bddaaede..0fae31332 100644 --- a/www/pages/ajax/telechargement.php +++ b/www/pages/ajax/telechargement.php @@ -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']; diff --git a/www/pages/portefeuille.php b/www/pages/portefeuille.php index 7a3ef50d6..0a11040bd 100644 --- a/www/pages/portefeuille.php +++ b/www/pages/portefeuille.php @@ -14,6 +14,7 @@ if(!hasPerm('portefeuille')){

PORTEFEUILLE

getPortefeuille(0, $position, $nbAffichage, $triws); - $firephp->log($O, 'O'); $listSurveillance = $O['results']['reponses']; $nbReponses = $O['results']['nbReponses']; @@ -102,11 +103,47 @@ $(document).ready(function() + +

Exportation de votre portefeuille

+

+ + Exporter votre portefeuille au format CSV +

+
+ + +

Options de tri

+

Surveillance Score

- log($totPage, 'totPage'); if($totPage != 1) { ?>