Bugs Fixes
fix extend expiry bug
This commit is contained in:
parent
fec7780f50
commit
b7fdc90aa7
@ -195,34 +195,35 @@ class Package
|
|||||||
|
|
||||||
if ($b) {
|
if ($b) {
|
||||||
$lastExpired = Lang::dateAndTimeFormat($b['expiration'], $b['time']);
|
$lastExpired = Lang::dateAndTimeFormat($b['expiration'], $b['time']);
|
||||||
$isChangePlan = false;
|
if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on' && $config['extend_expiry'] == 'yes') {
|
||||||
if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
|
|
||||||
// if it same internet plan, expired will extend
|
// if it same internet plan, expired will extend
|
||||||
if ($p['validity_unit'] == 'Months') {
|
switch ($p['validity_unit']) {
|
||||||
|
case 'Months':
|
||||||
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
||||||
$time = $b['time'];
|
$time = $b['time'];
|
||||||
} else if ($p['validity_unit'] == 'Period') {
|
break;
|
||||||
|
case 'Period':
|
||||||
$date_exp = date("Y-m-$day_exp", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
$date_exp = date("Y-m-$day_exp", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
||||||
$time = date("23:59:00");
|
$time = date("23:59:00");
|
||||||
} else if ($p['validity_unit'] == 'Days') {
|
break;
|
||||||
|
case 'Days':
|
||||||
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
|
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
|
||||||
$time = $b['time'];
|
$time = $b['time'];
|
||||||
} else if ($p['validity_unit'] == 'Hrs') {
|
break;
|
||||||
|
case 'Hrs':
|
||||||
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
|
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
|
||||||
$date_exp = $datetime[0];
|
$date_exp = $datetime[0];
|
||||||
$time = $datetime[1];
|
$time = $datetime[1];
|
||||||
} else if ($p['validity_unit'] == 'Mins') {
|
break;
|
||||||
|
case 'Mins':
|
||||||
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' minutes')));
|
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' minutes')));
|
||||||
$date_exp = $datetime[0];
|
$date_exp = $datetime[0];
|
||||||
$time = $datetime[1];
|
$time = $datetime[1];
|
||||||
}
|
break;
|
||||||
} else {
|
|
||||||
$isChangePlan = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ($b['status'] == 'on') {
|
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if ($_app_stage != 'demo') {
|
if ($_app_stage != 'Demo') {
|
||||||
try {
|
try {
|
||||||
if (file_exists($dvc)) {
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
@ -232,7 +233,7 @@ class Package
|
|||||||
}
|
}
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
Message::sendTelegram(
|
Message::sendTelegram(
|
||||||
"Sistem Error. When activate Package. You need to sync manually\n" .
|
"System Error. When activate Package. You need to sync manually\n" .
|
||||||
"Router: $router_name\n" .
|
"Router: $router_name\n" .
|
||||||
"Customer: u$c[username]\n" .
|
"Customer: u$c[username]\n" .
|
||||||
"Plan: p$p[name_plan]\n" .
|
"Plan: p$p[name_plan]\n" .
|
||||||
@ -241,7 +242,7 @@ class Package
|
|||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Message::sendTelegram(
|
Message::sendTelegram(
|
||||||
"Sistem Error. When activate Package. You need to sync manually\n" .
|
"System Error. When activate Package. You need to sync manually\n" .
|
||||||
"Router: $router_name\n" .
|
"Router: $router_name\n" .
|
||||||
"Customer: u$c[username]\n" .
|
"Customer: u$c[username]\n" .
|
||||||
"Plan: p$p[name_plan]\n" .
|
"Plan: p$p[name_plan]\n" .
|
||||||
@ -250,7 +251,7 @@ class Package
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
// if contains 'mikrotik', 'hotspot', 'pppoe', 'radius' then recharge it
|
// if contains 'mikrotik', 'hotspot', 'pppoe', 'radius' then recharge it
|
||||||
if (Validator::containsKeyword($p['device'])) {
|
if (Validator::containsKeyword($p['device'])) {
|
||||||
@ -283,16 +284,14 @@ class Package
|
|||||||
//its already paid
|
//its already paid
|
||||||
$t->price = 0;
|
$t->price = 0;
|
||||||
} else {
|
} else {
|
||||||
if ($p['validity_unit'] == 'Period') {
|
switch ($p['validity_unit']) {
|
||||||
// Postpaid price from field
|
case 'Period':
|
||||||
$add_inv = User::getAttribute("Invoice", $id_customer);
|
$add_inv = User::getAttribute("Invoice", $id_customer);
|
||||||
if (empty($add_inv) or $add_inv == 0) {
|
$t->price = (empty($add_inv) or $add_inv == 0) ? $p['price'] + $add_cost : $add_inv + $add_cost;
|
||||||
$t->price = $p['price'] + $add_cost;
|
break;
|
||||||
} else {
|
default:
|
||||||
$t->price = $add_inv + $add_cost;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$t->price = $p['price'] + $add_cost;
|
$t->price = $p['price'] + $add_cost;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$t->recharged_on = $date_only;
|
$t->recharged_on = $date_only;
|
||||||
@ -337,7 +336,7 @@ class Package
|
|||||||
} else {
|
} else {
|
||||||
// active plan not exists
|
// active plan not exists
|
||||||
$dvc = Package::getDevice($p);
|
$dvc = Package::getDevice($p);
|
||||||
if ($_app_stage != 'demo') {
|
if ($_app_stage != 'Demo') {
|
||||||
try {
|
try {
|
||||||
if (file_exists($dvc)) {
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
@ -347,7 +346,7 @@ class Package
|
|||||||
}
|
}
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
Message::sendTelegram(
|
Message::sendTelegram(
|
||||||
"Sistem Error. When activate Package. You need to sync manually\n" .
|
"System Error. When activate Package. You need to sync manually\n" .
|
||||||
"Router: $router_name\n" .
|
"Router: $router_name\n" .
|
||||||
"Customer: u$c[username]\n" .
|
"Customer: u$c[username]\n" .
|
||||||
"Plan: p$p[name_plan]\n" .
|
"Plan: p$p[name_plan]\n" .
|
||||||
@ -356,7 +355,7 @@ class Package
|
|||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Message::sendTelegram(
|
Message::sendTelegram(
|
||||||
"Sistem Error. When activate Package. You need to sync manually\n" .
|
"System Error. When activate Package. You need to sync manually\n" .
|
||||||
"Router: $router_name\n" .
|
"Router: $router_name\n" .
|
||||||
"Customer: u$c[username]\n" .
|
"Customer: u$c[username]\n" .
|
||||||
"Plan: p$p[name_plan]\n" .
|
"Plan: p$p[name_plan]\n" .
|
||||||
@ -398,13 +397,15 @@ class Package
|
|||||||
$t->price = 0;
|
$t->price = 0;
|
||||||
// its already paid
|
// its already paid
|
||||||
} else {
|
} else {
|
||||||
if ($p['validity_unit'] == 'Period') {
|
switch ($p['validity_unit']) {
|
||||||
// Postpaid price always zero for first time
|
case 'Period':
|
||||||
$note = '';
|
$note = '';
|
||||||
$bills = [];
|
$bills = [];
|
||||||
$t->price = 0;
|
$t->price = 0;
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
$t->price = $p['price'] + $add_cost;
|
$t->price = $p['price'] + $add_cost;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$t->recharged_on = $date_only;
|
$t->recharged_on = $date_only;
|
||||||
@ -456,6 +457,7 @@ class Package
|
|||||||
"\nPrice: " . Lang::moneyFormat($p['price'] + $add_cost) .
|
"\nPrice: " . Lang::moneyFormat($p['price'] + $add_cost) .
|
||||||
"\nNote:\n" . $note);
|
"\nNote:\n" . $note);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($bills) && count($bills) > 0) {
|
if (is_array($bills) && count($bills) > 0) {
|
||||||
User::billsPaid($bills, $id_customer);
|
User::billsPaid($bills, $id_customer);
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
<option value="enable" {if $_c['new_version_notify']=='enable' }selected="selected" {/if}>
|
<option value="enable" {if $_c['new_version_notify']=='enable' }selected="selected" {/if}>
|
||||||
{Lang::T('Enabled')}
|
{Lang::T('Enabled')}
|
||||||
</option>
|
</option>
|
||||||
<option value="disable" {if $_c['new_version_notify']=='disable'
|
<option value="disable" {if $_c['new_version_notify']=='disable' }selected="selected" {/if}>
|
||||||
}selected="selected" {/if}>{Lang::T('Disabled')}
|
{Lang::T('Disabled')}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -139,6 +139,19 @@
|
|||||||
{Lang::T('This will show is Customer currently is online or not')}
|
{Lang::T('This will show is Customer currently is online or not')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">{Lang::T('Extend Package Expiry')}</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<select name="extend_expiry" id="extend_expiry" class="form-control">
|
||||||
|
<option value="yes" {if $_c['extend_expiry']!='no' }selected="selected" {/if}>
|
||||||
|
{Lang::T('Yes')}</option>
|
||||||
|
<option value="no" {if $_c['extend_expiry']=='no' }selected="selected" {/if}>
|
||||||
|
{Lang::T('No')}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<p class="help-block col-md-4">
|
||||||
|
<small> {Lang::T('If user buy same internet plan, expiry date will extend')}</small></p>
|
||||||
|
</div>
|
||||||
<div class="form-group has-error">
|
<div class="form-group has-error">
|
||||||
<label class="col-md-3 control-label">{Lang::T('Allow Balance custom amount')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Allow Balance custom amount')}</label>
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
@ -153,7 +166,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<p class="help-block col-md-4">
|
<p class="help-block col-md-4">
|
||||||
{Lang::T('Allow Customer buy balance with any amount')}
|
{Lang::T('Allow Customer buy balance with any amount')}
|
||||||
<br>*Maybe still have bug
|
<br>*Please report any issue or bugs
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -172,7 +185,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
var sectionTimeoutCheckbox = document.getElementById('enable_session_timeout');
|
var sectionTimeoutCheckbox = document.getElementById('enable_session_timeout');
|
||||||
var timeoutDurationInput = document.getElementById('timeout_duration_input');
|
var timeoutDurationInput = document.getElementById('timeout_duration_input');
|
||||||
var timeoutDurationField = document.getElementById('session_timeout_duration');
|
var timeoutDurationField = document.getElementById('session_timeout_duration');
|
||||||
@ -182,7 +195,7 @@
|
|||||||
timeoutDurationField.required = true;
|
timeoutDurationField.required = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sectionTimeoutCheckbox.addEventListener('change', function() {
|
sectionTimeoutCheckbox.addEventListener('change', function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
timeoutDurationInput.style.display = 'block';
|
timeoutDurationInput.style.display = 'block';
|
||||||
timeoutDurationField.required = true;
|
timeoutDurationField.required = true;
|
||||||
@ -192,7 +205,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector('form').addEventListener('submit', function(event) {
|
document.querySelector('form').addEventListener('submit', function (event) {
|
||||||
if (sectionTimeoutCheckbox.checked && (!timeoutDurationField.value || isNaN(
|
if (sectionTimeoutCheckbox.checked && (!timeoutDurationField.value || isNaN(
|
||||||
timeoutDurationField.value))) {
|
timeoutDurationField.value))) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user