Commit 763650f4 authored by Raph El's avatar Raph El
Browse files

Hotfix indicateurs

parent f75d3575
......@@ -438,7 +438,7 @@
"label" : "Indicateur",
"list" : "indicators",
"select2" : {
"multiple" : true
"multiple" : false
},
"rules" : { "required" : true }
}
......
......@@ -313,7 +313,7 @@ class Form {
foreach ( $value["answers"] as $keyA => $valA) {
if( !empty($valA["answers"][Organization::CONTROLLER]) ){
if( !empty($valA["answers"][Organization::CONTROLLER]) && !empty($valA["answers"][Organization::CONTROLLER]["id"])){
$orga = Element::getElementById($valA["answers"][Organization::CONTROLLER]["id"], Organization::COLLECTION, null, array("name", "email", "shortDescription"));
$orga["id"] = $valA["answers"][Organization::CONTROLLER]["id"];
$orga["type"] = Organization::COLLECTION;
......@@ -321,7 +321,7 @@ class Form {
}
if( !empty($valA["answers"][Project::CONTROLLER]) ){
if( !empty($valA["answers"][Project::CONTROLLER]) && !empty($valA["answers"][Project::CONTROLLER]["id"]) ){
$project = Element::getElementById($valA["answers"][Project::CONTROLLER]["id"], Project::COLLECTION, null, array("name", "email", "shortDescription"));
$project["id"] = $valA["answers"][Project::CONTROLLER]["id"];
$project["type"] = Project::COLLECTION;
......
......@@ -35,12 +35,14 @@ $editBtnL = ($canAdmin) ? " <a href='javascript:;' data-form='".$step."' data-st
//always show indicateur emploi
$emploiExists = false;
foreach ($answers as $q => $a) {
if( isset($a["indicateur"]) && in_array("5d7fa1c540bb4e8f7b496afe", $a["indicateur"]) )
if( isset($a["indicateur"]) && is_array($a["indicateur"]) && in_array("5d7fa1c540bb4e8f7b496afe", $a["indicateur"]) )
$emploiExists = true;
else if( isset($a["indicateur"]) && "5d7fa1c540bb4e8f7b496afe" == $a["indicateur"] )
$emploiExists = true;
}
if( !$emploiExists ){
$emploiIndic = [ "indicateur" => ["5d7fa1c540bb4e8f7b496afe"] ];
$emploiIndic = [ "indicateur" => "5d7fa1c540bb4e8f7b496afe" ];
PHDB::update( Form::ANSWER_COLLECTION, [ "_id"=>new MongoId($id) ],
array('$push' => array("answers.".$answer['formId'].".answers.".$step.".".$key=>$emploiIndic)));
$answers[] = $emploiIndic;
......@@ -48,9 +50,10 @@ $editBtnL = ($canAdmin) ? " <a href='javascript:;' data-form='".$step."' data-st
//var_dump($indicateurs); //exit;
foreach ($answers as $q => $a) {
if(isset($a["indicateur"])){
foreach ($a["indicateur"] as $kA => $valA) {
//foreach ($a["indicateur"] as $kA => $valA) {
echo "<tr>".
"<td id='indic".$ct."' rowspan=2 style='vertical-align : middle;text-align:center;'>".( !empty($indicateurs[$valA]) ? $indicateurs[$valA] : "" )."</td>".
//"<td id='indic".$ct."' rowspan=2 style='vertical-align : middle;text-align:center;'>".( !empty($indicateurs[$valA]) ? $indicateurs[$valA] : "" )."</td>".
"<td id='indic".$ct."' rowspan=2 style='vertical-align : middle;text-align:center;'>".( !empty($indicateurs[$a["indicateur"]]) ? $indicateurs[$a["indicateur"]] : "" )."</td>".
"<td>Objectif</td>".
"<td style='vertical-align : middle;text-align:center;'></td>".
"<td class='editContent' data-key='res2019' data-indic='indic".$ct."' data-pos='".$q."' data-type='objectif'>".(isset($a["objectif"]["res2019"])?$a["objectif"]["res2019"]:"")."</td>".
......@@ -58,7 +61,6 @@ $editBtnL = ($canAdmin) ? " <a href='javascript:;' data-form='".$step."' data-st
"<td class='editContent' data-key='res2021' data-indic='indic".$ct."' data-pos='".$q."' data-type='objectif'>".(isset($a["objectif"]["res2021"])?$a["objectif"]["res2021"]:"")."</td>".
"<td class='editContent' data-key='res2022' data-indic='indic".$ct."' data-pos='".$q."' data-type='objectif'>".(isset($a["objectif"]["res2022"])?$a["objectif"]["res2022"]:"")."</td>";
echo "</tr>";
echo "<tr>".
"<td>Réalisé</td>".
"<td class='editContent'data-key='res2018' data-indic='indic".$ct."' data-pos='".$q."' data-type='reality'>".(isset($a["reality"]["res2018"]) ? $a["reality"]["res2018"]:"")."</td>".
......@@ -70,9 +72,8 @@ $editBtnL = ($canAdmin) ? " <a href='javascript:;' data-form='".$step."' data-st
$ct++;
}
//}
}
}
?>
......
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