سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 22:00 UTC
Extend prepared server immutability guard to finalized cheques
davoodmehraban89 committed
Sep 29, 2026 at 22:38 UTC
88d282b1c0d429adfc01ab41cf1ff2ecec719d9c
1 file changed
+2
-1
supabase/migrations/20260929190000_posted_source_immutability_guard.sql
+2
-1
@@ -12,7 +12,7 @@ declare
12
voucher_status text := '';
13
source_locked boolean := false;
14
begin
15
- if old.collection not in ('invoices','purchases','payments','expenses','contractStatements') then
15
+ if old.collection not in ('invoices','purchases','payments','expenses','cheques','contractStatements') then
16
return case when tg_op='DELETE' then old else new end;
17
end if;
18
@@ -26,6 +26,7 @@ begin
26
27
source_locked :=
28
coalesce(old.data->>'accountingStatus','')='posted'
29
+ or (old.collection='cheques' and coalesce(old.data->>'status','') in ('cleared','bounced','cancelled'))
30
or (old.collection='contractStatements' and coalesce(old.data->>'status','') in ('posted','reversed'))
31
or voucher_status in ('posted','reversed');
32