From 8d46fc78ae6407c9d2c09089c88969b0bbe28388 Mon Sep 17 00:00:00 2001 From: Ferywir Date: Thu, 11 Jun 2026 21:20:09 +0200 Subject: [PATCH] feat(preferences): apply report filter (suppress merchant-transfer reports) [#198] Honour the per-user report-filter checkboxes in marketComplete(): - v4: recipient gets no report for transfers between own villages - v6: recipient gets no report for transfers from foreign villages - v5: sender gets no report for transfers to foreign villages The user row is already fully loaded by getUserFields(), so the prefs are read without extra queries. Removes the "not coded yet" tag from the report-filter section in the preferences form. Co-Authored-By: Claude Opus 4.8 --- GameEngine/Automation.php | 13 +++++++++++-- Templates/Profile/preference.tpl | 5 +---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 08b52f89..a8cdcd25 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -641,8 +641,17 @@ class Automation { $ownally = $userData_from['alliance']; $targetally = $userData_to['alliance']; - $database->addNotice($to['owner'],$to['wref'],$targetally,$sort_type,''.addslashes($from['name']).' send resources to '.addslashes($to['name']).'',''.$from['owner'].','.$from['wref'].','.$data['wood'].','.$data['clay'].','.$data['iron'].','.$data['crop'].'',$data['endtime']); - if($from['owner'] != $to['owner']) { + // Report filter preferences (#198): skip merchant-transfer notices + // according to the saved checkboxes of the involved players. + // v4 -> recipient: no report for transfers to own villages + // v6 -> recipient: no report for transfers from foreign villages + // v5 -> sender: no report for transfers to foreign villages + $ownTransfer = ($from['owner'] == $to['owner']); + $skipRecipient = $ownTransfer ? !empty($userData_to['v4']) : !empty($userData_to['v6']); + if(!$skipRecipient) { + $database->addNotice($to['owner'],$to['wref'],$targetally,$sort_type,''.addslashes($from['name']).' send resources to '.addslashes($to['name']).'',''.$from['owner'].','.$from['wref'].','.$data['wood'].','.$data['clay'].','.$data['iron'].','.$data['crop'].'',$data['endtime']); + } + if(!$ownTransfer && empty($userData_from['v5'])) { $database->addNotice($from['owner'],$to['wref'],$ownally,$sort_type,''.addslashes($from['name']).' send resources to '.addslashes($to['name']).'',''.$from['owner'].','.$from['wref'].','.$data['wood'].','.$data['clay'].','.$data['iron'].','.$data['crop'].'',$data['endtime']); } $database->modifyResource($data['to'],$data['wood'],$data['clay'],$data['iron'],$data['crop'],1); diff --git a/Templates/Profile/preference.tpl b/Templates/Profile/preference.tpl index 41ee994e..7e695c67 100644 --- a/Templates/Profile/preference.tpl +++ b/Templates/Profile/preference.tpl @@ -406,10 +406,7 @@ if(isset($_POST['lang'])) - Report filter - - - +