Commit 0efa1c22 authored by Raph El's avatar Raph El

Hotfix indicateur

parent 449379a9
......@@ -182,6 +182,56 @@ class DatamigrationController extends CommunecterController {
echo "<br/>-------------------------------------------------------------------------------------------<br/>";
}
}
public function actionUpdateAnswersIndicateurs(){
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]))){
$answers=PHDB::find(Form::ANSWER_COLLECTION, array("source.key"=>"ctenat", "answers" => array('$exists' => 1)));
$iTer=0;
$iFa=0;
foreach($answers as $k => $v){
if(!empty($v["answers"]) &&
!empty($v["formId"])&&
!empty($v["answers"][$v["formId"]]) &&
!empty($v["answers"][$v["formId"]]["answers"]) &&
!empty($v["answers"][$v["formId"]]["answers"]["murir"])&&
!empty($v["answers"][$v["formId"]]["answers"]["murir"]["results"])){
$indList = $v["answers"][$v["formId"]]["answers"]["murir"]["results"] ;
$newsInd = array();
foreach ($indList as $keyI => $valI) {
if( is_array($valI["indicateur"]) ){
foreach ($valI["indicateur"] as $keyInd => $valInd ) {
$n = array();
$n["indicateur"] = $valInd;
if($keyInd == 0 && !empty($valI["objectif"]))
$n["objectif"] = $valI["objectif"];
if($keyInd == 0 && !empty($valI["reality"]))
$n["reality"] = $valI["reality"];
$newsInd[] = $n;
}
} else
$newsInd[] = $valI;
}//
$iFa++;
PHDB::update(Form::ANSWER_COLLECTION,
array("_id" => new MongoId($k)) ,
array('$set' => array("answers.".$v["formId"].".answers.murir.results" => $newsInd))
);
}
}
//Rest::json($res); exit;
echo $iFa." fiches actions ";
}else{
echo "Accès réservé au Big Bosses !";
}
}
public function actionUpdateAnswersActionCandidateMissing(){
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]))){
$answers=PHDB::find(Form::ANSWER_COLLECTION, array("source.key"=>"ctenat", "priorisation" => array('$exists' => 0)));
......
......@@ -7,6 +7,9 @@ co2/datamigration/ModifyCostumDB
/////////////////////////// End permanent bash /////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
*** CTENAT
co2/datamigration/UpdateAnswersIndicateurs
/////////////////////////// BASH VERSION 0.99 /////////////////////////////////////
// This file helps any devlopper to update his environment in order to make it work
......
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