Ajout option filtre par nom
This commit is contained in:
parent
7751aa504a
commit
7d3f435f2a
2
README
2
README
@ -120,7 +120,9 @@ Send Options list (in)
|
||||
ftp
|
||||
sftp
|
||||
mail
|
||||
- FilterName - Filtre par nom de prestation (true) ou par nom défini
|
||||
|
||||
Recv Options list (out)
|
||||
-----------------------
|
||||
- Log - Log read disable by default
|
||||
|
||||
|
20
fileSend.php
20
fileSend.php
@ -59,6 +59,7 @@ if ( isset($opts->file) )
|
||||
$optionsRunWithEndFile = false;
|
||||
$optionsLog = false;
|
||||
$optionsRoute = array();
|
||||
$optionsFilterName = false;
|
||||
$repositoryDir = 'send';
|
||||
|
||||
$c = new Zend_Config($application->getOptions());
|
||||
@ -103,11 +104,12 @@ if ( isset($opts->file) )
|
||||
$repositoryDir = $p['directory'];
|
||||
}
|
||||
|
||||
// --- Match prestation
|
||||
if ($type == $p['type'] && $fluxRepository == $repositoryDir)
|
||||
{
|
||||
$prestation = $p['name'];
|
||||
|
||||
// --- Set option
|
||||
// --- Set options
|
||||
if (array_key_exists('in', $p) && count($p['in']) > 0)
|
||||
{
|
||||
foreach ($p['in'] as $option => $value)
|
||||
@ -116,6 +118,18 @@ if ( isset($opts->file) )
|
||||
}
|
||||
}
|
||||
|
||||
// --- Filters
|
||||
if ($optionsFilterName === true) {
|
||||
if ( strpos($filenameIn, $prestation) === false ) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if (is_string($optionsFilterName) && strlen($optionsFilterName) > 0) {
|
||||
if (strpos($filenameIn, $optionsFilterName) === false) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -172,6 +186,8 @@ if ( isset($opts->file) )
|
||||
}
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
// --- Detail du fichier
|
||||
$nbLines = 0;
|
||||
if ( strtolower(substr($filenameIn, -3)) == 'csv' ) {
|
||||
@ -251,7 +267,7 @@ if ( isset($opts->file) )
|
||||
foreach ($optionsRoute as $tr => $value) {
|
||||
switch($tr) {
|
||||
case 'cp':
|
||||
if (copy($fluxBasePath . '/' . $filenameIn, $value. '/' . $filenameOut)) {
|
||||
if (copy($fluxBasePath . '/' . $filenameIn, $value . '/' . $filenameOut)) {
|
||||
echo date('Y-m-d H:i:s')." - Copie du fichier $filenameIn dans $value\n";
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user