Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.
Hi Babynus,
I would like to connect the status of a document to the status of the activity I link to it. I try this code in the fonction save on model/Document.php but it doesn't work
foreach ($this->_Link as $link){
if ($link->ref1Type == "Activity" && count($this->_Link) == 1){
$activity = new Activity();
$crit = array('id'=>$link->ref1Id);
$activity = (object) $activity->getSqlElementsFromCriteria($crit);
foreach ($activity as $act){
$act->idStatus = $this->idStatus;
}
}
}
Can't you tell me how i can do it or how i can save to modify activiy table?
1) Check that $this->_Link is not empty.
3) If you have anoter item linked, nothing is done : check you have only 1 activity linked
4) You don't save your activity after updating status... :whistle:
5) Optimise code
foreach ($this->_Link as $link){
if ($link->ref1Type == "Activity"){
$activity = new Activity($link->ref1Id);
$activity->idStatus = $this->idStatus;
$activity->save();
}
}
Thank you. It's exactly what I need.