Commit c460ae81 authored by Raph El's avatar Raph El

Hotfix

parent b4d6b0a5
......@@ -203,10 +203,22 @@ class DatamigrationController extends CommunecterController {
}
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)));
$answers=PHDB::find(Form::ANSWER_COLLECTION,
array("source.key"=>"ctenat",
'$or' => array(
array( "priorisation" => array('$exists' => 0) ),
array( "priorisation" => array('$nin' => array(
Ctenat::STATUT_ACTION_VALID,
Ctenat::STATUT_ACTION_MATURATION,
Ctenat::STATUT_ACTION_LAUREAT,
Ctenat::STATUT_ACTION_REFUSE,
Ctenat::STATUT_ACTION_CANDIDAT,
Ctenat::STATUT_ACTION_CONTRACT,
"selected"))),
) ), array("formId", "priorisation") );
$iTer=0;
$iFa=0;
Rest::json($answers); exit;
foreach($answers as $k => $v){
if(!empty($v["answers"]) &&
......@@ -220,11 +232,21 @@ class DatamigrationController extends CommunecterController {
$cter=PHDB::findOne(Project::COLLECTION,array("slug"=> $v["formId"]), array("name", "slug"));
$iFa++;
echo "CTER concerné : ".$cter["name"]." : Project -> ".$project["slug"]."<br/>";
PHDB::update(Form::ANSWER_COLLECTION,
array("_id" => $v["_id"]) ,
array('$set' => array("priorisation" => "Action Candidate"))
);
echo "CTER concerné : ".$cter["name"]." : -> ".$cter["slug"]."<br/>";
$prio = "";
if(!empty($v["priorisation"])){
if($v["priorisation"] == "abandoned"){
$prio = Ctenat::STATUT_ACTION_REFUSE;
}
} else {
}
// PHDB::update(Form::ANSWER_COLLECTION,
// array("_id" => $v["_id"]) ,
// array('$set' => array("priorisation" => "Action Candidate"))
// );
}
}
......@@ -6820,6 +6842,7 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
$pL = $answer["answers"][$answer["formId"]]["answers"]["murir"]["planFinancement"] ;
$newPL = array();
foreach ($pL as $keyPL => $valPL) {
if(!empty($valPL["financer"]) && $valPL["financer"] == "public"){
$valPL["financerType"] = "colfinanceur";
......@@ -6838,10 +6861,10 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
}
$resAnswers[$keyA] = $newPL;
//echo $keyA."<br>";
echo $keyA."<br>";
PHDB::update( "answers",
array("_id"=>new MongoId($keyA)),
array('$set' => array( "answers.".$answer["formId"].".answers.planFinancement" => $newPL ) ) );
array('$set' => array( "answers.".$answer["formId"].".answers.murir.planFinancement" => $newPL ) ) );
}
}
echo "public : ".$i;
......
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