Try to detect old reference for file

This commit is contained in:
Michael RICOIS 2012-11-03 11:28:31 +00:00
parent 9f4e5090c2
commit bf3b2ad0a0

View File

@ -611,6 +611,19 @@ class Infogreffe
$mode = 'fichier';
$file_exist = true;
}
//As type_acte change, try to detect file by a pattern
//acte-388048308-ACSSPRH-20090630-9201-00-B-01374-30975-02.pdf
$filePattern = $this->acteFilename($siren,$ref);
$posBegin = 15;
$posEnd = strpos($filePattern, '-', $posBegin);
$filePattern = substr_replace($filePattern, '(.*)', $posBegin, $posEnd-$posBegin);
$detectedFiles = glob($filePattern);
if ($detectedFiles!==false && count($detectedFiles)>0) {
$fichier = $detectedFiles[0];
$mode = 'fichier';
$file_exist = true;
}
//Génération date (date_acte peut être vide)
if(!empty($acte['date_acte'])){ $date = WDate::dateT('Y-m-d', 'Ymd', $acte['date_acte']); }