liquid_feedback_frontend
view app/main/interest/_action/update.lua @ 985:6d05e28e1112
Updated Greek translation
| author | Stratos Zolotas | 
|---|---|
| date | Wed Mar 20 09:06:39 2013 +0100 (2013-03-20) | 
| parents | 072fa7a9e0fc | 
| children | 701a5cf6b067 | 
 line source
     1 local issue_id = assert(param.get("issue_id", atom.integer), "no issue id given")
     3 local interest = Interest:by_pk(issue_id, app.session.member.id)
     5 local issue = Issue:new_selector():add_where{ "id = ?", issue_id }:for_share():single_object_mode():exec()
     7 if issue.closed then
     8   slot.put_into("error", _"This issue is already closed.")
     9   return false
    10 elseif issue.fully_frozen then 
    11   slot.put_into("error", _"Voting for this issue has already begun.")
    12   return false
    13 elseif 
    14   (issue.half_frozen and issue.phase_finished) or
    15   (not issue.accepted and issue.phase_finished) 
    16 then
    17   slot.put_into("error", _"Current phase is already closed.")
    18   return false
    19 end
    21 if param.get("delete", atom.boolean) then
    22   if interest then
    23     interest:destroy()
    24     --slot.put_into("notice", _"Interest removed")
    25   else
    26     --slot.put_into("notice", _"Interest not existent")
    27   end
    28   return
    29 end
    31 if not app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
    32   error("access denied")
    33 end
    35 if not interest then
    36   interest = Interest:new()
    37   interest.issue_id   = issue_id
    38   interest.member_id  = app.session.member_id
    39 end
    41 interest:save()
    43 --slot.put_into("notice", _"Interest updated")
