'options' => CRM_Core_PseudoConstant::country(),
],
$options['prefix'] . 'location_type_id' => [
- 'name' => 'is_primary',
+ 'name' => 'location_type_id',
'title' => $options['prefix_label'] . ts('Location Type'),
'type' => CRM_Utils_Type::T_INT,
'is_fields' => TRUE,
}
}
+ /**
+ * Test that Loation Type prints out a sensible piece of data
+ */
+ public function testLocationTypeIdHandling() {
+ $customLocationType = $this->callAPISuccess('LocationType', 'create', [
+ 'name' => 'Custom Location Type',
+ 'display_name' => 'CiviTest Custom Location Type',
+ 'is_active' => 1,
+ ]);
+ $this->individualCreate([
+ 'api.Address.create' => [
+ 'location_type_id' => $customLocationType['id'],
+ 'is_primary' => 1,
+ 'street_number' => 3,
+ ],
+ ]);
+ $input = [
+ 'fields' => [
+ 'address_street_number',
+ 'address_odd_street_number',
+ 'address_location_type_id',
+ ],
+ ];
+ $obj = $this->getReportObject('CRM_Report_Form_Contact_Summary', $input);
+ $obj->setParams($obj->getParams());
+ $sql = $obj->buildQuery(TRUE);
+ $rows = [];
+ $obj->buildRows($sql, $rows);
+ $obj->formatDisplay($rows);
+ $this->assertEquals('CiviTest Custom Location Type', $rows[0]['civicrm_address_address_location_type_id']);
+ }
+
}