X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FReport%2FForm%2FContact%2FCurrentEmployer.php;h=1b389e6e94ac9463b25b839209e1dbfccbc2e325;hb=9d72cede30c1a6986256fba4cac6b28ea963f543;hp=29f013c68606947e0248e13d5194e5458f07ac88;hpb=d638fee129abf7016758ece8f7914040df63f735;p=civicrm-core.git diff --git a/CRM/Report/Form/Contact/CurrentEmployer.php b/CRM/Report/Form/Contact/CurrentEmployer.php index 29f013c686..1b389e6e94 100644 --- a/CRM/Report/Form/Contact/CurrentEmployer.php +++ b/CRM/Report/Form/Contact/CurrentEmployer.php @@ -38,7 +38,9 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form { protected $_summary = NULL; protected $_customGroupExtends = array( - 'Contact', 'Individual'); + 'Contact', + 'Individual' + ); public $_drilldownReport = array('contact/detail' => 'Link to Detail Report'); @@ -51,154 +53,131 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form { function __construct() { $this->_columns = array( - 'civicrm_employer' => - array( + 'civicrm_employer' => array( 'dao' => 'CRM_Contact_DAO_Contact', - 'fields' => - array( - 'organization_name' => - array('title' => ts('Employer Name'), + 'fields' => array( + 'organization_name' => array( + 'title' => ts('Employer Name'), 'required' => TRUE, 'no_repeat' => TRUE, ), - 'id' => - array( + 'id' => array( 'no_display' => TRUE, 'required' => TRUE, ), ), - 'filters' => - array( - 'organization_name' => - array('title' => ts('Employer Name'), + 'filters' => array( + 'organization_name' => array( + 'title' => ts('Employer Name'), 'operatorType' => CRM_Report_Form::OP_STRING, ), ), ), - 'civicrm_contact' => - array( + 'civicrm_contact' => array( 'dao' => 'CRM_Contact_DAO_Contact', - 'fields' => - array( - 'sort_name' => - array('title' => ts('Employee Name'), + 'fields' => array( + 'sort_name' => array( + 'title' => ts('Employee Name'), 'required' => TRUE, ), - 'first_name' => array('title' => ts('First Name'), + 'first_name' => array( + 'title' => ts('First Name'), ), - 'last_name' => array('title' => ts('Last Name'), + 'last_name' => array( + 'title' => ts('Last Name'), ), - 'job_title' => - array('title' => ts('Job Title'), + 'job_title' => array( + 'title' => ts('Job Title'), 'default' => TRUE, ), - 'gender_id' => - array('title' => ts('Gender'), + 'gender_id' => array( + 'title' => ts('Gender'), ), - 'id' => - array( + 'id' => array( 'no_display' => TRUE, 'required' => TRUE, ), - 'contact_type' => - array( + 'contact_type' => array( 'title' => ts('Contact Type'), ), - 'contact_sub_type' => - array( + 'contact_sub_type' => array( 'title' => ts('Contact Subtype'), ), ), - 'filters' => - array( - 'sort_name' => - array('title' => ts('Employee Name')), - 'id' => - array('no_display' => TRUE), + 'filters' => array( + 'sort_name' => array('title' => ts('Employee Name')), + 'id' => array('no_display' => TRUE), ), 'grouping' => 'contact-fields', ), - 'civicrm_relationship' => - array( + 'civicrm_relationship' => array( 'dao' => 'CRM_Contact_DAO_Relationship', - 'fields' => - array( - 'start_date' => - array('title' => ts('Employee Since'), + 'fields' => array( + 'start_date' => array( + 'title' => ts('Employee Since'), 'default' => TRUE, ), ), - 'filters' => - array( - 'start_date' => - array('title' => ts('Employee Since'), + 'filters' => array( + 'start_date' => array( + 'title' => ts('Employee Since'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE, ), ), ), - 'civicrm_phone' => - array( + 'civicrm_phone' => array( 'dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-fields', - 'fields' => - array( - 'phone' => - array('title' => ts('Phone'), + 'fields' => array( + 'phone' => array( + 'title' => ts('Phone'), 'default' => TRUE, ), ), ), - 'civicrm_email' => - array( + 'civicrm_email' => array( 'dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-fields', - 'fields' => - array( - 'email' => - array('title' => ts('Email'), + 'fields' => array( + 'email' => array( + 'title' => ts('Email'), 'default' => TRUE, ), ), ), - 'civicrm_address' => - array( + 'civicrm_address' => array( 'dao' => 'CRM_Core_DAO_Address', 'grouping' => 'contact-fields', - 'fields' => - array( + 'fields' => array( 'street_address' => NULL, 'city' => NULL, 'postal_code' => NULL, - 'state_province_id' => - array('title' => ts('State/Province'), + 'state_province_id' => array( + 'title' => ts('State/Province'), ), - 'country_id' => - array('title' => ts('Country'), + 'country_id' => array( + 'title' => ts('Country'), ), ), - 'filters' => - array( - 'country_id' => - array('title' => ts('Country'), + 'filters' => array( + 'country_id' => array( + 'title' => ts('Country'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::country(NULL, FALSE), ), - 'state_province_id' => - array('title' => ts('State/Province'), + 'state_province_id' => array( + 'title' => ts('State/Province'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::stateProvince(), ), ), ), - 'civicrm_group' => - array( + 'civicrm_group' => array( 'dao' => 'CRM_Contact_DAO_Group', 'alias' => 'cgroup', - 'filters' => - array( - 'gid' => - array( + 'filters' => array( + 'gid' => array( 'name' => 'group_id', 'title' => ts('Group'), 'group' => TRUE, @@ -224,7 +203,9 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form { foreach ($this->_columns as $tableName => $table) { if (array_key_exists('fields', $table)) { foreach ($table['fields'] as $fieldName => $field) { - if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) { + if (!empty($field['required']) || + !empty($this->_params['fields'][$fieldName]) + ) { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field); @@ -268,10 +249,12 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} if (array_key_exists('filters', $table)) { foreach ($table['filters'] as $fieldName => $field) { $clause = NULL; - if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE) { + if (CRM_Utils_Array::value('operatorType', $field) & + CRM_Report_Form::OP_DATE + ) { $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params); - $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params); - $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params); + $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params); + $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params); $clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']); } @@ -298,7 +281,9 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} $this->_where = "WHERE {$this->_aliases['civicrm_contact']}.employer_id!='null' "; } else { - $this->_where = "WHERE ({$this->_aliases['civicrm_contact']}.employer_id!='null') AND " . implode(' AND ', $clauses); + $this->_where = + "WHERE ({$this->_aliases['civicrm_contact']}.employer_id!='null') AND " . + implode(' AND ', $clauses); } if ($this->_aclWhere) { @@ -316,7 +301,10 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} function postProcess() { // get the acl clauses built before we assemble the query - $this->buildACLClause(array($this->_aliases['civicrm_contact'], $this->_aliases['civicrm_employer'])); + $this->buildACLClause(array( + $this->_aliases['civicrm_contact'], + $this->_aliases['civicrm_employer'] + )); parent::postProcess(); }