Bilansext : Diverses corrections

This commit is contained in:
Michael RICOIS 2014-10-08 09:49:29 +00:00
parent 4efa250eb2
commit 1681173277

View File

@ -53,7 +53,7 @@ $db = Zend_Db::factory($c->profil->db->metier);
Zend_Db_Table_Abstract::setDefaultAdapter($db);
$pathSend = $c->profil->path->storage . '/clients/bilansext/send';
$pathBackup = $c->profil->path->storage . '/clients/bilansext/done';
$pathBackup = $c->profil->path->storage . '/clients/bilansext/send/done';
// Lecture du dossier des dépots de bilans à demander en saisie
if ($opts->source == 'extranet')
@ -65,17 +65,16 @@ if ($opts->source == 'extranet')
{
if ($filename != '.' && $filename != '..' && substr($filename, -4) == '.pdf')
{
if (preg_match('/([0-9]{9})_([0-9]{8})_([0-9]{2})_([0-9]{1})_([0-9]{1,})_([0-9]{1,}).pdf/', $filename, $t))
if (preg_match('/([0-9]{9})_([0-9]{8})_([0-9]{2})_([0-9]{1})_([0-9]{1,})_([0-9]{1,}).pdf/', $filename, $t))
{
$filetime = date('YmdHis', filectime($pathSend.'/'.$filename));
$siren = $t[0];
$cloture = $t[1];
$duree = $t[2];
$confidentiel = $t[2];
$userId = $t[4];
$extranetId = $t[5];
$siren = $t[1];
$cloture = $t[2];
$duree = $t[3];
$confidentiel = $t[4];
$userId = $t[5];
$extranetId = $t[6];
if ( false !== ( $file = file_get_contents($pathSend.'/'.$filename) ) )
{
@ -115,8 +114,8 @@ if ($opts->source == 'extranet')
//Copier le fichier
if ($insertOk === true) {
if (!copy($pathSend.'/'.$filename, $pathBackup.'/'.$filename)) {
echo date('Y-m-d H:i:s') ." - Impossible de copier le fichier $filename.\n";
if (!rename($pathSend.'/'.$filename, $pathBackup.'/'.$filename)) {
echo date('Y-m-d H:i:s') ." - Impossible de déplacer le fichier $filename.\n";
}
}
}