Exemplo n.º 1
0
 /**
  * Function to process the form
  *
  * @access public
  *
  * @return None
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Core_Session::setStatus("Batch has been deleted successfully.");
         CRM_Core_BAO_Batch::deleteBatch($this->_id);
         return;
     }
     if ($this->_id) {
         $params['id'] = $this->_id;
     } else {
         $session = CRM_Core_Session::singleton();
         $params['created_id'] = $session->get('userID');
         $params['created_date'] = CRM_Utils_Date::processDate(date("Y-m-d his"));
     }
     $batch = CRM_Core_BAO_Batch::create($params);
     // redirect to batch entry page.
     $session = CRM_Core_Session::singleton();
     if ($this->_action & CRM_Core_Action::ADD) {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/batch/entry', "id={$batch->id}&reset=1&action=add"));
     } else {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/batch/entry', "id={$batch->id}&reset=1"));
     }
 }