Commit 2f068dbc authored by Clément Damiens's avatar Clément Damiens

Merge remote-tracking branch 'origin/qa' into qa

parents 46c4fc65 cd611ed9
......@@ -151,6 +151,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)));
......@@ -6813,8 +6863,8 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
PHDB::update( "answers",
array("_id"=>new MongoId($a["_id"])),
array('$push' => array( "answers.".$slug.".answers.murir.budget" => [
"nature" => $fk,
"poste" => "Depense fonctionnement",
"financer" => $fk,
"title" => "Depense fonctionnement",
"amount2019" => "",
"amount2020" => $a[ "answers"][ $slug ][ "answers"][ "financement"][$fk]["total"],
"amount2021" => "",
......@@ -6831,23 +6881,23 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
"amount2021" => "",
"amount2022" => ""
] ) ) );
// else if($fk == 'financeursnonprecises' )
// PHDB::update( "answers",
// array("_id"=>new MongoId($a["_id"])),
// array('$push' => array("answers.".$slug.".answers.murir.planFinancement" => [
// "nature" => $fk,
// "poste" => "Financements Département",
// "amount2019" => "",
// "amount2020" => $a[ "answers"][ $slug ][ "answers"][ "financement"][$fk]["total"],
// "amount2021" => "",
// "amount2022" => ""
// ]) ) );
else if($fk == 'financeursnonprecises' )
PHDB::update( "answers",
array("_id"=>new MongoId($a["_id"])),
array('$push' => array("answers.".$slug.".answers.murir.planFinancement" => [
"nature" => "autre",
"poste" => "Financements Autre",
"amount2019" => "",
"amount2020" => $a[ "answers"][ $slug ][ "answers"][ "financement"][$fk]["total"],
"amount2021" => "",
"amount2022" => ""
]) ) );
else if($fk == 'autofinancement' )
PHDB::update( "answers",
array("_id"=>new MongoId($a["_id"])),
array('$push' => array("answers.".$slug.".answers.murir.planFinancement" => [
"nature" => "acteursocioeco",
"poste" => "Fonds Propres",
"poste" => "Autofinancement Porteur projet",
"amount2019" => "",
"amount2020" => $a[ "answers"][ $slug ][ "answers"][ "financement"][$fk]["total"],
"amount2021" => "",
......@@ -6869,23 +6919,23 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
array("_id"=>new MongoId($a["_id"])),
array('$push' => array("answers.".$slug.".answers.murir.planFinancement" => [
"nature" => "acteursocioeco",
"poste" => "Divers financements privés",
"poste" => "Banque",
"amount2019" => "",
"amount2020" => $a[ "answers"][ $slug ][ "answers"][ "financement"][$fk]["total"],
"amount2021" => "",
"amount2022" => ""
]) ) );
else if($fk == 'colautofinancement)' )
PHDB::update( "answers",
array("_id"=>new MongoId($a["_id"])),
array('$push' => array("answers.".$slug.".answers.murir.planFinancement" => [
"nature" => "colfinanceur",
"poste" => "Autofinancement Collectivité",
"amount2019" => "",
"amount2020" => $a[ "answers"][ $slug ][ "answers"][ "financement"][$fk]["total"],
"amount2021" => "",
"amount2022" => ""
]) ) );
//else if($fk == 'colautofinancement)' )
// PHDB::update( "answers",
// array("_id"=>new MongoId($a["_id"])),
// array('$push' => array("answers.".$slug.".answers.murir.planFinancement" => [
// "nature" => $fk,
// "poste" => "Autofinancement - collectivité (revenus)",
// "amount2019" => "",
// "amount2020" => $a[ "answers"][ $slug ][ "answers"][ "financement"][$fk]["total"],
// "amount2021" => "",
// "amount2022" => ""
// ]) ) );
else if($fk == 'colfinanceur' )
PHDB::update( "answers",
array("_id"=>new MongoId($a["_id"])),
......@@ -6968,7 +7018,7 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
array("_id"=>new MongoId($a["_id"])),
array('$push' => array("answers.".$slug.".answers.murir.planFinancement" => [
"nature" => "acteursocioeco",
"poste" => "Acteurs socio-économiques",
"poste" => "Chambre consulaire",
"amount2019" => "",
"amount2020" => $a[ "answers"][ $slug ][ "answers"][ "financement"][$fk]["total"],
"amount2021" => "",
......@@ -6990,7 +7040,7 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
array("_id"=>new MongoId($a["_id"])),
array('$push' => array("answers.".$slug.".answers.murir.planFinancement" => [
"nature" => "acteursocioecot",
"poste" => "Acteurs socio-économiques",
"poste" => "Fondations",
"amount2019" => "",
"amount2020" => $a[ "answers"][ $slug ][ "answers"][ "financement"][$fk]["total"],
"amount2021" => "",
......
......@@ -7,6 +7,11 @@ co2/datamigration/ModifyCostumDB
/////////////////////////// End permanent bash /////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
*** CTENAT
co2/datamigration/UpdateAnswersIndicateurs
co2/datamigration/
co2/datamigration/Financter
/////////////////////////// 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