Commit 984ce464 authored by Théo GUILLON's avatar Théo GUILLON
Browse files

Correction : du prefix pour les coresponsables et les soustraitants pour que...

Correction : du prefix pour les coresponsables et les soustraitants pour que les varibles soient unique pour la génération
parent 5116e6ea
...@@ -429,7 +429,7 @@ class ModelesController extends AppController { ...@@ -429,7 +429,7 @@ class ModelesController extends AppController {
foreach ($coresponsables as $key => $coresponsable) { foreach ($coresponsables as $key => $coresponsable) {
$translation = str_replace('_', '', ucwords($coresponsable, "_")); $translation = str_replace('_', '', ucwords($coresponsable, "_"));
$coresponsables[__d('responsable_soustraitant', 'responsable_soustraitant.champ' . $translation)] = 'valeur_'.$coresponsable; $coresponsables[__d('responsable_soustraitant', 'responsable_soustraitant.champ' . $translation)] = 'coresponsable_'.$coresponsable;
unset($coresponsables[$key]); unset($coresponsables[$key]);
} }
...@@ -461,7 +461,7 @@ class ModelesController extends AppController { ...@@ -461,7 +461,7 @@ class ModelesController extends AppController {
foreach ($soustraitances as $key => $soustraitance) { foreach ($soustraitances as $key => $soustraitance) {
$translation = str_replace('_', '', ucwords($soustraitance, "_")); $translation = str_replace('_', '', ucwords($soustraitance, "_"));
$soustraitances[__d('responsable_soustraitant', 'responsable_soustraitant.champ' . $translation)] = 'valeur_'.$soustraitance; $soustraitances[__d('responsable_soustraitant', 'responsable_soustraitant.champ' . $translation)] = 'soustraitance_'.$soustraitance;
unset($soustraitances[$key]); unset($soustraitances[$key]);
} }
......
...@@ -853,9 +853,17 @@ class Fiche extends AppModel implements LinkedOrganisationInterface { ...@@ -853,9 +853,17 @@ class Fiche extends AppModel implements LinkedOrganisationInterface {
$jsons = json_decode($value['Valeur']['valeur'], true); $jsons = json_decode($value['Valeur']['valeur'], true);
if ($value['Valeur']['champ_name'] === 'coresponsables') {
$prefix = 'coresponsable_';
} elseif ($value['Valeur']['champ_name'] === 'soustraitances') {
$prefix = 'soustraitance_';
} else {
$prefix = 'valeur_';
}
foreach ($jsons as $key => $json) { foreach ($jsons as $key => $json) {
foreach ($json as $variable => $val) { foreach ($json as $variable => $val) {
$donnees[$value['Valeur']['champ_name']][$key]['valeur_' . $variable] = [ $donnees[$value['Valeur']['champ_name']][$key][$prefix . $variable] = [
'value' => $val, 'value' => $val,
'type' => 'text' 'type' => 'text'
]; ];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment