Project

General

Profile

Feature #3035 » redminder-start-date.patch

for 0.8-stable branch rev. 2475 - Stanislav German-Evtushenko, 2009-03-26 22:07

View differences:

app/models/mailer.rb (working copy)
53 53
         :issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
54 54
  end
55 55

  
56
  def reminder(user, issues, days)
56
  def reminder(user, issues, days, start, sort_key)
57 57
    set_language_if_valid user.language
58 58
    recipients user.mail
59 59
    subject l(:mail_subject_reminder, issues.size)
60 60
    body :issues => issues,
61 61
         :days => days,
62
         :issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => 'due_date', :sort_order => 'asc')
62
         :issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => sort_key, :sort_order => 'asc')
63 63
  end
64 64

  
65 65
  def document_added(document)
......
168 168
    days = options[:days] || 7
169 169
    project = options[:project] ? Project.find(options[:project]) : nil
170 170
    tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
171

  
172
    s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date]
171
    start = options[:start] || nil
172
    if start
173
        s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.start_date = ?", false, days.day.from_now.to_date]
174
	sort_key = "due_date"
175
    else
176
        s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date]
177
	sort_key = "start_date"
178
    end
173 179
    s << "#{Issue.table_name}.assigned_to_id IS NOT NULL"
174 180
    s << "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}"
175 181
    s << "#{Issue.table_name}.project_id = #{project.id}" if project
......
179 185
                                          :conditions => s.conditions
180 186
                                    ).group_by(&:assigned_to)
181 187
    issues_by_assignee.each do |assignee, issues|
182
      deliver_reminder(assignee, issues, days) unless assignee.nil?
188
      deliver_reminder(assignee, issues, days, start, sort_key) unless assignee.nil?
183 189
    end
184 190
  end
185 191

  
lib/redmine/wiki_formatting/textile/formatter.rb (working copy)
30 30
          super
31 31
          self.hard_breaks=true
32 32
          self.no_span_caps=true
33
          self.filter_styles=true
33
#          self.filter_styles=true
34 34
        end
35 35
        
36 36
        def to_html(*rules, &block)
lib/tasks/reminder.rake (working copy)
22 22
  * days     => number of days to remind about (defaults to 7)
23 23
  * tracker  => id of tracker (defaults to all trackers)
24 24
  * project  => id or identifier of project (defaults to all projects)
25
  * start    => remind at for start-date instead of due-date
25 26

  
26 27
Example:
27 28
  rake redmine:send_reminders days=7 RAILS_ENV="production"
......
33 34
    options[:days] = ENV['days'].to_i if ENV['days']
34 35
    options[:project] = ENV['project'] if ENV['project']
35 36
    options[:tracker] = ENV['tracker'].to_i if ENV['tracker']
37
    options[:start] = ENV['start'].to_i if ENV['start']
36 38
    
37 39
    Mailer.reminders(options)
38 40
  end
(1-1/3)