Bugs Fixes
fix extend expiry bug
This commit is contained in:
parent
fec7780f50
commit
b7fdc90aa7
@ -195,34 +195,35 @@ class Package
|
||||
|
||||
if ($b) {
|
||||
$lastExpired = Lang::dateAndTimeFormat($b['expiration'], $b['time']);
|
||||
$isChangePlan = false;
|
||||
if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
|
||||
if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on' && $config['extend_expiry'] == 'yes') {
|
||||
// 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'));
|
||||
$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'));
|
||||
$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'));
|
||||
$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')));
|
||||
$date_exp = $datetime[0];
|
||||
$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')));
|
||||
$date_exp = $datetime[0];
|
||||
$time = $datetime[1];
|
||||
}
|
||||
} else {
|
||||
$isChangePlan = true;
|
||||
break;
|
||||
}
|
||||
|
||||
//if ($b['status'] == 'on') {
|
||||
$dvc = Package::getDevice($p);
|
||||
if ($_app_stage != 'demo') {
|
||||
if ($_app_stage != 'Demo') {
|
||||
try {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
@ -232,7 +233,7 @@ class Package
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
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" .
|
||||
"Customer: u$c[username]\n" .
|
||||
"Plan: p$p[name_plan]\n" .
|
||||
@ -241,7 +242,7 @@ class Package
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
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" .
|
||||
"Customer: u$c[username]\n" .
|
||||
"Plan: p$p[name_plan]\n" .
|
||||
@ -250,7 +251,7 @@ class Package
|
||||
);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
// if contains 'mikrotik', 'hotspot', 'pppoe', 'radius' then recharge it
|
||||
if (Validator::containsKeyword($p['device'])) {
|
||||
@ -283,16 +284,14 @@ class Package
|
||||
//its already paid
|
||||
$t->price = 0;
|
||||
} else {
|
||||
if ($p['validity_unit'] == 'Period') {
|
||||
// Postpaid price from field
|
||||
switch ($p['validity_unit']) {
|
||||
case 'Period':
|
||||
$add_inv = User::getAttribute("Invoice", $id_customer);
|
||||
if (empty($add_inv) or $add_inv == 0) {
|
||||
$t->price = $p['price'] + $add_cost;
|
||||
} else {
|
||||
$t->price = $add_inv + $add_cost;
|
||||
}
|
||||
} else {
|
||||
$t->price = (empty($add_inv) or $add_inv == 0) ? $p['price'] + $add_cost : $add_inv + $add_cost;
|
||||
break;
|
||||
default:
|
||||
$t->price = $p['price'] + $add_cost;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$t->recharged_on = $date_only;
|
||||
@ -337,7 +336,7 @@ class Package
|
||||
} else {
|
||||
// active plan not exists
|
||||
$dvc = Package::getDevice($p);
|
||||
if ($_app_stage != 'demo') {
|
||||
if ($_app_stage != 'Demo') {
|
||||
try {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
@ -347,7 +346,7 @@ class Package
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
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" .
|
||||
"Customer: u$c[username]\n" .
|
||||
"Plan: p$p[name_plan]\n" .
|
||||
@ -356,7 +355,7 @@ class Package
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
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" .
|
||||
"Customer: u$c[username]\n" .
|
||||
"Plan: p$p[name_plan]\n" .
|
||||
@ -398,13 +397,15 @@ class Package
|
||||
$t->price = 0;
|
||||
// its already paid
|
||||
} else {
|
||||
if ($p['validity_unit'] == 'Period') {
|
||||
// Postpaid price always zero for first time
|
||||
switch ($p['validity_unit']) {
|
||||
case 'Period':
|
||||
$note = '';
|
||||
$bills = [];
|
||||
$t->price = 0;
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
$t->price = $p['price'] + $add_cost;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$t->recharged_on = $date_only;
|
||||
@ -456,6 +457,7 @@ class Package
|
||||
"\nPrice: " . Lang::moneyFormat($p['price'] + $add_cost) .
|
||||
"\nNote:\n" . $note);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($bills) && count($bills) > 0) {
|
||||
User::billsPaid($bills, $id_customer);
|
||||
|
@ -19,8 +19,8 @@
|
||||
<option value="enable" {if $_c['new_version_notify']=='enable' }selected="selected" {/if}>
|
||||
{Lang::T('Enabled')}
|
||||
</option>
|
||||
<option value="disable" {if $_c['new_version_notify']=='disable'
|
||||
}selected="selected" {/if}>{Lang::T('Disabled')}
|
||||
<option value="disable" {if $_c['new_version_notify']=='disable' }selected="selected" {/if}>
|
||||
{Lang::T('Disabled')}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -139,6 +139,19 @@
|
||||
{Lang::T('This will show is Customer currently is online or not')}
|
||||
</p>
|
||||
</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">
|
||||
<label class="col-md-3 control-label">{Lang::T('Allow Balance custom amount')}</label>
|
||||
<div class="col-md-5">
|
||||
@ -153,7 +166,7 @@
|
||||
</div>
|
||||
<p class="help-block col-md-4">
|
||||
{Lang::T('Allow Customer buy balance with any amount')}
|
||||
<br>*Maybe still have bug
|
||||
<br>*Please report any issue or bugs
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -172,7 +185,7 @@
|
||||
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var sectionTimeoutCheckbox = document.getElementById('enable_session_timeout');
|
||||
var timeoutDurationInput = document.getElementById('timeout_duration_input');
|
||||
var timeoutDurationField = document.getElementById('session_timeout_duration');
|
||||
@ -182,7 +195,7 @@
|
||||
timeoutDurationField.required = true;
|
||||
}
|
||||
|
||||
sectionTimeoutCheckbox.addEventListener('change', function() {
|
||||
sectionTimeoutCheckbox.addEventListener('change', function () {
|
||||
if (this.checked) {
|
||||
timeoutDurationInput.style.display = 'block';
|
||||
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(
|
||||
timeoutDurationField.value))) {
|
||||
event.preventDefault();
|
||||
|
Loading…
x
Reference in New Issue
Block a user