diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-09-23 23:56:32 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-09-23 23:56:32 -0500 |
commit | c34a48fd2107adbc7ea08cf3aae007d70ec60b61 (patch) | |
tree | a9b347662524b15cb0be802240a63bcaa8fa5725 /FS/FS/msg_template.pm | |
parent | 1c83c4c02ba6d35ffbabe71bfd4cf6e70afbb894 (diff) |
RT#37908: Convert existing email-sending code to use common interface [removed template confs]
Diffstat (limited to 'FS/FS/msg_template.pm')
-rw-r--r-- | FS/FS/msg_template.pm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index 4c2ac4bd4..49403889c 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -94,6 +94,7 @@ sub _rebless { my $class = 'FS::msg_template::' . $self->msgclass; eval "use $class;"; bless($self, $class) unless $@; + warn "Error loading msg_template msgclass: " . $@ if $@; #or die? # merge in the extension fields (but let fields in $self override them) # except don't ever override the extension's primary key, it's immutable @@ -657,20 +658,22 @@ sub _upgrade_data { [ 'decline_msgnum', 'declinetemplate', '', '', '' ], [ 'impending_recur_msgnum', 'impending_recur_template', '', '', 'impending_recur_bcc' ], [ 'payment_receipt_msgnum', 'payment_receipt_email', '', '', '' ], - [ 'welcome_msgnum', 'welcome_email', 'welcome_email-subject', 'welcome_email-from', '' ], - [ 'warning_msgnum', 'warning_email', 'warning_email-subject', 'warning_email-from', '' ], + [ 'welcome_msgnum', 'welcome_email', 'welcome_email-subject', 'welcome_email-from', '', 'welcome_email-mimetype' ], + [ 'threshold_warning_msgnum', 'warning_email', 'warning_email-subject', 'warning_email-from', 'warning_email-cc', 'warning_email-mimetype' ], ); my @agentnums = ('', map {$_->agentnum} qsearch('agent', {})); foreach my $agentnum (@agentnums) { foreach (@fixes) { - my ($newname, $oldname, $subject, $from, $bcc) = @$_; + my ($newname, $oldname, $subject, $from, $bcc, $mimetype) = @$_; + if ($conf->exists($oldname, $agentnum)) { my $new = new FS::msg_template({ + 'msgclass' => 'email', 'msgname' => $oldname, 'agentnum' => $agentnum, 'from_addr' => ($from && $conf->config($from, $agentnum)) || '', - 'bcc_addr' => ($bcc && $conf->config($from, $agentnum)) || '', + 'bcc_addr' => ($bcc && $conf->config($bcc, $agentnum)) || '', 'subject' => ($subject && $conf->config($subject, $agentnum)) || '', 'mime_type' => 'text/html', 'body' => join('<BR>',$conf->config($oldname, $agentnum)), @@ -681,6 +684,8 @@ sub _upgrade_data { $conf->delete($oldname, $agentnum); $conf->delete($from, $agentnum) if $from; $conf->delete($subject, $agentnum) if $subject; + $conf->delete($bcc, $agentnum) if $bcc; + $conf->delete($mimetype, $agentnum) if $mimetype; } } |