Patch #4293

Add the possibility to log time through mail receive gateway

Added by Arnaud Ligot over 3 years ago. Updated over 3 years ago.

Status:NewStart date:2009-11-25
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:-

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

History

#1 Updated by Jean-Philippe Lang over 3 years ago

  • Category changed from Email notifications to Email receiving

Also available in: Atom PDF