liquid_feedback_frontend
diff app/main/admin/_action/cancel_issue.lua @ 1025:413fd413c4d9
Added action for admin cancel issue
author | bsw |
---|---|
date | Sun Aug 11 22:23:35 2013 +0200 (2013-08-11) |
parents | |
children | 42edba78d946 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/admin/_action/cancel_issue.lua Sun Aug 11 22:23:35 2013 +0200 1.3 @@ -0,0 +1,27 @@ 1.4 +local issue = Issue 1.5 + :new_selector() 1.6 + :add_where{ "id = ?", param.get_id()} 1.7 + :single_object_mode() 1.8 + :for_update() 1.9 + :exec() 1.10 + 1.11 +if issue.closed then 1.12 + error("issue is already closed") 1.13 + return false 1.14 +end 1.15 + 1.16 +issue.state = "canceled_by_admin" 1.17 +issue.closed = "now" 1.18 + 1.19 +local admin_notice 1.20 +if issue.admin_notice then 1.21 + admin_notice = issue.admin_notice .. "\n\n" 1.22 +else 1.23 + admin_notice = "" 1.24 +end 1.25 + 1.26 +admin_notice = admin_notice .. param.get("admin_notice") 1.27 + 1.28 +issue.admin_notice = admin_notice 1.29 + 1.30 +issue:save()