Commit 2b7f5a92 authored by Tibor Katelbach's avatar Tibor Katelbach

deal tweks step 4 5

parent e1ecdbc2
......@@ -23,6 +23,11 @@ $paramsData = [
"estimate" => false
];
function is_true($val, $return_null=false){
$boolval = ( is_string($val) ? filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : (bool) $val );
return ( $boolval===null && !$return_null ? false : $boolval );
}
if( isset($parentForm["params"][$kunik]["group"]) )
$paramsData["group"] = $parentForm["params"][$kunik]["group"];
if( isset($parentForm["params"][$kunik]["nature"]) )
......@@ -30,7 +35,7 @@ if( isset($parentForm["params"][$kunik]["nature"]) )
if( isset($parentForm["params"][$kunik]["amounts"]) )
$paramsData["amounts"] = $parentForm["params"][$kunik]["amounts"];
if( isset($parentForm["params"][$kunik]["estimate"]) )
$paramsData["estimate"] = $parentForm["params"][$kunik]["estimate"];
$paramsData["estimate"] = is_true($parentForm["params"][$kunik]["estimate"]);
// if(isset($answers)){
// foreach ($answers as $q => $a) {
......@@ -69,7 +74,7 @@ $properties = [
];
}
if($debug)var_dump($answers);
if($debug)var_dump($paramsData);
var_dump($paramsData);
?>
<?php
......
......@@ -48,19 +48,11 @@ if( isset($parentForm["params"][$kunik]) ) {
if( isset($parentForm["params"][$kunik]["openFinancing"]) )
$paramsData["openFinancing"] = $parentForm["params"][$kunik]["openFinancing"];
}
$communityLinks = array();
if(!empty($form["parent"])){
foreach ($form["parent"] as $key => $value) {
$cl= Element::getCommunityByTypeAndId($key,$value["type"]);
if(!empty($cl))
$communityLinks = array_merge($communityLinks, $cl);
}
}
$communityLinks = Element::getCommunityByParentTypeAndId( $parentForm["parent"] );
$organizations = Link::groupFindByType( Organization::COLLECTION,$communityLinks,["name","links"] );
$orgs = [];
foreach ($organizations as $id => $or) {
$roles = null;
if( isset( $communityLinks[$id]["roles"] ) )
......@@ -74,6 +66,7 @@ foreach ($organizations as $id => $or) {
}
}
}
//var_dump($orgs); exit;
$listLabels = array_merge(Ctenat::$financerTypeList,$orgs);
......
......@@ -66,18 +66,10 @@ if( isset($parentForm["params"][$kunik]["limitRoles"]) )
if( isset($parentForm["params"][$kunik]["budgetCopy"]) )
$paramsData["budgetCopy"] = $parentForm["params"][$kunik]["budgetCopy"];
$communityLinks = array();
if(!empty($form["parent"])){
foreach ($form["parent"] as $key => $value) {
$cl= Element::getCommunityByTypeAndId($key,$value["type"]);
if(!empty($cl))
$communityLinks = array_merge($communityLinks, $cl);
}
}
$communityLinks = Element::getCommunityByParentTypeAndId( $parentForm["parent"] );
$organizations = Link::groupFindByType( Organization::COLLECTION,$communityLinks,["name","links"] );
$orgs = [];
foreach ($organizations as $id => $or) {
$roles = null;
if( isset( $communityLinks[$id]["roles"] ) )
......@@ -517,9 +509,11 @@ $(document).ready(function() {
};
delete tplCtx.pos;
delete tplCtx.budgetpath;
mylog.log("btnFinancer save",tplCtx);
dataHelper.path2Value( tplCtx, function(){
saveLinks(answerObj._id.$id,"worker",userId,closePrioModal);
dataHelper.path2Value( tplCtx, function() {
saveLinks(answerObj._id.$id,"worker", userId,closePrioModal );
} );
}
},
......
......@@ -65,7 +65,7 @@
$tds .= "<a href='javascript:;' data-id='".$answer["_id"]."' data-budgetpath='".$copy."' data-form='".$copyF."' data-pos='".$q."' class='".$class." btnWorker margin-left-5 padding-10'>".$valbl."</a>";
}
if( $i == "todo" )
else if( $i == "todo" )
{
$valbl = "<i class='fa fa-plus'></i>";
$class= "btn btn-default";
......@@ -87,7 +87,8 @@
$tds .= $a["financer"]["line"];
else if( $i == "workType" && isset( $a["worker"]["workType"] ) )
$tds .= $a["worker"]["workType"];
else if( $i == "progress"){
else if( $i == "progress")
{
if(isset($a["todo"])){
$progress = floor($todoDone*100/count($a["todo"]));
}
......@@ -106,7 +107,8 @@
'</div>'.
'</div>';
}
else if( $i == "total"){
else if( $i == "total")
{
$total = 0;
$totalPayedHere = 0;
$amounts = (isset($parentForm["params"][$budgetKey]["amounts"])) ? $parentForm["params"][$budgetKey]["amounts"] : ["price" => "Price"] ;
......@@ -151,7 +153,8 @@
'</div>'.
'</div>';
}
else if( $i == "validation"){
else if( $i == "validation")
{
$color = "default";
$valbl = "?";
$tool= "En attente de validation";
......
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