Esempio n. 1
0
 /**
  * Add or edit Passenger illness delete
  * CODE: passenger_illness_delete
  */
 public function executeDeleteIllness(sfWebRequest $request)
 {
     if (!$this->getUser()->hasCredential(array('Administrator'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     if ($request->isMethod('post')) {
         try {
             $ill = PassengerIllnessCategoryPeer::retrieveByPK($request->getParameter('id'));
             $this->forward404Unless($ill);
             $ill->delete();
             $this->getUser()->setFlash('success', 'Passenger Illness Category information has been successfully deleted!');
         } catch (Exception $e) {
             $this->getUser()->setFlash('warning', "There are related persons to this Passenger Illness Category. Please remove them first.");
         }
     }
     return $this->redirect('@pill');
 }