Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 08882e8c

Von Moritz Bunkus vor mehr als 18 Jahren hinzugefügt

  • ID 08882e8ce50b1e317d313dac8f27d306dae4492d
  • Vorgänger 367bf289
  • Nachfolger 3edbebcc

Sprachentabelle um Felder erweitert, um bei jeder Sprache auch die Ausgabeformate für Zahlen und Datumsangaben zu speichern und zu verwalten.

Unterschiede anzeigen:

SL/AM.pm
# 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);
......
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);
......
$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();
......
# 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;
......
# 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;
bin/mozilla/am.pl
$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|<th class=listheading width=60%>|
......
qq|<th class=listheading>|
. $locale->text('Article Code')
. qq|</th>|;
$column_header{output_numberformat} =
qq|<th class=listheading>|
. $locale->text('Number Format')
. qq|</th>|;
$column_header{output_dateformat} =
qq|<th class=listheading>|
. $locale->text('Date Format')
. qq|</th>|;
$column_header{output_longdates} =
qq|<th class=listheading>|
. $locale->text('Long Dates')
. qq|</th>|;
$form->header;
......
$column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
$column_data{article_code} =
qq|<td align=right>$ref->{article_code}</td>|;
$column_data{output_numberformat} =
"<td nowrap>" .
($ref->{output_numberformat} ? $ref->{output_numberformat} :
$locale->text("use program settings")) .
"</td>";
$column_data{output_dateformat} =
"<td nowrap>" .
($ref->{output_dateformat} ? $ref->{output_dateformat} :
$locale->text("use program settings")) .
"</td>";
$column_data{output_longdates} =
"<td nowrap>" .
($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
"</td>";
map { print "$column_data{$_}\n" } @column_index;
......
$form->header;
my $numberformat =
qq|<option value="">| . $locale->text("use program settings") .
qq|</option>|;
foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
$numberformat .=
($item eq $form->{output_numberformat})
? "<option selected>$item"
: "<option>$item"
. "</option>";
}
my $dateformat =
qq|<option value="">| . $locale->text("use program settings") .
qq|</option>|;
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})
? "<option selected>$item"
: "<option>$item"
. "</option>";
}
print qq|
<body>
......
<tr height="5"></tr>
<tr>
<th align=right>| . $locale->text('Language') . qq|</th>
<td><input name=description size=30 value="$form->{description}"></td>
<td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
<tr>
<tr>
<th align=right>| . $locale->text('Template Code') . qq|</th>
<td><input name=template_code size=5 value=$form->{template_code}></td>
<td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
</tr>
<tr>
<th align=right>| . $locale->text('Article Code') . qq|</th>
<td><input name=article_code size=10 value=$form->{article_code}></td>
<td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
</tr>
<tr>
<th align=right>| . $locale->text('Number Format') . qq|</th>
<td><select name="output_numberformat">$numberformat</select></td>
</tr>
<tr>
<th align=right>| . $locale->text('Date Format') . qq|</th>
<td><select name="output_dateformat">$dateformat</select></td>
</tr>
<tr>
<th align=right>| . $locale->text('Long Dates') . qq|</th>
<td><input type="radio" name="output_longdates" value="1"| .
($form->{output_longdates} ? " checked" : "") .
qq|>| . $locale->text("Yes") .
qq|<input type="radio" name="output_longdates" value="0"| .
($form->{output_longdates} ? "" : " checked") .
qq|>| . $locale->text("No") .
qq|</td>
</tr>
<td colspan=2><hr size=3 noshade></td>
</tr>
locale/de/all
'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&uuml;hrt zwei neue Konzepte ein: Steuerzonen und Buchungsgruppen.',
'Lx-Office is about to update the database <b><TMPL_VAR dbname ESCAPE=HTML></b>. You should create a backup of the database before proceeding because the backup might not be reversible.' => 'Lx-Office wird gleich die Datenbank <b><TMPL_VAR dbname ESCAPE=HTML></b> aktualisieren. Sie sollten eine Sicherungskopie der Datenbank erstellen, bevor Sie fortfahren, da die Aktualisierung unter Umst&auml;nden nicht umkehrbar ist.',
......
'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',
locale/de/am
'Lead' => 'Kundenquelle',
'Liability' => 'Passiva/Mittelherkunft',
'Link' => 'Verkn?pfungen',
'Long Dates' => 'Lange Monatsnamen',
'Long Description' => 'Langtext',
'Name' => 'Name',
'Netto Terms' => 'Zahlungsziel netto',
......
'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',
......
'lead deleted!' => 'Kundenquelle gel?scht',
'lead saved!' => 'Kundenquelle geichert',
'service units' => 'Dienstleistungseinheiten',
'use program settings' => 'benutze Programmeinstellungen',
};
$self->{subs} = {
sql/Pg-upgrade/Pg-upgrade-2.4.0.0-2.4.0.1.sql
ALTER TABLE language ADD COLUMN output_numberformat text;
ALTER TABLE language ADD COLUMN output_dateformat text;
ALTER TABLE language ADD COLUMN output_longdates boolean;

Auch abrufbar als: Unified diff