{ id => 'serialnr', width => 10, value => $locale->text('Serial No.'), display => 0, },
{ id => 'projectnr', width => 10, value => $locale->text('Project'), display => 0, },
{ id => 'sellprice', width => 15, value => $locale->text('Price'), display => !$is_delivery_order, },
- { id => 'sellprice_pg', width => 8, value => $locale->text('Pricegroup'), display => ($form->{type} =~ /^(sales_|invoice)/) && !$is_delivery_order, },
+ { id => 'sellprice_pg', width => 8, value => $locale->text('Pricegroup'), display => !$is_delivery_order && !$is_purchase, },
{ id => 'discount', width => 5, value => $locale->text('Discount'), display => !$is_delivery_order, },
{ id => 'linetotal', width => 10, value => $locale->text('Extended'), display => !$is_delivery_order, },
{ id => 'bin', width => 10, value => $locale->text('Bin'), display => 0, },
# for last row and report
# set pricegroup drop down list from report menu
if ($form->{"sellprice_$i"} != 0) {
+ # remember the pricegroup_id in pricegroup_old
+ # but don't overwrite it
$form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"};
my $default_option = $form->{"sellprice_$i"}.'--'.$form->{"pricegroup_id_$i"};
- $column_data{sellprice_pg} = NTI($cgi->popup_menu("sellpricepg_$i", [ $default_option ], $default_option, { $default_option => $form->{"pricegroup_$i"} || '' }));
+ $column_data{sellprice_pg} = NTI($cgi->popup_menu("sellprice_pg_$i", [ $default_option ], $default_option, { $default_option => $form->{"pricegroup_$i"} || '' }));
} else {
$column_data{sellprice_pg} = qq| |;
}
qw(bin listprice inventory_accno income_accno expense_accno unit weight
assembly taxaccounts partsgroup formel longdescription not_discountable
part_payment_id partnotes id lastcost price_factor_id price_factor);
- push @new_fields, "lizenzen" if ($main::lizenzen);
+ push @new_fields, "lizenzen" if $::lx_office_conf{features}->{lizenzen};
push @new_fields, grep { m/^ic_cvar_/ } keys %{ $form->{item_list}->[0] };
my $i = 0;
foreach my $ref (@{ $form->{item_list} }) {
my $checked = ($i++) ? "" : "checked";
- if ($main::lizenzen) {
+ if ($::lx_office_conf{features}->{lizenzen}) {
if ($ref->{inventory_accno} > 0) {
$ref->{"lizenzen"} = qq|<option></option>|;
foreach my $item (@{ $form->{LIZENZEN}{ $ref->{"id"} } }) {
$form->{payment_id} = $form->{"part_payment_id_$i"};
}
- if ($main::lizenzen) {
+ if ($::lx_office_conf{features}->{lizenzen}) {
map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } qw(lizenzen);
}
$form->{old_callback} = $form->escape($form->{callback}, 1);
$form->{callback} = $form->escape("$form->{script}?action=display_form", 1);
- # save all form variables except action in a previousform variable
- my $previousform = join '&', map { my $value = $form->{$_}; $value =~ s/&/%26/; "$_=$value" } grep { !/action/ } keys %$form;
+ # save all form variables except action in the session and keep the key in the previousform variable
+ my $previousform = $::auth->save_form_in_session(skip_keys => [ qw(action) ]);
my @HIDDENS;
- push @HIDDENS, { 'name' => 'previousform', 'value' => $form->escape($previousform, 1) };
+ push @HIDDENS, { 'name' => 'previousform', 'value' => $previousform };
push @HIDDENS, map +{ 'name' => $_, 'value' => $form->{$_} }, qw(rowcount vc);
push @HIDDENS, map +{ 'name' => $_, 'value' => $form->{"${_}_$form->{rowcount}"} }, qw(partnumber description unit);
push @HIDDENS, { 'name' => 'taxaccount2', 'value' => $form->{taxaccounts} };
my $script = $form->{"script"};
$script =~ s|.*/||;
$script =~ s|.pl$||;
- $locale = new Locale($main::language, $script);
+ $locale = new Locale($::lx_office_conf{system}->{language}, $script);
map { $form->{"select$_"} = "" } ($form->{vc}, "currency");
$form->{email} = $form->{shiptoemail} if $form->{shiptoemail} && $form->{formname} =~ /(pick|packing|bin)_list/;
- if ($form->{"cp_id"} && !$form->{"email"}) {
+ if ($form->{"cp_id"}) {
CT->get_contact(\%myconfig, $form);
- $form->{"email"} = $form->{"cp_email"};
+ $form->{"email"} = $form->{"cp_email"} if $form->{"cp_email"};
}
my $title = $locale->text('E-mail') . " " . $form->get_formname_translation();
) : undef,
($form->{type} eq 'invoice' && $form->{storno}) ? (
opthash("storno_invoice", $form->{PD}{storno_invoice}, $locale->text('Storno Invoice')),
- opthash("storno_packing_list", $form->{PD}{storno_packing_list}, $locale->text('Storno Packing List'))
) : undef,
($form->{type} =~ /_delivery_order$/) ? (
opthash($form->{type}, $form->{PD}{$form->{type}}, $locale->text('Delivery Order')),
push @MEDIA, grep $_,
opthash("screen", $form->{OP}{screen}, $locale->text('Screen')),
- ($form->{printers} && scalar @{ $form->{printers} } && $main::latex_templates) ?
+ ($form->{printers} && scalar @{ $form->{printers} } && $::lx_office_conf{print_templates}->{latex}) ?
opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef,
- ($main::latex_templates && !$options{no_queue}) ?
+ ($::lx_office_conf{print_templates}->{latex} && !$options{no_queue}) ?
opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef
if ($form->{media} ne 'email');
push @FORMAT, grep $_,
- ($main::opendocument_templates && $main::openofficeorg_writer_bin && $main::xvfb_bin
- && (-x $main::openofficeorg_writer_bin) && (-x $main::xvfb_bin)
+ ($::lx_office_conf{print_templates}->{opendocument} && $::lx_office_conf{applications}->{openofficeorg_writer} && $::lx_office_conf{applications}->{xvfb}
+ && (-x $::lx_office_conf{applications}->{openofficeorg_writer}) && (-x $::lx_office_conf{applications}->{xvfb})
&& !$options{no_opendocument_pdf}) ?
opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef,
- ($main::latex_templates) ?
+ ($::lx_office_conf{print_templates}->{latex}) ?
opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef,
- ($main::latex_templates && !$options{no_postscript}) ?
+ ($::lx_office_conf{print_templates}->{latex} && !$options{no_postscript}) ?
opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef,
(!$options{no_html}) ?
opthash("html", $form->{DF}{html}, "HTML") : undef,
- ($main::opendocument_templates && !$options{no_opendocument}) ?
+ ($::lx_office_conf{print_templates}->{opendocument} && !$options{no_opendocument}) ?
opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef,
- ($main::excel_templates && !$options{no_excel}) ?
+ ($::lx_office_conf{print_templates}->{excel} && !$options{no_excel}) ?
opthash("excel", $form->{DF}{excel}, $locale->text("Excel")) : undef;
push @LANGUAGE_ID,
);
my %template_vars = (
- display_copies => scalar @{ $form->{printers} || [] } && $main::latex_templates && $form->{media} ne 'email',
+ display_copies => scalar @{ $form->{printers} || [] } && $::lx_office_conf{print_templates}->{latex} && $form->{media} ne 'email',
display_remove_draft => (!$form->{id} && $form->{draft_id}),
display_groupitems => !$dont_display_groupitems{$form->{type}},
groupitems_checked => $form->{groupitems} ? "checked" : '',
&save();
$form->{formname} = $formname;
&edit();
+ $::lxdebug->leave_sub();
::end_of_request();
}
if ($form->{formname} eq "invoice") {
$form->{label} = $locale->text('Invoice');
}
- if ($form->{formname} eq "packing_list") {
-
- # this is from an invoice
- $form->{label} = $locale->text('Packing List');
- }
if ($form->{formname} eq 'sales_order') {
$inv = "ord";
$due = "req";
$order = 1;
}
- if ($form->{formname} eq 'packing_list' && $form->{type} ne 'invoice') {
-
- # we use the same packing list as from an invoice
- $inv = "ord";
- $due = "req";
- $form->{invdate} = $form->{"${inv}date"} = $form->{transdate};
- $form->{label} = $locale->text('Packing List');
- $order = 1;
- # set invnumber for template packing_list
- $form->{invnumber} = $form->{ordnumber};
- }
if ($form->{formname} eq 'purchase_order') {
$inv = "ord";
$due = "req";
# $locale->text('Invoice Number missing!')
# $locale->text('Invoice Date missing!')
- # $locale->text('Packing List Number missing!')
- # $locale->text('Packing List Date missing!')
# $locale->text('Order Number missing!')
# $locale->text('Order Date missing!')
# $locale->text('Quotation Number missing!')
my $filename;
if ($filename = $queued{ $form->{formname} }) {
$form->{queued} =~ s/\Q$form->{formname} $filename\E//;
- unlink "$main::spool/$filename";
+ unlink $::lx_office_conf{paths}->{spool} . "/$filename";
$filename =~ s/\..*$//g;
} else {
$filename = time;
}
$filename .= ($form->{postscript}) ? '.ps' : '.pdf';
- $form->{OUT} = ">$main::spool/$filename";
+ $form->{OUT} = ">" . $::lx_office_conf{paths}->{spool} . "/$filename";
# add type
$form->{queued} .= " $form->{formname} $filename";
}
# /saving the history
- $form->parse_template(\%myconfig, $main::userspath);
+ $form->parse_template(\%myconfig);
$form->{callback} = "";