public function executeVisitAdd(sfWebRequest $request) { if ($request->isMethod('POST')) { $visit = new Visit(); $visit->setPatientId($this->getRequestParameter('patient_id')); if ($this->getRequestParameter('doctor_id')) { $visit->setDoctorId($this->getRequestParameter('doctor_id')); } if ($this->getRequestParameter('ward_doc_id')) { $visit->setWardDocId($this->getRequestParameter('ward_doc_id')); } if ($this->getRequestParameter('ward_bed_id')) { $visit->setWardBedId($this->getRequestParameter('ward_bed_id')); } if ($this->getRequestParameter('room_id')) { $visit->setRoomId($this->getRequestParameter('room_id')); } if ($this->getRequestParameter('admit_date')) { $visit->setAdmitDate($this->getRequestParameter('admit_date')); } $visit->setVisitDate($this->getRequestParameter('visit_date')); $visit->setTime($this->getRequestParameter('time')); $visit->setVisitType($this->getRequestParameter('visit_type')); $visit->setStatus(Constant::VISIT_PENDING); $visit->save(); $this->getUser()->setFlash('SUCCESS_MESSAGE', 'Visit to Doctor added Successfully.'); $this->redirect('FrontDesk/visitList'); } else { $this->patient = PatientPeer::retrieveByPk(Utility::DecryptQueryString($request->getParameter('patient'))); } }