# HG changeset patch # User jbe # Date 1331399043 -3600 # Node ID 61e20e161e9b5c4bd6aadbea30468b59e83f5bdd # Parent 592c6a236523e540c1b732fcd087c32cc3bb0378 Bugfix in function "write_event_initiative_revoked_trigger": Set "draft_id" in "event" table diff -r 592c6a236523 -r 61e20e161e9b core.sql --- a/core.sql Mon Mar 05 20:06:52 2012 +0100 +++ b/core.sql Sat Mar 10 18:04:03 2012 +0100 @@ -1285,19 +1285,23 @@ RETURNS TRIGGER LANGUAGE 'plpgsql' VOLATILE AS $$ DECLARE - "issue_row" "issue"%ROWTYPE; + "issue_row" "issue"%ROWTYPE; + "draft_id_v" "draft"."id"%TYPE; BEGIN - SELECT * INTO "issue_row" FROM "issue" - WHERE "id" = NEW."issue_id"; IF OLD."revoked" ISNULL AND NEW."revoked" NOTNULL THEN + SELECT * INTO "issue_row" FROM "issue" + WHERE "id" = NEW."issue_id"; + SELECT "id" INTO "draft_id_v" FROM "current_draft" + WHERE "initiative_id" = NEW."id"; INSERT INTO "event" ( - "event", "member_id", "issue_id", "state", "initiative_id" + "event", "member_id", "issue_id", "state", "initiative_id", "draft_id" ) VALUES ( 'initiative_revoked', NEW."revoked_by_member_id", NEW."issue_id", "issue_row"."state", - NEW."id" ); + NEW."id", + "draft_id_v"); END IF; RETURN NULL; END;