From aa288d3f1fdf14e84f65a4312b9e6bf4c2191ec5 Mon Sep 17 00:00:00 2001 From: eileenmcnaughton Date: Fri, 29 May 2015 00:36:07 +0000 Subject: [PATCH] CRM-16580 cast contactID to an int when it is zero as currently it is inconsistent --- CRM/Contribute/Form/Contribution/Main.php | 3 ++- CRM/Core/Form.php | 4 ++-- CRM/Event/Form/Registration/Register.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 5f633b3e92..646397bf03 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -459,9 +459,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } $contactID = $this->getContactID(); - if ($this->getContactID() === '0') { + if ($this->getContactID() === 0) { $this->addCidZeroOptions($onlinePaymentProcessorEnabled); } + //build pledge block. $this->_useForMember = 0; //don't build membership block when pledge_id is passed diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 46209e8653..6441a57502 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1598,13 +1598,13 @@ class CRM_Core_Form extends HTML_QuickForm_Page { // from that page // we don't really need to set it when $tempID is set because the params have that stored $this->set('cid', 0); - return $tempID; + return (int) $tempID; } $userID = $this->getLoggedInUserContactID(); if ($tempID == $userID) { - return $userID; + return (int) $userID; } //check if this is a checksum authentication diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index fab803166b..0adedbbbb4 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -430,7 +430,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $pps[$key] = $name['name']; } } - if ($this->getContactID() === '0' && !$this->_values['event']['is_multiple_registrations']) { + if ($this->getContactID() === 0 && !$this->_values['event']['is_multiple_registrations']) { //@todo we are blocking for multiple registrations because we haven't tested $this->addCidZeroOptions($onlinePaymentProcessorEnabled); } -- 2.25.1