delete used Voucher more than 3 months

This commit is contained in:
Ibnu Maksum 2024-07-24 09:04:17 +07:00
parent e3796d38e4
commit df2e548a2a
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 8 additions and 3 deletions

View File

@ -480,7 +480,10 @@ switch ($action) {
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
}
$d = ORM::for_table('tbl_voucher')->where_equal('status', '1')->findMany();
$time3months = strtotime('-3 months');
$d = ORM::for_table('tbl_voucher')->where_equal('status', '1')
->where_raw("UNIX_TIMESTAMP(used_date) < $time3months")
->findMany();
if ($d) {
$jml = 0;
foreach ($d as $v) {

View File

@ -661,5 +661,6 @@
"Internet_Voucher_Expired": "Internet Voucher Expired",
"": "",
"Additional_Billing": "Additional Billing",
"_": "-"
"_": "-",
"Used_Date": "Used Date"
}

View File

@ -127,6 +127,7 @@
"ALTER TABLE `rad_acct` MODIFY `id` bigint NOT NULL AUTO_INCREMENT;"
],
"2024.7.24" : [
"ALTER TABLE `tbl_voucher` ADD `used_date` DATETIME NULL DEFAULT NULL AFTER `status`;"
"ALTER TABLE `tbl_voucher` ADD `used_date` DATETIME NULL DEFAULT NULL AFTER `status`;",
"UPDATE `tbl_voucher` SET `used_date`=now() WHERE `status`=1;"
]
}