Compare commits

...

9 Commits

Author SHA1 Message Date
04c480cafa Fix cronjob Delete customer 2023-09-01 13:40:26 +07:00
8be8737236 2023.9.1 2023-09-01 09:21:35 +07:00
a8515b7d60 Fix Username in user dashboard 2023-09-01 09:18:17 +07:00
d71eb37f48 add Cancel Button in user dashboard 2023-09-01 09:16:40 +07:00
8fcca70ead Time will not change while extending package 2023-09-01 09:06:00 +07:00
59f6c180cf Critical Fix extending user package 2023-09-01 09:02:39 +07:00
d53c4cf8c8 Best 2023-08-30 15:14:18 +07:00
620bfaeb29 unlink after upload 2023-08-30 11:24:08 +07:00
863dd65145 remove debug echo 2023-08-30 10:22:58 +07:00
9 changed files with 51 additions and 23 deletions

View File

@ -2,6 +2,17 @@
# CHANGELOG
## 2023.9.1.1
- Fix cronjob Delete customer
## 2023.9.1
- Critical bug fixes, bug happen when user buy package, expired time will be calculated from last expired, not from when they buy the package
- Time not change after user buy package for extending
- Add Cancel Button to user dashboard when it show unpaid package
- Fix username in user dashboard
## 2023.8.30
- Upload Logo from settings

View File

@ -39,7 +39,11 @@ class Lang
public static function dateTimeFormat($date){
global $config;
return date($config['date_format']. ' H:i', strtotime($date));
if(strtotime($date) < strtotime("2000-01-01 00:00:00")){
return "";
}else{
return date($config['date_format']. ' H:i', strtotime($date));
}
}
public static function dateAndTimeFormat($date, $time){

View File

@ -19,7 +19,7 @@ class Package
*/
public static function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel)
{
global $_c, $_L, $_notifmsg;
global $_c;
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time_only = date("H:i:s");
@ -102,7 +102,7 @@ class Package
Mikrotik::addHotspotUser($client, $p, $c);
}
if ($b['namebp'] == $p['name_plan']) {
if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
// if it same internet plan, expired will extend
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
@ -200,12 +200,14 @@ class Package
}
if ($b['namebp'] == $p['name_plan']) {
if ($b['namebp'] == $p['name_plan'] && $b['status'] == 'on') {
// if it same internet plan, expired will extend
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
$time = $b['time'];
} else if ($p['validity_unit'] == 'Hrs') {
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
$date_exp = $datetime[0];

View File

@ -229,12 +229,10 @@ switch ($action) {
run_hook('save_settings'); #HOOK
if ($_FILES['logo']['error'] > 0) {
r2(U . 'settings/app', 'e', 'Failed to process logo');
}
if (!empty($_FILES['logo']['name'])) {
if (file_exists('system/uploads/logo.png')) unlink('system/uploads/logo.png');
File::resizeCropImage($_FILES['logo']['tmp_name'], 'system/uploads/logo.png', 1078, 200, 100);
if (file_exists($_FILES['logo']['tmp_name'])) unlink($_FILES['logo']['tmp_name']);
}
if ($company == '') {
r2(U . 'settings/app', 'e', $_L['All_field_is_required']);

View File

@ -19,8 +19,8 @@ ORM::configure('logging', true);
include "autoload/Hookers.php";
// notification message
if(file_exists("system/uploads/notifications.json")){
$_notifmsg =json_decode(file_get_contents('system/uploads/notifications.json'), true);
if (file_exists("system/uploads/notifications.json")) {
$_notifmsg = json_decode(file_get_contents('system/uploads/notifications.json'), true);
}
$_notifmsg_default = json_decode(file_get_contents('system/uploads/notifications.default.json'), true);
@ -66,7 +66,7 @@ date_default_timezone_set($config['timezone']);
$textExpired = Lang::getNotifText('expired');
$d = ORM::for_table('tbl_user_recharges')->where('status', 'on')->where_lte('expiration', date("Y-m-d"))->find_many();
echo "Found ".count($d)." user(s)\n";
echo "Found " . count($d) . " user(s)\n";
run_hook('cronjob'); #HOOK
foreach ($d as $ds) {
@ -84,6 +84,7 @@ foreach ($d as $ds) {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::setHotspotLimitUptime($client, $c['username']);
Mikrotik::removeHotspotActiveUser($client, $c['username']);
Mikrotik::removeHotspotUser($client, $c['username']);
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
}
//update database user dengan status off
@ -106,10 +107,10 @@ foreach ($d as $ds) {
"\nRouter: " . $router_name .
"\nPrice: " . $p['price']);
}
}else{
} else {
echo "no renewall | plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
}
}else{
} else {
echo "no renewall | balance $config[enable_balance] auto_renewal $c[auto_renewal]\n";
}
} else echo " : ACTIVE \r\n";
@ -127,6 +128,7 @@ foreach ($d as $ds) {
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
Mikrotik::disablePpoeUser($client, $c['username']);
Mikrotik::removePpoeActive($client, $c['username']);
Mikrotik::removePpoeUser($client, $c['username']);
Message::sendPackageNotification($c['phonenumber'], $c['fullname'], $u['namebp'], $textExpired, $config['user_notification_expired']);
}

View File

@ -24,7 +24,7 @@
<label class="col-md-2 control-label">{Lang::T('Company Logo')}</label>
<div class="col-md-6">
<input type="file" class="form-control" id="logo" name="logo" accept="image/*">
<span class="help-block">For PDF Reports | Beset size 1078 x 200 | uploaded image will be autosize</span>
<span class="help-block">For PDF Reports | Best size 1078 x 200 | uploaded image will be autosize</span>
</div>
<span class="help-block col-md-4">
<a href="./{$logo}" target="_blank"><img src="./{$logo}" height="48" alt="logo for PDF"></a>

View File

@ -12,8 +12,7 @@
<tbody>
<tr>
<td>{Lang::T('expired')}</td>
<td>{date({$_c['date_format']}, strtotime($unpaid['expired_date']))}
{date('H:i', strtotime($unpaid['expired_date']))} </td>
<td>{Lang::dateTimeFormat($unpaid['expired_date'])} </td>
</tr>
<tr>
<td>{$_L['Plan_Name']}</td>
@ -30,10 +29,22 @@
</tbody>
</table>
<div class="box-footer p-2">
<a class="btn btn-danger btn-block btn-sm" href="{$_url}order/view/{$unpaid['id']}">
<span class="icon"><i class="ion ion-card"></i></span>
<span>{Lang::T('PAY NOW')}</span>
</a>
<div class="btn-group btn-group-justified mb15">
<div class="btn-group">
<a href="{$_url}order/view/{$unpaid['id']}/cancel" class="btn btn-danger btn-sm"
onclick="return confirm('{Lang::T('Cancel it?')}')">
<span class="glyphicon glyphicon-trash"></span>
{Lang::T('Cancel')}
</a>
</div>
<div class="btn-group">
<a class="btn btn-success btn-block btn-sm" href="{$_url}order/view/{$unpaid['id']}">
<span class="icon"><i class="ion ion-card"></i></span>
<span>{Lang::T('PAY NOW')}</span>
</a>
</div>
</div>
</div>
</div>
{/if}
@ -54,7 +65,7 @@
<table class="table table-bordered table-striped table-bordered table-hover">
<tr>
<td class="small text-success text-uppercase text-normal">{$_L['Username']}</td>
<td class="small mb15">{$_bill['username']}</td>
<td class="small mb15">{$_user['username']}</td>
</tr>
<tr>
<td class="small text-success text-uppercase text-normal">{$_L['Password']}</td>

View File

@ -70,10 +70,10 @@
</div>
<div class="btn-group btn-group-justified mb15">
<div class="btn-group">
<button type="submit" class="btn btn-primary">{$_L['Login']}</button>
<a href="{$_url}register" class="btn btn-success">{$_L['Register']}</a>
</div>
<div class="btn-group">
<a href="{$_url}register" class="btn btn-success">{$_L['Register']}</a>
<button type="submit" class="btn btn-primary">{$_L['Login']}</button>
</div>
</div>
</form>

View File

@ -1,3 +1,3 @@
{
"version": "2023.8.30"
"version": "2023.9.1.1"
}