Merge pull request #6259 from systopia/CRM-16871
[civicrm-core.git] / CRM / Batch / Form / Batch.php
index f9e8dc6070d49e06af433a881706aab397cf5718..5f10247b974dd4646f56bfbd41144cb70fdde420 100755 (executable)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  */
 
 /**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
- */
-
-/**
- * This class generates form components for batch entry
- *
+ * This class generates form components for batch entry.
  */
 class CRM_Batch_Form_Batch extends CRM_Admin_Form {
 
+  /**
+   * PreProcess function.
+   */
   public function preProcess() {
     parent::preProcess();
-    // set the usercontext
+    // Set the user context.
     $session = CRM_Core_Session::singleton();
     $session->replaceUserContext(CRM_Utils_System::url('civicrm/batch', "reset=1"));
   }
 
   /**
-   * Build the form object
-   *
-   * @return void
-   * @access public
+   * Build the form object.
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -78,16 +69,12 @@ class CRM_Batch_Form_Batch extends CRM_Admin_Form {
 
   /**
    * Set default values for the form.
-   *
-   * @access public
-   *
-   * @return void
    */
-  function setDefaultValues() {
+  public function setDefaultValues() {
     $defaults = array();
 
     if ($this->_action & CRM_Core_Action::ADD) {
-      // set batch name default
+      // Set batch name default.
       $defaults['title'] = CRM_Batch_BAO_Batch::generateBatchName();
     }
     else {
@@ -97,11 +84,7 @@ class CRM_Batch_Form_Batch extends CRM_Admin_Form {
   }
 
   /**
-   * Process the form submission
-   *
-   * @access public
-   *
-   * @return void
+   * Process the form submission.
    */
   public function postProcess() {
     $params = $this->controller->exportValues($this->_name);
@@ -117,21 +100,21 @@ class CRM_Batch_Form_Batch extends CRM_Admin_Form {
     else {
       $session = CRM_Core_Session::singleton();
       $params['created_id'] = $session->get('userID');
-      $params['created_date'] = CRM_Utils_Date::processDate( date( "Y-m-d" ), date( "H:i:s" ) );
+      $params['created_date'] = CRM_Utils_Date::processDate(date("Y-m-d"), date("H:i:s"));
     }
 
     // always create with data entry status
-    $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status','Data Entry', 'name');
+    $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     $batch = CRM_Batch_BAO_Batch::create($params);
 
     // redirect to batch entry page.
     $session = CRM_Core_Session::singleton();
-    if ( $this->_action & CRM_Core_Action::ADD ) {
+    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"));
     }
   }
-}
 
+}