Fatal error: Call to undefined function getlocations_fields_defaults() in /home/u5444/domains/medstream.krypton.vps-private.net/sites/all/modules/getlocations/modules/getlocations_location_taxonomize/getlocations_location_taxonomize.inc on line 38

Comments

dgastudio’s picture

Status: Active » Closed (duplicate)
angelg33k’s picture

Status: Closed (duplicate) » Active

I don't think this is a duplicate because I have the same problem and I do not have the Profile2 module installed. I'm still getting a PHP Fatal error: Call to undefined function getlocations_fields_defaults()

hutch’s picture

Is this occurring on uninstall? Please let me know so I can attempt a fix.

dom.’s picture

Hi !
Same problem here with both 7x-1.1 and 7x-1.dev. It occurs when uninstalling the module. While screen with this php error. The module can't be uninstall therefore.

hutch’s picture

Although I have not been able to replicate the error, it's not the first time that I have seen dependency issues on install and uninstall of modules, so here is a fix:
replace function getlocations_location_taxonomize_get_fields() in getlocations_location_taxonomize.inc with the following:

function getlocations_location_taxonomize_get_fields($assoc = TRUE, $labels = FALSE) {
  // get fields from getlocations_fields table
  $defaults = array(
    'columns' => array(
      'glid'        => t('Glid'),
      'name'        => t('Name'),
      'street'      => t('Street'),
      'additional'  => t('Additional'),
      'city'        => t('City'),
      'province'    => t('Province'),
      'postal_code' => t('Post code'),
      'country'     => t('Country'),
      'latitude'    => t('Latitude'),
      'longitude'   => t('Longitude'),
    ),
  );
  $getlocations_fields_defaults = variable_get('getlocations_fields_defaults', $defaults);
  if (function_exists('getlocations_fields_defaults')) {
    $getlocations_fields_defaults = getlocations_fields_defaults();
  }
  $fields = $getlocations_fields_defaults['columns'];
  foreach ($fields as $key => $value) {
    $fields[$key] = $value;
  }
  // define the fields we support and their order
  $supported = array(
    'name',
    'street',
    'city',
    'province',
    'postal_code',
    'country',
  );

  $return = array();
  // remove unsupported fields
  foreach ($supported as $field) {
    if ($assoc) {
      if ($labels) {
        $return[$field] = $fields[$field];
      }
      else {
        $return[$field] = $field;
      }
    }
    else {
      $return[] = $field;
    }
  }
  return array_reverse($return);
}

I will commit this to dev ASAP.
Thank you for reporting this.

hutch’s picture

Status: Active » Needs review
hutch’s picture

This fix has been commited, available in dev tomorrow.

hutch’s picture

Status: Needs review » Closed (fixed)