or die "msgnum $msgnum not found\n";
}
- $param->{'payby'} = [ split(/\0/, $param->{'payby'}) ]
- unless ref($param->{'payby'});
-
my $sql_query = $class->search($param->{'search'});
my $count_query = delete($sql_query->{'count_query'});
@message = $msg_template->prepare( 'cust_main' => $cust_main );
}
else {
- my $to = $cust_main->invoicing_list_emailonly_scalar;
- next if !$to;
+ my @to = $cust_main->invoicing_list_emailonly;
+ next if !@to;
@message = (
'from' => $from,
- 'to' => $to,
+ 'to' => \@to,
'subject' => $subject,
'html_body' => $html_body,
'text_body' => $text_body,
+ 'custnum' => $cust_main->custnum,
);
} #if $msg_template
}
+=item conf
+
+Returns a configuration handle (L<FS::Conf>) set to the customer's locale,
+if they have one. If not, returns an FS::Conf with no locale.
+
+=cut
+
+sub conf {
+ my $self = shift;
+ return $self->{_conf} if (ref $self and $self->{_conf});
+ my $cust_main = $self->cust_main;
+ my $conf = new FS::Conf {
+ 'locale' => ($cust_main ? $cust_main->locale : '')
+ };
+ $self->{_conf} = $conf if ref $self;
+ return $conf;
+}
+
+=item mt TEXT [, ARGS ]
+
+Localizes a text string (see L<Locale::Maketext>) for the customer's locale,
+if they have one.
+
+=cut
+
+sub mt {
+ my $self = shift;
+ return $self->{_lh}->maketext(@_) if (ref $self and $self->{_lh});
+ my $cust_main = $self->cust_main;
+ my $locale = $cust_main ? $cust_main->locale : '';
+ my $lh = FS::L10N->get_handle($locale);
+ $self->{_lh} = $lh if ref $self;
+ return $lh->maketext(@_);
+}
+
=back
=head1 BUGS