use Carp;
use CGI;
+use List::MoreUtils qw(uniq);
use List::Util qw(min max first);
use SL::CVar;
if ($is_delivery_order) {
map { $form->{"${_}_${i}"} = $form->format_amount(\%myconfig, $form->{"${_}_${i}"}) } qw(sellprice discount lastcost);
- push @hidden_vars, qw(sellprice discount not_discountable price_factor_id lastcost);
+ push @hidden_vars, qw(sellprice discount not_discountable price_factor_id lastcost pricegroup_id);
push @hidden_vars, "stock_${stock_in_out}_sum_qty", "stock_${stock_in_out}";
}
$form->{"email"} = $form->{"cp_email"} if $form->{"cp_email"};
}
+ $form->{language} = $form->get_template_language(\%myconfig);
+ $form->{language} = "_" . $form->{language} if $form->{language};
+
my $title = $locale->text('E-mail') . " " . $form->get_formname_translation();
$form->{oldmedia} = $form->{media};
$form->get_shipto(\%myconfig);
}
- my @a = qw(name street zipcode city country contact);
+ my @a = qw(name department_1 department_2 street zipcode city country contact phone fax email);
my $shipto = 1;
format_dates($output_dateformat, $output_longdates,
qw(invdate orddate quodate pldate duedate reqdate transdate
shippingdate deliverydate validitydate paymentdate
- datepaid transdate_oe deliverydate_oe
+ datepaid transdate_oe deliverydate_oe dodate
employee_startdate employee_enddate
),
grep({ /^datepaid_\d+$/ ||
push @template_files, "$form->{formname}$form->{language}$printer_code.$extension";
push @template_files, "$form->{formname}.$extension";
push @template_files, "default.$extension";
-
- $form->{IN} = undef;
- for my $filename (@template_files) {
- if (-f "$myconfig{templates}/$filename") {
- $form->{IN} = $filename;
- last;
- }
- }
+ @template_files = uniq @template_files;
+ $form->{IN} = first { -f "$myconfig{templates}/$_" } @template_files;
if (!defined $form->{IN}) {
$::form->error($::locale->text('Cannot find matching template for this print request. Please contact your template maintainer. I tried these: #1.', join ', ', map { "'$_'"} @template_files));
media => $form->{media},
extension => $extension,
printer => SL::DB::Manager::Printer->find_by_or_create(id => $form->{printer_id}),
+ today => DateTime->today,
};
$form->parse_template(\%myconfig);