fix: standardize billing order status values and apply full-day expiry grace rule
- home_handling_functions.php: display expiration as Y-m-d only (not Y-m-d H:i);
apply full-day grace by comparing date-only (midnight) in PHP so a server
expiring on today's date remains Active the entire day
- cron-shop.php Step B & C: change server_expiration_date comparisons from
< DATE_SUB(NOW(), ...) to DATE(server_expiration_date) < DATE_SUB(CURDATE(), ...)
ensuring the full expiration day is honoured
- user_games/check_expire.php: change all three expiration queries from
<= time() to < strtotime(date('Y-m-d')) (today-midnight) for full-day grace
- billing/test_integration.php: replace status='paid' (old order status) with
status IN ('Active','paid') for backward compat during migration
- user_games/billing_integration.php: clarify comment that billing_invoices.status
uses the payment lifecycle ('paid'/'unpaid'/'due'), separate from billing_orders.status
- Add modules/billing/sql/normalize_billing_order_status.sql migration script
to convert installed->Active, paid->Active, suspended->Expired in existing rows
- Update CHANGELOG.md
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/439845e0-926e-4b49-9cd0-810457b73c12
Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
5f3013b4a4
commit
5b2162fb28
7 changed files with 79 additions and 20 deletions
|
|
@ -4,8 +4,8 @@
|
|||
*
|
||||
* Shared helper for recording admin-created game servers in the billing tables,
|
||||
* so they are treated identically to FREE website orders:
|
||||
* billing_invoices (status='paid', amount=0)
|
||||
* billing_orders (status='Active', price=0)
|
||||
* billing_invoices (status='paid', amount=0) — invoice payment status (paid/unpaid/due)
|
||||
* billing_orders (status='Active', price=0) — order lifecycle status (Active/Invoiced/Expired)
|
||||
*
|
||||
* This does NOT re-provision the server — the caller (add_home.php) already
|
||||
* created the server via the panel DB layer. We only write the billing ledger
|
||||
|
|
@ -80,7 +80,11 @@ if (!function_exists('admin_register_server_in_billing')) {
|
|||
$ftp_flag = $ftp ? 'enabled' : 'disabled';
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
// 3. Insert billing_invoice (amount=0, already "paid"). //
|
||||
// 3. Insert billing_invoice (amount=0, payment_status='paid'). //
|
||||
// Note: billing_invoices.status is the invoice payment lifecycle //
|
||||
// ('paid'/'unpaid'/'due') — distinct from billing_orders.status //
|
||||
// which uses the three-value order lifecycle (Active/Invoiced/ //
|
||||
// Expired). //
|
||||
// ------------------------------------------------------------------ //
|
||||
$invoice_fields = array(
|
||||
'order_id' => 0,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,11 @@
|
|||
function exec_ogp_module()
|
||||
{
|
||||
global $db;
|
||||
$expired_servers = $db->resultQuery("SELECT home_name, home_id, server_expiration_date FROM OGP_DB_PREFIXserver_homes WHERE server_expiration_date NOT LIKE 'X' AND server_expiration_date <= ".time().";");
|
||||
// Use strtotime(date('Y-m-d')) (midnight of today) so a server whose
|
||||
// expiration falls on today is still considered active for the full
|
||||
// calendar day. Only timestamps strictly before today midnight are expired.
|
||||
$today_midnight = strtotime(date('Y-m-d'));
|
||||
$expired_servers = $db->resultQuery("SELECT home_name, home_id, server_expiration_date FROM OGP_DB_PREFIXserver_homes WHERE server_expiration_date NOT LIKE 'X' AND server_expiration_date < " . $today_midnight . ";");
|
||||
if($expired_servers)
|
||||
{
|
||||
foreach ((array)$expired_servers as $expired_server)
|
||||
|
|
@ -35,7 +39,7 @@ function exec_ogp_module()
|
|||
}
|
||||
}
|
||||
|
||||
$expired_users = $db->resultQuery("SELECT user_id, home_id, user_expiration_date FROM OGP_DB_PREFIXuser_homes WHERE user_expiration_date NOT LIKE 'X' AND user_expiration_date <= ".time().";");
|
||||
$expired_users = $db->resultQuery("SELECT user_id, home_id, user_expiration_date FROM OGP_DB_PREFIXuser_homes WHERE user_expiration_date NOT LIKE 'X' AND user_expiration_date < " . $today_midnight . ";" );
|
||||
if($expired_users)
|
||||
{
|
||||
foreach ((array)$expired_users as $expired_user)
|
||||
|
|
@ -50,7 +54,7 @@ function exec_ogp_module()
|
|||
INNER JOIN
|
||||
OGP_DB_PREFIXuser_groups ug
|
||||
ON ug.group_id=g.group_id
|
||||
WHERE g.user_group_expiration_date NOT LIKE 'X' AND g.user_group_expiration_date <= ".time()." GROUP BY g.home_id;");
|
||||
WHERE g.user_group_expiration_date NOT LIKE 'X' AND g.user_group_expiration_date < " . $today_midnight . " GROUP BY g.home_id;");
|
||||
if($expired_groups)
|
||||
{
|
||||
foreach ((array)$expired_groups as $expired_group)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue