Following on from #506234: phone number to map automatically, I would be very interested in being able to set the field at the time of creation of the view.

I think this is sensible, as the phone number field will be known at the time of creating the view, and won't change dynamically after that.

Also, if the view has an address field (which is fairly likely in most cases), it would be great to have an option to assign the Country field to that of the address. I realise that this is not as reliable (in the case that the mobile is registered in a different country to the address), but it'd be a damn convenient option.

Comments

gunzip’s picture

Assigned: Unassigned » gunzip

i'll look at this asap. do you have any quick suggestion in how to do this programatically ?

JayKayAu’s picture

Thanks so much :)

I'm sorry, I don't really have any understanding of the underlying code in either Views, VBO or the SMS Bulk module. Just a rough understanding of how they link together.

I think the key is knowing when you're given a view, which field to extract and use as the phone number (and maybe country).

Perhaps you could have a list on the SMS Bulk configuration page where you choose an existing view from a dropdown, then the field that you'd extract from that view to use as the phone number/country. Then you could "Add another..." view + fields relationship..

Then whenever SMS Bulk is called by VBO, it can check its list to match the view it's acting on with the phone/country fields, and off you go. If there isn't a matching view/fields relationship, then SMS Bulk could show the existing field & country selectors at the time the SMS is sent.

Anyway, I'm kinda talking out of my hat - thanks for looking into this.

gunzip’s picture

Status: Active » Postponed

well, after some thoughts I've decided to postpone this issue. the only way is to provide options through view bulk operations settings form. there must be a list of all the current view fields to select the one which is the actual mobile number. in the meantime you can use some code in your own module to set up a default value for the number field:

function YOURMODULE_form_alter(&$form, &$form_state, $form_id) {
  if (isset($form['sms_field']) and strpos($form_id, 'views_bulk_operations_form') !== FALSE) {
    $form['sms_field'] = array(
      '#value' => 'profile_values_profile_number_value', // FIX THIS ONE
      '#type'  => 'value',
    );
  }
}

about the country field, things aren't so simple because not all the gateways could require a country field, moreover, per gateway settings can differ a lot. so i suspect this part of the request is impossible to satisfy.