From 1be22cfbc272b1d41c0f68b42a953c2baebbfe52 Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Mon, 25 May 2020 12:51:22 +0100 Subject: [PATCH] Clean up calls to CRM_Utils_Request::retrieve --- CRM/Activity/Form/ActivityLinks.php | 2 +- CRM/Contact/Form/Inline.php | 2 +- CRM/Contact/Form/Inline/Address.php | 6 +++--- CRM/Contact/Form/Inline/CustomData.php | 6 +++--- CRM/Contact/Page/Inline/Actions.php | 2 +- CRM/Contact/Page/Inline/Address.php | 6 +++--- CRM/Contact/Page/Inline/ContactInfo.php | 2 +- CRM/Contact/Page/Inline/ContactName.php | 2 +- CRM/Contact/Page/Inline/CustomData.php | 8 ++++---- CRM/Contact/Page/Inline/Demographics.php | 2 +- CRM/Contact/Page/Inline/Email.php | 2 +- CRM/Contact/Page/Inline/IM.php | 2 +- CRM/Mailing/Page/Common.php | 8 ++------ CRM/Utils/PagerAToZ.php | 4 +--- 14 files changed, 24 insertions(+), 30 deletions(-) diff --git a/CRM/Activity/Form/ActivityLinks.php b/CRM/Activity/Form/ActivityLinks.php index 024ed70da5..bc7ff22f08 100644 --- a/CRM/Activity/Form/ActivityLinks.php +++ b/CRM/Activity/Form/ActivityLinks.php @@ -30,7 +30,7 @@ class CRM_Activity_Form_ActivityLinks extends CRM_Core_Form { public static function commonBuildQuickForm($self) { $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $self); if (!$contactId) { - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive'); } $urlParams = "action=add&reset=1&cid={$contactId}&selectedChild=activity&atype="; diff --git a/CRM/Contact/Form/Inline.php b/CRM/Contact/Form/Inline.php index fcc034a7c9..2f551a1cea 100644 --- a/CRM/Contact/Form/Inline.php +++ b/CRM/Contact/Form/Inline.php @@ -56,7 +56,7 @@ abstract class CRM_Contact_Form_Inline extends CRM_Core_Form { * Common preprocess: fetch contact ID and contact type */ public function preProcess() { - $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE, NULL, $_REQUEST); + $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->assign('contactId', $this->_contactId); // get contact type and subtype diff --git a/CRM/Contact/Form/Inline/Address.php b/CRM/Contact/Form/Inline/Address.php index 4db79aee78..e33118c913 100644 --- a/CRM/Contact/Form/Inline/Address.php +++ b/CRM/Contact/Form/Inline/Address.php @@ -58,7 +58,7 @@ class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline { * hence calling parent constructor */ public function __construct() { - $locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $name = "Address_{$locBlockNo}"; parent::__construct(NULL, CRM_Core_Action::NONE, 'post', $name); @@ -70,14 +70,14 @@ class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline { public function preProcess() { parent::preProcess(); - $this->_locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', $this, TRUE, NULL, $_REQUEST); + $this->_locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', $this, TRUE); $this->assign('blockId', $this->_locBlockNo); $addressSequence = CRM_Core_BAO_Address::addressSequence(); $this->assign('addressSequence', $addressSequence); $this->_values = []; - $this->_addressId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, NULL, $_REQUEST); + $this->_addressId = CRM_Utils_Request::retrieve('aid', 'Positive', $this); $this->_action = CRM_Core_Action::ADD; if ($this->_addressId) { diff --git a/CRM/Contact/Form/Inline/CustomData.php b/CRM/Contact/Form/Inline/CustomData.php index 1d30895c36..d8e92f86bb 100644 --- a/CRM/Contact/Form/Inline/CustomData.php +++ b/CRM/Contact/Form/Inline/CustomData.php @@ -40,10 +40,10 @@ class CRM_Contact_Form_Inline_CustomData extends CRM_Contact_Form_Inline { public function preProcess() { parent::preProcess(); - $this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE, NULL, $_REQUEST); + $this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE, NULL); $this->assign('customGroupId', $this->_groupID); - $customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', $this, FALSE, 1, $_REQUEST); - $cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', $this, FALSE, 1, $_REQUEST); + $customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', $this, FALSE, 1); + $cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', $this, FALSE, 1); $subType = CRM_Contact_BAO_Contact::getContactSubType($this->_contactId, ','); CRM_Custom_Form_CustomData::preProcess($this, NULL, $subType, $cgcount, $this->_contactType, $this->_contactId); diff --git a/CRM/Contact/Page/Inline/Actions.php b/CRM/Contact/Page/Inline/Actions.php index 136e8e71ed..ef91f017d8 100644 --- a/CRM/Contact/Page/Inline/Actions.php +++ b/CRM/Contact/Page/Inline/Actions.php @@ -26,7 +26,7 @@ class CRM_Contact_Page_Inline_Actions extends CRM_Core_Page { * This method is called after the page is created. */ public function run() { - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $this->assign('contactId', $contactId); $this->assign('actionsMenuList', CRM_Contact_BAO_Contact::contextMenu($contactId)); diff --git a/CRM/Contact/Page/Inline/Address.php b/CRM/Contact/Page/Inline/Address.php index 99ee03591c..ce179303e0 100644 --- a/CRM/Contact/Page/Inline/Address.php +++ b/CRM/Contact/Page/Inline/Address.php @@ -27,9 +27,9 @@ class CRM_Contact_Page_Inline_Address extends CRM_Core_Page { */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); - $locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); - $addressId = CRM_Utils_Request::retrieve('aid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); + $locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); + $addressId = CRM_Utils_Request::retrieve('aid', 'Positive'); $address = []; if ($addressId > 0) { diff --git a/CRM/Contact/Page/Inline/ContactInfo.php b/CRM/Contact/Page/Inline/ContactInfo.php index 9243a5fde9..9dad262779 100644 --- a/CRM/Contact/Page/Inline/ContactInfo.php +++ b/CRM/Contact/Page/Inline/ContactInfo.php @@ -27,7 +27,7 @@ class CRM_Contact_Page_Inline_ContactInfo extends CRM_Core_Page { */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $params = ['id' => $contactId]; diff --git a/CRM/Contact/Page/Inline/ContactName.php b/CRM/Contact/Page/Inline/ContactName.php index 4e7e7a960c..aef76c6834 100644 --- a/CRM/Contact/Page/Inline/ContactName.php +++ b/CRM/Contact/Page/Inline/ContactName.php @@ -27,7 +27,7 @@ class CRM_Contact_Page_Inline_ContactName extends CRM_Core_Page { */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $isDeleted = (bool) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'is_deleted'); diff --git a/CRM/Contact/Page/Inline/CustomData.php b/CRM/Contact/Page/Inline/CustomData.php index a2ffabdfd7..8dd50fd786 100644 --- a/CRM/Contact/Page/Inline/CustomData.php +++ b/CRM/Contact/Page/Inline/CustomData.php @@ -27,10 +27,10 @@ class CRM_Contact_Page_Inline_CustomData extends CRM_Core_Page { */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); - $cgId = CRM_Utils_Request::retrieve('groupID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); - $customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST); - $cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); + $cgId = CRM_Utils_Request::retrieve('groupID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); + $customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1); + $cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1); //custom groups Inline $entityType = CRM_Contact_BAO_Contact::getContactType($contactId); diff --git a/CRM/Contact/Page/Inline/Demographics.php b/CRM/Contact/Page/Inline/Demographics.php index b211df4dcf..e3a714872f 100644 --- a/CRM/Contact/Page/Inline/Demographics.php +++ b/CRM/Contact/Page/Inline/Demographics.php @@ -27,7 +27,7 @@ class CRM_Contact_Page_Inline_Demographics extends CRM_Core_Page { */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $params = ['id' => $contactId]; diff --git a/CRM/Contact/Page/Inline/Email.php b/CRM/Contact/Page/Inline/Email.php index 8b4fed55d7..7ca97943c1 100644 --- a/CRM/Contact/Page/Inline/Email.php +++ b/CRM/Contact/Page/Inline/Email.php @@ -27,7 +27,7 @@ class CRM_Contact_Page_Inline_Email extends CRM_Core_Page { */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', ['labelColumn' => 'display_name']); diff --git a/CRM/Contact/Page/Inline/IM.php b/CRM/Contact/Page/Inline/IM.php index 8882d5ba6d..e20782a326 100644 --- a/CRM/Contact/Page/Inline/IM.php +++ b/CRM/Contact/Page/Inline/IM.php @@ -27,7 +27,7 @@ class CRM_Contact_Page_Inline_IM extends CRM_Core_Page { */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', ['labelColumn' => 'display_name']); $IMProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id'); diff --git a/CRM/Mailing/Page/Common.php b/CRM/Mailing/Page/Common.php index 5a39c63f3c..4bae016690 100644 --- a/CRM/Mailing/Page/Common.php +++ b/CRM/Mailing/Page/Common.php @@ -43,17 +43,13 @@ class CRM_Mailing_Page_Common extends CRM_Core_Page { throw new CRM_Core_Exception(ts("There was an error in your request")); } - $cancel = CRM_Utils_Request::retrieve("_qf_{$this->_type}_cancel", 'String', CRM_Core_DAO::$_nullObject, - FALSE, NULL, $_REQUEST - ); + $cancel = CRM_Utils_Request::retrieve("_qf_{$this->_type}_cancel", 'String'); if ($cancel) { $config = CRM_Core_Config::singleton(); CRM_Utils_System::redirect($config->userFrameworkBaseURL); } - $confirm = CRM_Utils_Request::retrieve('confirm', 'Boolean', CRM_Core_DAO::$_nullObject, - FALSE, NULL, $_REQUEST - ); + $confirm = CRM_Utils_Request::retrieve('confirm', 'Boolean'); list($displayName, $email) = CRM_Mailing_Event_BAO_Queue::getContactInfo($queue_id); $this->assign('display_name', $displayName); diff --git a/CRM/Utils/PagerAToZ.php b/CRM/Utils/PagerAToZ.php index c9e15a636a..eeed2e961a 100644 --- a/CRM/Utils/PagerAToZ.php +++ b/CRM/Utils/PagerAToZ.php @@ -135,9 +135,7 @@ class CRM_Utils_PagerAToZ { $qfKey = $query->_formValues['qfKey'] ?? NULL; } if (empty($qfKey)) { - // CRM-20943 Can only pass variables by reference and also cannot use $this so using $empty setting to NULL which is default. - $emptyVariable = NULL; - $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $emptyVariable, FALSE, NULL, $_REQUEST); + $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String'); } $aToZBar = []; -- 2.25.1