CRM-12877, fixed save-a-copy bug
authorDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Tue, 25 Jun 2013 11:27:25 +0000 (16:57 +0530)
committerDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Tue, 25 Jun 2013 11:27:25 +0000 (16:57 +0530)
----------------------------------------
* CRM-12877: Provide api for creating report instances
  http://issues.civicrm.org/jira/browse/CRM-12877

CRM/Report/Form/Instance.php

index 4152f1ff57b4b6fa0e05d4b99c8b7764fb27c3e9..064da4726aa3be344ed391b206c07addf02d21b1 100644 (file)
@@ -245,8 +245,10 @@ class CRM_Report_Form_Instance {
     $instanceID = $form->getVar('_id');
 
     if ($isNew = $form->getVar('_createNew')) {
-      // unset $instanceID so a new copy would be created
-      $instanceID = NULL;
+      // set the report_id since base template is going to be same, and we going to unset $instanceID
+      // which will make it difficult later on, to compute report_id
+      $params['report_id'] = CRM_Report_Utils_Report::getValueFromUrl($instanceID);
+      $instanceID = NULL; //unset $instanceID so a new copy would be created
     }
     $params['instance_id'] = $instanceID;
     if (CRM_Utils_Array::value('is_navigation', $params)) {