liquid_feedback_core
changeset 231:61e20e161e9b
Bugfix in function "write_event_initiative_revoked_trigger": Set "draft_id" in "event" table
author | jbe |
---|---|
date | Sat Mar 10 18:04:03 2012 +0100 (2012-03-10) |
parents | 592c6a236523 |
children | cf8a090503c0 |
files | core.sql |
line diff
1.1 --- a/core.sql Mon Mar 05 20:06:52 2012 +0100 1.2 +++ b/core.sql Sat Mar 10 18:04:03 2012 +0100 1.3 @@ -1285,19 +1285,23 @@ 1.4 RETURNS TRIGGER 1.5 LANGUAGE 'plpgsql' VOLATILE AS $$ 1.6 DECLARE 1.7 - "issue_row" "issue"%ROWTYPE; 1.8 + "issue_row" "issue"%ROWTYPE; 1.9 + "draft_id_v" "draft"."id"%TYPE; 1.10 BEGIN 1.11 - SELECT * INTO "issue_row" FROM "issue" 1.12 - WHERE "id" = NEW."issue_id"; 1.13 IF OLD."revoked" ISNULL AND NEW."revoked" NOTNULL THEN 1.14 + SELECT * INTO "issue_row" FROM "issue" 1.15 + WHERE "id" = NEW."issue_id"; 1.16 + SELECT "id" INTO "draft_id_v" FROM "current_draft" 1.17 + WHERE "initiative_id" = NEW."id"; 1.18 INSERT INTO "event" ( 1.19 - "event", "member_id", "issue_id", "state", "initiative_id" 1.20 + "event", "member_id", "issue_id", "state", "initiative_id", "draft_id" 1.21 ) VALUES ( 1.22 'initiative_revoked', 1.23 NEW."revoked_by_member_id", 1.24 NEW."issue_id", 1.25 "issue_row"."state", 1.26 - NEW."id" ); 1.27 + NEW."id", 1.28 + "draft_id_v"); 1.29 END IF; 1.30 RETURN NULL; 1.31 END;