Skip to content
Snippets Groups Projects
Commit 561a9be0 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Merge branches 'develop' and 'master' of https://git.unicaen.fr/open-source/OSE

parents b2d0c912 7082f4e4
No related branches found
No related tags found
No related merge requests found
...@@ -240,7 +240,9 @@ class Table ...@@ -240,7 +240,9 @@ class Table
'delete' => true, 'delete' => true,
'insert' => true, 'insert' => true,
'update' => true, 'update' => true,
'update-cols' => [],
'update-ignore-cols' => [], 'update-ignore-cols' => [],
'update-only-null' => [],
]; ];
$options = array_merge($defaultOptions, $options); $options = array_merge($defaultOptions, $options);
...@@ -300,10 +302,18 @@ class Table ...@@ -300,10 +302,18 @@ class Table
$oldc = isset($old[$c]) ? $old[$c] : null; $oldc = isset($old[$c]) ? $old[$c] : null;
if ($newc instanceof \DateTime) $newc = $newc->format('Y-m-d'); if ($newc instanceof \DateTime) $newc = $newc->format('Y-m-d');
if ($oldc instanceof \DateTime) $oldc = $oldc->format('Y-m-d'); if ($oldc instanceof \DateTime) $oldc = $oldc->format('Y-m-d');
if (!in_array($c, $options['update-ignore-cols']) && $c != 'ID' && array_key_exists($c, $new) && $newc !== $oldc) { if ($newc !== $oldc && array_key_exists($c, $new) && $c != 'ID') {
$ok = empty($options['update-cols']); // OK par défaut si une liste n'a pas été établie manuellement
if (in_array($c, $options['update-cols'])) $ok = true;
if (in_array($c, $options['update-ignore-cols'])) $ok = false;
if (in_array($c, $options['update-only-null']) && $oldc !== null) $ok = false;
if ($ok) {
$toUpdate[$c] = $new[$c]; $toUpdate[$c] = $new[$c];
} }
} }
}
if (!empty($toUpdate)) { if (!empty($toUpdate)) {
$this->update($toUpdate, $this->makeKeyArray($old, $key), $traitementOptions); $this->update($toUpdate, $this->makeKeyArray($old, $key), $traitementOptions);
$result['update']++; $result['update']++;
......
...@@ -190,7 +190,10 @@ class DataGen ...@@ -190,7 +190,10 @@ class DataGen
'table' => 'ETAT_SORTIE', 'table' => 'ETAT_SORTIE',
'context' => ['install', 'update'], 'context' => ['install', 'update'],
'key' => 'CODE', 'key' => 'CODE',
'options' => ['update' => false, 'delete' => false], 'options' => ['update' => true, 'delete' => false,
'update-cols' => ['CSV_PARAMS', 'CSV_TRAITEMENT', 'PDF_TRAITEMENT'],
'update-only-null' => ['CSV_PARAMS', 'CSV_TRAITEMENT', 'PDF_TRAITEMENT'],
],
], ],
[ [
'table' => 'MODELE_CONTRAT', 'table' => 'MODELE_CONTRAT',
......
...@@ -99,6 +99,7 @@ return [ ...@@ -99,6 +99,7 @@ return [
'CODE' => 'export_services', 'CODE' => 'export_services',
'LIBELLE' => 'Export des services', 'LIBELLE' => 'Export des services',
'PDF_TRAITEMENT' => '/data/Etats de sortie/export_services.php', 'PDF_TRAITEMENT' => '/data/Etats de sortie/export_services.php',
'CSV_TRAITEMENT' => '/data/Etats de sortie/export_services_csv.php',
'AUTO_BREAK' => true, 'AUTO_BREAK' => true,
'REQUETE' => 'SELECT 'REQUETE' => 'SELECT
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment