Add Customer now all field shown
This commit is contained in:
parent
56cea36a33
commit
e3b736e222
@ -21,4 +21,14 @@ class Lang
|
||||
global $config;
|
||||
return $config['currency_code'] . ' ' .number_format($var, 0, $config['dec_point'], $config['thousands_sep']);
|
||||
}
|
||||
|
||||
public static function phoneFormat($phone)
|
||||
{
|
||||
global $config;
|
||||
if(Validator::UnsignedNumber($phone) && !empty($config['country_code_phone'])){
|
||||
return preg_replace('/^0/', $config['country_code_phone'], $phone);
|
||||
}else{
|
||||
return $phone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ switch ($action) {
|
||||
$username = _post('username');
|
||||
$fullname = _post('fullname');
|
||||
$password = _post('password');
|
||||
$cpassword = _post('cpassword');
|
||||
$email = _post('email');
|
||||
$address = _post('address');
|
||||
$phonenumber = _post('phonenumber');
|
||||
run_hook('add_customer'); #HOOK
|
||||
@ -130,9 +130,6 @@ switch ($action) {
|
||||
if (!Validator::Length($password, 35, 2)) {
|
||||
$msg .= 'Password should be between 3 to 35 characters' . '<br>';
|
||||
}
|
||||
if ($password != $cpassword) {
|
||||
$msg .= 'Passwords does not match' . '<br>';
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
|
||||
if ($d) {
|
||||
@ -141,11 +138,12 @@ switch ($action) {
|
||||
|
||||
if ($msg == '') {
|
||||
$d = ORM::for_table('tbl_customers')->create();
|
||||
$d->username = $username;
|
||||
$d->username = Lang::phoneFormat($username);
|
||||
$d->password = $password;
|
||||
$d->email = $email;
|
||||
$d->fullname = $fullname;
|
||||
$d->address = $address;
|
||||
$d->phonenumber = $username;
|
||||
$d->phonenumber = Lang::phoneFormat($phonenumber);
|
||||
$d->save();
|
||||
r2(U . 'customers/list', 's', $_L['account_created_successfully']);
|
||||
} else {
|
||||
@ -154,27 +152,24 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'edit-post':
|
||||
$username = _post('username');
|
||||
$username = Lang::phoneFormat(_post('username'));
|
||||
$fullname = _post('fullname');
|
||||
$password = _post('password');
|
||||
$cpassword = _post('cpassword');
|
||||
$email = _post('email');
|
||||
$address = _post('address');
|
||||
$phonenumber = _post('phonenumber');
|
||||
$phonenumber = Lang::phoneFormat(_post('phonenumber'));
|
||||
run_hook('edit_customer'); #HOOK
|
||||
$msg = '';
|
||||
if (Validator::Length($username, 16, 2) == false) {
|
||||
$msg .= 'Username should be between 3 to 15 characters' . '<br>';
|
||||
}
|
||||
if (Validator::Length($fullname, 26, 2) == false) {
|
||||
$msg .= 'Full Name should be between 3 to 25 characters' . '<br>';
|
||||
if (Validator::Length($fullname, 26, 1) == false) {
|
||||
$msg .= 'Full Name should be between 2 to 25 characters' . '<br>';
|
||||
}
|
||||
if ($password != '') {
|
||||
if (!Validator::Length($password, 15, 2)) {
|
||||
$msg .= 'Password should be between 3 to 15 characters' . '<br>';
|
||||
}
|
||||
if ($password != $cpassword) {
|
||||
$msg .= 'Passwords does not match' . '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
$id = _post('id');
|
||||
@ -218,6 +213,7 @@ switch ($action) {
|
||||
$d->password = $password;
|
||||
}
|
||||
$d->fullname = $fullname;
|
||||
$d->email = $email;
|
||||
$d->address = $address;
|
||||
$d->phonenumber = $phonenumber;
|
||||
$d->save();
|
||||
@ -227,6 +223,7 @@ switch ($action) {
|
||||
$d->password = $password;
|
||||
}
|
||||
$d->fullname = $fullname;
|
||||
$d->email = $email;
|
||||
$d->address = $address;
|
||||
$d->phonenumber = $phonenumber;
|
||||
$d->save();
|
||||
|
@ -26,7 +26,8 @@ switch ($do) {
|
||||
$cpassword = _post('cpassword');
|
||||
$address = _post('address');
|
||||
if(!empty($config['sms_url'])){
|
||||
$phonenumber = $username;
|
||||
$phonenumber = Lang::phoneFormat($username);
|
||||
$username = $phonenumber;
|
||||
}else if(strlen($username)<21){
|
||||
$phonenumber = $username;
|
||||
}
|
||||
|
@ -9,9 +9,13 @@
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}customers/add-post" >
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Username']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="username" name="username" required placeholder="Phone number">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">+</span>
|
||||
<input type="text" class="form-control" name="username" required
|
||||
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Full_Name']}</label>
|
||||
@ -20,15 +24,25 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Password']}</label>
|
||||
<label class="col-md-2 control-label">{$_L['Email']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="password" class="form-control" required id="password" name="password">
|
||||
<input type="email" class="form-control" id="email" name="email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">+</span>
|
||||
<input type="text" class="form-control" name="phonenumber"
|
||||
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Confirm_Password']}</label>
|
||||
<label class="col-md-2 control-label">{$_L['Password']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="password" class="form-control" required id="cpassword" name="cpassword">
|
||||
<input type="text" class="form-control" autocomplete="off" required id="password" name="password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -11,7 +11,11 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Username']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="username" name="username" value="{$d['username']}" placeholder="Phone Number" required>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">+</span>
|
||||
<input type="text" class="form-control" name="username" value="{$d['username']}" required
|
||||
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -20,6 +24,22 @@
|
||||
<input type="text" class="form-control" id="fullname" name="fullname" value="{$d['fullname']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Email']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="email" class="form-control" id="email" name="email" value="{$d['email']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">+</span>
|
||||
<input type="text" class="form-control" name="phonenumber" value="{$d['phonenumber']}"
|
||||
placeholder="{if $_c['country_code_phone']!= ''}{$_c['country_code_phone']}{/if} {$_L['Phone_Number']}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Password']}</label>
|
||||
<div class="col-md-6">
|
||||
@ -27,24 +47,12 @@
|
||||
<span class="help-block">{$_L['password_change_help']}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Confirm_Password']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="password" class="form-control" id="cpassword" name="cpassword">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Address']}</label>
|
||||
<div class="col-md-6">
|
||||
<textarea name="address" id="address" class="form-control">{$d['address']}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="phonenumber" name="phonenumber" value="{$d['phonenumber']}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
|
Loading…
x
Reference in New Issue
Block a user