From: Sven Schöling Date: Wed, 30 Dec 2009 15:26:04 +0000 (+0100) Subject: Merge branch 'ir_templates' X-Git-Tag: release-2.6.1beta1~72 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/9bd3030a376850c427c102c6e0c54f19bd19332e?hp=2dbb0236bbcc475e01701bd2794eac9f0cbc5ed5 Merge branch 'ir_templates' Conflicts: SL/OP.pm --- diff --git a/SL/CP.pm b/SL/CP.pm index 64fd988c5..b7e6241de 100644 --- a/SL/CP.pm +++ b/SL/CP.pm @@ -358,15 +358,12 @@ sub process_payment { } } - # record a AR/AP with a payment - if ($form->round_amount($paymentamount, 2) > 0) { - $form->{invnumber} = ""; - OP::overpayment("", $myconfig, $form, $dbh, $paymentamount, $ml, 1); - } - my $rc; if ($form->round_amount($paymentamount, 2) < 0) { - $dbh->rollback; + # Hier werden negativen Zahlungseingänge abgefangen + # Besser: in Oberfläche schon prüfen + # Zahlungsein- und ausgänge sind immer positiv + $dbh->rollback; $rc = 0; } if ($form->round_amount($paymentamount, 2) == 0) { diff --git a/SL/IC.pm b/SL/IC.pm index 54cca39dd..080aedffe 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -1446,7 +1446,7 @@ sub follow_account_chain { qq| cnew.accno | . qq|FROM chart c | . qq|LEFT JOIN chart cnew ON c.new_chart_id = cnew.id | . - qq|WHERE (c.id = ?) AND NOT c.new_chart_id ISNULL AND (c.new_chart_id > 0)|; + qq|WHERE (c.id = ?) AND NOT c.new_chart_id IS NULL AND (c.new_chart_id > 0)|; $sth = prepare_query($form, $dbh, $query); while (1) { diff --git a/SL/OE.pm b/SL/OE.pm index b731dc1cc..b1e1f9f30 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -1277,6 +1277,39 @@ sub project_description { return $value; } +########################## +# Get data for the submitted order id +# from database +# +sub get_order_data_by_ordnumber { + $main::lxdebug->enter_sub(); + + my $self = shift; + my %params = @_; + + Common::check_params(\%params, qw(ordnumber)); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $dbh = $form->get_standard_dbh(); + + my @values = ($params{ordnumber}); + + # We query the database for the fields we need using the submitted "ordnumber" + my $query = <leave_sub(); + + return $result; +} + 1; __END__ diff --git a/SL/OP.pm b/SL/OP.pm deleted file mode 100644 index 808972f1a..000000000 --- a/SL/OP.pm +++ /dev/null @@ -1,105 +0,0 @@ -#===================================================================== -# LX-Office ERP -# Copyright (C) 2004 -# Based on SQL-Ledger Version 2.1.9 -# Web http://www.lx-office.org -# -#===================================================================== -# SQL-Ledger Accounting -# Copyright (C) 2003 -# -# Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://www.sql-ledger.org -# -# Contributors: -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#====================================================================== -# -# Overpayment function -# used in AR, AP, IS, IR, OE, CP -#====================================================================== - -package OP; - -use SL::DBUtils; - -use strict; - -sub overpayment { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form, $dbh, $amount, $ml) = @_; - - my $fxamount = $form->round_amount($amount * $form->{exchangerate}, 2); - my ($paymentaccno) = split(/--/, $form->{account}); - - my $vc_id = $form->{vc} eq "customer" ? "customer_id" : "vendor_id"; - my $arap = $form->{arap} eq "ar" ? "ar" : "ap"; - - my $query = qq|SELECT nextval('glid')|; - my ($new_id) = selectrow_query($form, $dbh, $query); - - # add AR/AP header transaction with a payment - $query = - qq|INSERT INTO $arap (id, invnumber, employee_id) | . - qq|VALUES (?, ?, (SELECT id FROM employee WHERE login = ?))|; - my @values = ($new_id, $form->{login}, $form->{login}); - do_query($form, $dbh, $query, @values); - - my $invnumber = ($form->{invnumber}) ? $form->{invnumber} : $new_id; - $query = - qq|UPDATE $arap SET invnumber = ?, $vc_id = ?, transdate = ?, datepaid = ?, | . - qq|duedate = ?, netamount = ?, amount = ?, paid = ?, | . - qq|curr = ?, department_id = ? | . - qq|WHERE id = ?|; - @values = ($invnumber, $form->{$vc_id}, - conv_date($form->{datepaid}), conv_date($form->{datepaid}), - conv_date($form->{datepaid}), 0, 0, $fxamount, $form->{currency}, - $form->{department_id}, $new_id); - do_query($form, $dbh, $query, @values); - - # add AR/AP - my ($accno) = split /--/, $form->{ $form->{ARAP} }; - - $query = - qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount) | . - qq|VALUES (?, (SELECT id FROM chart WHERE accno = ? ), ?, ?)|; - @values = ($new_id, $accno, conv_date($form->{datepaid}), $fxamount * $ml); - do_query($form, $dbh, $query, @values); - - # add payment - $query = - qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, source, memo) | . - qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|; - @values = ($new_id, $paymentaccno, conv_date($form->{datepaid}), - $amount * $ml * -1, $form->{source}, $form->{memo}); - do_query($form, $dbh, $query, @values); - - # add exchangerate difference - if ($fxamount != $amount) { - $query = - qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, cleared, fx_transaction) | . - qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?)|; - @values = ($new_id, $paymentaccno, conv_date($form->{datepaid}), - (($fxamount - $amount) * $ml * -1), 1, 1); - do_query($form, $dbh, $query, @values); - } - - $main::lxdebug->leave_sub(); -} - -1; - diff --git a/SL/Template/Plugin/T8.pm b/SL/Template/Plugin/T8.pm new file mode 100644 index 000000000..79fab96bb --- /dev/null +++ b/SL/Template/Plugin/T8.pm @@ -0,0 +1,24 @@ +package SL::Template::Plugin::T8; + +use Template::Plugin::Filter; +use base qw( Template::Plugin::Filter ); + +my $locale = undef; + +sub init { + my $self = shift; + + $locale ||= Locale->new($main::myconfig{countrycode}, 'all'); + + # first arg can specify filter name + $self->install_filter($self->{ _ARGS }->[0] || 'T8'); + + return $self; +} + +sub filter { + my ($self, $text, $args) = @_; + return $locale->text($text, @{ $args || [] }); +} + +return 'SL::Template::Plugin::T8'; diff --git a/bin/mozilla/cp.pl b/bin/mozilla/cp.pl index 94f82e694..51624331c 100644 --- a/bin/mozilla/cp.pl +++ b/bin/mozilla/cp.pl @@ -32,7 +32,6 @@ #====================================================================== use SL::CP; -use SL::OP; use SL::IS; use SL::IR; diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 4b9b1a5eb..b90209f94 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -34,6 +34,7 @@ use SL::FU; use SL::IS; use SL::PE; +use SL::OE; use Data::Dumper; use List::Util qw(max sum); @@ -155,6 +156,14 @@ sub invoice_links { $ref->{name} = $form->quote($ref->{name}); } + # Load data for a specific order and update form fields + my $order_data = OE->get_order_data_by_ordnumber(%$form) if $form->{ordnumber}; + + # Copy the fields we need to %form + for my $key (qw(payment_id salesman_id orddate taxzone_id quonumber)) { + $form->{$key} = $order_data->{$key}; + } + $form->restore_vars(qw(id)); IS->retrieve_invoice(\%myconfig, \%$form); @@ -162,6 +171,7 @@ sub invoice_links { $form->restore_vars(qw(taxincluded)) if $form->{id}; $form->restore_vars(qw(salesman_id)) if $main::editing; + # build vendor/customer drop down comatibility... don't ask if (@{ $form->{"all_customer"} }) { $form->{"selectcustomer"} = 1; diff --git a/doc/INSTALL.texi b/doc/INSTALL.texi index 0de29314a..43eeda94e 100644 --- a/doc/INSTALL.texi +++ b/doc/INSTALL.texi @@ -145,6 +145,12 @@ Verzeichnisse auf einem Debian/Ubuntu-System: @code{chown -R www-data lx-office-erp/users lx-office-erp/spool lx-office-erp/webdav} +Weiterhin muss der Webserver-Benutzer im Verzeichnis @code{templates} Verzeichnisse für +jeden neuen Benutzer, der in lx-office angelegt wird, anlegen dürfen: + +@code{chgrp www-data lx-office-erp/templates; chmod g+w lx-office-erp/templates} + + @c --------------------------------------------------------------- @node Anpassung der PostgreSQL-Konfiguration @@ -185,6 +191,8 @@ Wurde PostgreSQL nicht mit UTF-8 als Encoding initialisiert und ist ein Neuanlegen eines weiteren Clusters nicht möglich, so kann Lx-Office mit ISO-8859-15 als Encoding betrieben werden. +Das Encoding einer Datenbank kann in @code{psql} mit @code{\l} geprüft werden. + @node Änderungen an Konfigurationsdateien @section Änderungen an Konfigurationsdateien @@ -237,7 +245,7 @@ lancompiler 'pl/pgsql';} Bitte beachten Sie, dass der Pfad zur Datei @code{plpgsql.so} von Distribution zu Distribution verschiedlich sein kann. Bei Debian/Ubuntu befindet sie sich unter -@code{/usr/lib/postgresql/lib/plpgsql.so}. +@code{/usr/lib/postgresql/lib/plpgsql.so}, bei Ubuntu 9.10 unter @code{/usr/lib/postgresql/8.4/lib/plpgsql.so}. @c --------------------------------------------------------------- diff --git a/doc/dokumentenvorlagen-und-variablen.html b/doc/dokumentenvorlagen-und-variablen.html index 16e7fb014..b2b90cdcb 100644 --- a/doc/dokumentenvorlagen-und-variablen.html +++ b/doc/dokumentenvorlagen-und-variablen.html @@ -981,6 +981,10 @@ td { dunning_duedate Fälligkeitsdatum für diese Mahhnung + + dunning_id + Mahnungsnummer + fee Kummulative Mahngebühren diff --git a/locale/de/locales.pl b/locale/de/locales.pl index 7cc3c5302..bb30c7a90 100755 --- a/locale/de/locales.pl +++ b/locale/de/locales.pl @@ -558,6 +558,25 @@ sub scanhtmlfile { $plugins{needed}->{$plugin} = 1 if (first { $_ eq $plugin } qw(HTML LxERP JavaScript MultiColumnIterator)); } + while ($line =~ m/\[\% # Template-Start-Tag + [\-~#] # Whitespace-Unterdrückung + \s* # Optional beliebig viele Whitespace + [\'\"] # Anfang des zu übersetzenden Strings + (.*?) # Der zu übersetzende String + [\'\"] # Ende des zu übersetzenden Strings + \s*\|\s* # Pipe-Zeichen mit optionalen Whitespace davor und danach + \$T8 # Filteraufruf + .*? # Optionale Argumente für den Filter und Whitespaces + [\-~#] # Whitespace-Unterdrückung + \%\] # Template-Ende-Tag + /ix) { + print "Found filter >>>$1<<<\n"; + $cached{$_[0]}{all}{$1} = 1; + $cached{$_[0]}{html}{$1} = 1; + $plugins{needed}->{T8} = 1; + substr $line, $-[1], $+[0] - $-[0], ''; + } + while ("" ne $line) { if (!$copying) { if ($line =~ m||i) { @@ -608,9 +627,9 @@ sub scanhtmlfile { } # copy back into global arrays - map { $alllocales{$_} = 1 } keys %{$cached{$_[0]}{all}}; - map { $htmllocales{$_} = 1 } keys %{$cached{$_[0]}{html}}; - map { $submit{$_} = 1 } keys %{$cached{$_[0]}{submit}}; + map { $alllocales{$_} = 1 } keys %{$cached{$_[0]}{all}}; + map { $htmllocale{$_} = 1 } keys %{$cached{$_[0]}{html}}; + map { $submit{$_} = 1 } keys %{$cached{$_[0]}{submit}}; } sub converthtmlfile { diff --git a/scripts/templ2t8.pl b/scripts/templ2t8.pl new file mode 100755 index 000000000..f1e5bf6b5 --- /dev/null +++ b/scripts/templ2t8.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -pli.orig + +# +# template converter -> T8 converter +# +# wanna get rid of those tags? +# no problem. use this script to fix most it. +# +# use: perl tmpl2t8.pl +# +# will save the original file as file.orig +# +s/$/[% USE T8 %]/ if $. == 1; +s/([^<]+)<\/translate>/[%- '$1' | \$T8 %]/xg; diff --git a/templates/webpages/is/_payments_de.html b/templates/webpages/is/_payments_de.html index aa83860f9..1c39b20e3 100644 --- a/templates/webpages/is/_payments_de.html +++ b/templates/webpages/is/_payments_de.html @@ -1,25 +1,25 @@ -[%- USE LxERP %] +[%- USE LxERP %][% USE T8 %] [% IF is_type_credit_note %] - + [% ELSE %] - + [%- END %] - - - - + + + + [% IF show_exchangerate %] - + [% END %] - + @@ -66,13 +66,13 @@ - + - + diff --git a/templates/webpages/is/_payments_master.html b/templates/webpages/is/_payments_master.html index 521666192..1c39b20e3 100644 --- a/templates/webpages/is/_payments_master.html +++ b/templates/webpages/is/_payments_master.html @@ -1,25 +1,25 @@ -[%- USE LxERP %] +[%- USE LxERP %][% USE T8 %]
Zahlungsausgänge[%- 'Payments' | $T8 %]Zahlungseingänge[%- 'Incoming Payments' | $T8 %]
DatumBelegMemoBetrag[%- 'Date' | $T8 %][%- 'Source' | $T8 %][%- 'Memo' | $T8 %][%- 'Amount' | $T8 %]Wechselkurs.[%- 'Exch' | $T8 %]Konto[%- 'Account' | $T8 %]
Summe[%- 'Total' | $T8 %] [% LxERP.foramt_amount(totalpaid, 2) | html %]
Fehlbetrag[%- 'Missing amount' | $T8 %] [% LxERP.format_amount(paid_missing, 2) | html %]
[% IF is_type_credit_note %] - + [% ELSE %] - + [%- END %] - - - - + + + + [% IF show_exchangerate %] - + [% END %] - + @@ -66,13 +66,13 @@ - + - +
Payments[%- 'Payments' | $T8 %]Incoming Payments[%- 'Incoming Payments' | $T8 %]
DateSourceMemoAmount[%- 'Date' | $T8 %][%- 'Source' | $T8 %][%- 'Memo' | $T8 %][%- 'Amount' | $T8 %]Exch[%- 'Exch' | $T8 %]Account[%- 'Account' | $T8 %]
Total[%- 'Total' | $T8 %] [% LxERP.foramt_amount(totalpaid, 2) | html %]
Missing amount[%- 'Missing amount' | $T8 %] [% LxERP.format_amount(paid_missing, 2) | html %]