Merge pull request #2619 from pratik-joshi/CRM-13965-qa-fixes
[civicrm-core.git] / CRM / Contribute / Form.php
index e4aba5da377cf319066dc8d2eacdc202ab810642..4cf363715a38d2ba1ebcdfe982325bc7f77028bc 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -64,7 +64,7 @@ class CRM_Contribute_Form extends CRM_Core_Form {
    *
    * @access public
    *
-   * @return None
+   * @return void
    */
   function setDefaultValues() {
     $defaults = array();
@@ -73,11 +73,11 @@ class CRM_Contribute_Form extends CRM_Core_Form {
     if (isset($this->_id)) {
       $params = array('id' => $this->_id);
       if (!empty( $this->_BAOName)) {
-        require_once (str_replace('_', DIRECTORY_SEPARATOR, $this->_BAOName) . ".php");
-        eval($this->_BAOName . '::retrieve( $params, $defaults );');
+        $baoName = $this->_BAOName;
+        $baoName::retrieve($params, $defaults);
       }
     }
-    if ($this->_action == CRM_Core_Action::DELETE && CRM_Utils_Array::value('name', $defaults)) {
+    if ($this->_action == CRM_Core_Action::DELETE && !empty($defaults['name'])) {
       $this->assign('delName', $defaults['name']);
     }
     elseif ($this->_action == CRM_Core_Action::ADD) {
@@ -88,8 +88,8 @@ class CRM_Contribute_Form extends CRM_Core_Form {
 
     }
     elseif ($this->_action & CRM_Core_Action::UPDATE) {
-      if (CRM_Utils_Array::value('contact_id', $defaults) || CRM_Utils_Array::value('created_id', $defaults)) {
-        $contactID = CRM_Utils_Array::value('created_id', $defaults) ? $defaults['created_id'] : $defaults['contact_id'];
+      if (!empty($defaults['contact_id']) || !empty($defaults['created_id'])) {
+        $contactID = !empty($defaults['created_id']) ? $defaults['created_id'] : $defaults['contact_id'];
         $this->assign('created_id', $contactID);
         $this->assign('organisationId', $contactID);
       }
@@ -97,14 +97,14 @@ class CRM_Contribute_Form extends CRM_Core_Form {
       if ($parentId = CRM_Utils_Array::value('parent_id', $defaults)) {
         $this->assign('parentId', $parentId);
       }
-    }   
+    }
     return $defaults;
   }
 
   /**
    * Function to actually build the form
    *
-   * @return None
+   * @return void
    * @access public
    */
   public function buildQuickForm() {