View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - Bind the status of a document to an element bound by type Activity - ProjeQtOr
 
 

Bind the status of a document to an element bound by type Activity

More
06 Mar 2013 11:46 #1 by Luigy
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?

Please Log in or Create an account to join the conversation.

More
06 Mar 2013 13:15 - 06 Mar 2013 13:16 #2 by babynus
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();
  }
}

Babynus
Administrator of ProjeQtOr web site
Last edit: 06 Mar 2013 13:16 by babynus.
The following user(s) said Thank You: Luigy

Please Log in or Create an account to join the conversation.

More
06 Mar 2013 14:32 #3 by Luigy
Thank you. It's exactly what I need.

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.038 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.