summaryrefslogtreecommitdiff
path: root/FS/FS/msg_template.pm
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-09-23 23:56:32 -0500
committerMark Wells <mark@freeside.biz>2015-10-30 09:44:53 -0700
commit8f702e7cad3edd0a0d57e6406fe006f3ed4d980a (patch)
tree14824c15b83e27a94abb0bc860b483168bfbf9c7 /FS/FS/msg_template.pm
parent8a6f5fee108d0345fd2a73a3adf0f9a6076eaaa4 (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.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm
index c5d17cd..a45733a 100644
--- a/FS/FS/msg_template.pm
+++ b/FS/FS/msg_template.pm
@@ -96,6 +96,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
@@ -671,20 +672,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)),
@@ -695,6 +698,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;
}
}