take care of empty entity-id or table, in parent methods
authordeepak-srivastava <deepak.srivastava.0303@gmail.com>
Wed, 15 Oct 2014 13:25:17 +0000 (14:25 +0100)
committerdeepak-srivastava <deepak.srivastava.0303@gmail.com>
Wed, 15 Oct 2014 13:25:17 +0000 (14:25 +0100)
CRM/Core/BAO/RecurringEntity.php

index db0fe1cf518b50cc03908b5fed83d5a56bdf1ae3..e244b06bcd160fb62bb7545231eaf3135ce442cf 100644 (file)
@@ -354,6 +354,9 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
    */
   static public function getEntitiesForParent($parentId, $entityTable, $includeParent = TRUE, $mode = 3, $initiatorId = NULL) {
     $entities = array();
+    if (empty($parentId) || empty($entityTable)) {
+      return $entities;
+    }
 
     if (!$initiatorId) {
       $initiatorId = $parentId;
@@ -435,6 +438,10 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
    * @return int unsigned $parentId Parent ID 
    */
   static public function getParentFor($entityId, $entityTable, $includeParent = TRUE) {
+    if (empty($entityId) || empty($entityTable)) {
+      return NULL;
+    }
+
     $query = "
       SELECT parent_id 
       FROM civicrm_recurring_entity