public static function ContactContract(C3op_Projects_Action $action, C3op_Projects_HumanResource $humanResource, C3op_Projects_HumanResourceMapper $humanResourceMapper) { if ($humanResource->GetContact() > 0 && $humanResource->GetStatus() == C3op_Projects_HumanResourceStatusConstants::STATUS_FORESEEN) { $humanResource->SetStatus(C3op_Projects_HumanResourceStatusConstants::STATUS_CONTRACTED); $humanResourceMapper->update($humanResource); self::LogContracting($action); } }
public function getAllOutlaysForHumanResource(C3op_Projects_HumanResource $h) { $result = array(); foreach ($this->db->query(sprintf('SELECT id FROM projects_outlays WHERE human_resource = %d;', $h->GetId())) as $row) { $result[] = $row['id']; } return $result; }
public function ContactDismiss(C3op_Projects_Action $action, C3op_Projects_HumanResource $humanResource, C3op_Projects_HumanResourceMapper $humanResourceMapper) { if ($humanResource->GetContact() > 0) { $humanResource->SetContact(0); $humanResourceMapper->update($humanResource); $this->LogDismiss($action); } }
public function process($data) { if ($this->isValid($data) !== true) { throw new C3op_Form_HumanResourceCreateException('Invalid data!'); } else { $db = Zend_Registry::get('db'); $humanResourceMapper = new C3op_Projects_HumanResourceMapper($db); $humanResource = new C3op_Projects_HumanResource(); $humanResource->SetDescription($this->description->GetValue()); $humanResource->SetContact($this->contact->GetValue()); $humanResource->SetValue($this->value->GetValue()); $humanResource->SetAction($this->action->GetValue()); $humanResourceMapper->insert($humanResource); return $humanResource->GetId(); } }
private function ManageContractingLink(C3op_Projects_HumanResource $humanResource) { $contractingLink = ""; if ($humanResource->GetContact() > 0 && $humanResource->GetStatus() == C3op_Projects_HumanResourceStatusConstants::STATUS_FORESEEN) { $contractingLink = sprintf("javascript:passIdToAjax('/projects/human-resource/contract-contact', %d, contractContactResponse)", $humanResource->GetId()); } return $contractingLink; }
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(); }