extranet/www/pages/saisie.php

408 lines
17 KiB
PHP
Raw Normal View History

2009-03-13 14:58:10 +00:00
<?php
include_once(INCLUDE_PATH.'/partenaires/classMTva.php');
include_once(FWK_PATH.'/common/dates.php');
2009-03-13 14:58:10 +00:00
include_once(realpath(dirname(__FILE__).'/../pages_saisie/constantes.php'));
$siret=trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
2009-03-11 07:51:18 +00:00
$idEntreprise=trim(preg_replace('/[^0-9]/', '', $_REQUEST['idEntreprise']))*1; // Si id=0 alors non communiqu<71>
$siren=substr($siret,0,9);
$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'],
// 'encoding' => 'UTF-8'
));
if (!$_SESSION['connected'])
echo ('Vous devez <20>tre connect<63> afin de pouvoir utiliser cette fonctionnalit<69>');
2009-03-13 14:58:10 +00:00
elseif (
$_SESSION['tabInfo']['login']<>'ylenaour' &&
$_SESSION['tabInfo']['login']<>'jmartory' &&
$_SESSION['tabInfo']['login']<>'bpanacionne' &&
$_SESSION['tabInfo']['login']<>'mheitz' &&
$_SESSION['tabInfo']['login']<>'mpurcarin' &&
$_SESSION['tabInfo']['login']<>'mcochet' &&
$_SESSION['tabInfo']['login']<>'aegasse' &&
$_SESSION['tabInfo']['login']<>'mricois'
)
{
echo ('Vous n\'avez pas les droits n<>cessaires pour utiliser cette fonctionnalit<69>');
}
else {
if (isset($_REQUEST['frmSaisie'])) $tabSaisie = $_REQUEST['frmSaisie'];
if (isset($_REQUEST['jugement'])) $tabJugement= $_REQUEST['jugement'];
if (isset($_REQUEST['actionnaire'])) $tabActionna= $_REQUEST['actionnaire'];
if (isset($_REQUEST['particip'])) $tabParticip= $_REQUEST['particip'];
if (isset($_FILES['logoFile']) && $_FILES['logoFile']['error']<>UPLOAD_ERR_NO_FILE ) {
/** Un fichier a <20>t<EFBFBD> upload<61> **/
$logoFile = $_FILES['logoFile'];
$tmp_file = $logoFile['tmp_name'];
if ($logoFile['error']<>UPLOAD_ERR_OK) $message='Erreur lors de la copie du fichier';
if( !is_uploaded_file($tmp_file) ) $message="Le fichier est introuvable";
else {
// on v<>rifie maintenant l'extension
$type_file = $logoFile['type'];
$ext='';
if ( strstr($type_file, 'jpg')) $ext='jpg';
elseif( strstr($type_file, 'jpeg')) $ext='jpeg';
elseif( strstr($type_file, 'bmp')) $ext='bmp';
elseif( strstr($type_file, 'gif')) $ext='gif';
elseif( strstr($type_file, 'png')) $ext='png';
if ($ext=='')
$message="Le fichier n'est pas une image";
else {
// on copie le fichier dans le dossier de destination
$name_file = $siren.'.'.$ext;//$logoFile['name'];
if( !move_uploaded_file($tmp_file, PATH_LOGOS . $name_file) )
$message="Impossible de copier le fichier dans ".PATH_LOGOS;
else
$message="Le fichier a bien <20>t<EFBFBD> upload<61>";
}
}
} elseif (isset($_REQUEST['logoUrl']['del']) || (isset($_REQUEST['logoUrl']['url']) && $_REQUEST['logoUrl']['url']!='' ) ) {
if (isset($_REQUEST['logoUrl']['del']) && $_REQUEST['logoUrl']['del']) {
@unlink(PATH_LOGOS.$siren.'.jpeg');
@unlink(PATH_LOGOS.$siren.'.jpg');
@unlink(PATH_LOGOS.$siren.'.png');
@unlink(PATH_LOGOS.$siren.'.gif');
@unlink(PATH_LOGOS.$siren.'.bmp');
@unlink(PATH_LOGOS.$siren.'.');
} else {
2009-02-23 16:14:03 +00:00
include_once(FWK_PATH.'/common/curl.php');
$logoUrl = $_REQUEST['logoUrl']['url'];
$tabTmp = parse_url($logoUrl);
$hostUrl = $tabTmp['host'];
$pathUrl = $tabTmp['path'];
$tmp=explode('.', basename($pathUrl));
$ext=strtolower(end($tmp));
$page=getUrl($logoUrl, '', '', '', false, $hostUrl, '', 7);
$body=$page['body'];
//die(print_r());
if ($ext<>'jpeg' && $ext<>'jpg' && $ext<>'png' && $ext<>'gif' && $ext<>'bmp') {
$tmp=explode('/', $page['header']['Content-Type']);
$ext=trim(str_replace('?', '',strtolower(end($tmp))));
}
$name_file = $siren.'.'.$ext;
$fp=@fopen(PATH_LOGOS.$name_file, 'w');
@fwrite($fp, $body);
@fclose($fp);
//die('Logo trait<69>');
}
} else $message='';
if ($tabSaisie['action']=='sauver') {
$tabInfos=array('identite'=>$tabSaisie,
'jugement'=>$tabJugement,
'actionnaire'=>$tabActionna,
'participation'=>$tabParticip,
);
$message='Erreur lors de l\'enregistrement !';
try {
2009-03-11 07:51:18 +00:00
$O = $client->setInfosEntrep($siret, $idEntreprise, $tabInfos);
if ($O['result']==1) $message='Informations mises <20> jour !';
} catch (SoapFault $fault) {
2009-02-26 17:16:11 +00:00
include_once(realpath(dirname(__FILE__).'/../../').'/includes/soaperror.php');
processSoapFault($client,$fault,$tabInfo);
}
$tabSaisie=array('source'=>$tabJugement['source'],
'dateParution'=>$tabJugement['dateParution'],
'numParution'=>$tabJugement['numParution']);
$_SESSION['saisie']=$tabSaisie;
}
2009-03-06 16:29:16 +00:00
try {
2009-03-11 07:51:18 +00:00
$O = $client->getIdentite($siret, $idEntreprise);
$etab=$O['result'];
$tabEntrep=array();
$tabEntrep['raisonSociale']=$etab['Nom'];
$tabEntrep['siren']=$etab['Siren'];
$tabEntrep['tva']=$etab['TvaNumero'];
$tabEntrep['isin']=$etab['Isin'];
$tabEntrep['AutreId']=$etab['AutreId'];
$tabEntrep['active']=$etab['Statut'];
$tabEntrep['Source']=$etab['Source'];
$tabEntrep['SourceId']=$etab['SourceId'];
$tabEntrep['codeCommune']=$etab['Dept'].$etab['codeCommune'];
$tabEntrep['nafEn']=$etab['NafEnt'];
$tabEntrep['nafEt']=$etab['NafEtab'];
$_SESSION['tabInfo']['entrep']=$tabEntrep;
} catch (SoapFault $fault) {
2009-02-26 17:16:11 +00:00
include_once(realpath(dirname(__FILE__).'/../../').'/includes/soaperror.php');
processSoapFault($client,$fault,$tabInfo);
die();
}
2009-03-13 14:58:10 +00:00
//$firephp->log($etab,'Identit<69>');
?>
2009-03-13 14:58:10 +00:00
<div id="formSaisie">
<form name="form_saisie" action="./?page=saisie" method="POST" enctype="multipart/form-data">
<input type="hidden" name="frmSaisie[action]" value="sauver"/>
<input type="hidden" name="siret" value="<?=$siret?>"/>
2009-03-11 07:51:18 +00:00
<input type="hidden" name="id" value="<?=$idEntreprise?>"/>
<!--<input type="hidden" name="MAX_FILE_SIZE" value="2097152" />-->
2009-03-13 14:58:10 +00:00
<?php
2009-03-13 14:58:10 +00:00
if ($message<>'') {
?>
<h3><?=$message;?></h3>
<?php
}
?>
<img src="./img/rub_identite<?if ($etab['Siege']==0) echo '_etab';?>.png" width="577" height="36">
<label>Num&eacute;ro identifiant, Siret</label>
<span class="left">
<?=substr($etab['Siren'],0,3).' '.substr($etab['Siren'],3,3).' '.substr($etab['Siren'],6,3).'&nbsp; <i>'.substr($etab['Siret'],9,5).'</i>'?>
2009-03-13 14:58:10 +00:00
</span>
<label>Raison Sociale</label>
<span class="left"><?=$etab['Nom']; if ($etab['Nom2']<>'') echo '<br/>'.$etab['Nom2'];?></span>
<?php
if ($etab['Enseigne']<>'' && $etab['Sigle']<>'') { $titre='Enseigne / Sigle'; $lib=$etab['Enseigne'].' / '.$etab['Sigle']; }
elseif ($etab['Enseigne']<>'' && $etab['Sigle']=='') { $titre='Enseigne'; $lib=$etab['Enseigne']; }
elseif ($etab['Enseigne']=='' && $etab['Sigle']<>'') { $titre='Sigle'; $lib=$etab['Sigle']; }
else $titre='';
2009-03-13 14:58:10 +00:00
if ($titre<>'') {}
/**
** On recherche un logo
**/
$urlImg=$siteWeb='';
$locImg=PATH_LOGOS.$etab['Siren'];
if (file_exists($locImg.'.gif')) { $urlImg='/img/logos/'.$etab['Siren'].'.gif'; $ext='.gif'; }
elseif (file_exists($locImg.'.png')) { $urlImg='/img/logos/'.$etab['Siren'].'.png'; $ext='.png'; }
elseif (file_exists($locImg.'.jpg')) { $urlImg='/img/logos/'.$etab['Siren'].'.jpg'; $ext='.jpg'; }
elseif (file_exists($locImg.'.jpeg')) { $urlImg='/img/logos/'.$etab['Siren'].'.jpeg'; $ext='.jpeg'; }
if ($urlImg=='' && $etab['Isin']<>'') {
$locImg=PATH_LOGOS.$etab['Isin'];
if (file_exists($locImg.'.gif')) { $urlImg='/img/logos/'.$etab['Isin'].'.gif'; $ext='.gif'; }
elseif (file_exists($locImg.'.png')) { $urlImg='/img/logos/'.$etab['Isin'].'.png'; $ext='.png'; }
elseif (file_exists($locImg.'.jpg')) { $urlImg='/img/logos/'.$etab['Isin'].'.jpg'; $ext='.jpg'; }
elseif (file_exists($locImg.'.jpeg')) { $urlImg='/img/logos/'.$etab['Isin'].'.jpeg'; $ext='.jpeg'; }
}
if (substr($etab['Web'],0,7)<>'http://')
$siteWeb='http://'.$etab['Web'];
else
$siteWeb=$etab['Web'];
if ($urlImg<>'') {
$tabTmp=@getimagesize($locImg.$ext);
$w=$tabTmp[0];
$h=$tabTmp[1];
if ($w>350) $strSize=@redimage($locImg.$ext,350,150);
else $strSize='';
}
?>
2009-03-13 14:58:10 +00:00
<fieldset>
<legend>Logo</legend>
<span class="right"><? if ($urlImg<>'') { echo "<img src=\"$urlImg\" $strSize/><br/>"; }?></span>
<label>Fichier</label><input type="file" name="logoFile" size="30" />
<label>ou URL</label><input type="text" name="logoUrl[url]" size="40" maxlength="200"/><br/>
<label>ou Supprimer le logo existant</label><input type="checkbox" name="logoUrl[del]" value="true" />
</fieldset>
<img src="./img/srub_id.png" width="576" height="27">
<label>T&eacute;l&eacute;phone</label>
<input type="text" name="frmSaisie[tel]" size="25" maxlength="100" value="<?=trim($etab['Tel'])?>" />
<label>Fax</label>
<input type="text" name="frmSaisie[fax]" size="25" maxlength="100" value="<?=trim($etab['Fax'])?>" />
<label>Site Internet</label>
<input type="text" name="frmSaisie[web]" size="40" maxlength="100" value="<?=$siteWeb?>" />
<label>E-mail</label>
<input type="text" name="frmSaisie[mail]" size="40" maxlength="100" value="<?=trim($etab['Mail'])?>" />
<img src="./img/srub_activite.png" width="576" height="27">
<label>Code ISIN</label>
<input type="text" name="frmSaisie[isin]" size="15" maxlength="15" value="<?=trim($etab['Isin'])?>" />
<label>Activit&eacute; d&eacute;clar&eacute;e de l'entreprise</label>
<textarea name="frmSaisie[activite]" rows="5" cols="40"><?=$etab['Activite']?></textarea>
<fieldset>
<legend>Capital</legend>
<label>Montant</label>
<input type="text" name="frmSaisie[capital_mt]" size="10" maxlength="11" value="<?=trim($etab['Capital'])*1.0?>" disabled/>
<label>Devise</label>
<select disabled name="frmSaisie[capital_dev]">
<?php
$tmp=$client->getDevises();
$liste=$tmp['result'];
$selOne=false;
foreach ($liste as $iso=>$lib) {
if (trim($etab['CapitalDev'])==$iso) { $selOne=true; $sel='selected'; } else $sel='';
if (strlen($lib)>39) $lib=substr($lib,0,41).'...';
echo "<option value=\"$iso\" $sel >$lib</option>";
2009-03-13 14:58:10 +00:00
}
if (!$selOne) echo '<option value="0000" selected>-</option>';
?>
</select>
</fieldset>
2009-03-13 14:58:10 +00:00
<img src="./img/srub_bodacc.png" width="576" height="27" />
<label>Source <font color="Red">*</font></label>
<select name="jugement[source]">
<option value="TS" <?if (!isset($_SESSION['saisie']['source']) || $_SESSION['saisie']['source']=='TS') echo 'selected';?>>Tribunal via CCI</option>
<option value="TD" <?if ($_SESSION['saisie']['source']=='TD') echo 'selected';?>>Tribunal directement</option>
<option value="TA" <?if ($_SESSION['saisie']['source']=='TA') echo 'selected';?>>Tribunal via autre tiers</option>
<?php
$tmp=$client->getListeJalCollecte();
$liste=$tmp['result'];
foreach ($liste as $id=>$lib) {
//if (strlen($lib)>39) $lib=substr($lib,0,41).'...';
echo "<option value=\"JS$id\" ";
if ($_SESSION['saisie']['source']=="JS$id") echo 'selected';
echo ">$lib</option>";
}
?>
</select>
<div id="dateParution">
2009-03-13 14:58:10 +00:00
<label>Date de parution <font color="Red">*</font></label>
<input class="date" type="text" name="jugement[dateParution]" size="10" maxlength="10" value="<?if (isset($_SESSION['saisie']['dateParution'])) echo $_SESSION['saisie']['dateParution'];?>" />
<span class="left">(Format JJ/MM/AAAA)</span>
</div>
<div id="numParution">
2009-03-13 14:58:10 +00:00
<label>N&deg; de parution</label>
<input type="text" name="jugement[numParution]" size="10" maxlength="10" value="<?if (isset($_SESSION['saisie']['numParution'])) echo $_SESSION['saisie']['numParution'];?>" />
</div>
2009-03-13 14:58:10 +00:00
<label>Date &eacute;v&egrave;nement / jugement<font color="Red">*</font></label>
<input class="date" type="text" name="jugement[dateJuge]" size="10" maxlength="10" value="" />
<span class="left">(Format JJ/MM/AAAA)</span>
<label>Tribunal <font color="Red">*</font></label>
<select id="tribunal" name="jugement[tribunal]">
<option value="-" selected>-</option>
<?php
$tmp=$client->getTribunaux(array('C','I','G'));
$liste=$tmp['result'];
asort($liste);
foreach ($liste as $code=>$lib) {
if (strlen($lib)>39) $lib=substr($lib,0,41).'...';
echo '<option value="'.$code.'"';
if ($code==$etab['TribunalCode']) echo ' selected';
echo ">$lib</option>";
}
?>
</select>
<label>&Eacute;v&egrave;nement / Jugement <font color="Red">*</font></label>
<?php
if (!isset($_REQUEST['event']) || $_REQUEST['event']==''){
$event = '0000';
}else{
$event = $_REQUEST['event'];
}
?>
<select id="jugement" name="jugement[even][]" multiple size="5">
<option value="0000">-</option>
<option value="1100">Ouverture sauvegarde</option>
<option value="1200">Redressement Judiciaire</option>
<option value="1201">Conversion sauvegarde en Redressement Judiciaire</option>
<option value="1300">Conversion Redressement Judiciaire en Liquidation Judiciaire</option>
<option value="1301">Ouverture Liquidation Judiciaire</option>
<option value="1302">Ouverture Liquidation Judiciaire Simplifi<EFBFBD>e</option>
<option value="1303">Ouverture Liquidation Judiciaire sur r<EFBFBD>solution du plan</option>
<option value="1304">R<EFBFBD>ouverture Liquidation Judiciaire</option>
<option value="1305">Liquidation Judiciaire</option>
<option value="1306">Liquidation Judiciaire simplifi<EFBFBD>e</option>
<option value="1307">Conversion sauvegarde en Liquidation Judiciaire</option>
<option value="1308">Fin du r<EFBFBD>gime de Liquidation Judiciaire Simplifi<EFBFBD>e</option>
<option value="1309">Conversion Liquidation Judiciaire en Liquidation Judiciaire Simplifi<EFBFBD>e</option>
<option value="1310">Proc<EFBFBD>dure d'insolvabilit<EFBFBD> europ<EFBFBD>enne</option>
<option value="1311">Liquidation Judiciaire par extension au(x) g<EFBFBD>rant(s)</option>
<option value="1312">Liquidation Judiciaire avec continuation d'exploitation</option>
<option value="1413">Arr<EFBFBD>t du plan de continuation</option>
<option value="1414">Arr<EFBFBD>t du plan de redressement</option>
<option value="1503">Cl<EFBFBD>ture de la proc<EFBFBD>dure pour insuffisance d'actif</option>
<option value="1512">R<EFBFBD>solution du plan de continuation</option>
<option value="1600">Faillite personnelle</option>
<option value="1601">Interdiction de g<EFBFBD>rer</option>
<option value="1999">Autre proc<EFBFBD>dure collective</option>
<option value="2319">Poursuite de l'activit<EFBFBD> malgr<EFBFBD> perte > moiti<EFBFBD> du capital social</option>
<option value="2315">Modification de l'administration</option>
<option value="2313">Modification de l'activit<EFBFBD></option>
<option value="2305">Modification de la d<EFBFBD>nomination</option>
<option value="2307">Modification de la forme juridique</option>
<option value="2303">Modification de la date de cl<EFBFBD>ture de l'exercice</option>
<option value="2306">Modification de la dur<EFBFBD>e de la soci<EFBFBD>t<EFBFBD></option>
<option value="2102">Augmentation du capital social</option>
<option value="2100">Diminution du capital social</option>
<option value="2901">Transfert de si<EFBFBD>ge</option>
<option value="5500">Vente/cession : Entreprise r<EFBFBD>alisant la vente</option>
<option value="2202">Dissolution</option>
<option value="2206">Mise en sommeil</option>
<option value="6700">Radiation</option>
</select>
2009-03-13 14:58:10 +00:00
<div id="subFormSaisie">
<?php include('./pages_saisie/event_0000.php'); ?>
</div>
<img src="./img/srub_actio.png" width="576" height="27">
<p><a href="#" onclick="javascript:displayBlock('#formActionnaire');">Afficher/Masquer le formulaire</a></p>
<div id="formActionnaire">
<label>Siren actionnaire</label>
<input type="text" name="actionnaire[siren]" size="8" maxlength="12" value="" />
<label>Pourcentage</label><input type="text" name="actionnaire[pct]" size="3" maxlength="5" value="" /><span class="left">%</span>
<label>&nbsp;Major.&nbsp;/&nbsp;</label><input type="radio" name="actionnaire[majMin]" value="maj" checked>
<label>&nbsp;Minor. au</label><input type="radio" name="actionnaire[majMin]" value="min">
<label>DateMAJ</label><input type="text" name="actionnaire[dateMAJ]" size="10" maxlength="10" value="JJ/MM/AAAA" />
2009-03-13 14:58:10 +00:00
<label>Pays</label>
<select name="actionnaire[pays]"><?=$strSelectPays?></select>
<label>Raison sociale</label>
<input type="text" name="actionnaire[nom]" size="35" maxlength="80" value=""/>
<span class="left">si &eacute;tranger</span>
</div>
<img src="./img/srub_part.png" width="576" height="27">
<p><a href="#" onclick="displayBlock('#formParticipation');">Afficher/Masquer le formulaire</a></p>
2009-03-13 14:58:10 +00:00
<div id="formParticipation">
<label>Siren participation</label>
<input type="text" name="particip[siren]" size="8" maxlength="12" value="" />
<label>&agrave;</label>
<label>Pourcentage</label><input type="text" name="particip[pct]" size="3" maxlength="5" value="" /><span class="left">%</span>
<label>&nbsp;Major.&nbsp;/&nbsp;</label><input type="radio" name="particip[majMin]" value="maj" checked>
<label>&nbsp;Minor. au</label><input type="radio" name="particip[majMin]" value="min">
2009-03-13 14:58:10 +00:00
<input type="text" name="particip[dateMAJ]" size="10" maxlength="10" value="JJ/MM/AAAA" />
<label>Pays</label><select name="particip[pays]"><?=$strSelectPays?></select>
2009-03-13 14:58:10 +00:00
<label>Raison sociale</label>
<input type="text" name="particip[nom]" size="35" maxlength="80" value=""/>
<span class="left">&nbsp;si &eacute;tranger</span>
</div>
<input type="submit" value="Sauver"/>
</form>
2009-03-13 14:58:10 +00:00
</div>
<?php
2009-03-13 18:15:05 +00:00
}
?>