Beispiel #1
0
 public function update(C3op_Projects_HumanResource $i)
 {
     if (!isset($this->identityMap[$i])) {
         throw new C3op_Projects_HumanResourceMapperException('Object has no ID, cannot update.');
     }
     $sql = sprintf('UPDATE projects_human_resources SET action = %d,
                     description =  \'%s\',
                     contact = %d,
                     value =  %f,
                     status = %d
                      WHERE id = %d;', $i->GetAction(), $i->GetDescription(), $i->GetContact(), $i->GetValue(), $i->GetStatus(), $this->identityMap[$i]);
     try {
         $this->db->exec($sql);
     } catch (Exception $e) {
         throw new C3op_Projects_HumanResourceException("{$sql} failed");
     }
 }
Beispiel #2
0
 private function populateFieldsAssociatedToHumanResource(C3op_Projects_HumanResource $humanResource, C3op_Form_OutlayCreate $form)
 {
     $humanResourceField = $form->getElement('humanResource');
     $humanResourceField->setValue($humanResource->Getid());
     if ($humanResource->GetContact() > 0) {
         if (!isset($this->contactMapper)) {
             $this->contactMapper = new C3op_Register_ContactMapper($this->db);
         }
         $humanResourceContact = $this->contactMapper->findById($humanResource->GetContact());
         $this->viewInfo['contactName'] = $humanResourceContact->GetName();
         $this->viewInfo['linkContactDetail'] = "/register/contact/detail/?id=" . $humanResourceContact->GetId();
     }
     if (!isset($this->actionMapper)) {
         $this->actionMapper = new C3op_Projects_ActionMapper($this->db);
     }
     $actionField = $form->getElement('action');
     $actionField->setValue($humanResource->GetAction());
     $humanResourceAction = $this->actionMapper->findById($humanResource->GetAction());
     $this->viewInfo['actionTitle'] = $humanResourceAction->GetTitle();
     $this->viewInfo['linkActionDetail'] = "/projects/action/detail/?id=" . $humanResourceAction->GetId();
     $projectField = $form->getElement('project');
     $projectField->setValue($humanResourceAction->GetProject());
     if (!isset($this->projectMapper)) {
         $this->projectMapper = new C3op_Projects_ProjectMapper($this->db);
     }
     $thisProject = $this->projectMapper->findById($humanResourceAction->GetProject());
     $this->viewInfo['projectTitle'] = $thisProject->GetTitle();
     $this->viewInfo['linkProjectDetail'] = "/projects/project/detail/?id=" . $thisProject->GetId();
 }