Loading code/contrats/debugTests.php +4 −4 Changes for code/contrats/debugTests.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -244,12 +244,12 @@ foreach ($contrats as $cid => $contrat) { $cnom = $contrat['variable']; $php .= "$" . $cnom . " = new Contrat();\n"; $php .= "$" . $cnom . "->id = " . $contrat['id'] . "\n"; $php .= "$" . $cnom . "->id = " . $contrat['id'] . ";\n"; if ($contrat['histo_destruction']) { $php .= "$" . $cnom . "->historise = true;\n"; } if ($contrat['structure_id']) { $php .= "$" . $cnom . "->structure_id = " . $contrat['structure_id'] . ";\n"; $php .= "$" . $cnom . "->structureId = " . $contrat['structure_id'] . ";\n"; } if ($contrat['contrat_id']) { $php .= "$" . $cnom . "->setParent($" . $contrats[(int)$contrat['contrat_id']]['variable'] . ");\n"; Loading @@ -267,7 +267,7 @@ foreach ($contrats as $cid => $contrat) { // $php .= "$" . $cnom . "->histoCreation = new \Datetime('" . substr($contrat['histo_creation'], 0, 10) . "');\n"; //} if ($contrat['validation_id'] && null == $contrat['validation_histo_destruction']) { $php .= "$" . $cnom . "->edite = 1;\n"; $php .= "$" . $cnom . "->edite = true;\n"; } if ($contrat['total_hetd']) { $php .= "$" . $cnom . "->totalHetd = " . $contrat['total_hetd'] . ";\n"; Loading @@ -284,7 +284,7 @@ foreach ($contrats as $cid => $contrat) { $php .= "$" . $vnom . " = new VolumeHoraire();\n"; if ($volumesHoraire['structure_id']) { $php .= "$" . $vnom . "->structure_id = " . $volumesHoraire['structure_id'] . ";\n"; $php .= "$" . $vnom . "->structureId = " . $volumesHoraire['structure_id'] . ";\n"; } if ($volumesHoraire['service_id']) { $php .= "$" . $vnom . "->serviceId = " . $volumesHoraire['service_id'] . ";\n"; Loading module/Contrat/src/Tbl/Process/ContratProcess.php +1 −1 Changes for module/Contrat/src/Tbl/Process/ContratProcess.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -359,7 +359,7 @@ class ContratProcess implements ProcessInterface public function calculStructure(Contrat $contrat): void { if ($contrat->id && $contrat->edite == 1) { if ($contrat->id) { // Si le contrat existe déjà et a été valider, on ne touche à rien et on remonte ce qui avait déjà été décidé avant, on recalcule pour un projet return; } Loading tests/TblContrat/CalculStructureTest.php +51 Changes for tests/TblContrat/CalculStructureTest.php: 51 added lines, 0 removed lines. Original line number Diff line number Diff line <?php declare(strict_types=1); namespace TblContrat; use Application\Entity\Db\Parametre; use Contrat\Tbl\Process\Model\Contrat; use Contrat\Tbl\Process\Model\VolumeHoraire; use tests\TblContrat\TblContratTestCase; final class CalculStructureTest extends TblContratTestCase { public function testCasSimple(): void { $parametres = [ Parametre::AVENANT => Parametre::AVENANT_AUTORISE, Parametre::CONTRAT_MIS => Parametre::CONTRAT_MIS_MISSION, Parametre::CONTRAT_ENS => Parametre::CONTRAT_ENS_COMPOSANTE, ]; $this->useParametres($parametres); $contrat1 = new Contrat(); $contrat1->id = 38054; $contrat1->structureId = 477; $contrat1->edite = true; $contrat1->totalHetd = 2.1; $volumeHoraire1 = new VolumeHoraire(); $volumeHoraire1->structureId = 477; $volumeHoraire1->serviceId = 296429; $volumeHoraire1->volumeHoraireId = 715748; $volumeHoraire1->cm = 1.4; $volumeHoraire1->heures = 1.4; $volumeHoraire1->hetd = 2.1; $contrat1->volumesHoraires = [$volumeHoraire1]; $avenant1 = new Contrat(); $avenant1->id = 40343; $avenant1->structureId = 76; $avenant1->setParent($contrat1); $avenant1->numeroAvenant = 1; $avenant1->totalHetd = 2.1; //$this->process->calculStructure($contrat1); $this->process->calculStructure($avenant1); self::assertEquals(76, $avenant1->structureId); } } Loading
code/contrats/debugTests.php +4 −4 Changes for code/contrats/debugTests.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -244,12 +244,12 @@ foreach ($contrats as $cid => $contrat) { $cnom = $contrat['variable']; $php .= "$" . $cnom . " = new Contrat();\n"; $php .= "$" . $cnom . "->id = " . $contrat['id'] . "\n"; $php .= "$" . $cnom . "->id = " . $contrat['id'] . ";\n"; if ($contrat['histo_destruction']) { $php .= "$" . $cnom . "->historise = true;\n"; } if ($contrat['structure_id']) { $php .= "$" . $cnom . "->structure_id = " . $contrat['structure_id'] . ";\n"; $php .= "$" . $cnom . "->structureId = " . $contrat['structure_id'] . ";\n"; } if ($contrat['contrat_id']) { $php .= "$" . $cnom . "->setParent($" . $contrats[(int)$contrat['contrat_id']]['variable'] . ");\n"; Loading @@ -267,7 +267,7 @@ foreach ($contrats as $cid => $contrat) { // $php .= "$" . $cnom . "->histoCreation = new \Datetime('" . substr($contrat['histo_creation'], 0, 10) . "');\n"; //} if ($contrat['validation_id'] && null == $contrat['validation_histo_destruction']) { $php .= "$" . $cnom . "->edite = 1;\n"; $php .= "$" . $cnom . "->edite = true;\n"; } if ($contrat['total_hetd']) { $php .= "$" . $cnom . "->totalHetd = " . $contrat['total_hetd'] . ";\n"; Loading @@ -284,7 +284,7 @@ foreach ($contrats as $cid => $contrat) { $php .= "$" . $vnom . " = new VolumeHoraire();\n"; if ($volumesHoraire['structure_id']) { $php .= "$" . $vnom . "->structure_id = " . $volumesHoraire['structure_id'] . ";\n"; $php .= "$" . $vnom . "->structureId = " . $volumesHoraire['structure_id'] . ";\n"; } if ($volumesHoraire['service_id']) { $php .= "$" . $vnom . "->serviceId = " . $volumesHoraire['service_id'] . ";\n"; Loading
module/Contrat/src/Tbl/Process/ContratProcess.php +1 −1 Changes for module/Contrat/src/Tbl/Process/ContratProcess.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -359,7 +359,7 @@ class ContratProcess implements ProcessInterface public function calculStructure(Contrat $contrat): void { if ($contrat->id && $contrat->edite == 1) { if ($contrat->id) { // Si le contrat existe déjà et a été valider, on ne touche à rien et on remonte ce qui avait déjà été décidé avant, on recalcule pour un projet return; } Loading
tests/TblContrat/CalculStructureTest.php +51 Changes for tests/TblContrat/CalculStructureTest.php: 51 added lines, 0 removed lines. Original line number Diff line number Diff line <?php declare(strict_types=1); namespace TblContrat; use Application\Entity\Db\Parametre; use Contrat\Tbl\Process\Model\Contrat; use Contrat\Tbl\Process\Model\VolumeHoraire; use tests\TblContrat\TblContratTestCase; final class CalculStructureTest extends TblContratTestCase { public function testCasSimple(): void { $parametres = [ Parametre::AVENANT => Parametre::AVENANT_AUTORISE, Parametre::CONTRAT_MIS => Parametre::CONTRAT_MIS_MISSION, Parametre::CONTRAT_ENS => Parametre::CONTRAT_ENS_COMPOSANTE, ]; $this->useParametres($parametres); $contrat1 = new Contrat(); $contrat1->id = 38054; $contrat1->structureId = 477; $contrat1->edite = true; $contrat1->totalHetd = 2.1; $volumeHoraire1 = new VolumeHoraire(); $volumeHoraire1->structureId = 477; $volumeHoraire1->serviceId = 296429; $volumeHoraire1->volumeHoraireId = 715748; $volumeHoraire1->cm = 1.4; $volumeHoraire1->heures = 1.4; $volumeHoraire1->hetd = 2.1; $contrat1->volumesHoraires = [$volumeHoraire1]; $avenant1 = new Contrat(); $avenant1->id = 40343; $avenant1->structureId = 76; $avenant1->setParent($contrat1); $avenant1->numeroAvenant = 1; $avenant1->totalHetd = 2.1; //$this->process->calculStructure($contrat1); $this->process->calculStructure($avenant1); self::assertEquals(76, $avenant1->structureId); } }