From: Moritz Bunkus Date: Thu, 8 Nov 2012 11:41:59 +0000 (+0100) Subject: Merge branch 'master' of vc.linet-services.de:public/lx-office-erp X-Git-Tag: release-3.0.0beta1~29 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=fcbb613d03379b265cb0df7ce0b553ee630d52f3;hp=7c931a23dd4be179df2003599724734a23a9eade;p=kivitendo-erp.git Merge branch 'master' of vc.linet-services.de:public/lx-office-erp --- diff --git a/SL/CT.pm b/SL/CT.pm index de10623f2..93c3fcea2 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -598,6 +598,7 @@ sub search { my $dbh = $form->dbconnect($myconfig); my $cv = $form->{db} eq "customer" ? "customer" : "vendor"; + my $join_records = $form->{l_invnumber} || $form->{l_ordnumber} || $form->{l_quonumber}; my $where = "1 = 1"; my @values; @@ -611,7 +612,7 @@ sub search { $form->{sort} = $sortorder; my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC'; - if ($sortorder !~ /(business|id)/ && 1 >= scalar grep { $form->{$_} } qw(l_ordnumber l_quonumber l_invnumber )) { + if ($sortorder !~ /(business|id)/ && !$join_records) { $sortorder = "lower($sortorder) ${sortdir}"; } else { $sortorder .= " ${sortdir}"; @@ -705,21 +706,22 @@ sub search { my $query = qq|SELECT ct.*, b.description AS business | . + (qq|, NULL AS invnumber, NULL AS ordnumber, NULL AS quonumber, NULL AS invid, NULL AS module, NULL AS formtype, NULL AS closed | x!! $join_records) . qq|FROM $cv ct | . qq|LEFT JOIN business b ON (ct.business_id = b.id) | . qq|WHERE $where|; my @saved_values = @values; # redo for invoices, orders and quotations - if ($form->{l_invnumber} || $form->{l_ordnumber} || $form->{l_quonumber}) { - my ($ar, $union, $module); - $query = ""; + if ($join_records) { + my $union = "UNION"; if ($form->{l_invnumber}) { my $ar = $cv eq 'customer' ? 'ar' : 'ap'; my $module = $ar eq 'ar' ? 'is' : 'ir'; - - $query = + push(@values, @saved_values); + $query .= + qq| UNION | . qq|SELECT ct.*, b.description AS business, | . qq| a.invnumber, a.ordnumber, a.quonumber, a.id AS invid, | . qq| '$module' AS module, 'invoice' AS formtype, | . @@ -728,16 +730,12 @@ sub search { qq|JOIN $ar a ON (a.${cv}_id = ct.id) | . qq|LEFT JOIN business b ON (ct.business_id = b.id) | . qq|WHERE $where AND (a.invoice = '1')|; - - $union = qq|UNION|; } if ( $form->{l_ordnumber} ) { - if ($union eq "UNION") { - push(@values, @saved_values); - } + push(@values, @saved_values); $query .= - qq| $union | . + qq| UNION | . qq|SELECT ct.*, b.description AS business,| . qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | . qq| 'oe' AS module, 'order' AS formtype, o.closed | . @@ -745,16 +743,12 @@ sub search { qq|JOIN oe o ON (o.${cv}_id = ct.id) | . qq|LEFT JOIN business b ON (ct.business_id = b.id) | . qq|WHERE $where AND (o.quotation = '0')|; - - $union = qq|UNION|; } if ( $form->{l_quonumber} ) { - if ($union eq "UNION") { - push(@values, @saved_values); - } + push(@values, @saved_values); $query .= - qq| $union | . + qq| UNION | . qq|SELECT ct.*, b.description AS business, | . qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | . qq| 'oe' AS module, 'quotation' AS formtype, o.closed | . diff --git a/SL/Controller/ClientConfig.pm b/SL/Controller/ClientConfig.pm index aaed72fc5..41c19ee80 100644 --- a/SL/Controller/ClientConfig.pm +++ b/SL/Controller/ClientConfig.pm @@ -18,7 +18,7 @@ sub action_edit { $self->{payment_options} = [ { title => $::locale->text("never"), value => 0 }, { title => $::locale->text("every time"), value => 1 }, { title => $::locale->text("on the same day"), value => 2 }, ]; - $self->{accounting_options} = [ { title => $::locale->text("accrual"), value => "accrual" }, + $self->{accounting_options} = [ { title => $::locale->text("Accrual"), value => "accrual" }, { title => $::locale->text("cash"), value => "cash" }, ]; $self->{inventory_options} = [ { title => $::locale->text("perpetual"), value => "perpetual" }, { title => $::locale->text("periodic"), value => "periodic" }, ]; diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index f0d88ffa1..83210316c 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -25,12 +25,17 @@ sub init { $params{path_suffix} ||= ''; $params{schema} ||= ''; + $params{path} = "sql/" . $params{dbdriver} . "-upgrade2" . $params{path_suffix}; map { $self->{$_} = $params{$_} } keys %params; return $self; } +sub path { + $_[0]{path}; +} + sub parse_dbupdate_controls { $::lxdebug->enter_sub(); @@ -42,7 +47,7 @@ sub parse_dbupdate_controls { local *IN; my %all_controls; - my $path = "sql/" . $self->{dbdriver} . "-upgrade2" . $self->{path_suffix}; + my $path = $self->path; foreach my $file_name (<$path/*.sql>, <$path/*.pl>) { next unless (open(IN, $file_name)); diff --git a/SL/IC.pm b/SL/IC.pm index 0f4187094..ff80d76cb 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -1565,6 +1565,11 @@ sub retrieve_accounts { } else { $transdate = $form->{deliverydate}; } + } elsif (($form->{type} eq "credit_note") and $form->{deliverydate}) { + # if credit_note has a deliverydate, use this instead of invdate + # useful for credit_notes of invoices from an old period with different tax + # if there is no deliverydate then invdate is used, old default (see next elsif) + $transdate = $form->{deliverydate}; } elsif (($form->{type} eq "credit_note") || ($form->{script} eq 'ir.pl')) { $transdate = $form->{invdate}; } else { diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index f9d299ff5..500547597 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -940,7 +940,7 @@ sub edit_defaults { # default language my $all_languages = SL::DB::Manager::Language->get_all; -# EÜR = cash, Bilanzierung = accrual +# cash = IST-Versteuerung, accrual = SOLL-Versteuerung foreach my $key (keys %{ $form->{IC} }) { foreach my $accno (sort keys %{ $form->{IC}->{$key} }) { diff --git a/css/kivitendo/menu.css b/css/kivitendo/menu.css index 3523c7491..625abec85 100644 --- a/css/kivitendo/menu.css +++ b/css/kivitendo/menu.css @@ -318,3 +318,10 @@ div#menuv3 li:hover ul, div#menuv3 li li:hover ul, div#menuv3 li li li:hover ul, #html-menu div.s2 { padding-left: 16px } body { margin: 0 } + +@media print { + #menuv3, #menuv4, #html-menu, #frame-header, #js-menu { /* items with this class won't print */ + display: none; + } + #content.html-menu { margin-left: 0; } +} diff --git a/css/lx-office-erp/menu.css b/css/lx-office-erp/menu.css index 19f98b20c..807082ee4 100644 --- a/css/lx-office-erp/menu.css +++ b/css/lx-office-erp/menu.css @@ -325,3 +325,11 @@ div#menuv4 li li li li:hover ul #html-menu div.s2 { padding-left: 16px } body { margin: 0 } + + +@media print { + #menuv3, #menuv4, #html-menu, #frame-header, #js-menu { /* items with this class won't print */ + display: none; + } + #content.html-menu { margin-left: 0; } +} diff --git a/locale/de/all b/locale/de/all index f5a79c387..6ed0ddd6e 100644 --- a/locale/de/all +++ b/locale/de/all @@ -101,7 +101,7 @@ $self->{texts} = { 'Accounting Group deleted!' => 'Buchungsgruppe gelöscht!', 'Accounting Group saved!' => 'Buchungsgruppe gespeichert!', 'Accounting method' => 'Versteuerungsart', - 'Accrual' => 'Bilanzierung', + 'Accrual' => 'Soll-Versteuerung', 'Active' => 'Aktiv', 'Active?' => 'Aktiviert?', 'Add' => 'Erfassen', diff --git a/locale/de_DE/all b/locale/de_DE/all index 182d245c8..52d3ec595 100644 --- a/locale/de_DE/all +++ b/locale/de_DE/all @@ -101,7 +101,7 @@ $self->{texts} = { 'Accounting Group deleted!' => 'Buchungsgruppe gelöscht!', 'Accounting Group saved!' => 'Buchungsgruppe gespeichert!', 'Accounting method' => 'Versteuerungsart', - 'Accrual' => 'Bilanzierung', + 'Accrual' => 'Soll-Versteuerung', 'Active' => 'Aktiv', 'Active?' => 'Aktiviert?', 'Add' => 'Erfassen', @@ -2212,7 +2212,7 @@ $self->{texts} = { '[email]' => '[email]', 'absolute' => 'absolut', 'account_description' => 'Beschreibung', - 'accrual' => 'Bilanzierung (Soll-Versteuerung)', + 'accrual' => 'Soll-Versteuerung', 'action= not defined!' => 'action= nicht definiert!', 'active' => 'aktiv', 'all entries' => 'alle Einträge', diff --git a/scripts/dbupgrade2_tool.pl b/scripts/dbupgrade2_tool.pl index 253706c93..ba13e3f70 100755 --- a/scripts/dbupgrade2_tool.pl +++ b/scripts/dbupgrade2_tool.pl @@ -43,7 +43,8 @@ use SL::Dispatcher; my ($opt_list, $opt_tree, $opt_rtree, $opt_nodeps, $opt_graphviz, $opt_help); my ($opt_user, $opt_apply, $opt_applied, $opt_unapplied, $opt_format, $opt_test_utf8); -my ($opt_dbhost, $opt_dbport, $opt_dbname, $opt_dbuser, $opt_dbpassword); +my ($opt_dbhost, $opt_dbport, $opt_dbname, $opt_dbuser, $opt_dbpassword, $opt_create, $opt_type); +my ($opt_description, $opt_encoding, @opt_depends); our (%myconfig, $form, $user, $auth, $locale, $controls, $dbupgrader); @@ -231,6 +232,48 @@ sub dump_nodeps { "\n\n"; } +sub create_upgrade { + my (%params) = @_; + + my $filename = $params{filename}; + my $dbupgrader = $params{dbupgrader}; + my $type = $params{type} || ''; + my $description = $params{description} || ''; + my $encoding = $params{encoding} || 'utf-8'; + my @depends = @{ $params{depends} }; + + if (!@depends) { + my @releases = grep { /^release_/ } keys %$controls; + @depends = ((sort @releases)[-1]); + } + + my $comment; + if ($type eq 'sql') { + $comment = '--'; + } elsif ($type eq 'pl') { + $comment = '#'; + } elsif (!$type) { + die 'Error: No --type was given but is required for --create.'; + } else { + die 'Error: Unknown --type. Try "sql" or "pl".'; + } + + my $full_filename = $dbupgrader->path . '/' . $filename . '.' . $type; + + die "file '$full_filename' already exists, aborting" if -f $full_filename; + + + open my $fh, ">:encoding($encoding)", $full_filename or die "can't open $full_filename"; + print $fh "$comment \@tag: $filename\n"; + print $fh "$comment \@description: $description\n"; + print $fh "$comment \@depends: @depends\n"; + print $fh "$comment \@encoding: $encoding\n"; + close $fh; + + system("\$EDITOR $full_filename"); + exit 0; +} + sub apply_upgrade { my $name = shift; @@ -399,6 +442,11 @@ GetOptions("list" => \$opt_list, "user=s" => \$opt_user, "apply=s" => \$opt_apply, "applied" => \$opt_applied, + "create=s" => \$opt_create, + "type=s" => \$opt_type, + "encoding=s" => \$opt_encoding, + "description=s" => \$opt_description, + "depends=s" => \@opt_depends, "unapplied" => \$opt_unapplied, "test-utf8" => \$opt_test_utf8, "dbhost:s" => \$opt_dbhost, @@ -420,6 +468,12 @@ dump_tree_reverse() if ($opt_rtree); dump_graphviz('file_name' => $opt_graphviz, 'format' => $opt_format) if (defined $opt_graphviz); dump_nodeps() if ($opt_nodeps); +create_upgrade(filename => $opt_create, + dbupgrader => $dbupgrader, + type => $opt_type, + description => $opt_description, + encoding => $opt_encoding, + depends => \@opt_depends) if ($opt_create); if ($opt_user) { $auth = SL::Auth->new(); @@ -456,6 +510,7 @@ if ($opt_unapplied) { dump_unapplied(); } + if ($opt_test_utf8) { $form->error("--test-utf8 used but no database name given with --dbname.") if (!$opt_dbname); diff --git a/templates/webpages/is/form_header.html b/templates/webpages/is/form_header.html index bbe05f0a4..97561d154 100644 --- a/templates/webpages/is/form_header.html +++ b/templates/webpages/is/form_header.html @@ -197,12 +197,11 @@ [% 'Delivery Order Number' | $T8 %] +[%- END %] [% 'Delivery Date' | $T8 %] [% L.date_tag('deliverydate', deliverydate, cal_align='BL') %] -[%- END %] - [% 'Order Number' | $T8 %] diff --git a/templates/webpages/rp/report.html b/templates/webpages/rp/report.html index cf755d6b7..158c0cceb 100644 --- a/templates/webpages/rp/report.html +++ b/templates/webpages/rp/report.html @@ -63,7 +63,7 @@ [% 'Method' | $T8 %] [% L.radio_button_tag('method', value='accrual', checked=accrual, label=LxERP.t8('Accrual')) %] - [% L.radio_button_tag('method', value='cash', checked=cash, label=LxERP.t8('EUR')) %] + [% L.radio_button_tag('method', value='cash', checked=cash, label=LxERP.t8('cash')) %] [%- END %]