Commit b0eafd7d authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Correction de bug sur la gestion des dates

parent 41d91f7d
Loading
Loading
Loading
Loading
+1 −1
Changes for admin/actions/test.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
<?php

$bdd = $oa->getBdd();

$oa->exec('UnicaenTbl build-procedures');
 No newline at end of file
+2 −4
Changes for admin/src/BddAdmin/Driver/Oracle/Driver.php: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ class Driver implements DriverInterface
            throw $this->sendException($error);
        }

        $this->exec('ALTER SESSION SET NLS_DATE_FORMAT = \'yyyy-mm-dd\'');
        $this->exec('ALTER SESSION SET NLS_DATE_FORMAT = \'yyyy-mm-dd hh24:mi:ss\'');
        $this->exec('ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT = \'yyyy-mm-dd"T"hh24:mi:ss\'');
        $this->exec('ALTER SESSION SET NLS_NUMERIC_CHARACTERS=". "');

@@ -335,10 +335,8 @@ class Driver implements DriverInterface
            case Bdd::TYPE_STRING:
                return (string)$variable;
            case Bdd::TYPE_DATE:
                $date = \DateTime::createFromFormat('Y-m-d', $variable);
                $date = \DateTime::createFromFormat('Y-m-d H:i:s', $variable);
                if ($date instanceof \DateTime) {
                    $date->setTime(0, 0, 0);

                    return $date;
                } else {
                    return $variable;
+3 −3
Changes for admin/src/BddAdmin/Table.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -455,8 +455,8 @@ class Table
                foreach ($old as $c => $ov) {
                    $newc = isset($new[$c]) ? $new[$c] : null;
                    $oldc = isset($old[$c]) ? $old[$c] : null;
                    if ($newc instanceof \DateTime) $newc = $newc->format('Y-m-d');
                    if ($oldc instanceof \DateTime) $oldc = $oldc->format('Y-m-d');
                    if ($newc instanceof \DateTime) $newc = $newc->format('Y-m-d H:i:s');
                    if ($oldc instanceof \DateTime) $oldc = $oldc->format('Y-m-d H:i:s');
                    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

@@ -507,7 +507,7 @@ class Table
        foreach ($keyArray as $v) {
            if ($keyVal != '') $keyVal .= '_';
            if ($v instanceof \DateTime) {
                $keyVal .= $v->format('Y-m-d');
                $keyVal .= $v->format('Y-m-d-H-i-s');
            } else {
                $keyVal .= (string)$v;
            }
+3 −3
Changes for admin/src/DataGen.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -450,7 +450,7 @@ class DataGen
        foreach ($data as $i => $line) {
            foreach ($line as $col => $val) {
                if (isset($ddl['columns'][$col]) && $ddl['columns'][$col]['type'] == \BddAdmin\Bdd::TYPE_DATE && !empty($val) && is_string($val)) {
                    $data[$i][$col] = \DateTime::createFromFormat('Y-m-d', $val);
                    $data[$i][$col] = \DateTime::createFromFormat('Y-m-d H:i:s', $val);
                }
            }

@@ -492,8 +492,8 @@ class DataGen
    {
        $annees = [];
        for ($a = 1950; $a < 2100; $a++) {
            $dateDebut = \DateTime::createFromFormat('Y-m-d:H:i:s', $a . '-09-01:00:00:00');
            $dateFin   = \DateTime::createFromFormat('Y-m-d:H:i:s', ($a + 1) . '-08-31:00:00:00');
            $dateDebut = \DateTime::createFromFormat('Y-m-d H:i:s', $a . '-09-01 00:00:00');
            $dateFin   = \DateTime::createFromFormat('Y-m-d H:i:s', ($a + 1) . '-08-31 00:00:00');

            $anneeRef = $this->getAnneeCourante();
            $active   = ($a >= $anneeRef && $a < $anneeRef + 3);
+1 −4
Changes for data/ddl_config.php: 1 added line, 4 removed lines.
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ return [
    ]],
    'materialized-view' => ['includes' => [
        
    ]],
    ], 'excludes'                      => ['MV_EXT_SERVICE']],
    'view'              => ['includes' => [

    ]],
@@ -22,8 +22,5 @@ return [
    ]],
    'sequence'          => ['includes' => [

    ]],
    'materialized-view' => ['includes' => [

    ]],
];
 No newline at end of file
Loading