Ejemplo n.º 1
0
	public function save(Employee_Models_Contact $contact)
	{
		$probStart = $contact->getProbStart();
		$probEnd = $contact->getProbEnd();
		$secDate = $contact->getSecDate();
		if($probStart == "")
		{
			$probStart = null;
			}
		if($probEnd == "")
		{
			$probEnd = null;
			}
		if($secDate == "")
		{
			$secDate = null;
			}
		$data = array(
			'contactId' => $contact->getContactId(),
			'contactName' => $contact->getName(),
			'gender' => $contact->getGender(),
 			'titleName' => $contact->getTitleName(),
			'birth' => $contact->getBirth(),
			'titleSpec' => $contact->getTitleSpec(),
			'deptName' => $contact->getDeptName(),
			'dutyName' => $contact->getDutyName(),
			'edu' => $contact->getEdu(),
			'enroll' => $contact->getEnroll(),
			'political' => $contact->getPolitical(),
			'idCard' => $contact->getIdCard(),
			'ethnic' => $contact->getEthnic(),
			'address' => $contact->getAddress(),
			'zip' => $contact->getZip(),
			'phoneHome' => $contact->getPhoneHome(),
			'phoneMob' => $contact->getPhoneMob(),
			'residence' => $contact->getResidence(),
			'probStart' => $probStart,
			'probEnd' => $probEnd,
			'profile' => $contact->getProfile(),
			'security' => $contact->getSecurity(),
			'secIn' => $contact->getSecIn(),
			'secDate' => $secDate,
			'medical' => $contact->getMedical(),
			'relation1' => $contact->getRelation1(),
			'name1' => $contact->getName1(),
			'company1' => $contact->getCompany1(),
			'address1' => $contact->getAddress1(),
			'phone1' => $contact->getPhone1(),
			'relation2' => $contact->getRelation2(),
			'name2' => $contact->getName2(),
			'company2' => $contact->getCompany2(),
			'address2' => $contact->getAddress2(),
			'phone2' => $contact->getPhone2(),
			'relation3' => $contact->getRelation3(),
			'name3' => $contact->getName3(),
			'company3' => $contact->getCompany3(),
			'address3' => $contact->getAddress3(),
			'phone3' => $contact->getPhone3(),
			'relation4' => $contact->getRelation4(),
			'name4' => $contact->getName4(),
			'company4' => $contact->getCompany4(),
			'address4' => $contact->getAddress4(),
			'phone4' => $contact->getPhone4(),
			'remark' => $contact->getRemark()
		);
		if (null === ($id = $contact->getContactId())) {
			unset($data['contactId']);
			$this->getDbTable()->insert($data);
		} else {
			$this->getDbTable()->update($data, array('contactId = ?' => $contact->getContactId()));
		}
	}