summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Action
diff options
context:
space:
mode:
authormark <mark>2010-09-22 23:04:32 +0000
committermark <mark>2010-09-22 23:04:32 +0000
commit523edd344793bba1c53a622dcc618e74a962bcb6 (patch)
treee9cef77a51cd9dc0c282838828deda99b1ca692a /FS/FS/part_event/Action
parenta5713014d58b2a6f4d5f795fbda6aa50126c2afb (diff)
event action to send a notice to a fixed address, RT#8209
Diffstat (limited to 'FS/FS/part_event/Action')
-rw-r--r--FS/FS/part_event/Action/notice.pm2
-rw-r--r--FS/FS/part_event/Action/notice_to.pm55
2 files changed, 56 insertions, 1 deletions
diff --git a/FS/FS/part_event/Action/notice.pm b/FS/FS/part_event/Action/notice.pm
index 126965374..8e22c6844 100644
--- a/FS/FS/part_event/Action/notice.pm
+++ b/FS/FS/part_event/Action/notice.pm
@@ -5,7 +5,7 @@ use base qw( FS::part_event::Action );
use FS::Record qw( qsearchs );
use FS::msg_template;
-sub description { 'Send a notice from a message template'; }
+sub description { 'Email a notice to the customer\'s billing address'; }
#sub eventtable_hashref {
# { 'cust_main' => 1,
diff --git a/FS/FS/part_event/Action/notice_to.pm b/FS/FS/part_event/Action/notice_to.pm
new file mode 100644
index 000000000..194aeb84f
--- /dev/null
+++ b/FS/FS/part_event/Action/notice_to.pm
@@ -0,0 +1,55 @@
+package FS::part_event::Action::notice_to;
+
+use strict;
+use base qw( FS::part_event::Action );
+use FS::Record qw( qsearchs );
+use FS::msg_template;
+
+sub description { 'Email a notice to a specific address'; }
+
+#sub eventtable_hashref {
+# { 'cust_main' => 1,
+# 'cust_bill' => 1,
+# 'cust_pkg' => 1,
+# };
+#}
+
+sub option_fields {
+ (
+ 'to' => { 'label' => 'Destination',
+ 'type' => 'text',
+ 'size' => 30,
+ },
+ 'msgnum' => { 'label' => 'Template',
+ 'type' => 'select-table',
+ 'table' => 'msg_template',
+ 'name_col' => 'msgname',
+ 'disable_empty' => 1,
+ },
+ );
+}
+
+sub default_weight { 56; } #?
+
+sub do_action {
+ my( $self, $object ) = @_;
+
+ my $cust_main = $self->cust_main($object);
+
+ my $msgnum = $self->option('msgnum');
+
+ my $msg_template = qsearchs('msg_template', { 'msgnum' => $msgnum } )
+ or die "Template $msgnum not found";
+
+ my $to = $self->option('to')
+ or die "Can't send notice without a destination address";
+
+ $msg_template->send(
+ 'to' => $to,
+ 'cust_main' => $cust_main,
+ 'object' => $object,
+ );
+
+}
+
+1;