diff --git a/Content.Server/Backmen/Economy/Wage/WageManagerSystem.cs b/Content.Server/Backmen/Economy/Wage/WageManagerSystem.cs index 0d2803589bb..f954aff1b5b 100644 --- a/Content.Server/Backmen/Economy/Wage/WageManagerSystem.cs +++ b/Content.Server/Backmen/Economy/Wage/WageManagerSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.Backmen.Economy; +using System.Linq; +using Content.Shared.Backmen.Economy; using Content.Shared.FixedPoint; using Content.Shared.GameTicking; using Content.Shared.Roles; @@ -62,7 +63,7 @@ public override void Shutdown() public void OnPayday(WagePaydayEvent ev) { - foreach (var payout in PayoutsList) + foreach (var payout in PayoutsList.ToArray()) { // бонусная зп на отдел? if (ev.WhiteListTo.Count > 0 && !ev.WhiteListTo.Contains(payout.ToAccountNumber)) @@ -71,6 +72,12 @@ public void OnPayday(WagePaydayEvent ev) } var val = ev.Value ?? payout.PayoutAmount; + if (TerminatingOrDeleted(payout.ToAccountNumber) || TerminatingOrDeleted(payout.FromAccountNumber)) + { + PayoutsList.Remove(payout); + continue; + } + _bankManagerSystem.TryTransferFromToBankAccount( payout.FromAccountNumber, payout.ToAccountNumber,