Resolved trigger issue for payment/ihb numbers.

This commit is contained in:
Patrick Fic
2021-02-24 11:53:42 -08:00
parent 25869368b9
commit 7f02c130a2
4 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,11 @@
- args:
cascade: false
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.assign_ibh_number()\n RETURNS trigger\n
LANGUAGE plpgsql\nAS $function$\n begin\n IF NEW.isinhouse = true
and (new.invoice_number is null or new.invoice_number = 'ih') THEN\n UPDATE
counters\n\tSET count = count + 1\n\twhere shopid = (select shopid from jobs
where jobs.id = new.jobid)\n\tAND countertype = 'ihbnum'\n\tRETURNING concat(prefix,count)
into new.invoice_number;\n\n END IF;\n RETURN NEW;\n END;\n
\ $function$;"
type: run_sql