Save phone number and country info

This commit is contained in:
Kijin Sung 2019-08-03 20:35:17 +09:00
parent b37e70a41e
commit 1ee59e4196
3 changed files with 58 additions and 5 deletions

View file

@ -46,6 +46,10 @@ class memberAdminController extends member
foreach($getVars as $val)
{
$args->{$val} = Context::get($val);
if ($val === 'phone_number')
{
$args->phone_country = trim(preg_replace('/[^0-9-]/', '', Context::get('phone_country')), '-');
}
}
$member_srl = Context::get('member_srl');
// Check if an original member exists having the member_srl

View file

@ -617,11 +617,14 @@ class memberController extends member
foreach($getVars as $val)
{
$args->{$val} = Context::get($val);
if($val == 'birthday')
if ($val === 'birthday')
{
$args->birthday_ui = Context::get('birthday_ui');
}
if ($val === 'phone_number')
{
$args->phone_country = trim(preg_replace('/[^0-9-]/', '', Context::get('phone_country')), '-');
}
}
// mobile input date format can be different
@ -863,11 +866,14 @@ class memberController extends member
foreach($getVars as $val)
{
$args->{$val} = Context::get($val);
if($val == 'birthday')
if($val === 'birthday')
{
$args->birthday_ui = Context::get('birthday_ui');
}
if ($val === 'phone_number')
{
$args->phone_country = trim(preg_replace('/[^0-9-]/', '', Context::get('phone_country')), '-');
}
}
// Login Information
@ -2525,6 +2531,28 @@ class memberController extends member
$message = sprintf($managed_email_host[$emailhost_check],implode(', ',$hosts),'id@'.implode(', id@',$hosts));
return new BaseObject(-1, $message);
}
// Format phone number
if (strval($args->phone_number) !== '')
{
$args->phone_country = trim(preg_replace('/[^0-9-]/', '', $args->phone_country), '-');
$args->phone_number = preg_replace('/[^0-9]/', '', $args->phone_number);
$args->phone_type = '';
if(!$args->phone_country && $config->phone_number_default_country)
{
$args->phone_country = $config->phone_number_default_country;
}
if ($args->phone_country == '82')
{
$args->phone_number = Rhymix\Framework\Korea::formatPhoneNumber($args->phone_number);
}
}
else
{
$args->phone_country = '';
$args->phone_number = '';
$args->phone_type = '';
}
// Check if email address is duplicate
$member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address);
@ -2715,6 +2743,28 @@ class memberController extends member
}
}
}
// Format phone number
if (strval($args->phone_number) !== '')
{
$args->phone_country = trim(preg_replace('/[^0-9-]/', '', $args->phone_country), '-');
$args->phone_number = preg_replace('/[^0-9]/', '', $args->phone_number);
$args->phone_type = '';
if(!$args->phone_country && $config->phone_number_default_country)
{
$args->phone_country = $config->phone_number_default_country;
}
if ($args->phone_country == '82')
{
$args->phone_number = Rhymix\Framework\Korea::formatPhoneNumber($args->phone_number);
}
}
else
{
$args->phone_country = '';
$args->phone_number = '';
$args->phone_type = '';
}
// Check managed Email Host
if($logged_info->is_admin !== 'Y' && $logged_info->email_address !== $args->email_address && $oMemberModel->isDeniedEmailHost($args->email_address))

View file

@ -150,7 +150,6 @@
<div cond="$item->name == 'phone_number'" class="_subItem" style="display:none"|cond="!$item->isUse">
<label for="phone_number_default_country" class="x_inline">{$lang->phone_number_default_country}</label>
<select id="phone_number_default_country" name="phone_number_default_country">
<option value=""></option>
<!--@foreach($country_list as $country_info)-->
<!--@if($country_info->calling_code)-->
<option value="{$country_info->calling_code}" selected="selected"|cond="$country_info->calling_code == $config->phone_number_default_country">