Ajout fonctionnalités surveillance

This commit is contained in:
Michael RICOIS 2009-05-20 15:49:08 +00:00
parent 8eff06ba8f
commit 4cf1ced747
13 changed files with 685 additions and 174 deletions

View File

@ -0,0 +1,31 @@
$(document).ready(function(){
$("input[type=checkbox][name=surveillance]").change(function() {
if($(this).attr('checked')== true){
$("#survForm").css('display','block');
}else{
$("#survForm").css('display','none');
}
});
$('#frmSurv').submit(function() {
var options = {
target: '#frmSurv',
url: './pages/ajax_surveillance.php',
beforeSubmit: showRequest,
success: showResponse,
timeout: 3000,
};
$(this).ajaxSubmit(options);
return false;
});
function showResponse(responseText, statusText) {
$("#frmSurv").replaceWith('' + responseText + '');
}
function showRequest(formData, jqForm, options) {
$("#frmSurv").replaceWith('<div id="frmSurv">Mise sous surveillance en cours...</div>');
return true;
}
});

View File

@ -0,0 +1,23 @@
$(document).ready(function(){
$('#frmSurv').submit(function() {
var options = {
target: '#frmSurv',
url: './pages/ajax_surveillance.php',
beforeSubmit: showRequest,
success: showResponse,
timeout: 3000,
};
$(this).ajaxSubmit(options);
return false;
});
function showResponse(responseText, statusText) {
alert(statusText);
$("#frmSurv").replaceWith('' + responseText + '');
}
function showRequest(formData, jqForm, options) {
$("#frmSurv").replaceWith('<div id="frmSurv">Mise sous surveillance en cours...</div>');
return true;
}
});

View File

@ -0,0 +1,23 @@
form { }
form em { color:#FF0000;}
fieldset {border:0; margin:0; padding:0;}
fieldset legend{ padding:0 0 0 10px;}
.fieldgrp{clear:both; width:100%; margin-bottom:.5em; overflow:hidden;}
.fieldgrp:after{content:"."; display:block; clear:both; visibility:hidden; line-height:0; height:0; }
.fieldgrp label{font-weight:bold; margin-left:30px; width:180px; clear:both; padding:0 10px 0 0;line-height:22px;_padding-top:3px; float:left; display:block; font-size:108%;}
.fieldgrp label span{font-weight:normal;}
.fieldgrp label abbr{color:#4B911C; font-size:120%; vertical-align:middle;}
.field {float:left; padding:0 10px 0 0;line-height:22px;_padding-top:3px;}
.field .longfield{width:215px;}
.field .longfield-select{width:220px;}
.field .smallfield{width:95px;}
.field .medfield{width:110px;}
.field input, .field select{ font-size:110%; margin:2px 0; }
.field input[type="radio"] { margin:0 5px 0 5px; }
div.submit{ margin-left:200px; padding-left:0px; margin-top:1em; }
div.submit p.submit-button{margin-top:0;}
div.submit p.details{font-size:85%;color:#666;margin:0;}
div.submit p.required-note{margin-top:1em;}
div.submit p.required-note span{color:#4B911C;_color:#666;font-size:170%;vertical-align:top;}
input.submit {border:none;}
#survForm {display:none;}

View File

@ -0,0 +1,22 @@
form { }
form em { color:#FF0000;}
fieldset {border:0; margin:0; padding:0;}
fieldset legend{ padding:0 0 0 10px;}
.fieldgrp{clear:both; width:100%; margin-bottom:.5em; overflow:hidden;}
.fieldgrp:after{content:"."; display:block; clear:both; visibility:hidden; line-height:0; height:0; }
.fieldgrp label{font-weight:bold; margin-left:30px; width:180px; clear:both; padding:0 10px 0 0;line-height:22px;_padding-top:3px; float:left; display:block; font-size:108%;}
.fieldgrp label span{font-weight:normal;}
.fieldgrp label abbr{color:#4B911C; font-size:120%; vertical-align:middle;}
.field {float:left; padding:0 10px 0 0;line-height:22px;_padding-top:3px;}
.field .longfield{width:215px;}
.field .longfield-select{width:220px;}
.field .smallfield{width:95px;}
.field .medfield{width:110px;}
.field input, .field select{ font-size:110%; margin:2px 0; }
.field input[type="radio"] { margin:0 5px 0 5px; }
div.submit{ margin-left:200px; padding-left:0px; margin-top:1em; }
div.submit p.submit-button{margin-top:0;}
div.submit p.details{font-size:85%;color:#666;margin:0;}
div.submit p.required-note{margin-top:1em;}
div.submit p.required-note span{color:#4B911C;_color:#666;font-size:170%;vertical-align:top;}
input.submit {border:none;}

View File

@ -0,0 +1,159 @@
<?php
/**
* Affiche le formulaire surveillance.
*
* @param string $page
* La page ou l'on affiche le formulaire, détermine le type de surveillance.
* @param string $siret
* L'établissement à surveiller.
* @param array $notEmail
* Un tableau de login pour exclure l'affichage de l'adresse email
* @return string
* Retourne sous forme de chaine de caractère le fomulaire en HTML
*/
function formSurveillance($source, $siret, $notEmail, $displayAjax = TRUE){
$assocSourceTxt = array(
'annonces' => 'les annonces légales',
'insee' => 'les événements INSEE',
'bilans' => 'les bilans',
'indiscore' => 'IndiScore',
);
$fileStyle = 'style.css';
$fileJs = 'script.js';
if($displayAjax){
$fileStyle = 'style-ajax.css';
$fileJs = 'script-js.css';
}
$style = file_get_contents(realpath(dirname(__FILE__)).'/'.$fileStyle);
$js = file_get_contents(realpath(dirname(__FILE__)).'/'.$fileJs);
$formHTML = '';
$formHTML.= '<script type="text/javascript" src="./js/jquery.form.js"></script>'."\n";
$formHTML.= '<script type="text/javascript">'.$js.'</script>'."\n";
$formHTML.= '<style type="text/css">'.$style.'</style>'."\n";
$formHTML.= '<form id="frmSurv" name="frmSurv" action="./pages/ajax_surveillance.php" method="POST">';
$formHTML.= '<input name="surveillance" type="checkbox"/> Mettre sous surveillance '.$assocSourceTxt[$source].'<br/>';
$formHTML.= '<input name="q" type="hidden" value="setsurv"/>';
$formHTML.= '<input name="formSurv[siret]" type="hidden" value="'.$siret.'"/>';
$formHTML.= '<input name="formSurv[source]" type="hidden" value="'.$source.'"/>';
$formHTML.= '<div id="survForm">';
$formHTML.= '<div class="fieldgrp">';
$formHTML.= '<label class="StyleInfoLib">Votre référence</label><div class="field"><input name="formSurv[ref]" type="text" value="" size="10"/></div>';
$formHTML.= '</div>';
$email = '';
if(!in_array($_SESSION['tabInfo']['login'],$notEmail)){
$email = $_SESSION['tabInfo']['email'];
}
$formHTML.= '<div class="fieldgrp">';
$formHTML.= '<label class="StyleInfoLib">Adresse email du destinataire</label><div class="field"><input name="formSurv[email]" type="text" value="'.$email.'" size="20"/></div>';
$formHTML.= '</div>';
$formHTML.= '<div class="submit"><p class="submit-button">';
$formHTML.= '<input class="submit" type="image" src="./img/boutton_valider_off.gif" name="submit" onmouseover="this.src=\'./img/boutton_valider_on.gif\'" onmouseout="this.src=\'./img/boutton_valider_off.gif\'" title="Mettre sous surveillance...">';
$formHTML.= '</p></div>';
$formHTML.= '</div>';
$formHTML.= '</form>';
return $formHTML;
}
/**
* Gère la détection des droits et des préférences pour l'affichage de la surveillance.
*
* @param string $page
* La page ou l'on affiche le formulaire, détermine le type de surveillance.
* @param string $siret
* L'établissement à surveiller.
* @return void
*/
function getSurveillance($page, $siret){
global $client;
global $firephp;
$assocPageDroit = array(
'annonces' => 'survannonce',
'evenements' => 'survinsee',
'liasse' => 'survbilan',
'indiscore' => 'survscore',
);
$assocPageSource = array(
'annonces' => 'annonces',
'evenements' => 'insee',
'liasse' => 'bilans',
'indiscore' => 'score',
);
$firephp->log($_SESSION,'SESSION');
if(preg_match('/'.$assocPageDroit[$page].'/i', $_SESSION['tabInfo']['droits'])){
if(preg_match('/voirsurv/i', $_SESSION['tabInfo']['pref']) && inSurveillance($assocPageSource[$page], $siret)){
$return = 'L\'établisssement est sous surveillance.'."\n";
}else{
$notEmail = array('testreunica', 'reunicacsf');
$return = formSurveillance($source, $siret, $notEmail);
}
}
return $return;
}
/**
* Vérifie si l'établissement est en surveillance
*
* @param string $source
* Le type de surveillance.
* @param string $siret
* L'établissement surveillé.
* @return boolean
* true or false
*/
function inSurveillance($source, $siret){
global $client;
global $firephp;
$firephp->log('inSurveillance');
try{
$result = $client->getSurveillances($siret,$source);
$firephp->log($result,'result');
if(count($result['results'])>0){ return true; }
else{ return false; }
}catch(SoapFault $fault){
return false;
}
}
function setSurveillance($tabForm){
global $client;
global $firephp;
$siret = $tabForm['siret'];
$email = $tabForm['email'];
$ref = $tabForm['ref'];
$source = $tabForm['source'];
$message = '';
try{
$result = $client->setSurveillance($siret, $email, $ref, $source);
$firephp->log('Mise sous surveillance OK');
return $result;
}catch(SoapFault $fault){
$firephp->log($fault,'fault');
return FALSE;
}
}
function deleteSurveillance($siret, $email, $ref, $source){
global $client;
global $firephp;
try{
$result = $client->setSurveillance($siret, $email, $ref, $source, TRUE);
$firephp->log('Suppression surveillance');
return $result;
}catch(SoapFault $fault){
$firephp->log($fault,'fault');
return FALSE;
}
}
?>

View File

@ -0,0 +1,34 @@
<?php
session_start();
$firephp->log($_SESSION,'SESSION');
require_once 'surveillance/surveillance.php';
$client = new SoapClient(null, array( 'trace' => 1,
'soap_version' => SOAP_1_1,
'location' => WEBSERVICE_URL,
'uri' => WEBSERVICE_URI,
'login' => $_SESSION['tabInfo']['login'],
'password' => $_SESSION['tabInfo']['password']
));
if($_REQUEST['q']=='setsurv'){
$firephp->log($_REQUEST['formSurv'],'formSurv');
$firephp->log($client,'client');
$set = setSurveillance($_REQUEST['formSurv']);
if($set!==FALSE){
$return = 'L\'établissement à été placé sous surveillance.'."\n";
}else{
$return = 'Une erreur a rendu impossible la mise sous surveillance.'."\n";
}
$siret = $_REQUEST['formSurv']['siret'];
$page = $_REQUEST['formSurv']['page'];
$return.= getSurveillance($page, $siret);
}elseif($_REQUEST['q']=='getsurv'){
$return = getSurveillance($page, $siret);
}elseif($_REQUEST['q']=='ajouter'){
$siren = $_REQUEST['siren'];
$source = $_REQUEST['source'];
print formSurveillance($source, $siren, array(), FALSE);
}
print $return;
?>

View File

@ -2,10 +2,10 @@
if (!$_SESSION['connected']) die();
$tabInfo = $_SESSION['tabInfo'];
include_once(INCLUDE_PATH.'/partenaires/classMTva.php');
include_once(INCLUDE_PATH.'/partenaires/classMMap.php');
include_once(INCLUDE_PATH.'/partenaires/classMCoface.php');
include_once(FWK_PATH.'/common/dates.php');
require_once 'partenaires/classMTva.php';
require_once 'partenaires/classMMap.php';
require_once 'partenaires/classMCoface.php';
require_once 'common/dates.php';
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
if (strlen($siret)<>0 && strlen($siret)<>9 && strlen($siret)<>14) die('Paramètres incorrects !');
@ -321,18 +321,18 @@ if ($idan && ($vue=='bodacc' || $vue=='abod' || $vue=='balo' || $vue=='asso')) {
*/
}
if (!$idan) { ?>
if (!$idan) {
?>
<tr>
<td width="30">&nbsp;</td>
<td width="100" class="StyleInfoLib">&nbsp;</td>
<td width="450" colspan="2" class="StyleInfoData"><br/><br/><form action="./?page=annonces&action=surv&siret=<?=$siret?>" method="POST"><input type="checkbox"/> Mettre sous surveillance les annonces l&eacute;gales<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Votre r&eacute;f&eacute;rence <input name="ref" type="text" value="" size="10"/><br/>
Adresse email du destinataire <input name="email" type="text" value="<? if ($_SESSION['tabInfo']['login']<>'testreunica' && $_SESSION['tabInfo']['login']<>'reunicacsf') echo $tabInfo['email']?>" size="20"/>&nbsp;&nbsp;&nbsp;<input type="image" src="./img/boutton_valider_off.gif" name="submit" onmouseover="this.src='./img/boutton_valider_on.gif'" onmouseout="this.src='./img/boutton_valider_off.gif'" title="Mettre sous surveillance..."></form></td>
<td colspan="2" width="550" class="StyleInfoData">
<?php
require_once 'surveillance/surveillance.php';
print getSurveillance($page, $siret);
?>
</td>
</tr>
<? }
<?php
}
?>
</table>
<!--
<?/*
print_r($annonces);*/
?>-->
</table>

View File

@ -1,13 +1,13 @@
<?
if (!$_SESSION['connected']) die();
if (!$_SESSION['connected']) die();
$tabInfo = $_SESSION['tabInfo'];
$firephp->log($tabInfo, 'tabInfo');
include_once(INCLUDE_PATH.'/partenaires/classMTva.php');
include_once(INCLUDE_PATH.'/partenaires/classMMap.php');
//include_once(INCLUDE_PATH.'partenaires/classMCoface.php');
include_once(FWK_PATH.'/common/dates.php');
require_once(realpath(dirname(__FILE__).'/../../includes/').'/cache.php');
require_once 'partenaires/classMTva.php';
require_once 'partenaires/classMMap.php';
require_once 'common/dates.php';
require_once 'cache.php';
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
if (strlen($siret)<>0 && strlen($siret)<>9 && strlen($siret)<>14) die('Paramètres incorrects !');
@ -16,7 +16,32 @@ $idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; /
if (($siret*1)==0 && $idEntreprise==0) die('Paramètres incorrects !');
$siren=substr($siret,0,9);
$mil=false;
$raisonSociale=$tabInfo['entrep']['raisonSociale'];
?>
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
<tr>
<td colspan="3" align="center"><img src="./img/rub_evenements.png" width="577" height="36" /></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Num&eacute;ro identifiant Siren</td>
<td width="350" class="StyleInfoData"><?=substr($siren,0,3).' '.substr($siren,3,3).' '.substr($siren,6,3)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="350" class="StyleInfoData"><?=$raisonSociale?></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3"><img src="./img/srub_even_insee.png" width="576" height="27" /></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?php
//Générer un nom de fichier pour le cache et l'export des fichiers
if (($siret*1)==0 && ($siren*1)<100){
$fileName = $page2.'-'.$idEntreprise;
@ -30,7 +55,6 @@ if( preg_match('/saisie/i', $_SESSION['tabInfo']['droits']) || $_SESSION['tabInf
$cache->disable = TRUE;
$cache->forceStart = TRUE;
}
$cache->forceStart = TRUE;
if ( $cache->startCapture($fileName.'.html') == FALSE){
print $cache->displayCache();
}else{
@ -39,70 +63,34 @@ if ( $cache->startCapture($fileName.'.html') == FALSE){
$O = $client->getListeEvenements($siren);
$evens=$O['result'];
} catch (SoapFault $fault) {
include_once(realpath(dirname(__FILE__).'/../../').'/includes/soaperror.php');
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
die();
}
$raisonSociale=$tabInfo['entrep']['raisonSociale'];
?>
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
<tr>
<td colspan="3" align="center"><img src="./img/rub_evenements.png" width="577" height="36" /></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Num&eacute;ro identifiant Siren</td>
<td width="350" class="StyleInfoData"><?=substr($siren,0,3).' '.substr($siren,3,3).' '.substr($siren,6,3)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="350" class="StyleInfoData"><?=$raisonSociale?></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3"><img src="./img/srub_even_insee.png" width="576" height="27" /></td>
</tr>
?>
<table>
<?php
foreach ($evens as $i=>$even) {
if ($even['Siege']==1) $type='siège';
else $type='établissement';
$lien='<a title="Voir la fiche d\'identité" href="/?page=identite&siret='.$siren.$even['Nic'].'&idEntreprise='.$idEntreprise.'">';
$lien2='<a title="Voir la fiche d\'identité" href="/?page=identite&siret='.$even['SiretAss'].'&idEntreprise='.$idEntreprise.'">';
?>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData"><table><?foreach ($evens as $i=>$even) {
if ($even['Siege']==1) $type='siège';
else $type='établissement';
/*
if ($etab['Actif']==1) $type.='actif';
else $type.='inactif';
'EvenCode' => $even['codeEven'],
'' => prepareString($even['libEven']),
'EvenLibDet'=> prepareString($even['libEvenDet']),
'' => $even['dateEven'],
'DateSD'
*/
$lien='<a title="Voir la fiche d\'identité" href="/?page=identite&siret='.$siren.$even['Nic'].'&idEntreprise='.$idEntreprise.'">';
$lien2='<a title="Voir la fiche d\'identité" href="/?page=identite&siret='.$even['SiretAss'].'&idEntreprise='.$idEntreprise.'">';
?><tr>
<td class="StyleInfoLib" width="60"><?=WDate::dateT('Ymd','d/m/Y',$even['DateInfo'])?></td>
<!-- <td class="StyleInfoData" width="70" align="center"><?=$type?></td>
<td class="StyleInfoData" width="120">-->
<td class="StyleInfoData" width="480"><b><?=$even['EvenLib']?></b>&nbsp;<i> - NIC <?=$lien.$even['Nic']?></a> le <?=WDate::dateT('Ymd','d/m/Y',$even['EvenDate'])?></i><?
if (trim($even['EvenLibDet'])<>'') echo '<br/>'.str_replace(', ','<br/>', $even['EvenLibDet']);
if ($even['SiretAss']*1<>0) echo '<br/>Siret associé : '.$lien2.substr($even['SiretAss'],0,9).' '.substr($even['SiretAss'],9,5).'</a>';
?></td>
</tr><?
}
if (count($evens)==0)
echo '<tr><td class="StyleInfoData" width="580">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Aucun &eacute;v&egrave;nement n\'est pr&eacute;sente dans notre base</td></tr>';
// echo '<tr><td><pre>'.print_r($etabs).'</pre></td></tr>';
?></table></td>
</tr>
<td class="StyleInfoLib" width="60"><?=WDate::dateT('Ymd','d/m/Y',$even['DateInfo'])?></td>
<td class="StyleInfoData" width="480"><b><?=$even['EvenLib']?></b>&nbsp;<i> - NIC <?=$lien.$even['Nic'].'</a>'?> le <?=WDate::dateT('Ymd','d/m/Y',$even['EvenDate'])?></i>
<?
if (trim($even['EvenLibDet'])<>'') echo '<br/>'.str_replace(', ','<br/>', $even['EvenLibDet']);
if ($even['SiretAss']*1<>0) echo '<br/>Siret associé : '.$lien2.substr($even['SiretAss'],0,9).' '.substr($even['SiretAss'],9,5).'</a>';
?>
</td>
</tr>
<tr>
</table>
</tr>
<?
}
if (count($evens)==0)
echo '<tr><td class="StyleInfoData" width="580">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Aucun &eacute;v&egrave;nement n\'est pr&eacute;sente dans notre base</td></tr>';
?>
</table>
<?php
//Exportation des données sous forme de fichier
function htmldecode($value){
@ -127,7 +115,18 @@ if ( $cache->startCapture($fileName.'.html') == FALSE){
$array2xml->records = $tabForExport;
$array2xml->writeXML($fileName);
}
}//Fin test mise en cache
$cache->stopCapture(); //On arrete la capture pour le cache
?>
?>
</td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?php
require_once 'surveillance/surveillance.php';
print getSurveillance($page, $siret);
?>
</td>
</tr>
</table>

View File

@ -18,10 +18,10 @@ elseif (!preg_match('/INDISCORE/i', $_SESSION['tabInfo']['droits']))
echo ('Vous n\'avez pas les droits nécessaires pour utiliser cette fonctionnalité (2)');
else {
include_once(INCLUDE_PATH.'/partenaires/classMTva.php');
include_once(INCLUDE_PATH.'/partenaires/classMMap.php');
include_once(INCLUDE_PATH.'/partenaires/classMCoface.php');
include_once(FWK_PATH.'/common/dates.php');
require_once 'partenaires/classMTva.php';
require_once 'partenaires/classMMap.php';
require_once 'partenaires/classMCoface.php';
require_once 'common/dates.php';
$tabInfo = $_SESSION['tabInfo'];
@ -30,7 +30,7 @@ try {
$etab=$O['result'];
$iTva=new MTva($etab['Siren']);
} catch (SoapFault $fault) {
include_once(realpath(dirname(__FILE__).'/../../').'/includes/soaperror.php');
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
die();
}
@ -102,6 +102,15 @@ try {
<td width="200" class="StyleInfoLib">T&eacute;l&eacute;phone</td>
<td width="350" class="StyleInfoData"><?=$etab['Tel']?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?php
require_once 'surveillance/surveillance.php';
print getSurveillance($page, $siret);
?>
</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
@ -190,13 +199,8 @@ try {
</tr>
<tr>
<td colspan="3" align="center"><img src="./img/logo_indiscore.png"/></td>
</tr>
</tr>
</table>
<!--
<?
print_r($etab);
?>
-->
<?
}
?>

View File

@ -151,10 +151,9 @@ if (($siret*1)==0 && $idEntreprise==0) die('Param
$siren=substr($siret,0,9);
$mil=false;
include_once(INCLUDE_PATH.'/partenaires/classMTva.php');
include_once(INCLUDE_PATH.'/partenaires/classMMap.php');
//include_once(INCLUDE_PATH.'partenaires/classMCoface.php');
include_once(FWK_PATH.'/common/dates.php');
require_once 'partenaires/classMTva.php';
require_once 'partenaires/classMMap.php';
require_once 'common/dates.php';
try {
$O = $client->getListeBilans($siren);
@ -170,10 +169,8 @@ try {
processSoapFault($client,$fault,$tabInfo);
die();
}
$raisonSociale=$tabInfo['entrep']['raisonSociale'];
$typBil=array('C'=>'Consolidé', 'N'=>'', 'S'=>'Réel Simplifié');
$raisonSociale=$tabInfo['entrep']['raisonSociale'];
$typBil=array('C'=>'Consolidé', 'N'=>'', 'S'=>'Réel Simplifié');
?>
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
<tr>
@ -213,32 +210,12 @@ try {
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr><!--
<tr>
<td colspan="3"><img src="./img/srub_bilana.png" width="576" height="27" /></td>
</tr>
<tr>
<td colspan="3">ACTIF...</td>
</tr>
<tr>
<td colspan="3"><img src="./img/srub_bilanp.png" width="576" height="27" /></td>
</tr>
<tr>
<td colspan="3">PASSIF...</td>
</tr>
<tr>
<td colspan="3"><img src="./img/srub_cdr.png" width="576" height="27" /></td>
</tr>
<tr>
<td colspan="3">CDR...</td>
</tr>-->
<?
/** Si un bilan est sélectionné dans la liste, on affiche le bilan
**/
/** Si un bilan est sélectionné dans la liste, on affiche le bilan **/
if ($mil) {
/** Si le bilan est au réel simplifié, on le convertit pour un affichage au réel noraml
**/
/** Si le bilan est au réel simplifié, on le convertit pour un affichage au réel noraml **/
if ($tabBilan['CONSOLIDE']=='S') {
$tabTmp=$tabBilan;
$tabBilan=bilanSimplifie2Normal($tabBilan);
@ -254,9 +231,7 @@ try {
<a href="#passif">Passif</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#compte_resultat">Compte de r&eacute;sultat</a><?
/** Si le bilan est un bilan consolidé, on n'affiche pas la suite
**/
/** Si le bilan est un bilan consolidé, on n'affiche pas la suite **/
if ($tabBilan['CONSOLIDE']<>'C') {
?><br/>
<a href="#annexe5">Annexe 5 - Immobilisations</a>&nbsp;&nbsp;&nbsp;&nbsp;
@ -3296,8 +3271,13 @@ try {
?>
</td>
</tr>
</table><!--
<?
print_r($tabBilans);
print_r($tabBilan);
?>-->
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?php
require_once 'surveillance/surveillance.php';
print getSurveillance($page, $siret);
?>
</td>
</tr>
</table>

View File

@ -1,4 +1,4 @@
<?
<?php
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1;
@ -11,7 +11,7 @@ elseif ($_SESSION['tabInfo']['profil']<>'Administrateur' && !preg_match('/MONPRO
else {
//
$tabInfo = $_SESSION['tabInfo'];
echo '<h6>'.$_SESSION['tabInfo']['mode_edition'].'</h6>';
//echo '<h6>'.$_SESSION['tabInfo']['mode_edition'].'</h6>';
$message='';
if (isset($_REQUEST['login']) && $_REQUEST['login']<>'' && $_REQUEST['login']<>$_SESSION['tabInfo']['login'] && $_SESSION['tabInfo']['profil']=='Administrateur')
@ -37,17 +37,21 @@ else {
}
if ($_REQUEST['referer']=='administration') {
?><script language="javascript">
?>
<script language="javascript">
alert("Le profil <?=$loginVu?> a été mis à jour !");
document.location.href='/?page=administration&id=<?=$idEntreprise?>&siret=<?=$siret?>';
</script><?
</script>
<?php
}
if ($_REQUEST['frmOptions']['changepwd']==1 && $loginVu==$_SESSION['tabInfo']['login'] && $tabOptions['action']=='save' ) {
?><script language="javascript">
?>
<script language="javascript">
alert("La modification de votre mot de passe nécessite votre déconnexion !");
document.location.href='/?page=main&action=logout';
</script><?
</script>
<?php
}
}
@ -73,6 +77,10 @@ if ($_SESSION['tabInfo']['profil']=='Administrateur')
else
$admin=false;
?>
<style type="text/css">
table {border-collapse:collapse;}
.bottom td {border-bottom:1px solid;}
</style>
<form name="form_moncompte" action="./?page=moncompte" method="POST" enctype="multipart/form-data">
<? if ($_REQUEST['action']=='new') { ?>
<input type="hidden" name="frmOptions[action]" value="new"/>
@ -166,7 +174,9 @@ else
<option value="100" <?=$opt[100]?>>100</option>
<option value="150" <?=$opt[150]?>>150</option>
<option value="200" <?=$opt[200]?>>200</option>
</select></td></tr>
</select></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Inclure</td>
<td width="350" class="StyleInfoData">
@ -184,14 +194,16 @@ else
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Supports pour les alertes</td>
<td width="350" class="StyleInfoData"><input type="checkbox" name="frmOptions[alertes][]" value="sms" disabled/> SMS<br/>
<input type="checkbox" name="frmOptions[alertes][]" value="fax" disabled/> Fax<br/>
<input type="checkbox" name="frmOptions[alertes][]" value="mail" checked disabled/> Mail<br/></td>
<td width="350" class="StyleInfoData">
<input type="checkbox" name="frmOptions[alertes][]" value="sms" disabled/> SMS<br/>
<input type="checkbox" name="frmOptions[alertes][]" value="fax" disabled/> Fax<br/>
<input type="checkbox" name="frmOptions[alertes][]" value="mail" checked disabled/> Mail<br/>
</td>
</tr>
<? if ($_SESSION['tabInfo']['login']=='ylenaour') {
$formatMail=$login['formatMail'];
//die(print_r($login));
?>
<?php
if ($_SESSION['tabInfo']['login']=='ylenaour') {
$formatMail=$login['formatMail'];
?>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Format des emails</td>
@ -210,9 +222,9 @@ else
</select>
</td>
</tr>
<?
//print_r($_SESSION['tabInfo']);die();
} ?>
<?php
//print_r($_SESSION['tabInfo']);die();
} ?>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
@ -224,37 +236,41 @@ else
<td width="200" class="StyleInfoLib">Type de profil</td>
<td width="350" class="StyleInfoData"><?=$login['profil']?></td>
</tr>
<tr>
<tr class="bottom">
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Pr&eacute;f&eacute;rences</td>
<?
<?php
$tabPref=array( 'naf4'=>'',
'news'=>'',
'mappy'=>'',
'cartes'=>'',
'voirsurv'=>'',
);
if (preg_match('/NAF4/i', $login['pref'])) $tabPref['naf4']='checked';
if (preg_match('/MAPPY/i', $login['pref'])) $tabPref['mappy']='checked';
if (preg_match('/NEWS/i', $login['pref'])) $tabPref['news']='checked';
if (preg_match('/CARTES/i', $login['pref'])) $tabPref['cartes']='checked';
if (preg_match('/VOIRSURV/i', $login['pref'])) $tabPref['voirsurv']='checked';
?>
<td width="350" class="StyleInfoData"><input type="checkbox" name="frmOptions[pref][]" value="naf4" <?=$tabPref['naf4']?>/> Afficher les anciens NAF<br/>
<input type="checkbox" name="frmOptions[pref][]" value="mappy" <?=$tabPref['mappy']?>/> Afficher les fa&ccedil;ades d'immeubles<br/>
<input type="checkbox" name="frmOptions[pref][]" value="cartes" <?=$tabPref['cartes']?>/> Afficher les cartes et les plans<br/>
<input type="checkbox" name="frmOptions[pref][]" value="news" <?=$tabPref['news']?>/> Afficher les news Google&copy;<br/>
<input type="checkbox" name="frmOptions[pref][]" value="voirsurv" <?=$tabPref['voirsurv']?>/> Afficher et Vérifier les surveillances<br/>
</td>
</tr>
<tr>
<tr class="bottom">
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Droits d'acc&egrave;s</td>
<?
<?php
/*$init='disabled ';
if ( $_SESSION['tabInfo']['login']=='ylenaour' ||
$_SESSION['tabInfo']['login']=='jmartory' ||
$_SESSION['tabInfo']['login']=='mheitz' )*/
$init='';
$tabDroits=array( 'kbis'=>$init,
$tabDroits=array(
'kbis'=>$init,
'ipari'=>$init,
'actes'=>$init,
'marques'=>$init,
@ -262,6 +278,10 @@ else
'scorecsf'=>$init,
'monprofil'=>$init,
'eveninsee'=>$init,
'survinsee'=>$init,
'survannonce'=>$init,
'survbilan'=>$init,
'survscore'=>$init,
);
if (preg_match('/KBIS/i', $login['droits'])) $tabDroits['kbis'].='checked';
if (preg_match('/IPARI/i', $login['droits'])) $tabDroits['ipari'].='checked';
@ -270,29 +290,42 @@ else
if (preg_match('/INDISCORE/i', $login['droits'])) $tabDroits['indiscore'].='checked';
if (preg_match('/SCORECSF/i', $login['droits'])) $tabDroits['scorecsf'].='checked';
if (preg_match('/MONPROFIL/i', $login['droits'])) $tabDroits['monprofil'].='checked';
if (preg_match('/EVENINSEE/i', $login['droits'])) $tabDroits['eveninsee'].='checked';
?>
if (preg_match('/EVENINSEE/i', $login['droits'])) $tabDroits['eveninsee'].='checked';
if (preg_match('/SURVINSEE/i', $login['droits'])) $tabDroits['survinsee'].='checked';
if (preg_match('/SURVANNONCE/i', $login['droits'])) $tabDroits['survannonce'].='checked';
if (preg_match('/SURVBILAN/i', $login['droits'])) $tabDroits['survbilan'].='checked';
if (preg_match('/SURVSCORE/i', $login['droits'])) $tabDroits['survscore'].='checked';
?>
<td width="350" class="StyleInfoData">
<?
if ( $_SESSION['tabInfo']['login']=='ylenaour' || $_SESSION['tabInfo']['login']=='jmartory' ||
$_SESSION['tabInfo']['login']=='mheitz' ) {
?>
<?
if ( $_SESSION['tabInfo']['login']=='ylenaour' ||
$_SESSION['tabInfo']['login']=='jmartory' ||
$_SESSION['tabInfo']['login']=='mheitz' ) {?>
<input type="checkbox" name="frmOptions[droits][]" value="kbis" <?=$tabDroits['kbis']?> <?if (!$admin) echo 'disabled';?> /> Extrait RCS<br/>
<?
}
<?php
}
if ($_SESSION['tabInfo']['idClient']<>18) { ?>
<input type="checkbox" name="frmOptions[droits][]" value="actes" <?=$tabDroits['actes']?> <?if (!$admin) echo 'disabled';?> /> Pi&egrave;ces officielles<br/>
<input type="checkbox" name="frmOptions[droits][]" value="ipari" <?=$tabDroits['ipari']?> <?if (!$admin) echo 'disabled';?> /> Investigation par l'image IparI&copy;<br/>
<input type="checkbox" name="frmOptions[droits][]" value="marques" <?=$tabDroits['marques']?> <?if (!$admin) echo 'disabled';?> /> Marques d&eacute;pos&eacute;es<br/>
<? } ?>
<?php } ?>
<input type="checkbox" name="frmOptions[droits][]" value="indiscore" <?=$tabDroits['indiscore']?> <?if (!$admin) echo 'disabled';?> /> indiScore&copy;<br/>
<input type="checkbox" name="frmOptions[droits][]" value="eveninsee" <?=$tabDroits['eveninsee']?> <?if (!$admin) echo 'disabled';?> /> &Eacute;v&egrave;nements INSEE<br/>
<? if ($_SESSION['tabInfo']['idClient']<>18) { ?>
<?php
if ($_SESSION['tabInfo']['idClient']<>18) { ?>
<input type="checkbox" name="frmOptions[droits][]" value="scorecsf" <?=$tabDroits['scorecsf']?> <?if (!$admin) echo 'disabled';?> /> score CSF<br/>
<? } ?>
<input type="checkbox" name="frmOptions[droits][]" value="monprofil" <?=$tabDroits['monprofil']?> <?if (!$admin) echo 'disabled';?> /> Mon profil</td>
</tr>
<?php } ?>
<input type="checkbox" name="frmOptions[droits][]" value="survinsee" <?=$tabDroits['monprofil']?> <?if (!$admin) echo 'disabled';?> /> Surveillance des annonces légales<br/>
<input type="checkbox" name="frmOptions[droits][]" value="survannonce" <?=$tabDroits['monprofil']?> <?if (!$admin) echo 'disabled';?> /> Surveillance des événements INSEE<br/>
<input type="checkbox" name="frmOptions[droits][]" value="survbilan" <?=$tabDroits['monprofil']?> <?if (!$admin) echo 'disabled';?> /> Surveillance des bilans <br/>
<input type="checkbox" name="frmOptions[droits][]" value="survscore" <?=$tabDroits['monprofil']?> <?if (!$admin) echo 'disabled';?> /> Surveillance des événements sur le score<br/>
<input type="checkbox" name="frmOptions[droits][]" value="monprofil" <?=$tabDroits['monprofil']?> <?if (!$admin) echo 'disabled';?> /> Mon profil
</td>
</tr>
<?php
if ( $loginVu==$_SESSION['tabInfo']['login'] &&
($_SESSION['tabInfo']['login']=='ylenaour' || $_SESSION['tabInfo']['login']=='jmartory' || $_SESSION['tabInfo']['login']=='mheitz' || $_SESSION['tabInfo']['login']=='mpurcarin' || $_SESSION['tabInfo']['login']=='mcochet' || $_SESSION['tabInfo']['login']=='aegasse')
@ -315,7 +348,6 @@ else
</tr>
</table>
</form>
<?
// print_r($_REQUEST['frmOptions']);echo '</pre>';
<?php
}
?>
?>

204
www/pages/options_surv.php Normal file
View File

@ -0,0 +1,204 @@
<?php
if (!$_SESSION['connected'])
echo ('Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité');
if($_REQUEST['action']=='supprimer'){
require_once 'surveillance/surveillance.php';
deleteSurveillance($_REQUEST['siren'], $_REQUEST['email'], '', $_REQUEST['source'], true);
}
//Liste des surveillances de l'utilisateur
/*
Mode de présentation :
Siren | Raison Sociale | CP | Ville | Surveillance (Annonces légales, INSEE, Bilan, IndiScore )
*/
try{
$result = $client->getSurveillances(0,'', true);
$listSurveillance = $result['results'];
} catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
die();
}
$firephp->log($listSurveillance, 'Surveillance');
//Trier la liste de surveillance
$tabIndex = array();
$i=0;
$listTrier = array();
foreach($listSurveillance as $item){
if(!array_key_exists($item['siren'], $tabIndex)){
//Tableau d'index
$tabIndex[$item['siren']] = $i;
//Création du tableau trier
$listTrier[$i]['siren'] = $item['siren'];
$listTrier[$i]['nic'] = $item['nic'];
$listTrier[$i]['rs'] = $item['rs'];
$dateAjoutTS = mktime(0, 0, 0, substr($item['dateAjout'],5,2), substr($item['dateAjout'],8,2), substr($item['dateAjout'],0,4));
$dateDerEnvoiTS = mktime(substr($item['dateDerEnvoi'],11,2), substr($item['dateDerEnvoi'],14,2), substr($item['dateDerEnvoi'],17,2), substr($item['dateDerEnvoi'],5,2), substr($item['dateDerEnvoi'],8,2), substr($item['dateDerEnvoi'],0,4));
$listTrier[$i]['sources'] = array(
$item['source']=>array(
'email'=>$item['email'],
'ref'=>$item['ref'],
'dateAjout'=>$item['dateAjout'],
'dateAjoutTS'=>$dateAjoutTS,
'dateDerEnvoi'=> $item['dateDerEnvoi'],
'dateDerEnvoiTS'=>$dateDerEnvoiTS,
)
);
$i++;
}else{
$key = $tabIndex[$item['siren']];
$dateAjoutTS = mktime(0, 0, 0, substr($item['dateAjout'],5,2), substr($item['dateAjout'],8,2), substr($item['dateAjout'],0,4));
$dateDerEnvoiTS = mktime(substr($item['dateDerEnvoi'],11,2), substr($item['dateDerEnvoi'],14,2), substr($item['dateDerEnvoi'],17,2), substr($item['dateDerEnvoi'],5,2), substr($item['dateDerEnvoi'],8,2), substr($item['dateDerEnvoi'],0,4));
$source = array(
'email'=>$item['email'],
'ref'=>$item['ref'],
'dateAjout'=>$item['dateAjout'],
'dateAjoutTS'=>$dateAjoutTS,
'dateDerEnvoi'=> $item['dateDerEnvoi'],
'dateDerEnvoiTS'=>$dateDerEnvoiTS,
);
$listTrier[$key]['sources'][$item['source']] = $source;
}
}
$firephp->log($listTrier, 'listTrier');
//Tri selon le siren
//Tri selon la date d'ajout
//Tri selon la date de dernier envoi
//Tri selon les types d'annonces (présentation du tableau différent)
$tabSource = array('annonces', 'insee', 'bilans', 'score');
?>
<style>
#center {background: #ffffff; width:580px; padding:5px; }
#center h1 {margin:5px; padding:5px; background:#606060; color:#ffffff; font:600 1.4em Arial, Verdana, Sans-serif; letter-spacing:1px; line-height:1.2em;}
#center h2 {margin:5px; padding:5px; background:#00008c; color:#ffffff; font:bold 1.2em Arial, Verdana, Sans-serif; }
#surveillance {margin:5px; border-collapse:collapse; border:1px solid; font:normal 1em Arial, Verdana, Sans-serif; letter-spacing:1px; line-height: 1em;}
#surveillance tr {border:1px solid;}
#surveillance th {border:1px solid; padding:5px;}
#surveillance td {border:1px solid; text-align: center; padding:5px;}
#surveillance .left {text-align:left;}
#surveillance .actionred {color:#cc0000;}
#surveillance .actiongreen {color:#00cc00;}
</style>
<link rel="stylesheet" href="./css/thickbox.css" type="text/css" />
<script type="text/javascript" src="./js/thickbox.js"></script>
<div id="center">
<h1 class="titre">SURVEILLANCE</h1>
<h2>Liste des surveillances: </h2>
<table id="surveillance" width="570">
<thead>
<th colspan="2">Identité</th>
<th colspan="4">Type de surveillance</th>
</thead>
<tr>
<td>Siren</td>
<td>Raison Sociale</td>
<td>Surveillance</td>
<td>Action</td>
<td>Ajouter le</td>
<td>Envoyé le</td>
</tr>
<?php
foreach($listTrier as $item){
?>
<tr>
<td class="left"><?php print $item['siren']; ?></td>
<td><?php print $item['rs']; ?></td>
<td class="left">
<?php
foreach($tabSource as $source){
if(array_key_exists($source, $item['sources'])){
?>
<?php print $source;?>
<br/>
<?php
}else{
?>
<?php print $source;?>
<br/>
<?php
}
}
if(array_key_exists('', $item['sources'])){
?>
Inconnu
<?php
}
?>
</td>
<td class="left">
<?php
foreach($tabSource as $source){
if(array_key_exists($source, $item['sources'])){
?>
<a class="actionred" href="./?page=surveillance&action=supprimer&siren=<?php print $item['siren']; ?>&source=<?php print $source;?>&email=<?php print $item['sources'][$source]['email']; ?>" title="Supprimer la surveillance">Supprimer</a>
<br/>
<?php
}else{
?>
<a class="actiongreen thickbox" href="./pages/ajax_surveillance.php?q=ajouter&siren=<?php print $item['siren']; ?>&source=<?php print $source;?>" title="Ajouter la surveillance">Ajouter</a>
<br/>
<?php
}
}
if(array_key_exists('', $item['sources'])){
?>
<a class="actionred" href="./?page=surveillance&action=supprimer&siren=<?php print $item['siren']; ?>&source=<?php print $source;?>&email=<?php print $item['sources']['']['email']; ?>" title="Supprimer la surveillance">Supprimer</a>
<br/>
<?php
}
?>
</td>
<td>
<?php
foreach($tabSource as $source){
if(array_key_exists($source, $item['sources'])){
?>
<?php print substr($item['sources'][$source]['dateAjout'],8,2).'/'.substr($item['sources'][$source]['dateAjout'],5,2).'/'.substr($item['sources'][$source]['dateAjout'],0,4); ?>
<br/>
<?php
}else{
?>
-<br/>
<?php
}
}
?>
</td>
<td>
<?php
foreach($tabSource as $source){
if(array_key_exists($source, $item['sources'])){
?>
<?php print substr($item['sources'][$source]['dateDerEnvoi'],8,2).'/'.substr($item['sources'][$source]['dateDerEnvoi'],5,2).'/'.substr($item['sources'][$source]['dateDerEnvoi'],0,4); ?>
<br/>
<?php
}else{
?>
-<br/>
<?php
}
}
?>
</td>
</tr>
<?php
}
?>
</table>
</div>

View File

@ -38,12 +38,12 @@ else {
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Mon identifiant</td>
<td width="350" class="StyleInfoData"><?=$_SESSION['tabInfo']['login']?></i></td>
<td width="350" class="StyleInfoData"><i><?=$_SESSION['tabInfo']['login']?></i></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Mon identité</td>
<td width="350" class="StyleInfoData"><?=$_SESSION['tabInfo']['nom']?></i></td>
<td width="350" class="StyleInfoData"><i><?=$_SESSION['tabInfo']['nom']?></i></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>