The address & additional fields are both represented in the admin/settings/address table. There I can say I want to show the address, but hide the additional. Yet, the code says otherwise. I would suggest adding an if() for the additional or remove it from the table so you do not have the option to change additional one way or the other. I agree, however, that it should not be shown if the address is not shown.

  // Adds the Streets and the Additional fields
  if (!empty($fields['street'])) {
    $form['street'] = array(
      '#type'           => 'textfield',
      '#title'          => t('Street'),
      '#default_value'  => isset($values['street']) ? $values['street'] : '',
      '#size'           => 50,
      '#maxlength'      => 255,
      '#required'       => ($fields['street'] == ADDRESSES_FIELD_REQUIRED)
    );
    $form['additional'] = array(
      '#type'           => 'textfield',
      '#title'          => t('Additional'),
      '#default_value'  => isset($values['additional']) ? $values['additional'] : '',
      '#size'           => 50,
      '#maxlength'      => 255
    );
  }

Comments

AlexisWilke’s picture

Assigned: Unassigned » AlexisWilke
Status: Active » Needs review
StatusFileSize
new1.27 KB

Okay, there is a patch. I checked and it works great for me. Just in case, there is the code inline.

  // Adds the Streets and the Additional fields
  if (!empty($fields['street'])) {
    $form['street'] = array(
      '#type'           => 'textfield',
      '#title'          => t('Street'),
      '#default_value'  => isset($values['street']) ? $values['street'] : '',
      '#size'           => 50,
      '#maxlength'      => 255,
      '#required'       => ($fields['street'] == ADDRESSES_FIELD_REQUIRED)
    );
    if (!empty($fields['additional'])) {
      $form['additional'] = array(
        '#type'           => 'textfield',
        '#title'          => t('Additional'),
        '#default_value'  => isset($values['additional']) ? $values['additional'] : '',
        '#size'           => 50,
        '#maxlength'      => 255
      );
    }
  }
brmassa’s picture

Status: Needs review » Fixed

Alexis,

patch commited on CVS

regards,

massa

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.