Merge branch 'develop'
This commit is contained in:
commit
3bde397ad1
@ -27,8 +27,8 @@ try {
|
||||
$opts = new Zend_Console_Getopt(array(
|
||||
'help|?' => "Displays usage information.",
|
||||
'site-s' => "Rapports relatifs aux indiscore 2 et 3 de la journée courante ou depuis le SSAAMMJJ inclus",
|
||||
'ftp-s' => "Traitement des demandes par ftp",
|
||||
'file=s' => "Spécification du fichier de demande",
|
||||
'ftp' => "Traitement des demandes par ftp",
|
||||
'file=s' => "Spécification du fichier de demande (auto pour les non traités)",
|
||||
'verbose|v' => "Mode bavard ou debug",
|
||||
));
|
||||
$opts->parse();
|
||||
@ -144,68 +144,62 @@ if ($opts->site) {
|
||||
}
|
||||
|
||||
// --- Fichier de demande par FTP
|
||||
if ($opts->ftp) {
|
||||
//client, name, depotType, depotDate, depotFile, nbLines, dateInsert, dateExecute
|
||||
// --- Auto
|
||||
if ($opts->ftp === true) {
|
||||
// --- Detecter si la date n'est pas trop ancienne
|
||||
$dateNow = new DateTime();
|
||||
$dateIn1 = $dateNow->format('Y-m-d H:i:s');
|
||||
$dateNow->sub(new DateInterval('P2D'));
|
||||
$dateIn2 = $dateNow->format('Y-m-d H:i:s');
|
||||
//client, name, depotType, depotDate, depotFile, nbLines, dateInsert, dateExecute
|
||||
// --- Auto
|
||||
if ($opts->ftp === true) {
|
||||
// --- Detecter si la date n'est pas trop ancienne
|
||||
$dateNow = new DateTime();
|
||||
$dateIn1 = $dateNow->format('Y-m-d H:i:s');
|
||||
$dateNow->sub(new DateInterval('P2D'));
|
||||
$dateIn2 = $dateNow->format('Y-m-d H:i:s');
|
||||
|
||||
echo "Selection de fichier non traité entre $dateIn2 et $dateIn1\n";
|
||||
echo "Selection de fichier non traité entre $dateIn2 et $dateIn1\n";
|
||||
|
||||
$sql = "SELECT * FROM sdv1.flux_filein WHERE client=:client
|
||||
AND name=:prestation AND depotType=:typeDepot AND dateInsert BETWEEN :dateIn2 AND :dateIn1
|
||||
ORDER BY dateInsert DESC LIMIT 0,1";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('client', 'fransbonhomme');
|
||||
$stmt->bindValue('prestation', 'RAPPORT');
|
||||
$stmt->bindValue('typeDepot', 'FTP');
|
||||
$stmt->bindValue('dateIn2', $dateIn2);
|
||||
$stmt->bindValue('dateIn1', $dateIn1);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() == 0) {
|
||||
echo date('Y-m-d H:i:s')." : Aucun traitement à réaliser.\n";
|
||||
} else {
|
||||
$p = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$tabFichLigneCmd[] = $p->depotFile;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Manuel
|
||||
if ($opts->file === true) {
|
||||
if ($opts->file == 'auto') {
|
||||
$sql = "SELECT * FROM sdv1.flux_filein WHERE client=:client
|
||||
AND name=:prestation AND depotType=:typeDepot AND dateInsert BETWEEN :dateIn2 AND :dateIn1
|
||||
AND name=:prestation AND depotType=:typeDepot AND dateExecute='0000-00-00 00:00:00'
|
||||
ORDER BY dateInsert DESC LIMIT 0,1";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('client', 'fransbonhomme');
|
||||
$stmt->bindValue('prestation', 'RAPPORT');
|
||||
$stmt->bindValue('typeDepot', 'FTP');
|
||||
$stmt->bindValue('dateIn2', $dateIn2);
|
||||
$stmt->bindValue('dateIn1', $dateIn1);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() == 0) {
|
||||
echo date('Y-m-d H:i:s')." : Aucun traitement à réaliser.\n";
|
||||
} else {
|
||||
$p = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$tabFichLigneCmd[] = $p->depotFile;
|
||||
}
|
||||
} else {
|
||||
$sql = "SELECT * FROM sdv1.flux_filein WHERE client=:client
|
||||
AND name=:prestation AND depotType=:typeDepot AND depotFile=:file
|
||||
ORDER BY dateInsert DESC LIMIT 0,1";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('client', 'fransbonhomme');
|
||||
$stmt->bindValue('prestation', 'RAPPORT');
|
||||
$stmt->bindValue('typeDepot', 'FTP');
|
||||
$stmt->bindValue('file', $opts->file);
|
||||
}
|
||||
// --- Manuel
|
||||
else {
|
||||
if ($opts->ftp == 'manual') {
|
||||
$sql = "SELECT * FROM sdv1.flux_filein WHERE client=:client
|
||||
AND name=:prestation AND depotType=:typeDepot
|
||||
ORDER BY dateInsert DESC LIMIT 0,1";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('client', 'fransbonhomme');
|
||||
$stmt->bindValue('prestation', 'RAPPORT');
|
||||
$stmt->bindValue('typeDepot', 'FTP');
|
||||
} else {
|
||||
$sql = "SELECT * FROM sdv1.flux_filein WHERE client=:client
|
||||
AND name=:prestation AND depotType=:typeDepot AND depotFile=:file
|
||||
ORDER BY dateInsert DESC LIMIT 0,1";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue('client', 'fransbonhomme');
|
||||
$stmt->bindValue('prestation', 'RAPPORT');
|
||||
$stmt->bindValue('typeDepot', 'FTP');
|
||||
$stmt->bindValue('file', $opts->file);
|
||||
}
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$p = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$tabFichLigneCmd[] = $p->depotFile;
|
||||
}
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$p = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$tabFichLigneCmd[] = $p->depotFile;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Fichier de demande manuel
|
||||
if ($opts->file) {
|
||||
$tabFichLigneCmd[] = $opts->file;
|
||||
}
|
||||
|
||||
// $OptionEOL => Linux : LF (\n), Windows CRLF (\r\n)
|
||||
$OptionEOL = "\n";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user