edit ,add customer type
This commit is contained in:
parent
aae5b58d57
commit
f44d800400
@ -12,7 +12,7 @@ $ui->assign('_system_menu', 'customers');
|
|||||||
$action = $routes['1'];
|
$action = $routes['1'];
|
||||||
$ui->assign('_admin', $admin);
|
$ui->assign('_admin', $admin);
|
||||||
|
|
||||||
if (empty($action)) {
|
if (empty ($action)) {
|
||||||
$action = 'list';
|
$action = 'list';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ switch ($action) {
|
|||||||
$ui->assign('using', 'cash');
|
$ui->assign('using', 'cash');
|
||||||
$ui->assign('plan', $plan);
|
$ui->assign('plan', $plan);
|
||||||
$ui->display('recharge-confirm.tpl');
|
$ui->display('recharge-confirm.tpl');
|
||||||
}else{
|
} else {
|
||||||
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
|
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -191,7 +191,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r2(U . 'customers/view/' . $id_customer, 's', 'Sync success to '.implode(", ",$routers));
|
r2(U . 'customers/view/' . $id_customer, 's', 'Sync success to ' . implode(", ", $routers));
|
||||||
}
|
}
|
||||||
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
|
r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan');
|
||||||
break;
|
break;
|
||||||
@ -212,7 +212,7 @@ switch ($action) {
|
|||||||
->find_many();
|
->find_many();
|
||||||
|
|
||||||
$v = $routes['3'];
|
$v = $routes['3'];
|
||||||
if(empty($v)){
|
if (empty ($v)) {
|
||||||
$v = 'activation';
|
$v = 'activation';
|
||||||
}
|
}
|
||||||
if ($v == 'order') {
|
if ($v == 'order') {
|
||||||
@ -309,7 +309,8 @@ switch ($action) {
|
|||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ($c) $c->delete();
|
if ($c)
|
||||||
|
$c->delete();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
}
|
}
|
||||||
@ -328,6 +329,7 @@ switch ($action) {
|
|||||||
$address = _post('address');
|
$address = _post('address');
|
||||||
$phonenumber = _post('phonenumber');
|
$phonenumber = _post('phonenumber');
|
||||||
$service_type = _post('service_type');
|
$service_type = _post('service_type');
|
||||||
|
$account_type = _post('account_type');
|
||||||
//post Customers Attributes
|
//post Customers Attributes
|
||||||
$custom_field_names = (array) $_POST['custom_field_name'];
|
$custom_field_names = (array) $_POST['custom_field_name'];
|
||||||
$custom_field_values = (array) $_POST['custom_field_value'];
|
$custom_field_values = (array) $_POST['custom_field_value'];
|
||||||
@ -355,6 +357,7 @@ switch ($action) {
|
|||||||
$d->password = $password;
|
$d->password = $password;
|
||||||
$d->pppoe_password = $pppoe_password;
|
$d->pppoe_password = $pppoe_password;
|
||||||
$d->email = $email;
|
$d->email = $email;
|
||||||
|
$d->account_type = $account_type;
|
||||||
$d->fullname = $fullname;
|
$d->fullname = $fullname;
|
||||||
$d->address = $address;
|
$d->address = $address;
|
||||||
$d->created_by = $admin['id'];
|
$d->created_by = $admin['id'];
|
||||||
@ -365,13 +368,13 @@ switch ($action) {
|
|||||||
// Retrieve the customer ID of the newly created customer
|
// Retrieve the customer ID of the newly created customer
|
||||||
$customerId = $d->id();
|
$customerId = $d->id();
|
||||||
// Save Customers Attributes details
|
// Save Customers Attributes details
|
||||||
if (!empty($custom_field_names) && !empty($custom_field_values)) {
|
if (!empty ($custom_field_names) && !empty ($custom_field_values)) {
|
||||||
$totalFields = min(count($custom_field_names), count($custom_field_values));
|
$totalFields = min(count($custom_field_names), count($custom_field_values));
|
||||||
for ($i = 0; $i < $totalFields; $i++) {
|
for ($i = 0; $i < $totalFields; $i++) {
|
||||||
$name = $custom_field_names[$i];
|
$name = $custom_field_names[$i];
|
||||||
$value = $custom_field_values[$i];
|
$value = $custom_field_values[$i];
|
||||||
|
|
||||||
if (!empty($name)) {
|
if (!empty ($name)) {
|
||||||
$customField = ORM::for_table('tbl_customers_fields')->create();
|
$customField = ORM::for_table('tbl_customers_fields')->create();
|
||||||
$customField->customer_id = $customerId;
|
$customField->customer_id = $customerId;
|
||||||
$customField->field_name = $name;
|
$customField->field_name = $name;
|
||||||
@ -389,6 +392,7 @@ switch ($action) {
|
|||||||
case 'edit-post':
|
case 'edit-post':
|
||||||
$username = Lang::phoneFormat(_post('username'));
|
$username = Lang::phoneFormat(_post('username'));
|
||||||
$fullname = _post('fullname');
|
$fullname = _post('fullname');
|
||||||
|
$account_type = _post('account_type');
|
||||||
$password = _post('password');
|
$password = _post('password');
|
||||||
$pppoe_password = _post('pppoe_password');
|
$pppoe_password = _post('pppoe_password');
|
||||||
$email = _post('email');
|
$email = _post('email');
|
||||||
@ -451,6 +455,7 @@ switch ($action) {
|
|||||||
$d->pppoe_password = $pppoe_password;
|
$d->pppoe_password = $pppoe_password;
|
||||||
$d->fullname = $fullname;
|
$d->fullname = $fullname;
|
||||||
$d->email = $email;
|
$d->email = $email;
|
||||||
|
$d->account_type = $account_type;
|
||||||
$d->address = $address;
|
$d->address = $address;
|
||||||
$d->phonenumber = $phonenumber;
|
$d->phonenumber = $phonenumber;
|
||||||
$d->service_type = $service_type;
|
$d->service_type = $service_type;
|
||||||
@ -460,7 +465,7 @@ switch ($action) {
|
|||||||
// Update Customers Attributes values in tbl_customers_fields table
|
// Update Customers Attributes values in tbl_customers_fields table
|
||||||
foreach ($customFields as $customField) {
|
foreach ($customFields as $customField) {
|
||||||
$fieldName = $customField['field_name'];
|
$fieldName = $customField['field_name'];
|
||||||
if (isset($_POST['custom_fields'][$fieldName])) {
|
if (isset ($_POST['custom_fields'][$fieldName])) {
|
||||||
$customFieldValue = $_POST['custom_fields'][$fieldName];
|
$customFieldValue = $_POST['custom_fields'][$fieldName];
|
||||||
$customField->set('field_value', $customFieldValue);
|
$customField->set('field_value', $customFieldValue);
|
||||||
$customField->save();
|
$customField->save();
|
||||||
@ -468,7 +473,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add new Customers Attributess
|
// Add new Customers Attributess
|
||||||
if (isset($_POST['custom_field_name']) && isset($_POST['custom_field_value'])) {
|
if (isset ($_POST['custom_field_name']) && isset ($_POST['custom_field_value'])) {
|
||||||
$newCustomFieldNames = $_POST['custom_field_name'];
|
$newCustomFieldNames = $_POST['custom_field_name'];
|
||||||
$newCustomFieldValues = $_POST['custom_field_value'];
|
$newCustomFieldValues = $_POST['custom_field_value'];
|
||||||
|
|
||||||
@ -491,7 +496,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete Customers Attributess
|
// Delete Customers Attributess
|
||||||
if (isset($_POST['delete_custom_fields'])) {
|
if (isset ($_POST['delete_custom_fields'])) {
|
||||||
$fieldsToDelete = $_POST['delete_custom_fields'];
|
$fieldsToDelete = $_POST['delete_custom_fields'];
|
||||||
foreach ($fieldsToDelete as $fieldName) {
|
foreach ($fieldsToDelete as $fieldName) {
|
||||||
// Delete the Customers Attributes with the given field name
|
// Delete the Customers Attributes with the given field name
|
||||||
@ -521,7 +526,7 @@ switch ($action) {
|
|||||||
Mikrotik::removeHotspotActiveUser($client, $d['username']);
|
Mikrotik::removeHotspotActiveUser($client, $d['username']);
|
||||||
} else {
|
} else {
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
if (!empty($d['pppoe_password'])) {
|
if (!empty ($d['pppoe_password'])) {
|
||||||
Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']);
|
Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']);
|
||||||
} else {
|
} else {
|
||||||
Mikrotik::setPpoeUser($client, $c['username'], $password);
|
Mikrotik::setPpoeUser($client, $c['username'], $password);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user