Merge branch 'master' into master

This commit is contained in:
Focuslinkstech 2024-05-20 13:25:49 +01:00 committed by GitHub
commit 7710696886
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 30 additions and 15 deletions

View file

@ -326,4 +326,5 @@ ALTER TABLE `tbl_user_recharges` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `
ALTER TABLE `tbl_plans` CHANGE `allow_purchase` `prepaid` ENUM('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'yes' COMMENT 'is prepaid';
ALTER TABLE `tbl_transactions` ADD `note` VARCHAR(256) NOT NULL DEFAULT '' COMMENT 'for note' AFTER `type`;
ALTER TABLE `tbl_payment_gateway` ADD `trx_invoice` VARCHAR(25) NOT NULL DEFAULT '' COMMENT 'from tbl_transactions' AFTER `paid_date`;
ALTER TABLE `tbl_customers` ADD `status` ENUM('Active','Banned','Disabled') NOT NULL DEFAULT 'Active' AFTER `auto_renewal`;
ALTER TABLE `tbl_customers` ADD `status` ENUM('Active','Banned','Disabled') NOT NULL DEFAULT 'Active' AFTER `auto_renewal`;
ALTER TABLE `tbl_customers` CHANGE `status` `status` ENUM('Active','Banned','Disabled','Inactive','Limited','Suspended') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'Active';

View file

@ -315,6 +315,7 @@ switch ($action) {
->find_many();
if ($d) {
$ui->assign('d', $d);
$ui->assign('statuses', ORM::for_table('tbl_customers')->getEnum("status"));
$ui->assign('customFields', $customFields);
$ui->assign('xheader', $leafletpickerHeader);
$ui->display('customers-edit.tpl');

View file

@ -18,7 +18,7 @@ if (isset($_GET['renewal'])) {
if (_post('send') == 'balance') {
if ($config['enable_balance'] == 'yes' && $config['allow_balance_transfer'] == 'yes') {
if ($user['status'] == 'Disabled') {
if ($user['status'] == 'Active') {
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
}
$target = ORM::for_table('tbl_customers')->where('username', _post('username'))->find_one();
@ -80,7 +80,7 @@ if (_post('send') == 'balance') {
r2(U . 'home', 'd', Lang::T('Failed, balance is not available'));
}
} else if (_post('send') == 'plan') {
if ($user['status'] == 'Disabled') {
if ($user['status'] == 'Active') {
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
}
$actives = ORM::for_table('tbl_user_recharges')
@ -98,7 +98,7 @@ if (_post('send') == 'balance') {
$ui->assign('_bills', User::_billing());
if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
if ($user['status'] == 'Disabled') {
if ($user['status'] == 'Active') {
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
}
if (!empty(App::getTokenValue(_get('stoken')))) {
@ -128,7 +128,7 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
}
}
} else if (!empty(_get('extend'))) {
if ($user['status'] == 'Disabled') {
if ($user['status'] == 'Active') {
_alert(Lang::T('This account status') . ' : ' . Lang::T($user['status']), 'danger', "");
}
if (!$config['extend_expired']) {

View file

@ -589,5 +589,7 @@
"Don_t_forget_to_deactivate_all_active_plan_too": "Don't forget to deactivate all active plan too",
"Ascending": "Ascending",
"Descending": "Descending",
"Created_Date": "Created Date"
"Created_Date": "Created Date",
"Inactive": "Inactive",
"Suspended": "Suspended"
}

View file

@ -474,5 +474,7 @@
"SMS_and_WhatsApp": "SMS dan WhatsApp",
"The_method_which_OTP_will_be_sent_to_user": "Metode OTP yang akan dikirimkan ke pengguna",
"Disabled": "Dinonaktifkan",
"Banned": "Banned"
"Banned": "Dicekal",
"Inactive": "Tidak Aktif",
"Suspended": "Disuspend"
}

View file

@ -939,6 +939,8 @@ class ORM implements ArrayAccess
return $this->_add_result_column($column, $alias);
}
## ibnux add function
/**
* Add a column to the list of columns returned by the SELECT
* query. This defaults to '*'. The second optional argument is
@ -959,6 +961,14 @@ class ORM implements ArrayAccess
return $this;
}
public function getEnum($column){
$result = $this->raw_query("SHOW COLUMNS FROM ".$this->_table_name." WHERE Field = '$column'")->findArray();
preg_match("/^enum\(\'(.*)\'\)$/", $result[0]['Type'], $matches);
return explode("','", $matches[1]);
}
## END ibnux add function
/**
* Add an unquoted expression to the list of columns returned
* by the SELECT query. The second optional argument is

View file

@ -97,6 +97,9 @@
"2024.5.17" : [
"ALTER TABLE `tbl_customers` ADD `status` ENUM('Active','Banned','Disabled') NOT NULL DEFAULT 'Active' AFTER `auto_renewal`;"
],
"2024.5.18" : [
"ALTER TABLE `tbl_customers` CHANGE `status` `status` ENUM('Active','Banned','Disabled','Inactive','Limited','Suspended') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'Active';"
],
"2024.5.20" : [
"ALTER TABLE `tbl_customers` ADD `city` VARCHAR(255) NULL AFTER `address`, ADD `district` VARCHAR(255) NULL AFTER `city`, ADD `state` VARCHAR(255) NULL AFTER `district`, ADD `zip` VARCHAR(10) NULL AFTER `state`;"
]

View file

@ -112,14 +112,10 @@
<label class="col-md-3 control-label">{Lang::T('Status')}</label>
<div class="col-md-9">
<select class="form-control" id="status" name="status">
<option value="Active" {if $d['status'] eq 'Active' }selected{/if}>{Lang::T('Active')}
</option>
<option value="Disabled" {if $d['status'] eq 'Disabled' }selected{/if}>
{Lang::T('Disabled')}
</option>
<option value="Banned" {if $d['status'] eq 'Banned' }selected{/if}>
{Lang::T('Banned')}
{foreach $statuses as $status}
<option value="{$status}" {if $d['status'] eq $status }selected{/if}>{Lang::T($status)}
</option>
{/foreach}
</select>
<span class="help-block">
{Lang::T('Banned')}: {Lang::T('Customer cannot login again')}.<br>

View file

@ -86,7 +86,7 @@
</thead>
<tbody>
{foreach $d as $ds}
<tr>
<tr {if $ds['status'] != 'Active'}class="danger"{/if}>
<td onclick="window.location.href = '{$_url}customers/view/{$ds['id']}'"
style="cursor:pointer;">{$ds['username']}</td>
<td>{$ds['account_type']}</td>