From: Moritz Bunkus
Date: Tue, 17 May 2011 10:22:02 +0000 (+0200)
Subject: Merge remote branch 'refs/remotes/wulf/publish_1500_calc_numbers' into calc-in-parse...
X-Git-Tag: release-2.6.3~25^2~21^2^2~1
X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/300f3739cfe93d10a867a778a1430068c00c32a8?hp=9c477cc85df636b3d7fdd285de1f3b4a7d81d9a2
Merge remote branch 'refs/remotes/wulf/publish_1500_calc_numbers' into calc-in-parse-amount
---
diff --git a/SL/Auth.pm b/SL/Auth.pm
index 8b8d859ae..6fb66c482 100644
--- a/SL/Auth.pm
+++ b/SL/Auth.pm
@@ -46,7 +46,9 @@ sub reset {
}
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},
@@ -56,9 +58,13 @@ sub get_user_dbh {
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});
}
@@ -430,29 +436,30 @@ sub get_user_id {
}
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;
}
# --------------------------------------
@@ -694,7 +701,6 @@ sub create_unique_sesion_value {
$self->{unique_counter}++;
$value = { expiration => $params{expiration} ? ($now[0] + $params{expiration}) * 1000000 + $now[1] : undef,
- no_auto => !$params{auto_restore},
data => $value,
};
@@ -1176,11 +1182,6 @@ If C<$params{expiration}> is set then it is interpreted as a number of
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 and has therefore different behaviour than
-L.
-
Returns the key created in the session.
=item C
diff --git a/SL/DB/Helper/Attr.pm b/SL/DB/Helper/Attr.pm
index 463bfd654..94b53dd7f 100644
--- a/SL/DB/Helper/Attr.pm
+++ b/SL/DB/Helper/Attr.pm
@@ -30,7 +30,7 @@ sub make {
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;
}
diff --git a/SL/DO.pm b/SL/DO.pm
index f39196323..841f454db 100644
--- a/SL/DO.pm
+++ b/SL/DO.pm
@@ -831,6 +831,7 @@ sub order_details {
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"};
@@ -883,6 +884,7 @@ sub order_details {
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};
}
}
diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm
index 47c2e2a35..df8cc8344 100644
--- a/SL/Dispatcher.pm
+++ b/SL/Dispatcher.pm
@@ -231,13 +231,14 @@ sub handle_request {
};
# 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;
diff --git a/SL/Form.pm b/SL/Form.pm
index ad5f0a3cf..4db9e4bd4 100644
--- a/SL/Form.pm
+++ b/SL/Form.pm
@@ -1880,12 +1880,12 @@ sub set_payment_options {
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 "") {
diff --git a/SL/IS.pm b/SL/IS.pm
index a94035598..689c779be 100644
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -59,7 +59,7 @@ sub invoice_details {
$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|;
@@ -201,9 +201,11 @@ sub invoice_details {
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"};
@@ -241,12 +243,14 @@ sub invoice_details {
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;
@@ -258,8 +262,10 @@ sub invoice_details {
}
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;
@@ -274,11 +280,13 @@ sub invoice_details {
$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;
@@ -368,8 +376,11 @@ sub invoice_details {
$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"});
}
@@ -388,10 +399,12 @@ sub invoice_details {
}
}
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);
@@ -409,8 +422,6 @@ sub invoice_details {
$form->{username} = $myconfig->{name};
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
@@ -434,7 +445,7 @@ sub customer_details {
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};
@@ -505,8 +516,6 @@ sub customer_details {
'allow_fallback' => 1);
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
@@ -1134,7 +1143,8 @@ sub post_payment {
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);
@@ -1189,7 +1199,6 @@ sub post_payment {
restore_form($old_form);
my $rc = $dbh->commit();
- $dbh->disconnect();
$main::lxdebug->leave_sub();
@@ -1369,7 +1378,8 @@ sub delete_invoice {
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);
@@ -1399,7 +1409,6 @@ sub delete_invoice {
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};
@@ -1749,7 +1758,7 @@ sub retrieve_item {
my ($self, $myconfig, $form) = @_;
# connect to database
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
my $i = $form->{rowcount};
@@ -1960,8 +1969,6 @@ sub retrieve_item {
map { $item->{"ic_cvar_" . $_->{name} } = $_->{value} } @{ $custom_variables };
}
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
@@ -1977,7 +1984,7 @@ sub get_pricegroups_for_parts {
my ($self, $myconfig, $form) = @_;
- my $dbh = $form->dbconnect($myconfig);
+ my $dbh = $form->get_standard_dbh;
$form->{"PRICES"} = {};
@@ -2041,27 +2048,27 @@ sub get_pricegroups_for_parts {
}
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')) {
@@ -2125,7 +2132,7 @@ sub get_pricegroups_for_parts {
$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
@@ -2153,8 +2160,6 @@ sub get_pricegroups_for_parts {
$pkq->finish;
}
- $dbh->disconnect;
-
$main::lxdebug->leave_sub();
}
@@ -2169,13 +2174,11 @@ sub has_storno {
# 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;
@@ -2192,13 +2195,11 @@ sub is_storno {
# 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;
@@ -2209,13 +2210,11 @@ sub get_standard_accno_current_assets {
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;
diff --git a/SL/OE.pm b/SL/OE.pm
index 28e3975c3..7a35fa717 100644
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -1161,13 +1161,16 @@ sub order_details {
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};
@@ -1185,12 +1188,14 @@ sub order_details {
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;
@@ -1202,8 +1207,10 @@ sub order_details {
}
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;
@@ -1218,11 +1225,12 @@ sub order_details {
$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;
@@ -1293,8 +1301,11 @@ sub order_details {
$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"});
}
@@ -1305,9 +1316,11 @@ sub order_details {
$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;
diff --git a/doc/changelog b/doc/changelog
index b76755204..03a8f54af 100644
--- a/doc/changelog
+++ b/doc/changelog
@@ -31,6 +31,11 @@
- 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:
@@ -39,7 +44,7 @@
- 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
diff --git a/doc/dokumentenvorlagen-und-variablen.html b/doc/dokumentenvorlagen-und-variablen.html
index 24df1142d..978a529bd 100644
--- a/doc/dokumentenvorlagen-und-variablen.html
+++ b/doc/dokumentenvorlagen-und-variablen.html
@@ -149,6 +149,15 @@ td {
verändern.
+
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.
+
+
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
@@ -406,6 +415,10 @@ td {
name
Firmenname
+
+
payment_description
+
Name der Zahlart
+
payment_terms
Zahlungskonditionen
@@ -715,6 +728,10 @@ td {
ordnumber
Auftragsnummer, wenn die Rechnung aus einem Auftrag erstellt wurde
+
+
payment_description
+
Name der Zahlart
+
payment_terms
Zahlungskonditionen
@@ -736,7 +753,7 @@ td {
Transportmittel
-
subtotal
+
subtotal[_nofmt]
Zwischensumme aller Posten ohne Steuern
@@ -775,11 +792,11 @@ td {
Artikelbeschreibung
-
discount
+
discount[_nofmt]
Rabatt als Betrag
-
discount_sub
+
discount_sub[_nofmt]
Zwischensumme mit Rabatt
@@ -795,7 +812,7 @@ td {
Grafik
-
linetotal
+
linetotal[_nofmt]
Zeilensumme (Anzahl * Einzelpreis)
@@ -807,15 +824,15 @@ td {
Mikrofilm
-
netprice
+
netprice[_nofmt]
Nettopreis
-
nodiscount_linetotal
+
nodiscount_linetotal[_nofmt]
Zeilensumme ohne Rabatt
-
nodiscount_sub
+
nodiscount_sub[_nofmt]
Zwischensumme ohne Rabatt
@@ -855,7 +872,7 @@ td {
Projektbeschreibung
-
qty
+
qty[_nofmt]
Anzahl
@@ -867,7 +884,7 @@ td {
Position auf der Rechnung (1, 2, 3...)
-
sellprice
+
sellprice[_nofmt]
Verkaufspreis
diff --git a/doc/konfigurationsdatei.txt b/doc/konfigurationsdatei.txt
index bab8b420d..128365bbc 100644
--- a/doc/konfigurationsdatei.txt
+++ b/doc/konfigurationsdatei.txt
@@ -3,11 +3,17 @@
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.
diff --git a/kopf.pl b/kopf.pl
deleted file mode 120000
index 05c4a229e..000000000
--- a/kopf.pl
+++ /dev/null
@@ -1 +0,0 @@
-admin.pl
\ No newline at end of file
diff --git a/locale/de/all b/locale/de/all
index b3beb5e44..45a30f239 100644
--- a/locale/de/all
+++ b/locale/de/all
@@ -1212,6 +1212,8 @@ $self->{texts} = {
'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',
diff --git a/t/helper/attr.t b/t/helper/attr.t
index 4de1a53ff..cad0a0f9c 100644
--- a/t/helper/attr.t
+++ b/t/helper/attr.t
@@ -34,7 +34,7 @@ is($o->reqdate_as_date, '12.04.2010');
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);
diff --git a/templates/webpages/payment_term/form.html b/templates/webpages/payment_term/form.html
old mode 100644
new mode 100755
index 3ea1cdbaa..973940d76
--- a/templates/webpages/payment_term/form.html
+++ b/templates/webpages/payment_term/form.html
@@ -47,7 +47,7 @@
[%- 'Skonto' | $T8 %]
- %
+ %
@@ -69,6 +69,8 @@
[%- LxERP.t8('Field') %]
[%- LxERP.t8('Description') %]
+
<%payment_terms%>
[% LxERP.t8("Payment description") %]
+
<%payment_description%>
[% LxERP.t8("Payment description detail") %]
<%netto_date%>
[% LxERP.t8("Date the payment is due in full") %]
<%skonto_date%>
[% LxERP.t8("Date the payment is due with discount") %]