: '000000';
}
+=item agent_name
+
+=cut
+
+sub agent_name {
+ my $self = shift;
+ $self->cust_linked
+ ? $self->cust_main->agent_name
+ : $self->cust_unlinked_msg;
+}
+
=item prospect_sql
=item active_sql
sub email_search_result {
my($class, $param) = @_;
+ my $conf = FS::Conf->new;
+ my $send_to_domain = $conf->config('email-to-voice_domain');
+
my $msgnum = $param->{msgnum};
my $from = delete $param->{from};
my $subject = delete $param->{subject};
my $html_body = delete $param->{html_body};
my $text_body = delete $param->{text_body};
my $to_contact_classnum = delete $param->{to_contact_classnum};
+ my $emailtovoice_name = delete $param->{emailtovoice_contact};
+
my $error = '';
+ my $to = $emailtovoice_name . '@' . $send_to_domain unless !$emailtovoice_name;
+
my $job = delete $param->{'job'}
or die "email_search_result must run from the job queue.\n";
next; # unlinked object; nothing else we can do
}
+ my %to = {};
+ if ($to) { $to{'to'} = $to; }
+
if ( $msg_template ) {
# Now supports other context objects.
%message = $msg_template->prepare(
'cust_main' => $cust_main,
'object' => $obj,
'to_contact_classnum' => $to_contact_classnum,
+ %to
);
} else {
if (!@classes) {
@classes = ( 'invoice' );
}
- my @to = $cust_main->contact_list_email(@classes);
+ my @to = $to ? split(',', $to) : $cust_main->contact_list_email(@classes);
next if !@to;
%message = (
} #if $msg_template
# For non-cust_main searches, we avoid duplicates based on message
- # body text.
+ # body text.
my $unique = $cust_main->custnum;
$unique .= sha1($message{'text_body'}) if $class ne 'FS::cust_main';
if( $sent_to{$unique} ) {