my $template = SL::Template::create(type => 'PlainText', form => $form, myconfig => $myconfig);
my $mail = Mailer->new();
$mail->{bcc} = $form->get_bcc_defaults($myconfig, $form->{bcc});
$mail->{from} = $from;
$mail->{to} = $ref->{recipient};
$mail->{subject} = $template->parse_block($ref->{email_subject});
my $template = SL::Template::create(type => 'PlainText', form => $form, myconfig => $myconfig);
my $mail = Mailer->new();
$mail->{bcc} = $form->get_bcc_defaults($myconfig, $form->{bcc});
$mail->{from} = $from;
$mail->{to} = $ref->{recipient};
$mail->{subject} = $template->parse_block($ref->{email_subject});
my $sign_backup = $::myconfig{signature};
$::myconfig{signature} = $sign if $sign;
$mail->{message} .= $form->create_email_signature();
my $sign_backup = $::myconfig{signature};
$::myconfig{signature} = $sign if $sign;
$mail->{message} .= $form->create_email_signature();
+ $query = qq|SELECT id FROM dunning WHERE dunning_id = ?|;
+ my @ids = selectall_array_query($form, $dbh, $query, $dunning_id);
+ $mail->{record_id} = \@ids;
+ $mail->{record_type} = 'dunning';
+
ct.name AS customername, ct.id AS customer_id, a.duedate, da.fee,
da.interest, dn.dunning_description, dn.dunning_level, da.transdate AS dunning_date,
da.duedate AS dunning_duedate, da.dunning_id, da.dunning_config_id,
ct.name AS customername, ct.id AS customer_id, a.duedate, da.fee,
da.interest, dn.dunning_description, dn.dunning_level, da.transdate AS dunning_date,
da.duedate AS dunning_duedate, da.dunning_id, da.dunning_config_id,
c.country, c.department_1, c.department_2, c.email, c.customernumber,
c.greeting, c.contact, c.phone, c.fax, c.homepage,
c.email, c.taxincluded, c.business_id, c.taxnumber, c.iban,
c.country, c.department_1, c.department_2, c.email, c.customernumber,
c.greeting, c.contact, c.phone, c.fax, c.homepage,
c.email, c.taxincluded, c.business_id, c.taxnumber, c.iban,
LEFT JOIN customer c ON (ar.customer_id = c.id)
LEFT JOIN contacts co ON (ar.cp_id = co.cp_id)
LEFT JOIN employee e ON (ar.salesman_id = e.id)
LEFT JOIN customer c ON (ar.customer_id = c.id)
LEFT JOIN contacts co ON (ar.cp_id = co.cp_id)
LEFT JOIN employee e ON (ar.salesman_id = e.id)
WHERE (d.dunning_id = ?)
LIMIT 1|;
my $ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id);
WHERE (d.dunning_id = ?)
LIMIT 1|;
my $ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id);
$self->set_customer_cvars($myconfig, $form);
$self->set_template_options($myconfig, $form);
$self->set_customer_cvars($myconfig, $form);
$self->set_template_options($myconfig, $form);
$form->{attachment_filename} = $attachment_filename;
$form->{attachment_type} = "dunning";
$form->{attachment_id} = $invoice_id;
$form->{attachment_filename} = $attachment_filename;
$form->{attachment_type} = "dunning";
$form->{attachment_id} = $invoice_id;