Merge branch 4.6 into master
[civicrm-core.git] / CRM / Activity / Form / Activity.php
index 14db8696de41780b640908555016d581a4332c86..1fe07df7cb32008c2e2513839f22bba1484893ac 100644 (file)
@@ -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.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -122,6 +122,13 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
 
   protected $unsavedWarn = TRUE;
 
+  /**
+   * Explicitly declare the entity api name.
+   */
+  public function getDefaultEntity() {
+    return 'Activity';
+  }
+
   /**
    * The _fields var can be used by sub class to set/unset/edit the
    * form fields based on their requirement
@@ -961,7 +968,6 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
       // set params for repeat configuration in create mode
       $params['entity_id'] = $activityId;
       $params['entity_table'] = 'civicrm_activity';
-      $scheduleReminderDetails = array();
       if (!empty($params['entity_id']) && !empty($params['entity_table'])) {
         $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor($params['entity_id'], $params['entity_table']);
         if ($checkParentExistsForThisId) {
@@ -978,6 +984,11 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
       }
       $params['dateColumns'] = array('activity_date_time');
 
+      // Set default repetition start if it was not provided.
+      if (empty($params['repetition_start_date'])) {
+        $params['repetition_start_date'] = $params['activity_date_time'];
+      }
+
       // unset activity id
       unset($params['id']);
       $linkedEntities = array(