Commit 057ccdbb authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

debug

parent b6a3492c
Loading
Loading
Loading
Loading
Loading
+30 −13
Changes for code/contrats/debugTests.php: 30 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -276,13 +276,40 @@ foreach ($contrats as $cid => $contrat) {
    $volumeHoraireVariables = [];

    $php .= "\n";
    foreach ($contrat['volumesHoraires'] as $volumesHoraire) {
    foreach ($contrat['volumesHoraires'] as $volumeHoraire) {
        $volumesHorairesIndex++;
        $vnom = 'volumeHoraire' . $volumesHorairesIndex;

        $volumeHoraireVariables[] = $vnom;

        $php .= "$" . $vnom . " = new VolumeHoraire();\n";
        $php .= volumeHoraireToPhp($volumeHoraire, $vnom);
    }

    if (!empty($volumeHoraireVariables)) {
        $php .= "$" . $cnom . "->volumesHoraires = [$" . implode(', $', $volumeHoraireVariables) . "];\n";
        $php .= "\n";
    }
}

if (!empty($volumesHoraires)){
    $php .= "\n";
    foreach ($volumesHoraires as $volumeHoraire) {
        $volumesHorairesIndex++;
        $vnom = 'volumeHoraire' . $volumesHorairesIndex;

        $volumeHoraireVariables[] = $vnom;

        $php .= volumeHoraireToPhp($volumeHoraire, $vnom);
    }
}

\UnicaenCode\Util::highlight($php, 'php', true, ['show-line-numbers' => true]);



function volumeHoraireToPhp(array $volumesHoraire, string $vnom): string
{
    $php = "$" . $vnom . " = new VolumeHoraire();\n";
    if ($volumesHoraire['structure_id']) {
        $php .= "$" . $vnom . "->structureId        = " . $volumesHoraire['structure_id'] . ";\n";
    }
@@ -329,16 +356,6 @@ foreach ($contrats as $cid => $contrat) {
        $php .= "$" . $vnom . "->hetd               = " . $volumesHoraire['hetd'] . ";\n";
    }
    $php .= "\n";
    }

    if (!empty($volumeHoraireVariables)) {
        $php .= "$" . $cnom . "->volumesHoraires = [$" . implode(', $', $volumeHoraireVariables) . "];\n";
        $php .= "\n";
    return $php;
}
}

if (!empty($volumesHoraire)){
    $php .= "// 1 ou plusieurs volumes horaires (".count($volumesHoraire).") ne sont pas contractualisés";
}

\UnicaenCode\Util::highlight($php, 'php', true, ['show-line-numbers' => true]);