/** * Delete employee attachments * * @param int $empNumber Employee number * * @return boolean true if successfully deleted, false otherwise */ public function execute($request) { $this->form = new EmployeeAttachmentDeleteForm(array(), array(), true); $this->form->bind($request->getParameter($this->form->getName())); if ($this->form->isValid()) { $empId = $request->getParameter('EmpID', false); if (!$empId) { throw new PIMServiceException("No Employee ID given"); } if (!$this->IsActionAccessible($empId)) { $this->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); } $attachmentsToDelete = $request->getParameter('chkattdel', array()); if ($attachmentsToDelete) { $service = new EmployeeService(); $service->deleteAttachments($empId, $attachmentsToDelete); $this->getUser()->setFlash('attachmentMessage', array('success', __(TopLevelMessages::DELETE_SUCCESS))); } } $this->redirect($this->getRequest()->getReferer() . '#attachments'); }