Ejemplo n.º 1
0
	public function save(Pment_Models_Mplan $mplan) 
	{
		$data = array(
			'planId' => $mplan->getPlanId(),
			'projectId' => $mplan->getProjectId(),
			'planName' => $mplan->getPlanName(),
			'typeId' => $mplan->getTypeId(),
			'yearNum' => $mplan->getYearNum(),
			'monNum' => $mplan->getMonNum(),
			'pDate' => $mplan->getPDate(),
			'contactId' => $mplan->getContactId(),
			'status' =>$mplan->getStatus(),
			'remark' => $mplan->getRemark(),
			'approvcId' => $mplan->getApprovcId(),
			'approvcDate' => $mplan->getApprovcDate(),
			'approvcRemark' => $mplan->getApprovcRemark(),
			'approvfId' => $mplan->getApprovfId(),
			'approvfDate' => $mplan->getApprovfDate(),
			'approvfRemark' => $mplan->getApprovfRemark(),
			'total' => $mplan->getTotal()
		);
		if (null === ($id = $mplan->getPlanId())) {
			unset($data['planId']);
			return $this->getDbTable()->insert($data);
		} else {
			return $this->getDbTable()->update($data, array('planId = ?' => $mplan->getPlanId()));
		}
	}