use SL::Common;
use SL::DBUtils;
+use SL::DB::Default;
use SL::GenericTranslations;
use SL::IS;
use SL::Mailer;
$query =
qq|INSERT INTO ar (id, invnumber, transdate, gldate, customer_id,
taxincluded, amount, netamount, paid, duedate,
- invoice, curr, notes,
+ invoice, currency_id, notes,
employee_id)
VALUES (
?, -- id
-- duedate:
(SELECT duedate FROM dunning WHERE dunning_id = ? LIMIT 1),
'f', -- invoice
- (SELECT id FROM currencies WHERE curr = ?), -- curr
+ (SELECT id FROM currencies WHERE name = ?), -- curr
?, -- notes
-- employee_id:
(SELECT id FROM employee WHERE login = ?)
my $template = SL::Template::create(type => 'PlainText', form => $form, myconfig => $myconfig);
my $mail = Mailer->new();
- $mail->{charset} = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET;
$mail->{from} = $myconfig->{email};
$mail->{to} = $ref->{recipient};
$mail->{subject} = $template->parse_block($ref->{email_subject});
my ($self, $myconfig, $form) = @_;
- $form->{templates} = "$myconfig->{templates}";
+ my $defaults = SL::DB::Default->get;
+ $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+ $form->{templates} = $defaults->templates;
$form->{language} = $form->get_template_language($myconfig);
$form->{printer_code} = $form->get_printer_code($myconfig);
$form->{IN} = undef;
for my $filename (@template_files) {
- if (-f "$form->{templates}/$filename") {
+ if (-f ($defaults->templates . "/$filename")) {
$form->{IN} = $filename;
last;
}
ar.transdate, ar.duedate, ar.customer_id,
ar.invnumber, ar.ordnumber, ar.cp_id,
ar.amount, ar.netamount, ar.paid,
- (SELECT cu.curr FROM currencies cu WHERE cu.id=ar.curr) AS curr,
+ (SELECT cu.name FROM currencies cu WHERE cu.id=ar.currency_id) AS curr,
ar.amount - ar.paid AS open_amount,
ar.amount - ar.paid + da.fee + da.interest AS linetotal