added phone field to subbscription form and billing form
This commit is contained in:
parent
8f32d4e98b
commit
497a0108ae
@ -272,6 +272,7 @@ function materio_user_webform_client_11186_form_alter(&$form, &$form_state, $for
|
||||
$formaddress['locality'] = $address['locality'];
|
||||
}
|
||||
|
||||
$columnright['company']['phone_number']['#default_value'] = $member_profile->field_private_phone['und'][0]["number"];
|
||||
}
|
||||
|
||||
function materio_user_webform_client_11186_validate($form, &$form_state){
|
||||
@ -386,6 +387,7 @@ function materio_user_record_member_profile($values) {
|
||||
"administrative_e_mail"=>"field_administrative_email",
|
||||
"vat_number_intra_ce"=>"field_vat_number_intra_ce",
|
||||
"location"=>"field_adresse",
|
||||
"phone_number"=>"field_private_phone",
|
||||
);
|
||||
|
||||
foreach ($correspondances as $form_field => $field_name) {
|
||||
@ -399,6 +401,34 @@ function materio_user_record_member_profile($values) {
|
||||
case "location":
|
||||
$value = unserialize($values[$form_field]);
|
||||
// dsm($value, 'location value');
|
||||
break;
|
||||
case "phone_number":
|
||||
$pn = $values[$form_field];
|
||||
|
||||
if(module_exists('cck_phone')){
|
||||
preg_match('/^(\+[0-9]+)\s([0-9]+)$/', $pn, $matches);
|
||||
dsm($matches, "matches");
|
||||
$ccs = cck_phone_countrycodes();
|
||||
foreach ($ccs as $c => $vs) {
|
||||
if($vs['code'] == $matches[1]){
|
||||
$pn = "0".$matches[2];
|
||||
$cc = $c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$value = array(
|
||||
"number"=>$pn,
|
||||
"country_codes"=>$cc,
|
||||
"extension"=>"",
|
||||
);
|
||||
}else{
|
||||
$value = array(
|
||||
"number"=>$pn,
|
||||
"country_codes"=>"",
|
||||
"extension"=>"",
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
$value = array("value" => $values[$form_field]);
|
||||
@ -449,8 +479,14 @@ function materio_user_uc_cart_checkout_form_alter(&$form, &$form_state, $form_id
|
||||
$location = (object) $member_profile->field_adresse['und'][0];
|
||||
// dsm($location, "location");
|
||||
|
||||
$phone_field = field_get_items('profile2', $member_profile, 'field_private_phone');
|
||||
$phone = $phone_field ? field_view_value('profile2', $member_profile, 'field_private_phone', $phone_field[0]) : "";
|
||||
// $phone_field = field_get_items('profile2', $member_profile, 'field_private_phone');
|
||||
// $phone = $phone_field ? field_view_value('profile2', $member_profile, 'field_private_phone', $phone_field[0]) : "";
|
||||
// dsm($phone, 'phone');
|
||||
$phone_field = $member_profile->field_private_phone['und'][0];
|
||||
if(module_exists('cck_phone')){
|
||||
$cc = cck_phone_countrycodes($phone_field['country_codes']);
|
||||
$phone = $cc['code'] .' '. $phone_field['number'];
|
||||
}
|
||||
|
||||
$correspondances = array(
|
||||
"billing_first_name" => $member_profile->field_first_name['und'][0]['value'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user