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 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; }