]> wagnertech.de Git - mfinanz.git/commitdiff
Merge remote branch 'refs/remotes/wulf/publish_1500_calc_numbers' into calc-in-parse...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 17 May 2011 10:22:02 +0000 (12:22 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 17 May 2011 10:22:02 +0000 (12:22 +0200)
15 files changed:
SL/Auth.pm
SL/DB/Helper/Attr.pm
SL/DO.pm
SL/Dispatcher.pm
SL/Form.pm
SL/IS.pm
SL/OE.pm
doc/changelog
doc/dokumentenvorlagen-und-variablen.html
doc/konfigurationsdatei.txt
kopf.pl [deleted symlink]
locale/de/all
t/helper/attr.t
templates/webpages/payment_term/form.html [changed mode: 0644->0755]
templates/webpages/payment_term/list.html

index 8b8d859ae2c7ad060c0a23638c357e1a63f659f1..6fb66c482f59f9f2dcca899891ee00d06c61f684 100644 (file)
@@ -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<false> and has therefore different behaviour than
-L</set_session_value>.
-
 Returns the key created in the session.
 
 =item C<expire_session_keys>
index 463bfd654e5c3812b5e8d51e458172a03d42f1ae..94b53dd7f9f15b25285a16317043c94ecf346f40 100644 (file)
@@ -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;
 }
index f391963235d72faa09a4a640b763aaed8fe194be..841f454db8f1581716fb938aa5f7b9d8b862c9e4 100644 (file)
--- 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};
       }
     }
index 47c2e2a35cb41d3f56edf222019303445441f236..df8cc8344a684bcba50ccbceae621b0cb274c36e 100644 (file)
@@ -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;
index ad5f0a3cfa59d28b95134ee8ed0d9acc0c6761e2..4db9e4bd478f69b02fc569f6852a5f3878d1f60a 100644 (file)
@@ -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 "") {
index a940355982140f19b59e151559dcda6358c2c3c8..689c779be8f3b62be5ad988f3f3d9d7bb70f045e 100644 (file)
--- 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;
index 28e3975c3c1163991f8e79a2918815ea4d7ec81f..7a35fa717aedd5b186809b2c4badac97b12372e9 100644 (file)
--- 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;
index b76755204c94da2ba0205ef0e11ee210a0451a57..03a8f54af327d793b865d124e7f2ad64ebc3bd84 100644 (file)
 
   - 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
index 24df1142d15db68dfbb2d1a8ef688c9922618db3..978a529bd76fc71d2fb65585035756c0394909cd 100644 (file)
@@ -149,6 +149,15 @@ td {
    ver&auml;ndern</a>.
  </p>
 
+ <p>Einige Zahlenwerte werden auch in unformatierter Form zur Verf&uuml;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&uuml;r  no-format) aufrufen
+  (also z.B. netprice = 12,30 -- netprice_nofmt = 12.3). Variabeln die zus&auml;tzlich
+  unformatiert zur Verf&uuml;gung stehen sind unten als variable[_nofmt] gelistet.
+  Die Eckigen Klammern weisen also auf eine optionale Verw&auml;ndung der Erweiterung hin.
+  </p>
+
  <p>Fr&uuml;her wurde hier nur &uuml;ber LaTeX gesprochen. Inzwischen
   unterst&uuml;tzt Lx-Office aber auch OpenDocument-Vorlagen. Sofern
   es nicht ausdr&uuml;cklich eingeschr&auml;nkt wird, gilt das im
@@ -406,6 +415,10 @@ td {
     <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>
@@ -715,6 +728,10 @@ 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>
@@ -736,7 +753,7 @@ 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>
@@ -775,11 +792,11 @@ td {
     <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>
@@ -795,7 +812,7 @@ td {
     <td>Grafik</td>
    </tr>
    <tr>
-    <td><code>linetotal</code></td>
+    <td><code>linetotal[_nofmt]</code></td>
     <td>Zeilensumme (Anzahl * Einzelpreis)</td>
    </tr>
    <tr>
@@ -807,15 +824,15 @@ td {
     <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>
@@ -855,7 +872,7 @@ td {
     <td>Projektbeschreibung</td>
    </tr>
    <tr>
-    <td><code>qty</code></td>
+    <td><code>qty[_nofmt]</code></td>
     <td>Anzahl</td>
    </tr>
    <tr>
@@ -867,7 +884,7 @@ td {
     <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>
index bab8b420dd1cab5d945da6e0430b90cfba39dd3a..128365bbc414c4201c4b3888b0e91fd64dc6460f 100644 (file)
@@ -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 (symlink)
index 05c4a22..0000000
--- a/kopf.pl
+++ /dev/null
@@ -1 +0,0 @@
-admin.pl
\ No newline at end of file
index b3beb5e44312cfafafc3f87f1005292533029c38..45a30f23916d55cfba7e6b4ab6e918f19d782cc9 100644 (file)
@@ -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',
index 4de1a53ffe9944d2754522c7c25c3c952aaa0074..cad0a0f9cf6b42eba79131fa4ae8abbae0393433 100644 (file)
@@ -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);
old mode 100644 (file)
new mode 100755 (executable)
index 3ea1cdb..973940d
@@ -47,7 +47,7 @@
    <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>
@@ -69,6 +69,8 @@
 
   <table>
    <tr class="listheading"><th>[%- LxERP.t8('Field') %]</th><th>[%- LxERP.t8('Description') %]</th></tr>
+   <tr><td>&lt;%payment_terms%&gt;</td><td>[% LxERP.t8("Payment description") %]</td></tr>
+   <tr><td>&lt;%payment_description%&gt;</td><td>[% LxERP.t8("Payment description detail") %]</td></tr>
    <tr><td>&lt;%netto_date%&gt;</td><td>[% LxERP.t8("Date the payment is due in full") %]</td></tr>
    <tr><td>&lt;%skonto_date%&gt;</td><td>[% LxERP.t8("Date the payment is due with discount") %]</td></tr>
    <tr><td>&lt;%skonto_amount%&gt;</td><td>[% LxERP.t8("The deductible amount") %]</td></tr>
index 8563137d347a658e4ea2120dc39cb4b1dbbfea37..fd1ffd927073bb9c40485143eec62307286e4605 100644 (file)
@@ -38,7 +38,7 @@
      <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>