download requisitions_mailer.rb
Language: Ruby
License: GPL
Copyright: (C) 2007 Coupa Software Incorporated http://www.coupa.com
LOC: 27
Project Info
Coupa eProcurement(coupa)
Server: Spider_20090227_inc
Type: filesystem
...5.zip\coupa‑1.5\app\models\
   requisitions_mailer.rb
   user.rb

# Copyright (C) 2007  Coupa Software Incorporated http://www.coupa.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

class RequisitionsMailer < ActionMailer::Base
  helper ActionView::Helpers::UrlHelper
  include FileColumnHelper
  
  @@from_name = "Coupa Requisitions"
  @@from_address = "requisitions@#{server_settings[:domain]}"
  @@from_link = "<a href=\"mailto:#{@@from_address}\">#{@@from_name}</a>"
  @@from = "#{@@from_name} <#{@@from_address}>"
  @@template_subject = 'Coupa requisition email template'
  
  def request_entered(controller, email, requisition_header)
    @subject    = "Requisition ##{requisition_header.id} created"
    @body       = { :requisition_header => requisition_header, :controller => controller }
    @recipients = email.from.first
    @from       = @@from
    @sent_on    = Time.now
    @headers    = {}
    @content_type = 'text/html'
  end
  
  def request_failed(controller, email, errors)
    @subject    = "ERROR: #{email.subject}"
    @body       = { :errors => errors, :controller => controller }
    @recipients = email.from.first
    @from       = @@from
    @sent_on    = Time.now
    @headers    = {}
    @content_type = 'text/html'
  end
end

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us