Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 08882e8c

Von Moritz Bunkus vor etwa 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
856 856
  # connect to database
857 857
  my $dbh = $form->dbconnect($myconfig);
858 858

  
859
  my $query = qq|SELECT id, description, template_code, article_code
860
                 FROM language
861
		 ORDER BY 2|;
859
  my $query =
860
    "SELECT id, description, template_code, article_code, " .
861
    "  output_numberformat, output_dateformat, output_longdates " .
862
    "FROM language ORDER BY description";
862 863

  
863 864
  $sth = $dbh->prepare($query);
864 865
  $sth->execute || $form->dberror($query);
......
882 883
  my $dbh = $form->dbconnect($myconfig);
883 884

  
884 885
  my $query =
885
    qq|SELECT l.description, l.template_code, l.article_code
886
                 FROM language l
887
	         WHERE l.id = $form->{id}|;
886
    "SELECT description, template_code, article_code, " .
887
    "  output_numberformat, output_dateformat, output_longdates " .
888
    "FROM language WHERE id = ?";
888 889
  my $sth = $dbh->prepare($query);
889
  $sth->execute || $form->dberror($query);
890
  $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})");
890 891

  
891 892
  my $ref = $sth->fetchrow_hashref(NAME_lc);
892 893

  
......
899 900
  $main::lxdebug->leave_sub();
900 901
}
901 902

  
903
sub get_language_details {
904
  $main::lxdebug->enter_sub();
905

  
906
  my ($self, $myconfig, $form, $id) = @_;
907

  
908
  # connect to database
909
  my $dbh = $form->dbconnect($myconfig);
910

  
911
  my $query =
912
    "SELECT template_code, " .
913
    "  output_numberformat, output_dateformat, output_longdates " .
914
    "FROM language WHERE id = ?";
915
  my @res = $dbh->selectrow_array($query, undef, $id);
916
  $dbh->disconnect;
917

  
918
  $main::lxdebug->leave_sub();
919

  
920
  return @res;
921
}
922

  
902 923
sub save_language {
903 924
  $main::lxdebug->enter_sub();
904 925

  
......
906 927

  
907 928
  # connect to database
908 929
  my $dbh = $form->dbconnect($myconfig);
930
  my (@values, $query);
909 931

  
910
  $form->{description} =~ s/\'/\'\'/g;
911
  $form->{article_code} =~ s/\'/\'\'/g;
912
  $form->{template_code} =~ s/\'/\'\'/g;
913

  
932
  map({ push(@values, $form->{$_}); }
933
      qw(description template_code article_code
934
         output_numberformat output_dateformat output_longdates));
914 935

  
915 936
  # id is the old record
916 937
  if ($form->{id}) {
917
    $query = qq|UPDATE language SET
918
		description = '$form->{description}',
919
		template_code = '$form->{template_code}',
920
		article_code = '$form->{article_code}'
921
		WHERE id = $form->{id}|;
938
    $query =
939
      "UPDATE language SET " .
940
      "  description = ?, template_code = ?, article_code = ?, " .
941
      "  output_numberformat = ?, output_dateformat = ?, " .
942
      "  output_longdates = ? " .
943
      "WHERE id = ?";
944
    push(@values, $form->{id});
922 945
  } else {
923
    $query = qq|INSERT INTO language
924
                (description, template_code, article_code)
925
                VALUES ('$form->{description}', '$form->{template_code}', '$form->{article_code}')|;
946
    $query =
947
      "INSERT INTO language (" .
948
      "  description, template_code, article_code, " .
949
      "  output_numberformat, output_dateformat, output_longdates" .
950
      ") VALUES (?, ?, ?, ?, ?, ?)";
926 951
  }
927
  $dbh->do($query) || $form->dberror($query);
952
  $dbh->do($query, undef, @values) ||
953
    $form->dberror($query . " (" . join(", ", @values) . ")");
928 954

  
929 955
  $dbh->disconnect;
930 956

  
......
939 965
  # connect to database
940 966
  my $dbh = $form->dbconnect($myconfig);
941 967

  
942
  $query = qq|DELETE FROM language
943
	      WHERE id = $form->{id}|;
944
  $dbh->do($query) || $form->dberror($query);
968
  my $query = "DELETE FROM language WHERE id = ?";
969
  $dbh->do($query, undef, $form->{"id"}) ||
970
    $form->dberror($query . " ($form->{id})");
945 971

  
946 972
  $dbh->disconnect;
947 973

  
bin/mozilla/am.pl
1532 1532

  
1533 1533
  $form->{title} = $locale->text('Languages');
1534 1534

  
1535
  @column_index = qw(description template_code article_code);
1535
  @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
1536 1536

  
1537 1537
  $column_header{description} =
1538 1538
      qq|<th class=listheading width=60%>|
......
1546 1546
      qq|<th class=listheading>|
1547 1547
    . $locale->text('Article Code')
1548 1548
    . qq|</th>|;
1549
  $column_header{output_numberformat} =
1550
      qq|<th class=listheading>|
1551
    . $locale->text('Number Format')
1552
    . qq|</th>|;
1553
  $column_header{output_dateformat} =
1554
      qq|<th class=listheading>|
1555
    . $locale->text('Date Format')
1556
    . qq|</th>|;
1557
  $column_header{output_longdates} =
1558
      qq|<th class=listheading>|
1559
    . $locale->text('Long Dates')
1560
    . qq|</th>|;
1549 1561

  
1550 1562
  $form->header;
1551 1563

  
......
1584 1596
    $column_data{template_code}           = qq|<td align=right>$ref->{template_code}</td>|;
1585 1597
    $column_data{article_code} =
1586 1598
      qq|<td align=right>$ref->{article_code}</td>|;
1599
    $column_data{output_numberformat} =
1600
      "<td nowrap>" .
1601
      ($ref->{output_numberformat} ? $ref->{output_numberformat} :
1602
       $locale->text("use program settings")) .
1603
      "</td>";
1604
    $column_data{output_dateformat} =
1605
      "<td nowrap>" .
1606
      ($ref->{output_dateformat} ? $ref->{output_dateformat} :
1607
       $locale->text("use program settings")) .
1608
      "</td>";
1609
    $column_data{output_longdates} =
1610
      "<td nowrap>" .
1611
      ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
1612
      "</td>";
1587 1613

  
1588 1614
    map { print "$column_data{$_}\n" } @column_index;
1589 1615

  
......
1646 1672

  
1647 1673
  $form->header;
1648 1674

  
1675
  my $numberformat =
1676
    qq|<option value="">| . $locale->text("use program settings") .
1677
    qq|</option>|;
1678
  foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
1679
    $numberformat .=
1680
      ($item eq $form->{output_numberformat})
1681
      ? "<option selected>$item"
1682
      : "<option>$item"
1683
      . "</option>";
1684
  }
1685

  
1686
  my $dateformat =
1687
    qq|<option value="">| . $locale->text("use program settings") .
1688
    qq|</option>|;
1689
  foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
1690
    $dateformat .=
1691
      ($item eq $form->{output_dateformat})
1692
      ? "<option selected>$item"
1693
      : "<option>$item"
1694
      . "</option>";
1695
  }
1696

  
1649 1697
  print qq|
1650 1698
<body>
1651 1699

  
......
1661 1709
  <tr height="5"></tr>
1662 1710
  <tr>
1663 1711
    <th align=right>| . $locale->text('Language') . qq|</th>
1664
    <td><input name=description size=30 value="$form->{description}"></td>
1712
    <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
1665 1713
  <tr>
1666 1714
  <tr>
1667 1715
    <th align=right>| . $locale->text('Template Code') . qq|</th>
1668
    <td><input name=template_code size=5 value=$form->{template_code}></td>
1716
    <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
1669 1717
  </tr>
1670 1718
  <tr>
1671 1719
    <th align=right>| . $locale->text('Article Code') . qq|</th>
1672
    <td><input name=article_code size=10 value=$form->{article_code}></td>
1720
    <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
1721
  </tr>
1722
  <tr>
1723
    <th align=right>| . $locale->text('Number Format') . qq|</th>
1724
    <td><select name="output_numberformat">$numberformat</select></td>
1725
  </tr>
1726
  <tr>
1727
    <th align=right>| . $locale->text('Date Format') . qq|</th>
1728
    <td><select name="output_dateformat">$dateformat</select></td>
1729
  </tr>
1730
  <tr>
1731
    <th align=right>| . $locale->text('Long Dates') . qq|</th>
1732
    <td><input type="radio" name="output_longdates" value="1"| .
1733
    ($form->{output_longdates} ? " checked" : "") .
1734
    qq|>| . $locale->text("Yes") .
1735
    qq|<input type="radio" name="output_longdates" value="0"| .
1736
    ($form->{output_longdates} ? "" : " checked") .
1737
    qq|>| . $locale->text("No") .
1738
    qq|</td>
1673 1739
  </tr>
1674 1740
  <td colspan=2><hr size=3 noshade></td>
1675 1741
  </tr>
locale/de/all
602 602
  'Login Name'                  => 'Benutzername',
603 603
  'Login name missing!'         => 'Loginname fehlt.',
604 604
  'Logout'                      => 'Abmeldung',
605
  'Long Dates'                  => 'Lange Monatsnamen',
605 606
  'Long Description'            => 'Langtext',
606 607
  '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.',
607 608
  '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.',
......
1160 1161
  'soldtotal'                   => 'Verkaufte Anzahl',
1161 1162
  'successfully created!'       => 'wurde erfolgreich erstellt',
1162 1163
  'successfully deleted!'       => 'wurde erfolgreich gel?scht',
1164
  'use program settings'        => 'benutze Programmeinstellungen',
1163 1165
  'ustva'                       => 'UStVA',
1164 1166
  'website'                     => 'Webseite',
1165 1167
  'winston_export'              => 'Winston-Export',
locale/de/am
136 136
  'Lead'                        => 'Kundenquelle',
137 137
  'Liability'                   => 'Passiva/Mittelherkunft',
138 138
  'Link'                        => 'Verkn?pfungen',
139
  'Long Dates'                  => 'Lange Monatsnamen',
139 140
  'Long Description'            => 'Langtext',
140 141
  'Name'                        => 'Name',
141 142
  'Netto Terms'                 => 'Zahlungsziel netto',
......
147 148
  'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
148 149
  'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
149 150
  'Number'                      => 'Nummer',
151
  'Number Format'               => 'Zahlenformat',
150 152
  'Output Number Format'        => 'Zahlenformat (Ausgabe)',
151 153
  'Part Number'                 => 'Artikelnummer',
152 154
  'Part description'            => 'Artikelbeschreibung',
......
267 269
  'lead deleted!'               => 'Kundenquelle gel?scht',
268 270
  'lead saved!'                 => 'Kundenquelle geichert',
269 271
  'service units'               => 'Dienstleistungseinheiten',
272
  'use program settings'        => 'benutze Programmeinstellungen',
270 273
};
271 274

  
272 275
$self->{subs} = {
sql/Pg-upgrade/Pg-upgrade-2.4.0.0-2.4.0.1.sql
1
ALTER TABLE language ADD COLUMN output_numberformat text;
2
ALTER TABLE language ADD COLUMN output_dateformat text;
3
ALTER TABLE language ADD COLUMN output_longdates boolean;

Auch abrufbar als: Unified diff