diff options
author | ivan <ivan> | 2010-07-13 11:10:32 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-07-13 11:10:32 +0000 |
commit | c846f76083580025588006e3e2df8c3c562a63f4 (patch) | |
tree | feae0af4ccbab26638d2e46d3ed8478b92a173a4 /FS | |
parent | 7bab9a9fae4b88014262f7154e54874adcf3d947 (diff) |
notices, RT#8324
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/msg_template.pm | 4 | ||||
-rw-r--r-- | FS/FS/part_event/Action/notice.pm | 41 |
2 files changed, 41 insertions, 4 deletions
diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index 83acde2..97cf50f 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -166,15 +166,11 @@ sub send { my $subs = $self->substitutions; - use Data::Dumper; - warn Dumper($subs); - #XXX html escape this stuff my %hash = map { $_ => $cust_main->$_() } @{ $subs->{'cust_main'} }; unless ( ! $object || $object->table eq 'cust_main' ) { %hash = ( %hash, map { $_ => $object->$_() } @{ $subs->{$object->table} } ); } - warn Dumper(\%hash); my $subject_tmpl = new Text::Template ( TYPE => 'STRING', diff --git a/FS/FS/part_event/Action/notice.pm b/FS/FS/part_event/Action/notice.pm new file mode 100644 index 0000000..6a51d1e --- /dev/null +++ b/FS/FS/part_event/Action/notice.pm @@ -0,0 +1,41 @@ +package FS::part_event::Action::notice; + +use strict; +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 eventtable_hashref { +# { 'cust_main' => 1, +# 'cust_bill' => 1, +# 'cust_pkg' => 1, +# }; +#} + +sub option_fields { + ( + 'msgnum' => { 'label' => 'Template' }, + ); + +sub default_weight { 55; } #? + +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"; + + $msg_template->send( + 'cust_main' => $cust_main, + 'object' => $object, + ); + +} + +1; |