Project

General

Profile

Actions

Patch #4293

closed

Add the possibility to log time through mail receive gateway

Added by Arnaud Ligot over 15 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
-
Start date:
2009-11-25
Due date:
% Done:

0%

Estimated time:

Description

to test:

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

Best regards,

Arnaud Ligot.

  1. svn 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
Actions

Also available in: Atom PDF