issue #0002029 : Code traitement bilans comme les actes
This commit is contained in:
parent
88a7eeef4d
commit
5ed3101d98
@ -398,46 +398,51 @@ foreach ( $tabCommandes as $ref => $commande ) {
|
||||
$path = $infogreffe->getFilePath($commande->bilanType, $dateCloture);
|
||||
$nomCible = $infogreffe->getFileName($commande->bilanType, $dateCloture);
|
||||
|
||||
if (file_exists(ACTES_IGNUM_LOCAL_DIR.$fichier) && !file_exists(PATH_DATA.$path.$nomCible)) {
|
||||
if (rename(ACTES_IGNUM_LOCAL_DIR.$fichier, PATH_DATA.$path.$nomCible)){
|
||||
$fileOut = PATH_DATA.'/'.$path.'/'.$nomCible;
|
||||
|
||||
$bilanM = new Application_Model_JoGreffesBilans();
|
||||
$sql = $bilanM->select()
|
||||
->where('siren=?',$siren)
|
||||
->where('date_cloture=?', $dateCloture);
|
||||
if ($commande->bilanType=='sociaux') {
|
||||
$sql->where('type_comptes="" OR type_comptes="sociaux"');
|
||||
} else {
|
||||
$sql->where('type_comptes="consolides"');
|
||||
}
|
||||
$item = $bilanM->fetchRow($sql);
|
||||
$isFileOnStorage = false;
|
||||
|
||||
if ($item->pdfDate == '0000-00-00') {
|
||||
|
||||
$infos = $infogreffe->pdfInfos(PATH_DATA.$path.$nomCible);
|
||||
|
||||
if (false !== $infos) {
|
||||
$data = array(
|
||||
'pdfLink' => $file,
|
||||
'pdfSize' => $infos['size'],
|
||||
'pdfPage' => $infos['pages'],
|
||||
'pdfVer' => $infos['version'],
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
try {
|
||||
$result = $bilanM->update($data, 'id='.$item->id);
|
||||
} catch(Zend_Db_Adapter_Exception $e) {
|
||||
echo $e->getMessage();
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".ACTES_IGNUM_LOCAL_DIR.$fichier." déplacé en ".PATH_DATA.'/'.$path.$nomCible.".\n";
|
||||
if ( file_exists($fileOut) ) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".ACTES_IGNUM_LOCAL_DIR.$fichier." déjà présent en ".$fileOut.".\n";
|
||||
} else {
|
||||
if ( copy(ACTES_IGNUM_LOCAL_DIR.$fichier, $fileOut) ) {
|
||||
$isFileOnStorage = true;
|
||||
echo date ('Y/m/d - H:i:s')." - Fichier ".ACTES_IGNUM_LOCAL_DIR.$fichier." déplacé en ".$fileOut.".\n";
|
||||
} else {
|
||||
echo date ('Y/m/d - H:i:s')." ERREUR - Impossible de déplacer ".ACTES_IGNUM_LOCAL_DIR.$fichier." en ".PATH_DATA.'/'.$path.$nomCible." !\n";
|
||||
echo date ('Y/m/d - H:i:s')." ERREUR - Impossible de déplacer ".ACTES_IGNUM_LOCAL_DIR.$fichier." en ".$fileOut." !\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ( $isFileOnStorage && $item->pdfDate == '0000-00-00' ) {
|
||||
$bilanM = new Application_Model_JoGreffesBilans();
|
||||
$sql = $bilanM->select()
|
||||
->where('siren=?',$siren)
|
||||
->where('date_cloture=?', $dateCloture);
|
||||
if ($commande->bilanType=='sociaux') {
|
||||
$sql->where('type_comptes="" OR type_comptes="sociaux"');
|
||||
} else {
|
||||
$sql->where('type_comptes="consolides"');
|
||||
}
|
||||
$item = $bilanM->fetchRow($sql);
|
||||
if ($item->pdfDate == '0000-00-00') {
|
||||
$infos = $infogreffe->pdfInfos($fileOut);
|
||||
if (false !== $infos) {
|
||||
$data = array(
|
||||
'pdfLink' => $nomCible,
|
||||
'pdfSize' => $infos['size'],
|
||||
'pdfPage' => $infos['pages'],
|
||||
'pdfVer' => $infos['version'],
|
||||
'pdfDate' => date('Ymd'),
|
||||
);
|
||||
try {
|
||||
$result = $bilanM->update($data, 'id='.$item->id);
|
||||
} catch(Zend_Db_Adapter_Exception $e) {
|
||||
echo $e->getMessage();
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user