Project

General

Profile

Patch #4293

Updated by Toshi MARUYAMA almost 11 years ago

to test: 

 Just send typical mail to update an issue and add a line with "Time:X.XX" in it 


 Best regards, 

 Arnaud Ligot. 

 # svn diff 

 <pre><code class="diff"> 
 Index: app/models/mail_handler.rb 
 =================================================================== 
 --- app/models/mail_handler.rb    (revision 3092) 
 +++ app/models/mail_handler.rb    (working copy) 
 @@ -34,6 +34,7 @@ 
      @@handler_options[:allow_override] << 'project' unless @@handler_options[:issue].has_key?(:project) 
      # Status overridable by default 
      @@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status)     
 +      @@handler_options[:allow_override] << 'time' unless @@handler_options[:issue].has_key?(:time) 
      super email 
    end 
   
 @@ -144,6 +145,18 @@ 
      issue.save! 
      add_attachments(issue) 
      logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger && logger.info 
 +     
 +      #add time functions 
 +      time = get_keyword(:time) 
 +      if (time) 
 +        t = issue.time_entries.new 
 +        t.spent_on = Time.now 
 +        t.user_id = user.id 
 +        t.hours = time 
 +        t.save! 
 +        logger.info "MailHandler: time entry of #{t.hours} hours added to issue ##{issue.id}" if logger && logger.info 
 +      end 
 + 
      issue 
    end 
   
 @@ -173,6 +186,18 @@ 
      if status && issue.new_statuses_allowed_to(user).include?(status) 
        issue.status = status 
      end 
 +     
 +      #add time functions 
 +      time = get_keyword(:time) 
 +      if (time) 
 +        t = issue.time_entries.new 
 +        t.spent_on = Time.now 
 +        t.user_id = user.id 
 +        t.hours = time 
 +        t.save! 
 +        logger.info "MailHandler: time entry of #{t.hours} hours added to issue ##{issue.id}" if logger && logger.info 
 +      end 
 + 
      issue.save! 
      logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info 
      journal 
 </code></pre>

Back