Skip to content

Commit

Permalink
Merge pull request #9379 from colemanw/CRM-17335
Browse files Browse the repository at this point in the history
CRM-17335 - Remove unnecessary use of CRM_Core_DAO::$_nullObject
  • Loading branch information
colemanw authored Nov 13, 2016
2 parents 6217835 + 1273d77 commit 614fc6a
Show file tree
Hide file tree
Showing 69 changed files with 187 additions and 270 deletions.
16 changes: 5 additions & 11 deletions CRM/Activity/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function preProcess() {

// we allow the controller to set force/reset externally, useful when we are being
// driven by the wizard framework
$this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
$this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
$this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
Expand Down Expand Up @@ -281,7 +281,7 @@ public function fixFormValues() {
$this->_defaults['activity_status_id'] = $status;
}

$survey = CRM_Utils_Request::retrieve('survey', 'Positive', CRM_Core_DAO::$_nullObject);
$survey = CRM_Utils_Request::retrieve('survey', 'Positive');

if ($survey) {
$this->_formValues['activity_survey_id'] = $this->_defaults['activity_survey_id'] = $survey;
Expand Down Expand Up @@ -314,9 +314,7 @@ public function fixFormValues() {

// Added for membership search

$signupType = CRM_Utils_Request::retrieve('signupType', 'Positive',
CRM_Core_DAO::$_nullObject
);
$signupType = CRM_Utils_Request::retrieve('signupType', 'Positive');

if ($signupType) {
$this->_formValues['activity_role'] = 1;
Expand All @@ -342,9 +340,7 @@ public function fixFormValues() {
}
}

$dateLow = CRM_Utils_Request::retrieve('dateLow', 'String',
CRM_Core_DAO::$_nullObject
);
$dateLow = CRM_Utils_Request::retrieve('dateLow', 'String');

if ($dateLow) {
$dateLow = date('m/d/Y', strtotime($dateLow));
Expand All @@ -354,9 +350,7 @@ public function fixFormValues() {
$this->_defaults['activity_date_low'] = $dateLow;
}

$dateHigh = CRM_Utils_Request::retrieve('dateHigh', 'String',
CRM_Core_DAO::$_nullObject
);
$dateHigh = CRM_Utils_Request::retrieve('dateHigh', 'String');

if ($dateHigh) {
// Activity date time assumes midnight at the beginning of the date
Expand Down
2 changes: 1 addition & 1 deletion CRM/Batch/Form/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ private function processContribution(&$params) {
}
$value['line_item'] = $lineItem;
//finally call contribution create for all the magic
$contribution = CRM_Contribute_BAO_Contribution::create($value, CRM_Core_DAO::$_nullArray);
$contribution = CRM_Contribute_BAO_Contribution::create($value);
$batchTypes = CRM_Core_Pseudoconstant::get('CRM_Batch_DAO_Batch', 'type_id', array('flip' => 1), 'validate');
if (!empty($this->_batchInfo['type_id']) && ($this->_batchInfo['type_id'] == $batchTypes['Pledge Payment'])) {
$adjustTotalAmount = FALSE;
Expand Down
6 changes: 3 additions & 3 deletions CRM/Campaign/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function preProcess() {
$this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
$this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
$this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');

//operation for state machine.
$this->_operation = CRM_Utils_Request::retrieve('op', 'String', $this, FALSE, 'reserve');
Expand Down Expand Up @@ -393,14 +393,14 @@ public function fixFormValues() {
// note that this means that GET over-rides POST :)

//since we have qfKey, no need to manipulate set defaults.
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', CRM_Core_DAO::$_nullObject);
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String');

if (!$this->_force || CRM_Utils_Rule::qfKey($qfKey)) {
return;
}

// get survey id
$surveyId = CRM_Utils_Request::retrieve('sid', 'Positive', CRM_Core_DAO::$_nullObject);
$surveyId = CRM_Utils_Request::retrieve('sid', 'Positive');

if ($surveyId) {
$surveyId = CRM_Utils_Type::escape($surveyId, 'Integer');
Expand Down
12 changes: 6 additions & 6 deletions CRM/Campaign/Page/Petition/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class CRM_Campaign_Page_Petition_Confirm extends CRM_Core_Page {
public function run() {
CRM_Utils_System::addHTMLHead('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">');

$contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer', CRM_Core_DAO::$_nullObject);
$hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
$activity_id = CRM_Utils_Request::retrieve('a', 'String', CRM_Core_DAO::$_nullObject);
$petition_id = CRM_Utils_Request::retrieve('pid', 'String', CRM_Core_DAO::$_nullObject);
$contact_id = CRM_Utils_Request::retrieve('cid', 'Integer');
$subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer');
$hash = CRM_Utils_Request::retrieve('h', 'String');
$activity_id = CRM_Utils_Request::retrieve('a', 'String');
$petition_id = CRM_Utils_Request::retrieve('pid', 'String');
if (!$petition_id) {
$petition_id = CRM_Utils_Request::retrieve('p', 'String', CRM_Core_DAO::$_nullObject);
$petition_id = CRM_Utils_Request::retrieve('p', 'String');
}

if (!$contact_id ||
Expand Down
2 changes: 1 addition & 1 deletion CRM/Campaign/Selector/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
*/
public function buildPrevNextCache($sort) {
//for prev/next pagination
$crmPID = CRM_Utils_Request::retrieve('crmPID', 'Integer', CRM_Core_DAO::$_nullObject);
$crmPID = CRM_Utils_Request::retrieve('crmPID', 'Integer');

if (!$crmPID) {
$cacheKey = "civicrm search {$this->_key}";
Expand Down
4 changes: 2 additions & 2 deletions CRM/Case/Form/ActivityToCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ class CRM_Case_Form_ActivityToCase extends CRM_Core_Form {
* Build all the data structures needed to build the form.
*/
public function preProcess() {
$this->_activityId = CRM_Utils_Request::retrieve('activityId', 'Positive', CRM_Core_DAO::$_nullObject);
$this->_activityId = CRM_Utils_Request::retrieve('activityId', 'Positive');
if (!$this->_activityId) {
CRM_Core_Error::fatal('required activity id is missing.');
}

$this->_currentCaseId = CRM_Utils_Request::retrieve('caseId', 'Positive', CRM_Core_DAO::$_nullObject);
$this->_currentCaseId = CRM_Utils_Request::retrieve('caseId', 'Positive');
$this->assign('currentCaseId', $this->_currentCaseId);
$this->assign('buildCaseActivityForm', TRUE);
}
Expand Down
4 changes: 2 additions & 2 deletions CRM/Case/Form/ActivityView.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class CRM_Case_Form_ActivityView extends CRM_Core_Form {
public function preProcess() {
$contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $this, TRUE);
$activityID = CRM_Utils_Request::retrieve('aid', 'Integer', $this, TRUE);
$revs = CRM_Utils_Request::retrieve('revs', 'Boolean', CRM_Core_DAO::$_nullObject);
$caseID = CRM_Utils_Request::retrieve('caseID', 'Boolean', CRM_Core_DAO::$_nullObject);
$revs = CRM_Utils_Request::retrieve('revs', 'Boolean');
$caseID = CRM_Utils_Request::retrieve('caseID', 'Boolean');
$activitySubject = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity',
$activityID,
'subject'
Expand Down
6 changes: 3 additions & 3 deletions CRM/Case/Form/CaseView.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function preProcess() {
if ($this->_showRelatedCases) {
$relatedCases = $this->get('relatedCases');
if (!isset($relatedCases)) {
$cId = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$caseId = CRM_Utils_Request::retrieve('id', 'Integer', CRM_Core_DAO::$_nullObject);
$cId = CRM_Utils_Request::retrieve('cid', 'Integer');
$caseId = CRM_Utils_Request::retrieve('id', 'Integer');
$relatedCases = CRM_Case_BAO_Case::getRelatedCases($caseId, $cId);
}
$this->assign('relatedCases', $relatedCases);
Expand All @@ -77,7 +77,7 @@ public function preProcess() {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}

$fulltext = CRM_Utils_Request::retrieve('context', 'String', CRM_Core_DAO::$_nullObject);
$fulltext = CRM_Utils_Request::retrieve('context', 'String');
if ($fulltext == 'fulltext') {
$this->assign('fulltext', $fulltext);
}
Expand Down
22 changes: 6 additions & 16 deletions CRM/Case/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function preProcess() {
* driven by the wizard framework
*/

$this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject);
$this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
$this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search');
Expand Down Expand Up @@ -356,33 +356,25 @@ public function fixFormValues() {
return;
}

$caseStatus = CRM_Utils_Request::retrieve('status', 'Positive',
CRM_Core_DAO::$_nullObject
);
$caseStatus = CRM_Utils_Request::retrieve('status', 'Positive');
if ($caseStatus) {
$this->_formValues['case_status_id'] = $caseStatus;
$this->_defaults['case_status_id'] = $caseStatus;
}
$caseType = CRM_Utils_Request::retrieve('type', 'Positive',
CRM_Core_DAO::$_nullObject
);
$caseType = CRM_Utils_Request::retrieve('type', 'Positive');
if ($caseType) {
$this->_formValues['case_type_id'] = (array) $caseType;
$this->_defaults['case_type_id'] = (array) $caseType;
}

$caseFromDate = CRM_Utils_Request::retrieve('pstart', 'Date',
CRM_Core_DAO::$_nullObject
);
$caseFromDate = CRM_Utils_Request::retrieve('pstart', 'Date');
if ($caseFromDate) {
list($date) = CRM_Utils_Date::setDateDefaults($caseFromDate);
$this->_formValues['case_start_date_low'] = $date;
$this->_defaults['case_start_date_low'] = $date;
}

$caseToDate = CRM_Utils_Request::retrieve('pend', 'Date',
CRM_Core_DAO::$_nullObject
);
$caseToDate = CRM_Utils_Request::retrieve('pend', 'Date');
if ($caseToDate) {
list($date) = CRM_Utils_Date::setDateDefaults($caseToDate);
$this->_formValues['case_start_date_high'] = $date;
Expand Down Expand Up @@ -415,9 +407,7 @@ public function fixFormValues() {
}

// Now if case_owner is set in the url/post, use that instead.
$caseOwner = CRM_Utils_Request::retrieve('case_owner', 'Positive',
CRM_Core_DAO::$_nullObject
);
$caseOwner = CRM_Utils_Request::retrieve('case_owner', 'Positive');
if ($caseOwner) {
$this->_formValues['case_owner'] = $caseOwner;
$this->_defaults['case_owner'] = $caseOwner;
Expand Down
10 changes: 5 additions & 5 deletions CRM/Case/XMLProcessor/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -811,11 +811,11 @@ public static function getCaseReport($clientID, $caseID, $activitySetName, $para
}

public static function printCaseReport() {
$caseID = CRM_Utils_Request::retrieve('caseID', 'Positive', CRM_Core_DAO::$_nullObject);
$clientID = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject);
$activitySetName = CRM_Utils_Request::retrieve('asn', 'String', CRM_Core_DAO::$_nullObject);
$isRedact = CRM_Utils_Request::retrieve('redact', 'Boolean', CRM_Core_DAO::$_nullObject);
$includeActivities = CRM_Utils_Request::retrieve('all', 'Positive', CRM_Core_DAO::$_nullObject);
$caseID = CRM_Utils_Request::retrieve('caseID', 'Positive');
$clientID = CRM_Utils_Request::retrieve('cid', 'Positive');
$activitySetName = CRM_Utils_Request::retrieve('asn', 'String');
$isRedact = CRM_Utils_Request::retrieve('redact', 'Boolean');
$includeActivities = CRM_Utils_Request::retrieve('all', 'Positive');
$params = $otherRelationships = $globalGroupInfo = array();
$report = new CRM_Case_XMLProcessor_Report($isRedact);
if ($includeActivities) {
Expand Down
12 changes: 6 additions & 6 deletions CRM/Contact/BAO/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -2330,10 +2330,10 @@ public static function formatProfileContactParams(
* @param string $ctype
* Contact type.
*
* @return object
* @return object|null
* $dao contact details
*/
public static function &matchContactOnEmail($mail, $ctype = NULL) {
public static function matchContactOnEmail($mail, $ctype = NULL) {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$mail = $strtolower(trim($mail));
$query = "
Expand Down Expand Up @@ -2370,7 +2370,7 @@ public static function &matchContactOnEmail($mail, $ctype = NULL) {
if ($dao->fetch()) {
return $dao;
}
return CRM_Core_DAO::$_nullObject;
return NULL;
}

/**
Expand All @@ -2381,10 +2381,10 @@ public static function &matchContactOnEmail($mail, $ctype = NULL) {
* @param string $ctype
* Contact type.
*
* @return object
* @return object|null
* $dao contact details
*/
public static function &matchContactOnOpenId($openId, $ctype = NULL) {
public static function matchContactOnOpenId($openId, $ctype = NULL) {
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$openId = $strtolower(trim($openId));
$query = "
Expand All @@ -2409,7 +2409,7 @@ public static function &matchContactOnOpenId($openId, $ctype = NULL) {
if ($dao->fetch()) {
return $dao;
}
return CRM_Core_DAO::$_nullObject;
return NULL;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ public static function getGroupList(&$params) {
ON contact.id = gOrg.organization_id ";

//get the Organization ID
$orgID = CRM_Utils_Request::retrieve('oid', 'Positive', CRM_Core_DAO::$_nullObject);
$orgID = CRM_Utils_Request::retrieve('oid', 'Positive');
if ($orgID) {
$where = " AND gOrg.organization_id = {$orgID}";
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public function preProcess() {
$this->assign('paramSubType', $paramSubType);
}

if (CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject)) {
if (CRM_Utils_Request::retrieve('type', 'String')) {
CRM_Contact_Form_Edit_CustomData::preProcess($this);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Edit/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharin
* @return array|bool
* if no errors
*/
public static function formRule($fields, $files, $self) {
public static function formRule($fields, $files = array(), $self = NULL) {
$errors = array();

$customDataRequiredFields = array();
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contact/Form/Edit/CustomData.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class CRM_Contact_Form_Edit_CustomData {
* @param CRM_Core_Form $form
*/
public static function preProcess(&$form) {
$form->_type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
$form->_subType = CRM_Utils_Request::retrieve('subType', 'String', CRM_Core_DAO::$_nullObject);
$form->_type = CRM_Utils_Request::retrieve('type', 'String');
$form->_subType = CRM_Utils_Request::retrieve('subType', 'String');

//build the custom data as other blocks.
//$form->assign( "addBlock", false );
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contact/Form/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class CRM_Contact_Form_Location {
* @param CRM_Core_Form $form
*/
public static function preProcess(&$form) {
$form->_addBlockName = CRM_Utils_Request::retrieve('block', 'String', CRM_Core_DAO::$_nullObject);
$additionalblockCount = CRM_Utils_Request::retrieve('count', 'Positive', CRM_Core_DAO::$_nullObject);
$form->_addBlockName = CRM_Utils_Request::retrieve('block', 'String');
$additionalblockCount = CRM_Utils_Request::retrieve('count', 'Positive');

$form->assign('addBlock', FALSE);
if ($form->_addBlockName && $additionalblockCount) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ public function postProcess() {
$this->_done = TRUE;

//for prev/next pagination
$crmPID = CRM_Utils_Request::retrieve('crmPID', 'Integer', CRM_Core_DAO::$_nullObject);
$crmPID = CRM_Utils_Request::retrieve('crmPID', 'Integer');

if (array_key_exists($this->_searchButtonName, $_POST) ||
($this->_force && !$crmPID)
Expand Down
4 changes: 1 addition & 3 deletions CRM/Contact/Form/Search/Custom/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ public function __construct(&$formValues) {
parent::__construct($formValues);

if (!isset($formValues['state_province_id'])) {
$this->_stateID = CRM_Utils_Request::retrieve('stateID', 'Integer',
CRM_Core_DAO::$_nullObject
);
$this->_stateID = CRM_Utils_Request::retrieve('stateID', 'Integer');
if ($this->_stateID) {
$formValues['state_province_id'] = $this->_stateID;
}
Expand Down
Loading

0 comments on commit 614fc6a

Please sign in to comment.