|
|
|
@ -23,6 +23,12 @@ require_once('smeti_db.inc.php'); |
|
|
|
|
|
|
|
SMETI_db::init();
|
|
|
|
|
|
|
|
// Activer le plugin
|
|
|
|
$libelle = 'Instructions Comptables';
|
|
|
|
echo "Plugin courant : '$libelle' ";
|
|
|
|
SMETI_db::setCurPlugin($libelle);
|
|
|
|
echo 'OK'.PHP_EOL;
|
|
|
|
|
|
|
|
echo 'Chargement collectivités ';
|
|
|
|
$sql = SMETI_db::$pdo->prepare("SELECT code, item, libelle FROM v_items WHERE plugin = ( SELECT id FROM plugins WHERE libelle = 'Collectivités' )");
|
|
|
|
$sql->execute();
|
|
|
|
@ -38,8 +44,10 @@ echo 'OK'.PHP_EOL; |
|
|
|
// Se positonner sur l'instruction globale
|
|
|
|
$n = count($instructions);
|
|
|
|
for($i=0;$i<$n;$i++)
|
|
|
|
if ($intructions[$i][0] == 'INSCGLOB') |
|
|
|
if ($instructions[$i][0] == 'INSCGLOB') |
|
|
|
break;
|
|
|
|
if ($i == $n) die;
|
|
|
|
|
|
|
|
$pile_index = 0;
|
|
|
|
$pile_code[$pile_index] = $instructions[$i][0];
|
|
|
|
$pile_item[$pile_index] = $instructions[$i][1];
|
|
|
|
@ -112,22 +120,16 @@ clearLine(); |
|
|
|
echo 'OK'.PHP_EOL;
|
|
|
|
// Enlever la barre de progression
|
|
|
|
|
|
|
|
die;
|
|
|
|
|
|
|
|
echo 'Chargement des données (deuxième passe)'.PHP_EOL;
|
|
|
|
|
|
|
|
// Décliner par instruction
|
|
|
|
// Commencer par empiler deux valeurs vides
|
|
|
|
$pile_index = 1;
|
|
|
|
$pile_code[$pile_index] = '';
|
|
|
|
$pile_item[$pile_index] = 0;
|
|
|
|
|
|
|
|
$pile_index += 1;
|
|
|
|
$pile_code[$pile_index] = '';
|
|
|
|
$pile_item[$pile_index] = 0;
|
|
|
|
|
|
|
|
usort($shipments,'tri_chap_2');
|
|
|
|
$n = count($chapitres); |
|
|
|
$n = count($fonctions); |
|
|
|
$counter = 0;
|
|
|
|
foreach($shipments as $element)
|
|
|
|
{
|
|
|
|
@ -139,31 +141,22 @@ foreach($shipments as $element) |
|
|
|
if (!isset($element['code'])) continue;
|
|
|
|
if (!isset($element['libelle'])) continue;
|
|
|
|
|
|
|
|
if ($element['instruction'] != $pile_code[$pile_index-1]) |
|
|
|
if ('INSC'.$element['instruction'] != $pile_code[$pile_index-1]) |
|
|
|
{
|
|
|
|
$pile_index = 0;
|
|
|
|
// Se positonner sur l'instruction globale
|
|
|
|
$n = count($instructions);
|
|
|
|
for($i=0;$i<$n;$i++)
|
|
|
|
if ($instructions[$i][0] == 'INSC'.$element['instruction'])
|
|
|
|
break;
|
|
|
|
if ($i == $n) die;
|
|
|
|
|
|
|
|
// Rajouter un item pour l'instruction
|
|
|
|
SMETI_db::$code = $element['instruction'];
|
|
|
|
SMETI_db::$libelle = 'Instruction '. $element['instruction'];
|
|
|
|
SMETI_db::$req1->execute();
|
|
|
|
// Rajouter un lien
|
|
|
|
SMETI_db::$item = SMETI_db::$pdo->lastInsertId();
|
|
|
|
SMETI_db::$link = 0;
|
|
|
|
SMETI_db::$req2->execute();
|
|
|
|
// Rajouter un noeud
|
|
|
|
SMETI_db::$child = SMETI_db::$pdo->lastInsertId();
|
|
|
|
SMETI_db::$parent = $pile_item[$pile_index];
|
|
|
|
SMETI_db::$req3->execute();
|
|
|
|
$pile_index += 1;
|
|
|
|
$pile_code[$pile_index] = SMETI_db::$code;
|
|
|
|
$pile_item[$pile_index] = SMETI_db::$child;
|
|
|
|
$pile_index = 0;
|
|
|
|
$pile_code[$pile_index] = $instructions[$i][0];
|
|
|
|
$pile_item[$pile_index] = $instructions[$i][1];
|
|
|
|
|
|
|
|
$code = 'CHAP'.$element['instruction'];
|
|
|
|
$libelle = 'Chapitres '.$element['instruction'];
|
|
|
|
// Rajouter un item pour les chapitres
|
|
|
|
SMETI_db::$code = 'CHAP'.$element['instruction']; |
|
|
|
SMETI_db::$libelle = 'Chapitres '. $element['instruction']; |
|
|
|
SMETI_db::$code = 'FONC'.$element['instruction'];
|
|
|
|
SMETI_db::$libelle = 'Fonctions '. $element['instruction'];
|
|
|
|
SMETI_db::$req1->execute();
|
|
|
|
// Rajouter un lien
|
|
|
|
SMETI_db::$item = SMETI_db::$pdo->lastInsertId();
|
|
|
|
@ -181,7 +174,7 @@ foreach($shipments as $element) |
|
|
|
|
|
|
|
if ($element['code'] == $last) continue;
|
|
|
|
for($i=0;$i<$n;$i++)
|
|
|
|
if ($chapitres[$i][0] == $element['code']) |
|
|
|
if ($fonctions[$i][0] == $element['code']) |
|
|
|
break;
|
|
|
|
if ($i == $n) continue;
|
|
|
|
|
|
|
|
|