From cec737d80ac484ff28c49c565243e15159f42481 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 22 Jan 2016 15:08:03 +1300 Subject: [PATCH] CRM-17837 don't show linkable fields as links if the base url is not passed in. On some reports it may not be appropriate to have linkable urls. This currently applies to the lybunt - as the link is going through to the contribute/detail report which doesn't take the same filters - although making it self-linking might make sense this seems like a logical change to the parent function Change-Id: I969c92755cb053181a53acb5d829d6d9a0554e06 p Change-Id: I267409dced4602b028baa9c3beeaf8be70a712c3 --- CRM/Report/Form.php | 61 ++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index cee6653953..9bf3f30445 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -4038,15 +4038,17 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a if (array_key_exists('civicrm_address_country_id', $row)) { if ($value = $row['civicrm_address_country_id']) { $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value, FALSE); - $url = CRM_Report_Utils_Report::getNextUrl($baseUrl, - "reset=1&force=1&{$criteriaQueryParams}&" . - "country_id_op=in&country_id_value={$value}", - $this->_absoluteUrl, $this->_id - ); - $rows[$rowNum]['civicrm_address_country_id_link'] = $url; - $rows[$rowNum]['civicrm_address_country_id_hover'] = ts("%1 for this country.", - array(1 => $linkText) - ); + if ($baseUrl) { + $url = CRM_Report_Utils_Report::getNextUrl($baseUrl, + "reset=1&force=1&{$criteriaQueryParams}&" . + "country_id_op=in&country_id_value={$value}", + $this->_absoluteUrl, $this->_id + ); + $rows[$rowNum]['civicrm_address_country_id_link'] = $url; + $rows[$rowNum]['civicrm_address_country_id_hover'] = ts("%1 for this country.", + array(1 => $linkText) + ); + } } $entryFound = TRUE; @@ -4054,15 +4056,17 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a if (array_key_exists('civicrm_address_county_id', $row)) { if ($value = $row['civicrm_address_county_id']) { $rows[$rowNum]['civicrm_address_county_id'] = CRM_Core_PseudoConstant::county($value, FALSE); - $url = CRM_Report_Utils_Report::getNextUrl($baseUrl, - "reset=1&force=1&{$criteriaQueryParams}&" . - "county_id_op=in&county_id_value={$value}", - $this->_absoluteUrl, $this->_id - ); - $rows[$rowNum]['civicrm_address_county_id_link'] = $url; - $rows[$rowNum]['civicrm_address_county_id_hover'] = ts("%1 for this county.", - array(1 => $linkText) - ); + if ($baseUrl) { + $url = CRM_Report_Utils_Report::getNextUrl($baseUrl, + "reset=1&force=1&{$criteriaQueryParams}&" . + "county_id_op=in&county_id_value={$value}", + $this->_absoluteUrl, $this->_id + ); + $rows[$rowNum]['civicrm_address_county_id_link'] = $url; + $rows[$rowNum]['civicrm_address_county_id_hover'] = ts("%1 for this county.", + array(1 => $linkText) + ); + } } $entryFound = TRUE; } @@ -4070,15 +4074,16 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a if (array_key_exists('civicrm_address_state_province_id', $row)) { if ($value = $row['civicrm_address_state_province_id']) { $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($value, FALSE); - - $url = CRM_Report_Utils_Report::getNextUrl($baseUrl, - "reset=1&force=1&{$criteriaQueryParams}&state_province_id_op=in&state_province_id_value={$value}", - $this->_absoluteUrl, $this->_id - ); - $rows[$rowNum]['civicrm_address_state_province_id_link'] = $url; - $rows[$rowNum]['civicrm_address_state_province_id_hover'] = ts("%1 for this state.", - array(1 => $linkText) - ); + if ($baseUrl) { + $url = CRM_Report_Utils_Report::getNextUrl($baseUrl, + "reset=1&force=1&{$criteriaQueryParams}&state_province_id_op=in&state_province_id_value={$value}", + $this->_absoluteUrl, $this->_id + ); + $rows[$rowNum]['civicrm_address_state_province_id_link'] = $url; + $rows[$rowNum]['civicrm_address_state_province_id_hover'] = ts("%1 for this state.", + array(1 => $linkText) + ); + } } $entryFound = TRUE; } @@ -4106,7 +4111,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a if (array_key_exists('civicrm_contact_' . $fieldName, $row)) { if (($value = $row['civicrm_contact_' . $fieldName]) != FALSE) { $rows[$rowNum]['civicrm_contact_' . $fieldName] = CRM_Core_Pseudoconstant::getLabel('CRM_Contact_BAO_Contact', $fieldName, $value); - if (($title = CRM_Utils_Array::value($fieldName, $addLinks)) != FALSE) { + if ($baseUrl && ($title = CRM_Utils_Array::value($fieldName, $addLinks)) != FALSE) { $this->addLinkToRow($rows[$rowNum], $baseUrl, $linkText, $value, $fieldName, 'civicrm_contact', $title); } } -- 2.25.1