From 08882e8ce50b1e317d313dac8f27d306dae4492d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 18 Dec 2006 10:24:32 +0000 Subject: [PATCH] =?utf8?q?Sprachentabelle=20um=20Felder=20erweitert,=20um?= =?utf8?q?=20bei=20jeder=20Sprache=20auch=20die=20Ausgabeformate=20f=C3=BC?= =?utf8?q?r=20Zahlen=20und=20Datumsangaben=20zu=20speichern=20und=20zu=20v?= =?utf8?q?erwalten.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/AM.pm | 72 ++++++++++++------ bin/mozilla/am.pl | 74 ++++++++++++++++++- locale/de/all | 2 + locale/de/am | 3 + sql/Pg-upgrade/Pg-upgrade-2.4.0.0-2.4.0.1.sql | 3 + 5 files changed, 127 insertions(+), 27 deletions(-) create mode 100644 sql/Pg-upgrade/Pg-upgrade-2.4.0.0-2.4.0.1.sql diff --git a/SL/AM.pm b/SL/AM.pm index 6249f54d6..a3f7f7c27 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -856,9 +856,10 @@ sub language { # connect to database my $dbh = $form->dbconnect($myconfig); - my $query = qq|SELECT id, description, template_code, article_code - FROM language - ORDER BY 2|; + my $query = + "SELECT id, description, template_code, article_code, " . + " output_numberformat, output_dateformat, output_longdates " . + "FROM language ORDER BY description"; $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); @@ -882,11 +883,11 @@ sub get_language { my $dbh = $form->dbconnect($myconfig); my $query = - qq|SELECT l.description, l.template_code, l.article_code - FROM language l - WHERE l.id = $form->{id}|; + "SELECT description, template_code, article_code, " . + " output_numberformat, output_dateformat, output_longdates " . + "FROM language WHERE id = ?"; my $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); + $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})"); my $ref = $sth->fetchrow_hashref(NAME_lc); @@ -899,6 +900,26 @@ sub get_language { $main::lxdebug->leave_sub(); } +sub get_language_details { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form, $id) = @_; + + # connect to database + my $dbh = $form->dbconnect($myconfig); + + my $query = + "SELECT template_code, " . + " output_numberformat, output_dateformat, output_longdates " . + "FROM language WHERE id = ?"; + my @res = $dbh->selectrow_array($query, undef, $id); + $dbh->disconnect; + + $main::lxdebug->leave_sub(); + + return @res; +} + sub save_language { $main::lxdebug->enter_sub(); @@ -906,25 +927,30 @@ sub save_language { # connect to database my $dbh = $form->dbconnect($myconfig); + my (@values, $query); - $form->{description} =~ s/\'/\'\'/g; - $form->{article_code} =~ s/\'/\'\'/g; - $form->{template_code} =~ s/\'/\'\'/g; - + map({ push(@values, $form->{$_}); } + qw(description template_code article_code + output_numberformat output_dateformat output_longdates)); # id is the old record if ($form->{id}) { - $query = qq|UPDATE language SET - description = '$form->{description}', - template_code = '$form->{template_code}', - article_code = '$form->{article_code}' - WHERE id = $form->{id}|; + $query = + "UPDATE language SET " . + " description = ?, template_code = ?, article_code = ?, " . + " output_numberformat = ?, output_dateformat = ?, " . + " output_longdates = ? " . + "WHERE id = ?"; + push(@values, $form->{id}); } else { - $query = qq|INSERT INTO language - (description, template_code, article_code) - VALUES ('$form->{description}', '$form->{template_code}', '$form->{article_code}')|; + $query = + "INSERT INTO language (" . + " description, template_code, article_code, " . + " output_numberformat, output_dateformat, output_longdates" . + ") VALUES (?, ?, ?, ?, ?, ?)"; } - $dbh->do($query) || $form->dberror($query); + $dbh->do($query, undef, @values) || + $form->dberror($query . " (" . join(", ", @values) . ")"); $dbh->disconnect; @@ -939,9 +965,9 @@ sub delete_language { # connect to database my $dbh = $form->dbconnect($myconfig); - $query = qq|DELETE FROM language - WHERE id = $form->{id}|; - $dbh->do($query) || $form->dberror($query); + my $query = "DELETE FROM language WHERE id = ?"; + $dbh->do($query, undef, $form->{"id"}) || + $form->dberror($query . " ($form->{id})"); $dbh->disconnect; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 1ebd59816..4d3a88f33 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1532,7 +1532,7 @@ sub list_language { $form->{title} = $locale->text('Languages'); - @column_index = qw(description template_code article_code); + @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates); $column_header{description} = qq|| @@ -1546,6 +1546,18 @@ sub list_language { qq|| . $locale->text('Article Code') . qq||; + $column_header{output_numberformat} = + qq|| + . $locale->text('Number Format') + . qq||; + $column_header{output_dateformat} = + qq|| + . $locale->text('Date Format') + . qq||; + $column_header{output_longdates} = + qq|| + . $locale->text('Long Dates') + . qq||; $form->header; @@ -1584,6 +1596,20 @@ sub list_language { $column_data{template_code} = qq|$ref->{template_code}|; $column_data{article_code} = qq|$ref->{article_code}|; + $column_data{output_numberformat} = + "" . + ($ref->{output_numberformat} ? $ref->{output_numberformat} : + $locale->text("use program settings")) . + ""; + $column_data{output_dateformat} = + "" . + ($ref->{output_dateformat} ? $ref->{output_dateformat} : + $locale->text("use program settings")) . + ""; + $column_data{output_longdates} = + "" . + ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) . + ""; map { print "$column_data{$_}\n" } @column_index; @@ -1646,6 +1672,28 @@ sub language_header { $form->header; + my $numberformat = + qq||; + foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) { + $numberformat .= + ($item eq $form->{output_numberformat}) + ? ""; + } + + my $dateformat = + qq||; + foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) { + $dateformat .= + ($item eq $form->{output_dateformat}) + ? ""; + } + print qq| @@ -1661,15 +1709,33 @@ sub language_header { | . $locale->text('Language') . qq| - + | . $locale->text('Template Code') . qq| - {template_code}> + | . $locale->text('Article Code') . qq| - {article_code}> + + + + | . $locale->text('Number Format') . qq| + + + + | . $locale->text('Date Format') . qq| + + + + | . $locale->text('Long Dates') . qq| + {output_longdates} ? " checked" : "") . + qq|>| . $locale->text("Yes") . + qq|{output_longdates} ? "" : " checked") . + qq|>| . $locale->text("No") . + qq|
diff --git a/locale/de/all b/locale/de/all index 609e65f60..2ddbf252c 100644 --- a/locale/de/all +++ b/locale/de/all @@ -602,6 +602,7 @@ gestartet', 'Login Name' => 'Benutzername', 'Login name missing!' => 'Loginname fehlt.', 'Logout' => 'Abmeldung', + 'Long Dates' => 'Lange Monatsnamen', 'Long Description' => 'Langtext', 'Lx-Office 2.4.0 introduces two new concepts: tax zones and Buchungsgruppen.' => 'Lx-Office 2.4.0 führt zwei neue Konzepte ein: Steuerzonen und Buchungsgruppen.', 'Lx-Office is about to update the database . You should create a backup of the database before proceeding because the backup might not be reversible.' => 'Lx-Office wird gleich die Datenbank aktualisieren. Sie sollten eine Sicherungskopie der Datenbank erstellen, bevor Sie fortfahren, da die Aktualisierung unter Umständen nicht umkehrbar ist.', @@ -1160,6 +1161,7 @@ gestartet', 'soldtotal' => 'Verkaufte Anzahl', 'successfully created!' => 'wurde erfolgreich erstellt', 'successfully deleted!' => 'wurde erfolgreich gelöscht', + 'use program settings' => 'benutze Programmeinstellungen', 'ustva' => 'UStVA', 'website' => 'Webseite', 'winston_export' => 'Winston-Export', diff --git a/locale/de/am b/locale/de/am index d37d99eb4..9add76b54 100644 --- a/locale/de/am +++ b/locale/de/am @@ -136,6 +136,7 @@ $self->{texts} = { 'Lead' => 'Kundenquelle', 'Liability' => 'Passiva/Mittelherkunft', 'Link' => 'Verknüpfungen', + 'Long Dates' => 'Lange Monatsnamen', 'Long Description' => 'Langtext', 'Name' => 'Name', 'Netto Terms' => 'Zahlungsziel netto', @@ -147,6 +148,7 @@ $self->{texts} = { 'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.', 'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.', 'Number' => 'Nummer', + 'Number Format' => 'Zahlenformat', 'Output Number Format' => 'Zahlenformat (Ausgabe)', 'Part Number' => 'Artikelnummer', 'Part description' => 'Artikelbeschreibung', @@ -267,6 +269,7 @@ $self->{texts} = { 'lead deleted!' => 'Kundenquelle gelöscht', 'lead saved!' => 'Kundenquelle geichert', 'service units' => 'Dienstleistungseinheiten', + 'use program settings' => 'benutze Programmeinstellungen', }; $self->{subs} = { diff --git a/sql/Pg-upgrade/Pg-upgrade-2.4.0.0-2.4.0.1.sql b/sql/Pg-upgrade/Pg-upgrade-2.4.0.0-2.4.0.1.sql new file mode 100644 index 000000000..b55199e29 --- /dev/null +++ b/sql/Pg-upgrade/Pg-upgrade-2.4.0.0-2.4.0.1.sql @@ -0,0 +1,3 @@ +ALTER TABLE language ADD COLUMN output_numberformat text; +ALTER TABLE language ADD COLUMN output_dateformat text; +ALTER TABLE language ADD COLUMN output_longdates boolean; -- 2.20.1