예제 #1
0
	public function editAction()
	{
		$projectId =$this->getProjectId();
		$editForm = new Vehicle_Forms_VerecordSave();
		$editForm->submit->setLabel('保存修改');
		$editForm->submit2->setAttrib('class','hide');
		$veId = $editForm->getElement('veId');
		$veId->setAttrib('disabled','disabled');

		$recordId = $this->_getParam('id',0);
		
		$verecords = new Vehicle_Models_VerecordMapper();
		$verecords->populateVeDd($editForm);
		$vId = $verecords->findVeId($recordId);
		
		$editForm = $verecords->formValidator($editForm,1);
		
		$errorMsg = null;
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if($editForm->isValid($formData))
			{
				$array = $verecords->dataValidator($formData,$recordId,$vId,1);
				$trigger = $array['trigger'];
				$errorMsg = $array['errorMsg'];
				if($trigger == 0)
				{
					$verecord = new Vehicle_Models_verecord();
					$verecord->setrecordId($recordId);
					$verecord->setVeId($vId);
					$verecord->setPrjFlag(1);
					$verecord->setProjectId($projectId);
					$verecord->setStartDate($editForm->getValue('startDate'));
					$verecord->setEndDate($editForm->getValue('endDate'));
					$verecord->setRoute($editForm->getValue('route'));
					$verecord->setMileBf($editForm->getValue('mileBf'));
					$verecord->setMileAf($editForm->getValue('mileAf'));
					$verecord->setPurpose($editForm->getValue('purpose'));
					$verecord->setUser($editForm->getValue('user'));
					$verecord->setMileRef($editForm->getValue('mileRef'));
					$verecord->setContactId($editForm->getValue('contactId'));
					$verecord->setAmount($editForm->getValue('amount'));
					$verecord->setRemark($editForm->getValue('remark'));
					$verecords->save($verecord);
					$veId = new Vehicle_Models_VehicleMapper();
					$plateNo = $veId->findPlateNo($verecord->getVeId());
					$this->_helper->flashMessenger->addMessage('对工程用车记录'.$plateNo.'修改成功。');
					$this->_redirect('/pment/verecord');
					}
					else
					{
						$editForm->populate($formData);
						$veId->setValue($vId);
						}
				}
				else
				{
					$editForm->populate($formData);
					$veId->setValue($vId);
					}
			}
			else
			{
				if($recordId > 0)
				{
					$arrayVerecord = $verecords->findArrayVerecord($recordId);
					$editForm->populate($arrayVerecord);
					}
					else
					{
						$this->_redirect('/pment/verecord');
						}
				}
		$this->view->errorMsg = $errorMsg;
		$this->view->editForm = $editForm;
		$this->view->id = $recordId;
	}
예제 #2
0
	public function editAction()
	{
		$editForm = new Vehicle_Forms_MtncSave();
		$editForm->submit->setLabel('保存修改');
		$editForm->submit2->setAttrib('class','hide');
		$veId = $editForm->getElement('veId');
		$veId->setAttrib('disabled','disabled');

		$mtnId = $this->_getParam('id',0);
		$from = $this->_getParam('from',0);
		
		$mtncs = new Vehicle_Models_MtncMapper();
		$mtncs->populateVeDd($editForm);
		$vId = $mtncs->findVeId($mtnId);
		
		$editForm = $mtncs->formValidator($editForm,1);
		
		$errorMsg = null;
		$link = null;
		if($from == 0)
		{
			$link = "/vehicle/mtnc";
			}
			elseif($from == 1)
			{
				$link = '"/vehicle/index/display/id/'.$vId.'"';
				}
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if($editForm->isValid($formData))
			{
				$array = $mtncs->dataValidator($formData,$mtnId,$vId,1);
				$trigger = $array['trigger'];
				$errorMsg = $array['errorMsg'];
				if($trigger == 0)
				{
					$mtnc = new Vehicle_Models_Mtnc();
					$mtnc->setMtnId($mtnId);
					$mtnc->setVeId($vId);
					$mtnc->setRDate($editForm->getValue('rDate'));
					$mtnc->setDetail($editForm->getValue('detail'));
					$mtnc->setContactId($editForm->getValue('contactId'));
					$mtnc->setMile($editForm->getValue('mile'));
					$mtnc->setAmount($editForm->getValue('amount'));
					$mtnc->setRemark($editForm->getValue('remark'));
					$mtncs->save($mtnc);
					$veId = new Vehicle_Models_VehicleMapper();
					$plateNo = $veId->findPlateNo($mtnc->getVeId());
					$this->_helper->flashMessenger->addMessage($plateNo.'修改成功。');
					$this->_redirect($link);
					}
					else
					{
						$editForm->populate($formData);
						$veId->setValue($vId);
						}
				}
				else
				{
					$editForm->populate($formData);
					$veId->setValue($vId);
					}
			}
			else
			{
				if($mtnId > 0)
				{
					$arrayMtnc = $mtncs->findArrayMtnc($mtnId);
					$editForm->populate($arrayMtnc);
					}
					else
					{
						$this->_redirect($link);
						}
				}
		$this->view->errorMsg = $errorMsg;
		$this->view->editForm = $editForm;
		$this->view->id = $mtnId;
		$this->view->blink = $link;
	}
예제 #3
0
	public function editAction()
	{
		$editForm = new Vehicle_Forms_RepairSave();
		$editForm->submit->setLabel('保存修改');
		$editForm->submit2->setAttrib('class','hide');
		$veId = $editForm->getElement('veId');
		$veId->setAttrib('disabled','disabled');

		$repId = $this->_getParam('id',0);
		$from = $this->_getParam('from',0);
		
		$repairs = new Vehicle_Models_RepairMapper();
		$repairs->populateVeDd($editForm);
		$vId = $repairs->findVeId($repId);
		
		$editForm = $repairs->formValidator($editForm,1);
		
		$errorMsg = null;
		$link = null;
		if($from == 0)
		{
			$link = "/vehicle/repair";
			}
			elseif($from == 1)
			{
				$link = '"/vehicle/index/display/id/'.$vId.'"';
				}
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if($editForm->isValid($formData))
			{
				$array = $repairs->dataValidator($formData,1);
				$trigger = $array['trigger'];
				$errorMsg = $array['errorMsg'];
				if($trigger == 0)
				{
					$repair = new Vehicle_Models_Repair();
					$repair->setRepId($repId);
					$repair->setVeId($vId);
					$repair->setRDate($editForm->getValue('rDate'));
					$repair->setReason($editForm->getValue('reason'));
					$repair->setDetail($editForm->getValue('detail'));
					$repair->setContactId($editForm->getValue('contactId'));
					$repair->setSpot($editForm->getValue('spot'));
					$repair->setDescr($editForm->getValue('descr'));
					$repair->setAmount($editForm->getValue('amount'));
					$repair->setInsFlag($editForm->getValue('insFlag'));
					if($editForm->getValue('insFlag') == '1')
					{
						$repair->setIndem($editForm->getValue('indem'));
						}
						else
						{
							$repair->setIndem('');
							}
					$repair->setIndem($editForm->getValue('indem'));
					$repair->setRemark($editForm->getValue('remark'));
					$repairs->save($repair);
					$veId = new Vehicle_Models_VehicleMapper();
					$plateNo = $veId->findPlateNo($repair->getVeId());
					$this->_helper->flashMessenger->addMessage($plateNo.'修改成功。');
					$this->_redirect($link);
					}
					else
					{
						$editForm->populate($formData);
						$veId->setValue($vId);
						}
				}
				else
				{
					$editForm->populate($formData);
					$veId->setValue($vId);
					}
			}
			else
			{
				if($repId > 0)
				{
					$arrayRepair = $repairs->findArrayRepair($repId);
					$editForm->populate($arrayRepair);
					}
					else
					{
						$this->_redirect($link);
						}
				}
		$this->view->errorMsg = $errorMsg;
		$this->view->editForm = $editForm;
		$this->view->id = $repId;
		$this->view->blink = $link;
	}