Beispiel #1
0
 public static function ChangePredictedFinishDate(C3op_Projects_Action $action, C3op_Projects_ActionMapper $actionMapper, $newDate, $observation)
 {
     if ($observation != "" && $action->GetPredictedFinishDate() != $newDate) {
         $action->SetPredictedFinishDate($newDate);
         $actionMapper->update($action);
         self::LogPredictedFinishDateChanging($action, $observation);
     }
 }
Beispiel #2
0
 public function process($data)
 {
     if ($this->isValid($data) !== true) {
         throw new C3op_Form_ActionCreateException('Invalid data!');
     } else {
         $db = Zend_Registry::get('db');
         $actionMapper = new C3op_Projects_ActionMapper($db);
         $action = new C3op_Projects_Action($this->project->GetValue());
         //            $action->SetTitle($this->title->GetValue());
         $action->SetTitle($data['title']);
         $action->SetStatus(C3op_Projects_ActionStatusConstants::STATUS_PLAN);
         $action->SetDescription($this->description->GetValue());
         $predictedBeginDate = $this->predictedBeginDate->GetValue();
         $dateValidator = new C3op_Util_ValidDate();
         if ($dateValidator->isValid($predictedBeginDate)) {
             $converter = new C3op_Util_DateConverter();
             $dateForMysql = $converter->convertDateToMySQLFormat($predictedBeginDate);
             $action->SetPredictedBeginDate($dateForMysql);
         }
         $predictedFinishDate = $this->predictedFinishDate->GetValue();
         $dateValidator = new C3op_Util_ValidDate();
         if ($dateValidator->isValid($predictedFinishDate)) {
             $converter = new C3op_Util_DateConverter();
             $dateForMysql = $converter->convertDateToMySQLFormat($predictedFinishDate);
             $action->SetPredictedFinishDate($dateForMysql);
         }
         $action->SetSubordinatedTo($this->subordinatedTo->GetValue());
         $action->SetResponsible($this->responsible->GetValue());
         $milestone = $this->milestone->GetValue();
         if ($milestone == '1') {
             $action->SetMilestone(1);
         } else {
             $action->SetMilestone(0);
         }
         $requirementForReceiving = $this->requirementForReceiving->GetValue();
         if ($requirementForReceiving == '1') {
             $action->SetRequirementForReceiving(1);
         } else {
             $action->SetRequirementForReceiving(0);
         }
         $actionMapper->insert($action);
         return $action->getId();
     }
 }