Commit 117a3825 authored by Raph El's avatar Raph El

Hotfix statut action

parent c460ae81
......@@ -199,7 +199,7 @@ class DatamigrationController extends CommunecterController {
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"]))){
......@@ -209,52 +209,76 @@ class DatamigrationController extends CommunecterController {
array( "priorisation" => array('$exists' => 0) ),
array( "priorisation" => array('$nin' => array(
Ctenat::STATUT_ACTION_VALID,
Ctenat::STATUT_ACTION_MATURATION,
//Ctenat::STATUT_ACTION_MATURATION,
Ctenat::STATUT_ACTION_LAUREAT,
Ctenat::STATUT_ACTION_REFUSE,
Ctenat::STATUT_ACTION_CANDIDAT,
Ctenat::STATUT_ACTION_CONTRACT,
"selected"))),
) ), array("formId", "priorisation") );
Ctenat::STATUT_ACTION_CONTRACT))),
) ), array("formId", "priorisation", "answers") );
$iTer=0;
$iFa=0;
Rest::json($answers); exit;
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"]["project"])&&
!empty($v["answers"][$v["formId"]]["answers"]["project"]["id"])){
$project=PHDB::findOneById(Project::COLLECTION,$v["answers"][$v["formId"]]["answers"]["project"]["id"], array("name", "slug"));
$cter=PHDB::findOne(Project::COLLECTION,array("slug"=> $v["formId"]), array("name", "slug"));
$iFa++;
echo "CTER concerné : ".$cter["name"]." : -> ".$cter["slug"]."<br/>";
$iFa=0;
$listCter = array();
if(!empty($answers)){
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"]["project"])&&
!empty($v["answers"][$v["formId"]]["answers"]["project"]["id"])){
//Rest::json($v["answers"]); exit;
$project=PHDB::findOneById(Project::COLLECTION,$v["answers"][$v["formId"]]["answers"]["project"]["id"], array("name", "slug"));
$cter=PHDB::findOne(Project::COLLECTION,array("slug"=> $v["formId"]), array("name", "slug"));
$iFa++;
//echo "CTER concerné : ".$cter["name"]." : -> ".$cter["slug"]."<br/>";
$prio = "";
if(!empty($v["priorisation"])){
if($v["priorisation"] == "abandoned"){
$prio = Ctenat::STATUT_ACTION_REFUSE;
}else if($v["priorisation"] == "selected"){
$prio = Ctenat::STATUT_ACTION_VALID;
}else if($v["priorisation"] == "reserved"){
$prio = Ctenat::STATUT_ACTION_LAUREAT;
}else if($v["priorisation"] == Ctenat::STATUT_ACTION_MATURATION){
$prio = Ctenat::STATUT_ACTION_LAUREAT;
}
} else {
if( $cter["slug"] == "cteNordArdeche" || $cter["slug"] == "cteSudArdeche" )
$prio = Ctenat::STATUT_ACTION_VALID;
else
$prio = Ctenat::STATUT_ACTION_CANDIDAT;
}
$prio = "";
//echo $prio." CTER concerné : ".$cter["name"]." : -> ".$cter["slug"]."<br/>";
if( $prio != ""){
if(!isset($listCter[$cter["slug"]])){
$listCter[$cter["slug"]]["count"] = 1;
$listCter[$cter["slug"]]["projects"][] = $k. " -> ".$project["name"]. " : ".$prio ;
}else{
$listCter[$cter["slug"]]["projects"][] = $k. " -> ".$project["name"]. " : ".$prio;
$listCter[$cter["slug"]]["count"]++;
}
PHDB::update(Form::ANSWER_COLLECTION,
array("_id" => new MongoId($k)) ,
array('$set' => array("priorisation" => $prio))
);
if(!empty($v["priorisation"])){
if($v["priorisation"] == "abandoned"){
$prio = Ctenat::STATUT_ACTION_REFUSE;
Ctenat::updatePrioAnswers($k, $v["formId"], $prio, "priorisation");
}
} else {
}
// PHDB::update(Form::ANSWER_COLLECTION,
// array("_id" => $v["_id"]) ,
// array('$set' => array("priorisation" => "Action Candidate"))
// );
}
}
Rest::json($listCter); exit;
echo $iFa." fiches actions ";
}else{
echo "Accès réservé au Big Bosses !";
}
}
public function actionUpdateProjectOpenEditionCteNat(){
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]))){
$projects=PHDB::find(Project::COLLECTION, array("source.key"=>"ctenat"));
......@@ -6861,7 +6885,7 @@ 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.murir.planFinancement" => $newPL ) ) );
......
......@@ -11,6 +11,7 @@ co2/datamigration/ModifyCostumDB
co2/datamigration/UpdateAnswersIndicateurs
co2/datamigration/FinancterLabel
co2/datamigration/Financter
co2/datamigration/UpdateAnswersActionCandidateMissing
/////////////////////////// BASH VERSION 0.99 /////////////////////////////////////
......
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