Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 07948c34

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID 07948c344b0f699314c1b05b4e9c41b8babc3981
  • Vorgänger 2381f1e3
  • Nachfolger d33ad436

Trennung zwischen Dienstleistungs- und Wareneinheiten aufgehoben.

Unterschiede anzeigen:

SL/AM.pm
1776 1776
sub retrieve_units {
1777 1777
  $main::lxdebug->enter_sub();
1778 1778

  
1779
  my ($self, $myconfig, $form, $type, $prefix) = @_;
1779
  my ($self, $myconfig, $form, $prefix) = @_;
1780 1780

  
1781 1781
  my $dbh = $form->dbconnect($myconfig);
1782 1782

  
1783 1783
  my $query = "SELECT *, base_unit AS original_base_unit FROM units";
1784
  my @values;
1785
  if ($type) {
1786
    $query .= " WHERE (type = ?)";
1787
    @values = ($type);
1788
  }
1789 1784

  
1790
  my $sth = $dbh->prepare($query);
1791
  $sth->execute(@values) || $form->dberror($query . " (" . join(", ", @values) . ")");
1785
  my $sth = prepare_execute_query($form, $dbh, $query);
1792 1786

  
1793 1787
  my $units = {};
1794 1788
  while (my $ref = $sth->fetchrow_hashref()) {
......
2037 2031
sub add_unit {
2038 2032
  $main::lxdebug->enter_sub();
2039 2033

  
2040
  my ($self, $myconfig, $form, $name, $base_unit, $factor, $type, $languages) = @_;
2034
  my ($self, $myconfig, $form, $name, $base_unit, $factor, $languages) = @_;
2041 2035

  
2042 2036
  my $dbh = $form->dbconnect_noauto($myconfig);
2043 2037

  
2044 2038
  my $query = qq|SELECT COALESCE(MAX(sortkey), 0) + 1 FROM units|;
2045 2039
  my ($sortkey) = selectrow_query($form, $dbh, $query);
2046 2040

  
2047
  $query = "INSERT INTO units (name, base_unit, factor, type, sortkey) " .
2048
    "VALUES (?, ?, ?, ?, ?)";
2049
  do_query($form, $dbh, $query, $name, $base_unit, $factor, $type, $sortkey);
2041
  $query = "INSERT INTO units (name, base_unit, factor, sortkey) " .
2042
    "VALUES (?, ?, ?, ?)";
2043
  do_query($form, $dbh, $query, $name, $base_unit, $factor, $sortkey);
2050 2044

  
2051 2045
  if ($languages) {
2052 2046
    $query = "INSERT INTO units_language (unit, language_id, localized, localized_plural) VALUES (?, ?, ?, ?)";
......
2067 2061
sub save_units {
2068 2062
  $main::lxdebug->enter_sub();
2069 2063

  
2070
  my ($self, $myconfig, $form, $type, $units, $delete_units) = @_;
2064
  my ($self, $myconfig, $form, $units, $delete_units) = @_;
2071 2065

  
2072 2066
  my $dbh = $form->dbconnect_noauto($myconfig);
2073 2067

  
......
2125 2119
sub swap_units {
2126 2120
  $main::lxdebug->enter_sub();
2127 2121

  
2128
  my ($self, $myconfig, $form, $dir, $name_1, $unit_type) = @_;
2122
  my ($self, $myconfig, $form, $dir, $name_1) = @_;
2129 2123

  
2130 2124
  my $dbh = $form->dbconnect_noauto($myconfig);
2131 2125

  
......
2136 2130

  
2137 2131
  $query =
2138 2132
    qq|SELECT sortkey FROM units | .
2139
    qq|WHERE sortkey | . ($dir eq "down" ? ">" : "<") . qq| ? AND type = ? | .
2133
    qq|WHERE sortkey | . ($dir eq "down" ? ">" : "<") . qq| ? | .
2140 2134
    qq|ORDER BY sortkey | . ($dir eq "down" ? "ASC" : "DESC") . qq| LIMIT 1|;
2141
  my ($sortkey_2) = selectrow_query($form, $dbh, $query, $sortkey_1, $unit_type);
2135
  my ($sortkey_2) = selectrow_query($form, $dbh, $query, $sortkey_1);
2142 2136

  
2143 2137
  if (defined($sortkey_1)) {
2144 2138
    $query = qq|SELECT name FROM units WHERE sortkey = ${sortkey_2}|;

Auch abrufbar als: Unified diff