Changeset 714
- Timestamp:
- 11/02/07 13:55:41 (1 year ago)
- Files:
-
- trunk/app/models/notification_mailer.rb (modified) (4 diffs)
- trunk/app/views/notification_mailer/task_notification.rhtml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/models/notification_mailer.rb
r713 r714 11 11 12 12 # Functions that the ModelObserver runs when corresponding events 13 # for tasks take place 13 # for models take place. These class methods are named based on the 14 # name of a model and the event name: "#{model name}_#{event name}" 14 15 15 16 def self.customer_created(customer) … … 34 35 def self.task_assigned_workers(task) 35 36 return unless task.added_worker_ids and not task.added_worker_ids.empty? 36 assigned_workers_with_email = User.find(:all, :conditions => ["id IN (?) AND email IS NOT NULL AND email != '' AND notify_on_task_worker = ?", task.added_worker_ids, true])37 assigned_workers_with_email = User.find(:all, :conditions => ["id IN (?) AND email IS NOT NULL AND email != ? AND notify_on_task_worker = ?", task.added_worker_ids, '', true]) 37 38 return if assigned_workers_with_email.empty? 38 39 … … 101 102 end 102 103 104 task_url = url_for(:host => ApplicationController.host, :controller => 'task', :action => 'view', :id => task.id) 105 asset = task.asset 106 107 message = localize("Task {%i} (%s) - %s\n\n%s\n\nAsset: %s (%s)\n", task.id, task.task_type.name, task_url, task.short_description, asset.full_code, asset.name) 108 message += localize("Asset type: %s\n", asset.asset_type.name) if asset.asset_type 109 message += localize("Creation date: %s\nCreator: %s", format_datetime(task.created_at), task.creator.login_and_name) 110 103 111 recipients recipient 104 112 subject "NorfelloCMMS: #{title}" 105 113 from NotificationMailer.email_sender 106 114 sent_on Time.now 107 body : task => task, :asset => task.asset, :task_url => url_for(:host => ApplicationController.host, :controller => 'task', :action => 'view', :id => task.id), :automatic_message => automatic_message115 body :message => message, :automatic_message => automatic_message 108 116 109 NotificationMailer._info "Mail generated for task ID:#{task.id} on event :#{event}"117 NotificationMailer._info("Mail generated for task ID:#{task.id} on event :#{event}") 110 118 end 111 119 … … 131 139 132 140 private 141 133 142 def localize(msg, *args) 134 143 # English is used for all messages 135 144 return msg % args 136 145 end 146 147 def format_datetime(datetime) 148 # English is used for all messages 149 return datetime.strftime('%Y-%m-%d %H:%M:%S') 150 end 137 151 end trunk/app/views/notification_mailer/task_notification.rhtml
r652 r714 1 <%= _('Task {%i} (%s) - %s', @task.id, @task.task_type.name, @task_url) %> 2 3 <%= @task.short_description %> 4 5 <%= _('Asset') %>: <%= "#{@asset.full_code} (#{@asset.name})" %> 6 <% if @asset.asset_type -%> 7 <%= _('Asset type') %>: <%= @asset.asset_type.name %> 8 <% end -%> 9 <%= _('Creation date') %>: <%= Localization.format_date(@task.created_at) %> 10 <%= _('Creator') %>: <%= @task.creator.login_and_name %> 1 <%= @message %> 11 2 12 3 ----