From 6888a09b5fe9f019834c71cbafbce289fc6bc37a Mon Sep 17 00:00:00 2001
From: Ferywir <65760459+Ferywir@users.noreply.github.com>
Date: Mon, 22 Jun 2026 17:41:28 +0200
Subject: [PATCH] fix(admin): let editPlus subtract Plus/bonus days as the form
advertises (#254)
---
Admin/Templates/editPlus.tpl | 2 +-
GameEngine/Admin/Mods/editPlus.php | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Admin/Templates/editPlus.tpl b/Admin/Templates/editPlus.tpl
index 9f60ba38..da734cea 100644
--- a/Admin/Templates/editPlus.tpl
+++ b/Admin/Templates/editPlus.tpl
@@ -71,7 +71,7 @@ if($id){
-
ℹ️ The values add up. Put 5 to add 5 days.
+ ℹ️ The values add up. Put 5 to add 5 days, -5 to remove 5 days.
📊 Current Active Bonuses
diff --git a/GameEngine/Admin/Mods/editPlus.php b/GameEngine/Admin/Mods/editPlus.php
index f6678caf..f7c35d7b 100755
--- a/GameEngine/Admin/Mods/editPlus.php
+++ b/GameEngine/Admin/Mods/editPlus.php
@@ -64,7 +64,9 @@ if (!$user) {
foreach ($bonusDuration as $key => $add) {
$current = (int)($user[$key] ?? 0);
$base = $current < $time ? $time : $current;
- $bonusDuration[$key] = $add > 0 ? $base + $add : $current;
+ // A negative value subtracts days (the form advertises "Add / Remove Days").
+ // 0 leaves the current expiry untouched; the clamp below caps it at "expired".
+ $bonusDuration[$key] = $add != 0 ? $base + $add : $current;
if ($bonusDuration[$key] < $time) {
$bonusDuration[$key] = 0;
}