* @static
* @access public
*/
- function setUFFieldStatus($customGroupId, $is_active) {
+ static function setUFFieldStatus($customGroupId, $is_active) {
//find the profile id given custom group id
$queryString = "SELECT civicrm_custom_field.id as custom_field_id
FROM civicrm_custom_field, civicrm_custom_group
* @param array $profileAddressFields array of profile fields that relate to address fields
* @param array $profileFilter filter to apply to profile fields - expected usage is to only fill based on
* the bottom profile per CRM-13726
+ *
+ * @return bool Can the address block be hidden safe in the knowledge all fields are elsewhere collected (see CRM-15118)
*/
static function assignAddressField($key, &$profileAddressFields, $profileFilter) {
$billing_id = CRM_Core_BAO_LocationType::getBilling();
list($prefixName, $index) = CRM_Utils_System::explode('-', $key, 2);
$profileFields = civicrm_api3('uf_field', 'get', array_merge($profileFilter,
- array('is_active' => 1, 'return' => 'field_name', 'options' => array(
+ array('is_active' => 1, 'return' => 'field_name, is_required', 'options' => array(
'limit' => 0,
))
));
'postal_code',
'country'
);
+ $requiredBillingFields = array_diff($validBillingFields, array('middle_name','supplemental_address_1'));
$validProfileFields = array();
+ $requiredProfileFields = array();
foreach ($profileFields['values'] as $field) {
if(in_array($field['field_name'], $validBillingFields)) {
$validProfileFields[] = $field['field_name'];
}
+ if ($field['is_required']) {
+ $requiredProfileFields[] = $field['field_name'];
+ }
}
if (!in_array($prefixName, $validProfileFields) ) {
) {
$profileAddressFields[$prefixName] = $index;
}
+
+ $potentiallyMissingRequiredFields = array_diff($requiredBillingFields, $requiredProfileFields);
+ CRM_Core_Resources::singleton()->addSetting(array('billing' => array('billingProfileIsHideable' => empty($potentiallyMissingRequiredFields))));
}
/**
return isset($availableFields[$fieldName]);
}
+ /**
+ * @return array|null
+ */
static function getContribBatchEntryFields() {
if (self::$_contriBatchEntryFields === NULL) {
self::$_contriBatchEntryFields = array(
return self::$_contriBatchEntryFields;
}
+ /**
+ * @return array|null
+ */
public static function getMemberBatchEntryFields() {
if (self::$_memberBatchEntryFields === NULL) {
self::$_memberBatchEntryFields = array(