Author: hhubner Date: 2006-11-08 02:01:18 -0500 (Wed, 08 Nov 2006) New Revision: 2064
Modified: trunk/projects/bos/m2/m2.lisp trunk/projects/bos/m2/mail-generator.lisp Log: Allow for country-specific emails. Contract data is now sent to the danish office for danish contracts. Other countries can be added by changing mail-generator.lisp.
Modified: trunk/projects/bos/m2/m2.lisp =================================================================== --- trunk/projects/bos/m2/m2.lisp 2006-11-08 06:59:43 UTC (rev 2063) +++ trunk/projects/bos/m2/m2.lisp 2006-11-08 07:01:18 UTC (rev 2064) @@ -346,7 +346,7 @@ (format t "profil.name = ~S;~%" (string-safe (or (user-full-name sponsor) "[anonym]"))) (format t "profil.country = ~S;~%" (or (sponsor-country sponsor) "[unbekannt]")) (format t "profil.anzahl = ~D;~%" (loop for contract in paid-contracts - sum (length (contract-m2s contract)))) + sum (length (contract-m2s contract)))) (format t "profil.nachricht = '~A';~%" (string-safe (sponsor-info-text sponsor))) (format t "profil.contracts = [ ];~%") (loop for contract in paid-contracts
Modified: trunk/projects/bos/m2/mail-generator.lisp =================================================================== --- trunk/projects/bos/m2/mail-generator.lisp 2006-11-08 06:59:43 UTC (rev 2063) +++ trunk/projects/bos/m2/mail-generator.lisp 2006-11-08 07:01:18 UTC (rev 2064) @@ -2,6 +2,13 @@
(enable-interpol-syntax)
+(defvar *country->office-email* '(("DK" . "service@bosdanmark.dk"))) + +(defun contract-office-email (contract) + "Return the email address of the MXM office responsible for handling a contract" + (or (cdr (assoc (sponsor-country (contract-sponsor contract)) *country->office-email* :test #'string-equal)) + *office-mail-address*)) + (defun send-system-mail (&key (to *office-mail-address*) (subject "(no subject") (text "(no text)") (content-type "text/plain; charset=UTF-8") more-headers) (send-smtp "localhost" *mail-sender* to (format nil "X-Mailer: BKNR-BOS-mailer @@ -151,7 +158,8 @@ :encoding :base64 :content (file-contents (contract-pdf-pathname contract :print t))) mime-parts)) - (send-system-mail :subject (format nil "~A-Spenderdaten - Sponsor-ID ~D Contract-ID ~D" + (send-system-mail :to (contract-office-email contract) + :subject (format nil "~A-Spenderdaten - Sponsor-ID ~D Contract-ID ~D" type (store-object-id (contract-sponsor contract)) (store-object-id contract))