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 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 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"); } }
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(); }