[freeside-commits] freeside/FS/FS/part_event/Action notice.pm, 1.1, 1.2 notice_to.pm, NONE, 1.1

Mark Wells mark at wavetail.420.am
Wed Sep 22 16:04:33 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS/part_event/Action
In directory wavetail.420.am:/tmp/cvs-serv1065/FS/FS/part_event/Action

Modified Files:
	notice.pm 
Added Files:
	notice_to.pm 
Log Message:
event action to send a notice to a fixed address, RT#8209

Index: notice.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Action/notice.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- notice.pm	13 Jul 2010 11:09:39 -0000	1.1
+++ notice.pm	22 Sep 2010 23:04:31 -0000	1.2
@@ -5,7 +5,7 @@
 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,

--- NEW FILE: notice_to.pm ---
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;



More information about the freeside-commits mailing list