Suppression mode outdated
This commit is contained in:
parent
02d03a2ae9
commit
892ffa1a2f
@ -10,7 +10,6 @@ try {
|
||||
'get-s' => "Recupère seulement les actes du FTP (un seul document si la référence est spécifier G<NNN> )",
|
||||
'send-s' => "Récupère les actes et envoi un mail à chaque client (un seul acte si la référence est spécifier G<NNN>)",
|
||||
'type-s' => "Type de document : bilan, acte",
|
||||
'control' => "Control",
|
||||
));
|
||||
$opts->parse();
|
||||
$optionsNb = count($opts->getOptions());
|
||||
@ -129,80 +128,6 @@ function sendMail($commande, $type){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Connexion à la base de données
|
||||
*/
|
||||
$db = Zend_Db::factory($c->profil->db->metier);
|
||||
Zend_Db_Table_Abstract::setDefaultAdapter($db);
|
||||
|
||||
/**
|
||||
* List actes files and check if an entry exist in the database
|
||||
* greffes/actes/AAAA/MM
|
||||
* preg_match('/^acte-([0-9]{9})-(ST)-([0-9]{8})-.*\.pdf/', $fichier, $matches)
|
||||
* preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-([0-9]{8})-.*-([0-9]{2})\.pdf/', $fichier, $matches)
|
||||
*/
|
||||
if ($opts->control) {
|
||||
|
||||
$dir = PATH_DATA.'/greffes/actes';
|
||||
if (is_dir($dir)) {
|
||||
if ($dh = opendir($dir)) {
|
||||
//Annee
|
||||
while (($anneeDir = readdir($dh)) !== false) {
|
||||
if ($anneeDir != '.' || $anneeDir != '..') {
|
||||
echo "Dir ".$dir . DIRECTORY_SEPARATOR . $anneeDir."\n";
|
||||
if ($dhAnneeDir = opendir($dir . DIRECTORY_SEPARATOR . $anneeDir)) {
|
||||
//Mois
|
||||
while (($moisDir = readdir($dhAnneeDir)) !== false) {
|
||||
echo "Dir ".$dir . DIRECTORY_SEPARATOR . $anneeDir . DIRECTORY_SEPARATOR . $moisDir."\n";
|
||||
if ($moisDir != '.' || $moisDir != '..') {
|
||||
//Fichier
|
||||
if ($dhFile = opendir($dir . DIRECTORY_SEPARATOR . $anneeDir . DIRECTORY_SEPARATOR . $moisDir)) {
|
||||
while (($file = readdir($dhFile)) !== false) {
|
||||
if ($file != '.' || $file != '..') {
|
||||
|
||||
if (preg_match('/^acte-([0-9]{9})-([0-9a-zA-Z]{1,})-([0-9]{8})-.*-([0-9]{2})\.pdf/', $file, $matches)) {
|
||||
$siren = $matches[1];
|
||||
$type = $matches[2];
|
||||
$date = $matches[3];
|
||||
$num = $matches[4];
|
||||
|
||||
$sql = "SELECT FROM WHERE ";
|
||||
|
||||
$actesM = new Application_Model_ActesFiles();
|
||||
$sql = $actesM->select()
|
||||
->where('siren=?', $siren)
|
||||
->where('type=?', $type)
|
||||
->where('date=?', $date)
|
||||
->where('num=?', $num);
|
||||
$result = $actesM->fetchRow($sql);
|
||||
if ( null === $result ) {
|
||||
echo "Insert $file\n";
|
||||
$actesM->insert(array(
|
||||
'siren' => $siren,
|
||||
'type' => $type,
|
||||
'date' => $date,
|
||||
'num' => $num,
|
||||
'file' => $file,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
closedir($dhFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dhAnneeDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des commandes non traités depuis la base de données
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user