From 8fbe389dfa389111ad8f3ed8a7e0467fbd396300 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Mon, 31 Jul 2017 16:20:09 +0530 Subject: [PATCH] CRM-20994 : Fix hardcoded relationship type value --- CRM/Report/Form/Contact/CurrentEmployer.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Report/Form/Contact/CurrentEmployer.php b/CRM/Report/Form/Contact/CurrentEmployer.php index 15458912e1..d0081f850b 100644 --- a/CRM/Report/Form/Contact/CurrentEmployer.php +++ b/CRM/Report/Form/Contact/CurrentEmployer.php @@ -237,6 +237,11 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form { } public function from() { + $relType = civicrm_api3('RelationshipType', 'getvalue', array( + 'return' => "id", + 'name_a_b' => "Employee of", + 'name_b_a' => "Employer of", + )); $this->_from = " FROM civicrm_contact {$this->_aliases['civicrm_contact']} @@ -247,7 +252,7 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} LEFT JOIN civicrm_relationship {$this->_aliases['civicrm_relationship']} ON ( {$this->_aliases['civicrm_relationship']}.contact_id_a={$this->_aliases['civicrm_contact']}.id AND {$this->_aliases['civicrm_relationship']}.contact_id_b={$this->_aliases['civicrm_contact']}.employer_id - AND {$this->_aliases['civicrm_relationship']}.relationship_type_id=4) + AND {$this->_aliases['civicrm_relationship']}.relationship_type_id={$relType}) LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']} ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND {$this->_aliases['civicrm_address']}.is_primary = 1 ) -- 2.25.1