Sha256: e9d084a3d22ba4a68ee55e3e5f8114c5110ee3f177538994ded0072c1dae653b
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
class Knjtasks::Task_assigned_user < Knj::Datarow has_one [ {:class => :User, :required => true}, {:class => :Task, :required => true} ] def self.list(d) sql = "SELECT #{table}.* FROM #{table}" join_task = true if d.args["orderby"] == "project_task_names" join_task = true if d.args["task_status_not"] if join_task orderby = "project_task_names" d.args.delete("orderby") sql += " LEFT JOIN Task ON Task.id = #{table}.task_id LEFT JOIN Project ON Project.id = Task.project_id " end sql += " WHERE 1=1" ret = list_helper(d) d.args.each do |key, val| case key when "task_status_not" sql += " AND Task.status != '#{d.db.esc(val)}'" else raise sprintf(_("Invalid key: %s."), key) end end sql += ret[:sql_where] if orderby == "task_name" sql += " ORDER BY Project.name, Task.name" else sql += ret[:sql_order] end sql += ret[:sql_limit] return d.ob.list_bysql(table, sql) end def self.add(d) link = d.ob.get_by(:Task_assigned_user, { "task_id" => d.data[:task_id], "user_id" => d.data[:user_id] }) raise _("That user is already assigned to that task.") if link end def add_after(d) task.send_notify_assigned(user, _site.user) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
knjtasks-0.0.3 | models/class_task_assigned_user.rb |