Update From trunk
This commit is contained in:
commit
120828c4cd
@ -102,10 +102,16 @@ class FichierController extends Zend_Controller_Action
|
||||
'/greffes/bilans/'.$matches[1].'/'.substr($matches[2],0,4).'/';
|
||||
}
|
||||
//acte
|
||||
else {
|
||||
$path = realpath($c->profil->path->data).'/pdf/';
|
||||
else if (preg_match('/^acte-[0-9]{9}-(.*)-([0-9]{8})-/', $file, $matches)) {
|
||||
$type = $matches[1];
|
||||
$date = $matches[2];
|
||||
$annee = substr($date,0,4);
|
||||
$mois = substr($date,4,2);
|
||||
$path = realpath($c->profil->path->data).'/greffes/actes/'.$annee.'/'.$mois.'/';
|
||||
}
|
||||
|
||||
|
||||
Zend_Registry::get('firebug')->info($path);
|
||||
|
||||
if(file_exists($path.$file) && filesize($path.$file)>0) {
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: ' . $content_type.'');
|
||||
@ -422,8 +428,8 @@ class FichierController extends Zend_Controller_Action
|
||||
echo "Impossible de charger le fichier.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bilan : Association
|
||||
*/
|
||||
@ -448,5 +454,5 @@ class FichierController extends Zend_Controller_Action
|
||||
echo "Impossible de charger le fichier.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -570,7 +570,8 @@ class SaisieController extends Zend_Controller_Action
|
||||
$this->view->assign('ListeTribunaux', $listeTribunaux);
|
||||
|
||||
$selectEvent = array(
|
||||
'1100', '1200', '1201', '1300', '1301', '1302', '1303', '1304', '1305', '1306', '1307',
|
||||
'1100', '1101' , '1200', '1201', '1300', '1301', '1302', '1303', '1304', '1305', '1306',
|
||||
'1307',
|
||||
'1308', '1309', '1310', '1311', '1312', '1408', '1411', '1412', '1413', '1414', '1415',
|
||||
'1511', '1502', '1503', '1512', '1600', '1601', '1999', '2102', '2100', '2202', '2206',
|
||||
'2319', '2315', '2313', '2305', '2307', '2303', '2306', '2901', '5500', '6700', '1010',
|
||||
@ -630,6 +631,7 @@ class SaisieController extends Zend_Controller_Action
|
||||
$ws = new WsScores();
|
||||
$reponse = $ws->getListeEtablissements($siren);
|
||||
$listeEtablissements = $reponse->result->item;
|
||||
//Zend_Registry::get('firebug')->info(count($listeEtablissements));
|
||||
$this->view->assign('ListeEtablissements', $listeEtablissements);
|
||||
//Assign constantes
|
||||
$this->view->assign('selectDir', $selectDir);
|
||||
@ -682,6 +684,35 @@ class SaisieController extends Zend_Controller_Action
|
||||
}
|
||||
}
|
||||
|
||||
public function listetabAction()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$siren = $this->getParam('siren');
|
||||
$p = $request->getParam('p', 0);
|
||||
if (!empty($p)) {
|
||||
$ws = new WsScores();
|
||||
$reponse = $ws->getListeEtablissements($siren, -1, $p);
|
||||
$liste = array();
|
||||
if (count($reponse->result->item)>0) {
|
||||
foreach ($reponse->result->item as $item) {
|
||||
$liste[] = array(
|
||||
'value' => $item->Nic,
|
||||
'label' => $siren.$item->Nic.' - '.$item->Adresse.' '.$item->CP.' '.$item->Ville,
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($p < $reponse->nbReponses) {
|
||||
$p = $p+200;
|
||||
}
|
||||
$output = array( 'p' => $p, 'list' => $liste );
|
||||
}
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le formulaire d'opposition insee
|
||||
*/
|
||||
@ -1289,6 +1320,7 @@ class SaisieController extends Zend_Controller_Action
|
||||
'P' => 'Projet de fusion',
|
||||
'T' => 'TUP',
|
||||
'L' => 'Tutelle',
|
||||
'E' => 'Franchise',
|
||||
);
|
||||
$this->view->assign('detention', $detention);
|
||||
|
||||
|
@ -14,22 +14,24 @@ class Application_Model_RapportsGiants extends Zend_Db_Table_Abstract
|
||||
public function getReportByIdAndType($companyId, $type)
|
||||
{
|
||||
if($type == 'CR') {
|
||||
$where = 'type="FU" or type="CO" or type="CR"';
|
||||
}else if ($type == 'CO') {
|
||||
$where = 'type="FU" or type="CO"';
|
||||
} else $where = 'type = "FU"';
|
||||
}
|
||||
else $where = 'type = "FU"';
|
||||
$sql = $this->select()
|
||||
->where('companyId = ? and '.$where, $companyId);
|
||||
$result = $this->getAdapter()->fetchRow($sql);
|
||||
if($type == 'FU') {
|
||||
/*if($type == 'FU') {
|
||||
$where = $this->getAdapter()->quoteInto('companyId = ? AND type = "CR" OR type = "CO"' , $companyId);
|
||||
//var_dump($where);exit;
|
||||
$this->delete($where);
|
||||
} else if($type == 'CO') {
|
||||
$where = $this->getAdapter()->quoteInto('companyId = ? and type = "CR"', $companyId);
|
||||
$this->delete($where);
|
||||
}
|
||||
}*/
|
||||
return ($result['report']);
|
||||
}
|
||||
|
||||
public function getReportDate($companyId, $type)
|
||||
{
|
||||
$sql = $this->select('date')
|
||||
|
@ -20,7 +20,7 @@
|
||||
<td valign="top"><b>Nom de la société</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" name="societe_name" value="Nom de la société." /></td>
|
||||
<td><input type="text" name="societe_name" value="<?php if (empty($this->rs)) {?>Nom de la société<?php } else { echo $this->rs; }?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Logo en fond ecran : </b><input type="checkbox" name="logo_background" value="true" /></td>
|
||||
@ -49,8 +49,7 @@
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript" src="/libs/form/jquery.form.js">
|
||||
</script type="text/javascript">
|
||||
<script type="text/javascript" src="/libs/form/jquery.form.js"></script>
|
||||
<script>
|
||||
$('#uploadForm').ajaxForm({
|
||||
beforeSubmit: function() {
|
||||
|
@ -155,6 +155,7 @@ Cette entreprise est une personne physique exerçant son activité en nom propre
|
||||
elseif ($lien->MajMin=='P') echo 'projet fusion'; // Traiter l'affichage ou les arbres comme si %=100
|
||||
elseif ($lien->MajMin=='T') echo 'TUP'; // Traiter l'affichage ou les arbres comme si %=100
|
||||
elseif ($lien->MajMin=='L') echo 'tutelle';
|
||||
elseif ($lien->MajMin=='E') echo 'franchise';
|
||||
// elseif ($lien->MajMin=='A') echo 'absorbant';
|
||||
else echo ' ';
|
||||
?>
|
||||
|
@ -20,6 +20,23 @@ foreach($this->ListeEtablissements as $etablissement) {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="info">
|
||||
<a href="<?=$this->url(array('controller'=>'saisie','action'=>'listetab','siren'=>$this->siren),null,true)?>" id="insert-etab">Insérer les établissements suivant</a>
|
||||
<input type="hidden" name="p" value="200"/>
|
||||
<script>
|
||||
$('#insert-etab').click(function(e){
|
||||
e.preventDefault();
|
||||
var p = $('input[name=p]').val();
|
||||
$.getJSON($(this).attr('href'), { p: p }, function(data){
|
||||
$('input[name=p]').val(data.p);
|
||||
$.each(data.list, function(i, v) {
|
||||
var option = '<option value="'+ v.value+'">'+v.label+'</option>';
|
||||
$(option).appendTo('select[name="jugement[nic]"]');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Nouveau dirigeant 1</legend>
|
||||
|
@ -611,13 +611,15 @@ class Infogreffe
|
||||
} else {
|
||||
$siren = $depot['num_siren'];
|
||||
}
|
||||
$fichier = $this->pathData.$this->actePath($ref).$this->acteFilename($siren,$ref);
|
||||
|
||||
/*$fichier = $this->pathData.$this->actePath($ref).$this->acteFilename($siren,$ref);
|
||||
Zend_Registry::get('firebug')->info($fichier);
|
||||
if( file_exists($fichier) && filesize($fichier)>0 )
|
||||
{
|
||||
$mode = 'fichier';
|
||||
Zend_Registry::get('firebug')->info('Fichier exist');
|
||||
$mode = 'fichier';
|
||||
$file_exist = true;
|
||||
}
|
||||
}*/
|
||||
|
||||
$actesM = new Application_Model_ActesFiles();
|
||||
$sql = $actesM->select()
|
||||
@ -629,7 +631,9 @@ class Infogreffe
|
||||
$result = $actesM->fetchRow($sql);
|
||||
if ( null !== $result ) {
|
||||
Zend_Registry::get('firebug')->info($result);
|
||||
if ( file_exists($this->pathData.$this->actePath($ref).$result->file) )
|
||||
$fichier = $this->pathData.$this->actePath($ref).$result->file;
|
||||
Zend_Registry::get('firebug')->info($fichier);
|
||||
if ( file_exists($fichier) )
|
||||
{
|
||||
Zend_Registry::get('firebug')->info($acte);
|
||||
if ($result->type != $acte['type_acte'] && $result->type2 == '') {
|
||||
@ -1206,12 +1210,18 @@ class Infogreffe
|
||||
|
||||
function acteFilename($siren, $ref)
|
||||
{
|
||||
return 'acte-'.$siren.'-'.$ref.'.pdf';
|
||||
return 'acte-'.$siren.'-'.$ref.'.pdf';
|
||||
}
|
||||
|
||||
function actePath($ref)
|
||||
{
|
||||
return '/pdf/';
|
||||
preg_match('/^(.*)-([0-9]{8})-/', $ref, $matches);
|
||||
$type = $matches[1];
|
||||
$date = $matches[2];
|
||||
$annee = substr($date,0,4);
|
||||
$mois = substr($date,4,2);
|
||||
|
||||
return '/greffes/actes/'.$annee.'/'.$mois.'/';
|
||||
}
|
||||
|
||||
function bilanRef($bilan)
|
||||
|
@ -2253,9 +2253,9 @@ class WsScores
|
||||
* @param string $siren
|
||||
* @return mixed
|
||||
*/
|
||||
public function getListeEtablissements($siren, $actif = -1)
|
||||
public function getListeEtablissements($siren, $actif = -1, $position = 0)
|
||||
{
|
||||
$filename = 'listeetablissements-'.$siren;
|
||||
$filename = 'listeetablissements-'.$siren.'-'.$position;
|
||||
if ($actif != -1){
|
||||
$filename.= '-'.$actif;
|
||||
}
|
||||
@ -2267,8 +2267,8 @@ class WsScores
|
||||
$params->siren = $siren;
|
||||
$params->dep = 0;
|
||||
$params->actif = $actif;
|
||||
$params->position = 0;
|
||||
$params->nbRep = 500;
|
||||
$params->position = $position;
|
||||
$params->nbRep = 200;
|
||||
$client = $this->loadClient('entreprise');
|
||||
try {
|
||||
$reponse = $client->getListeEtablissements($params);
|
||||
|
@ -57,51 +57,21 @@ Zend_Registry::set('config', $c);
|
||||
$db = Zend_Db::factory($c->profil->db->sdv1);
|
||||
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
||||
|
||||
|
||||
function arboDir($dir, $subdir, $bloc_subdir)
|
||||
{
|
||||
$dir = $dir.'/'.$subdir;
|
||||
if (!is_dir($dir))
|
||||
{
|
||||
echo "Création du répertoire $dir\n";
|
||||
mkdir($dir);
|
||||
}
|
||||
foreach ($bloc_subdir as $bloc)
|
||||
{
|
||||
$dir = $dir.'/'.$bloc;
|
||||
if (!is_dir($dir))
|
||||
{
|
||||
echo "Création du répertoire $dir\n";
|
||||
mkdir($dir);
|
||||
}
|
||||
}
|
||||
return $dir;
|
||||
}
|
||||
|
||||
function fichierBilan($fichier)
|
||||
{
|
||||
global $dirStockage, $dirPDF;
|
||||
if (preg_match('/^(bilan|acte)-([0-9]{9})-([0-9]{4})_([a-z]{0,})-([0-9]{8})/', $fichier, $matches))
|
||||
{
|
||||
$siren = $matches[2];
|
||||
$blocSiren = array(
|
||||
substr($siren, 0, 3),
|
||||
substr($siren, 3, 3),
|
||||
substr($siren, 6, 3)
|
||||
);
|
||||
$annee = $matches[3];
|
||||
$type = $matches[4];
|
||||
if ($type == '') $type = 'sociaux';
|
||||
$dateCloture = $matches[5];
|
||||
|
||||
|
||||
//Création arborescence repertoire
|
||||
$dirNew = $dirStockage.'/bilans';
|
||||
if (!is_dir($dirNew)) { mkdir($dirNew); }
|
||||
$dirNew.= '/'.$type;
|
||||
if (!is_dir($dirNew)) { mkdir($dirNew); }
|
||||
$dirNew.= '/'.$annee;
|
||||
if (!is_dir($dirNew)) { mkdir($dirNew); }
|
||||
|
||||
$dirNew = $dirStockage.'/bilans/'.$type.'/'.$annee;
|
||||
if (!is_dir($dirNew)) { mkdir($dirNew, 0777, true); }
|
||||
|
||||
//Copie du fichier
|
||||
$fichierDest = 'bilan-'.$siren.'-'.$type.'-'.$dateCloture.'.pdf';
|
||||
if (file_exists($dirNew.'/'.$fichierDest))
|
||||
@ -129,27 +99,68 @@ function fichierBilan($fichier)
|
||||
function fichierActe($fichier)
|
||||
{
|
||||
global $dirStockage, $dirPDF;
|
||||
//acte-388048308-ACSSPRH-20090630-9201-00-B-01374-30975-02.pdf
|
||||
if (preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-([0-9]{8})-(.*)-(.*)-(.*)-(.*)-(.*)-([0-9]{1,})\.pdf$/', $fichier, $matches)){
|
||||
$siren = $matches[1];
|
||||
$type_acte = $matches[2];
|
||||
$date_acte = $matches[3];
|
||||
$num_acte = $matches[9];
|
||||
$file = $fichier;
|
||||
$actesM = new Application_Model_ActesFiles();
|
||||
|
||||
$sql = $actesM->select()->where('file=?',$file);
|
||||
$result = $actesM->fetchRow($sql);
|
||||
|
||||
if ( null === $result ) {
|
||||
$actesM->insert(array(
|
||||
'siren' => $siren,
|
||||
'type' => $type_acte,
|
||||
'date' => $date_acte,
|
||||
'num' => $num_acte,
|
||||
'file' => $file,
|
||||
));
|
||||
}
|
||||
if (preg_match('/^acte-([0-9]{9})-(ST)-([0-9]{8})-.*\.pdf/', $fichier, $matches)) {
|
||||
|
||||
$siren = $matches[1];
|
||||
$type_acte = $matches[2];
|
||||
$date_acte = $matches[3];
|
||||
$annee = substr($date_acte,0,4);
|
||||
$mois = substr($date_acte,4,2);
|
||||
|
||||
//Création arborescence repertoire
|
||||
$dirNew = $dirStockage.'/actes/'.$annee.'/'.$mois;
|
||||
if (!is_dir($dirNew)) { mkdir($dirNew, 0, true); }
|
||||
|
||||
//Copie du fichier
|
||||
if (file_exists($dirNew.'/'.$fichier)) {
|
||||
//echo "ACTE - Le fichier $fichier a déjà été copié.\n";
|
||||
} else {
|
||||
if ( copy($dirPDF.'/'.$fichier, $dirNew.'/'.$fichier) ) {
|
||||
echo "ACTE - Copie du fichier $dirPDF/$fichier vers $dirNew/$fichier\n";
|
||||
} else {
|
||||
echo "ACTE - ERREUR - Copie du fichier $fichier impossible!\n";
|
||||
}
|
||||
}
|
||||
} elseif (preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-([0-9]{8})-.*-([0-9]{2})\.pdf/', $fichier, $matches)) {
|
||||
$siren = $matches[1];
|
||||
$type_acte = $matches[2];
|
||||
$date_acte = $matches[3];
|
||||
$annee = substr($date_acte,0,4);
|
||||
$mois = substr($date_acte,4,2);
|
||||
$num_acte = $matches[4];
|
||||
|
||||
$actesM = new Application_Model_ActesFiles();
|
||||
$sql = $actesM->select()
|
||||
->where('siren=?', $siren)
|
||||
->where('type=?', $type_acte)
|
||||
->where('date=?', $date_acte)
|
||||
->where('num=?', $num_acte);
|
||||
|
||||
$result = $actesM->fetchRow($sql);
|
||||
|
||||
//Création arborescence repertoire
|
||||
$dirNew = $dirStockage.'/actes/'.$annee.'/'.$mois;
|
||||
if (!is_dir($dirNew)) { mkdir($dirNew, 0777, true); }
|
||||
|
||||
//Copie du fichier
|
||||
if (file_exists($dirNew.'/'.$fichier)) {
|
||||
//echo "ACTE - Le fichier $fichier a déjà été copié.\n";
|
||||
} else {
|
||||
if ( copy($dirPDF.'/'.$fichier, $dirNew.'/'.$fichier) ) {
|
||||
if ( null === $result ) {
|
||||
$actesM->insert(array(
|
||||
'siren' => $siren,
|
||||
'type' => $type_acte,
|
||||
'date' => $date_acte,
|
||||
'num' => $num_acte,
|
||||
'file' => $fichier,
|
||||
));
|
||||
}
|
||||
echo "ACTE - Copie du fichier $dirPDF/$fichier vers $dirNew/$fichier\n";
|
||||
} else {
|
||||
echo "ACTE - ERREUR - Copie du fichier $fichier impossible!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -161,17 +172,14 @@ function fichierActe($fichier)
|
||||
$dirPDF = '/var/www/data/pdf';
|
||||
$dirStockage = '/var/www/data/greffes';
|
||||
|
||||
if (!is_dir($dirStockage))
|
||||
{
|
||||
if (!is_dir($dirStockage)) {
|
||||
echo "Le nouveau répertoire $dirStockage n'a pas été trouvé.\n";
|
||||
exit;
|
||||
}
|
||||
if (!is_dir($dirStockage.'/bilans'))
|
||||
{
|
||||
if (!is_dir($dirStockage.'/bilans')) {
|
||||
mkdir($dirStockage.'/bilans');
|
||||
}
|
||||
if (!is_dir($dirStockage.'/actes'))
|
||||
{
|
||||
if (!is_dir($dirStockage.'/actes')) {
|
||||
mkdir($dirStockage.'/actes');
|
||||
}
|
||||
|
||||
@ -180,22 +188,22 @@ if ($handle = opendir($dirPDF)) {
|
||||
while ( false !== ($file = readdir($handle)) ) {
|
||||
$i++;
|
||||
if ( $file != '..' && $file != '.' ) {
|
||||
echo "Analyse du fichier $file ($i)\n";
|
||||
|
||||
if ($opts->echo) echo "Analyse du fichier $file ($i)\n";
|
||||
|
||||
// Traitement acte
|
||||
if ($opts->acte) {
|
||||
if ( preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{2})-/', $file) ) {
|
||||
if ( preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-/', $file) ) {
|
||||
fichierActe($file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Traitement bilan
|
||||
if ($opts->bilan) {
|
||||
if ( preg_match('/^(bilan|acte)-([0-9]{9})-([0-9]{4})_/', $file) ) {
|
||||
fichierBilan($file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -78,11 +78,11 @@ if ( isset($opts->reprise) )
|
||||
$infogreffe = new Infogreffe();
|
||||
switch($cmd->type){
|
||||
case 'acte':
|
||||
$path = $infogreffe->actePath($ref);
|
||||
$path = $infogreffe->actePath($cmd->ref);
|
||||
$fichier = $infogreffe->acteFilename($cmd->siren, $cmd->ref);
|
||||
break;
|
||||
case 'bilan':
|
||||
$path = $infogreffe->bilanPath($ref);
|
||||
$path = $infogreffe->bilanPath($cmd->ref);
|
||||
$fichier = $infogreffe->bilanFilename($cmd->siren, '0000_'.$cmd->ref);
|
||||
break;
|
||||
}
|
||||
@ -139,14 +139,16 @@ if ( isset($opts->rapport) || isset($opts->rapportcomplet) )
|
||||
$infogreffe = new Infogreffe();
|
||||
switch($cmd->type){
|
||||
case 'acte':
|
||||
$path = $infogreffe->actePath($cmd->ref);
|
||||
$fichier = $infogreffe->acteFilename($cmd->siren, $cmd->ref);
|
||||
break;
|
||||
case 'bilan':
|
||||
$path = $infogreffe->bilanPath($cmd->ref);
|
||||
$fichier = $infogreffe->bilanFilename($cmd->siren, $cmd->ref);
|
||||
break;
|
||||
}
|
||||
//Le fichier existe, alors on a résolu le problème (mauellement ?)
|
||||
if( file_exists(PATH_DATA . '/pdf/' . $fichier) ) {
|
||||
if( file_exists(PATH_DATA . $path . $fichier) ) {
|
||||
$data = array('erreur' => '', 'dateReception' => date('Y-m-d H:i:s'));
|
||||
$where = "siren='".$cmd->siren."' AND type='".$cmd->type."' AND ref='".$cmd->ref."' AND dateCommande='".$cmd->dateCommande."'";
|
||||
$commandesM->update($data, $where);
|
||||
|
Loading…
Reference in New Issue
Block a user