}
sub get_user_dbh {
- my ($self, $login) = @_;
+ my ($self, $login, %params) = @_;
+ my $may_fail = delete $params{may_fail};
+
my %user = $self->read_user($login);
my $dbh = SL::DBConnect->connect(
$user{dbconnect},
pg_enable_utf8 => $::locale->is_utf8,
AutoCommit => 0
}
- ) or $::form->dberror;
+ );
+
+ if (!$may_fail && !$dbh) {
+ $::form->error($::locale->text('The connection to the authentication database failed:') . "\n" . $DBI::errstr);
+ }
- if ($user{dboptions}) {
+ if ($user{dboptions} && $dbh) {
$dbh->do($user{dboptions}) or $::form->dberror($user{dboptions});
}
}
sub delete_user {
- $main::lxdebug->enter_sub();
+ $::lxdebug->enter_sub;
my $self = shift;
my $login = shift;
- my $form = $main::form;
-
- my $dbh = $self->dbconnect();
+ my $u_dbh = $self->get_user_dbh($login, may_fail => 1);
+ my $dbh = $self->dbconnect;
$dbh->begin_work;
my $query = qq|SELECT id FROM auth."user" WHERE login = ?|;
- my ($id) = selectrow_query($form, $dbh, $query, $login);
+ my ($id) = selectrow_query($::form, $dbh, $query, $login);
- $dbh->rollback and return $main::lxdebug->leave_sub() if (!$id);
+ $dbh->rollback and return $::lxdebug->leave_sub if (!$id);
- do_query($form, $dbh, qq|DELETE FROM auth.user_group WHERE user_id = ?|, $id);
- do_query($form, $dbh, qq|DELETE FROM auth.user_config WHERE user_id = ?|, $id);
+ do_query($::form, $dbh, qq|DELETE FROM auth.user_group WHERE user_id = ?|, $id);
+ do_query($::form, $dbh, qq|DELETE FROM auth.user_config WHERE user_id = ?|, $id);
+ do_query($::form, $u_dbh, qq|UPDATE employee SET deleted = 't' WHERE login = ?|, $login) if $u_dbh;
- $dbh->commit();
+ $dbh->commit;
+ $u_dbh->commit if $u_dbh;
- $main::lxdebug->leave_sub();
+ $::lxdebug->leave_sub;
}
# --------------------------------------
$self->{unique_counter}++;
$value = { expiration => $params{expiration} ? ($now[0] + $params{expiration}) * 1000000 + $now[1] : undef,
- no_auto => !$params{auto_restore},
data => $value,
};
seconds after which the value is removed from the session. It will
never expire if that parameter is falsish.
-If C<$params{auto_restore}> is trueish then the value will be copied
-into C<$::form> upon the next request automatically. It defaults to
-C<false> and has therefore different behaviour than
-L</set_session_value>.
-
Returns the key created in the session.
=item C<expire_session_keys>
sub _make_by_type {
my ($package, $name, $type) = @_;
_as_number ($package, $name, places => -2) if $type =~ /numeric | real | float/xi;
- _as_percent($package, $name, places => 0) if $type =~ /numeric | real | float/xi;
+ _as_percent($package, $name, places => 2) if $type =~ /numeric | real | float/xi;
_as_number ($package, $name, places => 0) if $type =~ /int/xi;
_as_date ($package, $name) if $type =~ /date | timestamp/xi;
}
push @{ $form->{TEMPLATE_ARRAYS}{description} }, $form->{"description_$i"};
push @{ $form->{TEMPLATE_ARRAYS}{longdescription} }, $form->{"longdescription_$i"};
push @{ $form->{TEMPLATE_ARRAYS}{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"});
+ push @{ $form->{TEMPLATE_ARRAYS}{qty_nofmt} }, $form->{"qty_$i"};
push @{ $form->{TEMPLATE_ARRAYS}{unit} }, $form->{"unit_$i"};
push @{ $form->{TEMPLATE_ARRAYS}{partnotes} }, $form->{"partnotes_$i"};
push @{ $form->{TEMPLATE_ARRAYS}{serialnumber} }, $form->{"serialnumber_$i"};
push @{ $form->{TEMPLATE_ARRAYS}{si_chargenumber}[$position-1] }, $si->{chargenumber};
push @{ $form->{TEMPLATE_ARRAYS}{si_bestbefore}[$position-1] }, $si->{bestbefore};
push @{ $form->{TEMPLATE_ARRAYS}{si_qty}[$position-1] }, $form->format_amount($myconfig, $si->{qty} * 1);
+ push @{ $form->{TEMPLATE_ARRAYS}{si_qty_nofmt}[$position-1] }, $si->{qty} * 1;
push @{ $form->{TEMPLATE_ARRAYS}{si_unit}[$position-1] }, $si->{unit};
}
}
};
# cleanup
+ $::auth->expire_session_keys->save_session;
+ $::auth->expire_sessions;
+ $::auth->reset;
+
$::locale = undef;
$::form = undef;
$::myconfig = ();
Form::disconnect_standard_dbh;
- $::auth->expire_session_keys->save_session;
- $::auth->expire_sessions;
- $::auth->reset;
$::lxdebug->end_request;
$::lxdebug->leave_sub;
my $dbh = $self->get_standard_dbh($myconfig);
my $query =
- qq|SELECT p.terms_netto, p.terms_skonto, p.percent_skonto, p.description_long | .
+ qq|SELECT p.terms_netto, p.terms_skonto, p.percent_skonto, p.description_long , p.description | .
qq|FROM payment_terms p | .
qq|WHERE p.id = ?|;
($self->{terms_netto}, $self->{terms_skonto}, $self->{percent_skonto},
- $self->{payment_terms}) =
+ $self->{payment_terms}, $self->{payment_description}) =
selectrow_query($self, $dbh, $query, $self->{payment_id});
if ($transdate eq "") {
$form->{duedate} ||= $form->{invdate};
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $sth;
my $query = qq|SELECT date | . conv_dateq($form->{duedate}) . qq| - date | . conv_dateq($form->{invdate}) . qq| AS terms|;
push @{ $form->{TEMPLATE_ARRAYS}->{description} }, $form->{"description_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{longdescription} }, $form->{"longdescription_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"});
+ push @{ $form->{TEMPLATE_ARRAYS}->{qty_nofmt} }, $form->{"qty_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{unit} }, $form->{"unit_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{deliverydate_oe} }, $form->{"reqdate_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{sellprice} }, $form->{"sellprice_$i"};
+ push @{ $form->{TEMPLATE_ARRAYS}->{sellprice_nofmt} }, $form->parse_amount($myconfig, $form->{"sellprice_$i"});
push @{ $form->{TEMPLATE_ARRAYS}->{ordnumber_oe} }, $form->{"ordnumber_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{transdate_oe} }, $form->{"transdate_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{invnumber} }, $form->{"invnumber"};
my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice / $price_factor->{factor}, 2);
$form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2);
- push @{ $form->{TEMPLATE_ARRAYS}->{netprice} }, ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : '';
+ push @{ $form->{TEMPLATE_ARRAYS}->{netprice} }, ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : '';
+ push @{ $form->{TEMPLATE_ARRAYS}->{netprice_nofmt} }, ($form->{"netprice_$i"} != 0) ? $form->{"netprice_$i"} : '';
$linetotal = ($linetotal != 0) ? $linetotal : '';
- push @{ $form->{TEMPLATE_ARRAYS}->{discount} }, ($discount != 0) ? $form->format_amount($myconfig, $discount * -1, 2) : '';
- push @{ $form->{TEMPLATE_ARRAYS}->{p_discount} }, $form->{"discount_$i"};
+ push @{ $form->{TEMPLATE_ARRAYS}->{discount} }, ($discount != 0) ? $form->format_amount($myconfig, $discount * -1, 2) : '';
+ push @{ $form->{TEMPLATE_ARRAYS}->{discount_nofmt} }, ($discount != 0) ? $discount * -1 : '';
+ push @{ $form->{TEMPLATE_ARRAYS}->{p_discount} }, $form->{"discount_$i"};
$form->{total} += $linetotal;
$form->{nodiscount_total} += $nodiscount_linetotal;
}
if ($form->{"subtotal_$i"} && $subtotal_header && ($subtotal_header != $i)) {
- push @{ $form->{TEMPLATE_ARRAYS}->{discount_sub} }, $form->format_amount($myconfig, $discount_subtotal, 2);
- push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_sub} }, $form->format_amount($myconfig, $nodiscount_subtotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{discount_sub} }, $form->format_amount($myconfig, $discount_subtotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{discount_sub_nofmt} }, $discount_subtotal;
+ push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_sub} }, $form->format_amount($myconfig, $nodiscount_subtotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_sub_nofmt} }, $nodiscount_subtotal;
$discount_subtotal = 0;
$nodiscount_subtotal = 0;
$nodiscount += $linetotal;
}
- push @{ $form->{TEMPLATE_ARRAYS}->{linetotal} }, $form->format_amount($myconfig, $linetotal, 2);
- push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_linetotal} }, $form->format_amount($myconfig, $nodiscount_linetotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{linetotal} }, $form->format_amount($myconfig, $linetotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{linetotal_nofmt} }, $linetotal_exact;
+ push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_linetotal} }, $form->format_amount($myconfig, $nodiscount_linetotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_linetotal_nofmt} }, $nodiscount_linetotal;
- push(@{ $form->{TEMPLATE_ARRAYS}->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}});
- push(@{ $form->{TEMPLATE_ARRAYS}->{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}});
+ push(@{ $form->{TEMPLATE_ARRAYS}->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}});
+ push(@{ $form->{TEMPLATE_ARRAYS}->{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}});
@taxaccounts = split(/ /, $form->{"taxaccounts_$i"});
$taxrate = 0;
$tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2);
push(@{ $form->{TEMPLATE_ARRAYS}->{taxbase} }, $form->format_amount($myconfig, $taxbase{$item}, 2));
+ push(@{ $form->{TEMPLATE_ARRAYS}->{taxbase_nofmt} }, $taxbase{$item});
push(@{ $form->{TEMPLATE_ARRAYS}->{tax} }, $form->format_amount($myconfig, $taxamount, 2));
+ push(@{ $form->{TEMPLATE_ARRAYS}->{tax_nofmt} }, $taxamount );
push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate} }, $form->format_amount($myconfig, $form->{"${item}_rate"} * 100));
+ push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate_nofmt} }, $form->{"${item}_rate"} * 100);
push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $form->{"${item}_description"} . q{ } . 100 * $form->{"${item}_rate"} . q{%});
push(@{ $form->{TEMPLATE_ARRAYS}->{taxnumber} }, $form->{"${item}_taxnumber"});
}
}
}
if($form->{taxincluded}) {
- $form->{subtotal} = $form->format_amount($myconfig, $form->{total} - $tax, 2);
+ $form->{subtotal} = $form->format_amount($myconfig, $form->{total} - $tax, 2);
+ $form->{subtotal_nofmt} = $form->{total} - $tax;
}
else {
- $form->{subtotal} = $form->format_amount($myconfig, $form->{total}, 2);
+ $form->{subtotal} = $form->format_amount($myconfig, $form->{total}, 2);
+ $form->{subtotal_nofmt} = $form->{total};
}
$form->{nodiscount_subtotal} = $form->format_amount($myconfig, $form->{nodiscount_total}, 2);
$form->{username} = $myconfig->{name};
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $form, @wanted_vars) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $language_id = $form->{language_id};
'allow_fallback' => 1);
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $form, $locale) = @_;
# connect to database, turn off autocommit
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->get_standard_dbh;
+ $dbh->begin_work;
my (%payments, $old_form, $row, $item, $query, %keep_vars);
restore_form($old_form);
my $rc = $dbh->commit();
- $dbh->disconnect();
$main::lxdebug->leave_sub();
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect_noauto($myconfig);
+ my $dbh = $form->get_standard_dbh;
+ $dbh->begin_work;
&reverse_invoice($dbh, $form);
do_query($form, $dbh, qq|DELETE FROM status WHERE trans_id = ?|, @values);
my $rc = $dbh->commit;
- $dbh->disconnect;
if ($rc) {
my $spool = $::lx_office_conf{paths}->{spool};
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $i = $form->{rowcount};
map { $item->{"ic_cvar_" . $_->{name} } = $_->{value} } @{ $custom_variables };
}
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
$form->{"PRICES"} = {};
}
my $query =
- qq|SELECT
+ qq|SELECT
+ 0 as pricegroup_id,
+ sellprice AS default_sellprice,
+ '' AS pricegroup,
+ sellprice AS price,
+ 'selected' AS selected
+ FROM parts
+ WHERE id = ?
+ UNION ALL
+ SELECT
pricegroup_id,
- (SELECT p.sellprice FROM parts p WHERE p.id = ?) AS default_sellprice,
- (SELECT pg.pricegroup FROM pricegroup pg WHERE id = pricegroup_id) AS pricegroup,
+ parts.sellprice AS default_sellprice,
+ pricegroup.pricegroup,
price,
'' AS selected
FROM prices
+ LEFT JOIN parts ON parts.id = parts_id
+ LEFT JOIN pricegroup ON pricegroup.id = pricegroup_id
WHERE parts_id = ?
-
- UNION
-
- SELECT
- 0 as pricegroup_id,
- (SELECT sellprice FROM parts WHERE id = ?) AS default_sellprice,
- '' AS pricegroup,
- (SELECT DISTINCT sellprice FROM parts where id = ?) AS price,
- 'selected' AS selected
- FROM prices
-
ORDER BY pricegroup|;
- my @values = (conv_i($id), conv_i($id), conv_i($id), conv_i($id));
+ my @values = (conv_i($id), conv_i($id));
my $pkq = prepare_execute_query($form, $dbh, $query, @values);
while (my $pkr = $pkq->fetchrow_hashref('NAME_lc')) {
$pkr->{selected} = ' selected';
}
} elsif ( ($form->parse_amount($myconfig, $price_new)
- != $form->parse_amount($myconfig, $form->{"sellprice_$i"}))
+ != $form->parse_amount($myconfig, $form->{"sellprice_$i"}))
and ($price_new ne 0) and defined $price_new) {
# sellprice has changed
# when loading existing invoices $price_new is NULL
$pkq->finish;
}
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
# ToDO: die when this happens and throw an error
$main::lxdebug->leave_sub() and return 0 if ($table =~ /\W/);
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $query = qq|SELECT storno FROM $table WHERE storno_id = ?|;
my ($result) = selectrow_query($form, $dbh, $query, $form->{id});
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
return $result;
# ToDO: die when this happens and throw an error
$main::lxdebug->leave_sub() and return 0 if ($table =~ /\W/);
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $query = qq|SELECT storno FROM $table WHERE id = ?|;
my ($result) = selectrow_query($form, $dbh, $query, $id);
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
return $result;
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $query = qq| SELECT accno FROM chart WHERE id = (SELECT ar_paid_accno_id FROM defaults)|;
my ($result) = selectrow_query($form, $dbh, $query);
- $dbh->disconnect();
-
$main::lxdebug->leave_sub();
return $result;
push @{ $form->{TEMPLATE_ARRAYS}->{description} }, $form->{"description_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{longdescription} }, $form->{"longdescription_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{qty} }, $form->format_amount($myconfig, $form->{"qty_$i"});
+ push @{ $form->{TEMPLATE_ARRAYS}->{qty_nofmt} }, $form->{"qty_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{ship} }, $form->format_amount($myconfig, $form->{"ship_$i"});
+ push @{ $form->{TEMPLATE_ARRAYS}->{ship_nofmt} }, $form->{"ship_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{unit} }, $form->{"unit_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{bin} }, $form->{"bin_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{partnotes} }, $form->{"partnotes_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{serialnumber} }, $form->{"serialnumber_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{reqdate} }, $form->{"reqdate_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{sellprice} }, $form->{"sellprice_$i"};
+ push @{ $form->{TEMPLATE_ARRAYS}->{sellprice_nofmt} }, $form->parse_amount($myconfig, $form->{"sellprice_$i"});
push @{ $form->{TEMPLATE_ARRAYS}->{listprice} }, $form->{"listprice_$i"};
push @{ $form->{TEMPLATE_ARRAYS}->{price_factor} }, $price_factor->{formatted_factor};
push @{ $form->{TEMPLATE_ARRAYS}->{price_factor_name} }, $price_factor->{description};
my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice / $price_factor->{factor}, 2);
$form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2);
- push @{ $form->{TEMPLATE_ARRAYS}->{netprice} }, ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : '';
+ push @{ $form->{TEMPLATE_ARRAYS}->{netprice} }, ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : '';
+ push @{ $form->{TEMPLATE_ARRAYS}->{netprice_nofmt} }, ($form->{"netprice_$i"} != 0) ? $form->{"netprice_$i"} : '';
$linetotal = ($linetotal != 0) ? $linetotal : '';
- push @{ $form->{TEMPLATE_ARRAYS}->{discount} }, ($discount != 0) ? $form->format_amount($myconfig, $discount * -1, 2) : '';
- push @{ $form->{TEMPLATE_ARRAYS}->{p_discount} }, $form->{"discount_$i"};
+ push @{ $form->{TEMPLATE_ARRAYS}->{discount} }, ($discount != 0) ? $form->format_amount($myconfig, $discount * -1, 2) : '';
+ push @{ $form->{TEMPLATE_ARRAYS}->{discount_nofmt} }, ($discount != 0) ? $discount * -1 : '';
+ push @{ $form->{TEMPLATE_ARRAYS}->{p_discount} }, $form->{"discount_$i"};
$form->{ordtotal} += $linetotal;
$form->{nodiscount_total} += $nodiscount_linetotal;
}
if ($form->{"subtotal_$i"} && $subtotal_header && ($subtotal_header != $i)) {
- push @{ $form->{TEMPLATE_ARRAYS}->{discount_sub} }, $form->format_amount($myconfig, $discount_subtotal, 2);
- push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_sub} }, $form->format_amount($myconfig, $nodiscount_subtotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{discount_sub} }, $form->format_amount($myconfig, $discount_subtotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{discount_sub_nofmt} }, $discount_subtotal;
+ push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_sub} }, $form->format_amount($myconfig, $nodiscount_subtotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_sub_nofmt} }, $nodiscount_subtotal;
$discount_subtotal = 0;
$nodiscount_subtotal = 0;
$nodiscount += $linetotal;
}
- push @{ $form->{TEMPLATE_ARRAYS}->{linetotal} }, $form->format_amount($myconfig, $linetotal, 2);
- push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_linetotal} }, $form->format_amount($myconfig, $nodiscount_linetotal, 2);
-
- push(@{ $form->{TEMPLATE_ARRAYS}->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}});
- push(@{ $form->{TEMPLATE_ARRAYS}->{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}});
+ push @{ $form->{TEMPLATE_ARRAYS}->{linetotal} }, $form->format_amount($myconfig, $linetotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{linetotal_nofmt} }, $linetotal_exact;
+ push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_linetotal} }, $form->format_amount($myconfig, $nodiscount_linetotal, 2);
+ push @{ $form->{TEMPLATE_ARRAYS}->{nodiscount_linetotal_nofmt} }, $nodiscount_linetotal;
+ push(@{ $form->{TEMPLATE_ARRAYS}->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}});
+ push(@{ $form->{TEMPLATE_ARRAYS}->{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}});
my ($taxamount, $taxbase);
my $taxrate = 0;
$tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2);
push(@{ $form->{TEMPLATE_ARRAYS}->{taxbase} }, $form->format_amount($myconfig, $taxbase{$item}, 2));
+ push(@{ $form->{TEMPLATE_ARRAYS}->{taxbase_nofmt} }, $taxbase{$item});
push(@{ $form->{TEMPLATE_ARRAYS}->{tax} }, $form->format_amount($myconfig, $taxamount, 2));
+ push(@{ $form->{TEMPLATE_ARRAYS}->{tax_nofmt} }, $taxamount);
push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate} }, $form->format_amount($myconfig, $form->{"${item}_rate"} * 100));
+ push(@{ $form->{TEMPLATE_ARRAYS}->{taxrate_nofmt} }, $form->{"${item}_rate"} * 100);
push(@{ $form->{TEMPLATE_ARRAYS}->{taxdescription} }, $form->{"${item}_description"} . q{ } . 100 * $form->{"${item}_rate"} . q{%});
push(@{ $form->{TEMPLATE_ARRAYS}->{taxnumber} }, $form->{"${item}_taxnumber"});
}
$form->{yesdiscount} = $form->format_amount($myconfig, $form->{nodiscount_total} - $nodiscount, 2);
if($form->{taxincluded}) {
- $form->{subtotal} = $form->format_amount($myconfig, $form->{ordtotal} - $tax, 2);
+ $form->{subtotal} = $form->format_amount($myconfig, $form->{ordtotal} - $tax, 2);
+ $form->{subtotal_nofmt} = $form->{ordtotal} - $tax;
} else {
- $form->{subtotal} = $form->format_amount($myconfig, $form->{ordtotal}, 2);
+ $form->{subtotal} = $form->format_amount($myconfig, $form->{ordtotal}, 2);
+ $form->{subtotal_nofmt} = $form->{ordtotal};
}
$form->{ordtotal} = ($form->{taxincluded}) ? $form->{ordtotal} : $form->{ordtotal} + $tax;
- Verkauf -> Berichte -> Filter nach Abteilungen wieder aktiviert
+ - Dokumentensystem -> der Name der Zahlart ist in den Dokumenten verfügbar, dies ermoglicht größere
+ Flexiblität in den Vorlagen über if-Abfragen
+
+ - Dokumentensystem -> viele Zahlenwerte sind nun auch in nicht fromatierter Form (alos ungerundet und mit . als Dezimaltrennzeichen) in den Dokumenten verfügbar.
+ Variabelenerweiterung: _nofmt, siehe doc/dokumentenvorlagen-und-variablen.html
Liste gefixter Bugs aus dem Bugtracker:
- Bugfix 1626: Beim Festlegen der Standardkonten kann beim Warenbestand eine Überschrift ausgewählt werden.
- Bugfix 1584: Summen und Saldenliste: Export to PDF/CSV in EÜR Modus falsch
- Bugfix 1597: Report Lagerbestand wirft Fehler, wenn Artikelnummer ausgeblendet werden soll
- - Bugfix 1569: Zahlungseingang löschen bei Rechnung
+ - Bugfix 1569: Zahlungseingang löschen bei Rechnung
- Bugfix 1632: Nach Installation 2.6.2-0 aus .deb funktioniert CSV-Import nicht
- Bugfix 1633: Stammdatenaufruf aus SEPA-Modul
- Bugfix 1575: Kundenrabatt geht verloren
verändern</a>.
</p>
+ <p>Einige Zahlenwerte werden auch in unformatierter Form zur Verfügung
+ gestellt (also z.B. 35 statt 35,00 oder 12.3 statt 12,30). Der Dezimaltrenner
+ ist dabei also immer ein Punkt unabhaengig vom eingestellten Zahlenformat.
+ Diese Variabelen kann man mit der Erweiterung _nofmt (für no-format) aufrufen
+ (also z.B. netprice = 12,30 -- netprice_nofmt = 12.3). Variabeln die zusätzlich
+ unformatiert zur Verfügung stehen sind unten als variable[_nofmt] gelistet.
+ Die Eckigen Klammern weisen also auf eine optionale Verwändung der Erweiterung hin.
+ </p>
+
<p>Früher wurde hier nur über LaTeX gesprochen. Inzwischen
unterstützt Lx-Office aber auch OpenDocument-Vorlagen. Sofern
es nicht ausdrücklich eingeschränkt wird, gilt das im
<td><code>name</code></td>
<td>Firmenname</td>
</tr>
+ <tr>
+ <td><code>payment_description</code></td>
+ <td>Name der Zahlart</td>
+ </tr>
<tr>
<td><code>payment_terms</code></td>
<td>Zahlungskonditionen</td>
<td><code>ordnumber</code></td>
<td>Auftragsnummer, wenn die Rechnung aus einem Auftrag erstellt wurde</td>
</tr>
+ <tr>
+ <td><code>payment_description</code></td>
+ <td>Name der Zahlart</td>
+ </tr>
<tr>
<td><code>payment_terms</code></td>
<td>Zahlungskonditionen</td>
<td>Transportmittel</td>
</tr>
<tr>
- <td><code>subtotal</code></td>
+ <td><code>subtotal[_nofmt]</code></td>
<td>Zwischensumme aller Posten ohne Steuern</td>
</tr>
<tr>
<td>Artikelbeschreibung</td>
</tr>
<tr>
- <td><code>discount</code></td>
+ <td><code>discount[_nofmt]</code></td>
<td>Rabatt als Betrag</td>
</tr>
<tr>
- <td><code>discount_sub</code></td>
+ <td><code>discount_sub[_nofmt]</code></td>
<td>Zwischensumme mit Rabatt</td>
</tr>
<tr>
<td>Grafik</td>
</tr>
<tr>
- <td><code>linetotal</code></td>
+ <td><code>linetotal[_nofmt]</code></td>
<td>Zeilensumme (Anzahl * Einzelpreis)</td>
</tr>
<tr>
<td>Mikrofilm</td>
</tr>
<tr>
- <td><code>netprice</code></td>
+ <td><code>netprice[_nofmt]</code></td>
<td>Nettopreis</td>
</tr>
<tr>
- <td><code>nodiscount_linetotal</code></td>
+ <td><code>nodiscount_linetotal[_nofmt]</code></td>
<td>Zeilensumme ohne Rabatt</td>
</tr>
<tr>
- <td><code>nodiscount_sub</code></td>
+ <td><code>nodiscount_sub[_nofmt]</code></td>
<td>Zwischensumme ohne Rabatt</td>
</tr>
<tr>
<td>Projektbeschreibung</td>
</tr>
<tr>
- <td><code>qty</code></td>
+ <td><code>qty[_nofmt]</code></td>
<td>Anzahl</td>
</tr>
<tr>
<td>Position auf der Rechnung (1, 2, 3...)</td>
</tr>
<tr>
- <td><code>sellprice</code></td>
+ <td><code>sellprice[_nofmt]</code></td>
<td>Verkaufspreis</td>
</tr>
<tr>
Seit Lx-Office 2.6.3. gibt es nur noch eine Konfigurationsdatei die benötigt wird - die: config/lx_office.conf.
Diese muß bei der Erstinstallation von Lx-Office (oder Migration von älteren Versionen) angelegt werden.
-Als Vorlage dient die Datei config/lx_office.conf.default.
+
+Als Vorlage dient die Datei config/lx_office.conf.default.
$ cp config/lx_office.conf.default config/lx_office.conf
-Diese Datei (lx_office.conf) ist dann eine installationsspezifische Datei,
+Die Datei config/lx_office.conf.default wird immer eingelesen, Werte die in
+config/lx_office.conf stehen überschreiben die Werte aus
+config/lx_office.conf.default. Die Datei config/lx_office.conf muss also nur
+die Abschintte und Werte enthalten die von config/lx_office.conf.default abweichen.
+
+Diese Datei (lx_office.conf) ist dann eine installationsspezifische Datei,
d.h. sie enthält bspw. lokale Passwörter und wird auch nicht im Versionsmanagement (git) verwaltet.
Die Konfiguration ist ferner serverabhängig, d.h. für alle Mandaten, bzw. Datenbanken gleich.
+++ /dev/null
-admin.pl
\ No newline at end of file
'Payment Terms' => 'Zahlungsbedingungen',
'Payment Terms missing in row ' => 'Zahlungsfrist fehlt in Zeile ',
'Payment date missing!' => 'Tag der Zahlung fehlt!',
+ 'Payment description' => 'Beschreibung der Zahlungsbedingung',
+ 'Payment description detail' => 'Langtext (Detail) der Zahlungsbedingung',
'Payment list as PDF' => 'Zahlungsliste als PDF',
'Payment posted!' => 'Zahlung gebucht!',
'Payment terms' => 'Zahlungsbedingungen',
is($o->marge_percent_as_percent('40'), '40');
is($o->marge_percent, 0.40);
is($o->marge_percent_as_percent, '40');
-is($o->marge_percent_as_percent('22,4'), '22');
+is($o->marge_percent_as_percent('22,4'), '22,40');
is($o->marge_percent, 0.224);
is($o->marge_percent_as_percent, '22');
is($o->marge_percent(0.231), 0.231);
<tr>
<td>[%- 'Skonto' | $T8 %]</td>
<td>
- <input name="payment_term.percent_skonto_as_number" value="[%- HTML.escape(SELF.payment_term.percent_skonto_as_number) %]" size="6">%
+ <input name="payment_term.percent_skonto_as_percent" value="[%- HTML.escape(SELF.payment_term.percent_skonto_as_percent) %]" size="6">%
</td>
</tr>
</table>
<table>
<tr class="listheading"><th>[%- LxERP.t8('Field') %]</th><th>[%- LxERP.t8('Description') %]</th></tr>
+ <tr><td><%payment_terms%></td><td>[% LxERP.t8("Payment description") %]</td></tr>
+ <tr><td><%payment_description%></td><td>[% LxERP.t8("Payment description detail") %]</td></tr>
<tr><td><%netto_date%></td><td>[% LxERP.t8("Date the payment is due in full") %]</td></tr>
<tr><td><%skonto_date%></td><td>[% LxERP.t8("Date the payment is due with discount") %]</td></tr>
<tr><td><%skonto_amount%></td><td>[% LxERP.t8("The deductible amount") %]</td></tr>
<td>[%- HTML.escape(payment_term.description_long) %]</td>
<td align="right">[%- HTML.escape(payment_term.terms_netto_as_number) %]</td>
<td align="right">[%- HTML.escape(payment_term.terms_skonto_as_number) %]</td>
- <td align="right">[%- HTML.escape(payment_term.percent_skonto_as_number) %] %</td>
+ <td align="right">[%- HTML.escape(payment_term.percent_skonto_as_percent) %] %</td>
</tr>
[%- END %]
</tbody>