From 884605ca7266165f85e0e388281cf8e4e42dda37 Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Tue, 12 Mar 2013 15:24:17 -0700 Subject: [PATCH] CRM-12101 --- CRM/Report/Form.php | 16 +++++++++------- CRM/Report/Utils/Report.php | 24 +++++++++++++++--------- CRM/Utils/Wrapper.php | 3 ++- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 5e1ff8f49b..2df7b4bd28 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1864,16 +1864,18 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND function processReportMode() { $buttonName = $this->controller->getButtonName(); - $output = CRM_Utils_Request::retrieve('output', - 'String', - CRM_Core_DAO::$_nullObject + $output = CRM_Utils_Request::retrieve( + 'output', + 'String', + CRM_Core_DAO::$_nullObject ); $this->_sendmail = - CRM_Utils_Request::retrieve('sendmail', - 'Boolean', - CRM_Core_DAO::$_nullObject - ); + CRM_Utils_Request::retrieve( + 'sendmail', + 'Boolean', + CRM_Core_DAO::$_nullObject + ); $this->_absoluteUrl = FALSE; $printOnly = FALSE; diff --git a/CRM/Report/Utils/Report.php b/CRM/Report/Utils/Report.php index 1a7d6214ca..1daef5c4d5 100644 --- a/CRM/Report/Utils/Report.php +++ b/CRM/Report/Utils/Report.php @@ -330,12 +330,12 @@ WHERE inst.report_id = %1"; } static function processReport($params) { - $instanceId = CRM_Utils_Array::value('instanceId', $params); // hack for now, CRM-8358 $_REQUEST['instanceId'] = $instanceId; $_REQUEST['sendmail'] = CRM_Utils_Array::value('sendmail', $params, 1); + // if cron is run from terminal --output is reserved, and therefore we would provide another name 'format' $_REQUEST['output'] = CRM_Utils_Array::value('format', $params, CRM_Utils_Array::value('output', $params, 'pdf')); $_REQUEST['reset'] = CRM_Utils_Array::value('reset', $params, 1); @@ -347,6 +347,11 @@ WHERE inst.report_id = %1"; $obj = new CRM_Report_Page_Instance(); $is_error = 0; if (strstr(CRM_Utils_Array::value('name', $templateInfo), '_Form')) { + // get the last element which is the form name and emulate a post submit via _qf_default + $formName = CRM_Utils_String::getClassName($templateInfo['name']); + if ($formName) { + $_REQUEST['_qf_default'] = "{$formName}:submit"; + } $instanceInfo = array(); CRM_Report_BAO_Instance::retrieve(array('id' => $instanceId), $instanceInfo); @@ -358,16 +363,17 @@ WHERE inst.report_id = %1"; } $wrapper = new CRM_Utils_Wrapper(); - $arguments['urlToSession'] = array( - array( - 'urlVar' => 'instanceId', - 'type' => 'Positive', - 'sessionVar' => 'instanceId', - 'default' => 'null', + $arguments = array( + 'urlToSession' => array( + array( + 'urlVar' => 'instanceId', + 'type' => 'Positive', + 'sessionVar' => 'instanceId', + 'default' => 'null', + ), ), + 'ignoreKey' => TRUE ); - $arguments['ignoreKey'] = TRUE; - $messages[] = $wrapper->run($templateInfo['name'], NULL, $arguments); } else { diff --git a/CRM/Utils/Wrapper.php b/CRM/Utils/Wrapper.php index 664f978b3e..30470da784 100644 --- a/CRM/Utils/Wrapper.php +++ b/CRM/Utils/Wrapper.php @@ -97,7 +97,8 @@ class CRM_Utils_Wrapper { $abort = CRM_Utils_Array::value('abort', $params, FALSE); $value = NULL; - $value = CRM_Utils_Request::retrieve($urlVar, + $value = CRM_Utils_Request::retrieve( + $urlVar, $type, $this->_controller, $abort, -- 2.25.1