commit 604959deb2d2d058a4c421468027e0d55066cffd
Author: Moritz Bunkus <m.bunkus@linet.de>
Date:   Fri Nov 24 14:38:44 2006 +0000

    Preisgruppen: Bei Zeilen mit noch nicht zugewiesenem Artikel wird gar keine Drop-Down-Box angezeigt. Bei den anderen Zeilen wird als erste Option "keine" angezeigt.

diff --git a/SL/IS.pm b/SL/IS.pm
index 686f8644c..66564344c 100644
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -685,8 +685,8 @@ sub post_invoice {
         ? qq|'$form->{"deliverydate_$i"}'|
         : "NULL";
 
-      # get pricegroup_id and save ist
-      ($null, my $pricegroup_id) = split /--/, $form->{"sellprice_drag_$i"};
+      # get pricegroup_id and save it
+      ($null, my $pricegroup_id) = split /--/, $form->{"sellprice_pg_$i"};
       $pricegroup_id *= 1;
       my $subtotal = $form->{"subtotal_$i"} * 1;
 
@@ -2062,12 +2062,15 @@ sub get_pricegroups_for_parts {
 
   my $dbh = $form->dbconnect($myconfig);
 
+  $form->{"PRICES"} = {};
+
   my $i  = 1;
   my $id = 0;
   my $dimension_units = AM->retrieve_units($myconfig, $form, "dimension");
   my $service_units = AM->retrieve_units($myconfig, $form, "service");
   my $all_units = AM->retrieve_units($myconfig, $form);
   while (($form->{"id_$i"}) or ($form->{"new_id_$i"})) {
+    $form->{"PRICES"}{$i} = [];
 
     $id = $form->{"id_$i"};
 
@@ -2077,7 +2080,7 @@ sub get_pricegroups_for_parts {
     }
 
     ($price, $selectedpricegroup_id) = split /--/,
-      $form->{"sellprice_drag_$i"};
+      $form->{"sellprice_pg_$i"};
 
     $pricegroup_old = $form->{"pricegroup_old_$i"};
     $form->{"new_pricegroup_$i"} = $selectedpricegroup_id;
@@ -2183,7 +2186,7 @@ sub get_pricegroups_for_parts {
                   and ($pkr->{price} == $form->{"sellprice_$i"})) {
 
                 # $pkr->{price}                         = $form->{"sellprice_$i"};
-                  } else {
+              } else {
                 $pkr->{price} = $form->{"sellprice_$i"};
               }
             }
diff --git a/SL/OE.pm b/SL/OE.pm
index 2e5c8d696..7813f3350 100644
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -351,7 +351,7 @@ sub save {
         ($form->{"reqdate_$i"}) ? qq|'$form->{"reqdate_$i"}'| : "NULL";
 
       # get pricegroup_id and save ist
-      ($null, my $pricegroup_id) = split /--/, $form->{"sellprice_drag_$i"};
+      ($null, my $pricegroup_id) = split /--/, $form->{"sellprice_pg_$i"};
       $pricegroup_id *= 1;
       $subtotal = $form->{"subtotal_$i"} * 1;
 
diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl
index b88d36dde..bbdbeafba 100644
--- a/bin/mozilla/io.pl
+++ b/bin/mozilla/io.pl
@@ -112,7 +112,7 @@ sub display_row {
       or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/))
       or (($form->{level} eq undef) and ($form->{type} =~ /invoice/))
       or ($form->{type} =~ /sales_order/)) {
-    push @column_index, qw(sellprice_drag);
+    push @column_index, qw(sellprice_pg);
   }
 
   push @column_index, qw(sellprice);
@@ -172,7 +172,7 @@ sub display_row {
       qq|<th align=left nowrap width=15 class=listheading>|
     . $locale->text('Price')
     . qq|</th>|;
-  $column_data{sellprice_drag} =
+  $column_data{sellprice_pg} =
       qq|<th align=left nowrap width=15 class=listheading>|
     . $locale->text('Pricegroup')
     . qq|</th>|;
@@ -329,7 +329,7 @@ sub display_row {
                             $is_assigned ? $form->{"unit_$i"} : undef))
       . "</td>";
 
-    # build in dragdrop for pricesgroups
+    # build in drop down list for pricesgroups
     if ($form->{"prices_$i"}) {
       if  ($form->{"new_pricegroup_$i"} != $form->{"old_pricegroup_$i"}) {
         $price_tmp = $form->format_amount(\%myconfig, $form->{"price_new_$i"}, $decimalplaces);
@@ -337,31 +337,27 @@ sub display_row {
         $price_tmp = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
       }
 
-      $column_data{sellprice_drag} =
-        qq|<td align=right><select name="sellprice_drag_$i">$form->{"prices_$i"}</select></td>|;
+      $column_data{sellprice_pg} =
+        qq|<td align=right><select name="sellprice_pg_$i">$form->{"prices_$i"}</select></td>|;
       $column_data{sellprice} =
         qq|<td><input name="sellprice_$i" size=10 value=$price_tmp></td>|;
     } else {
 
       # for last row and report
-      # set pricegroup dragdrop from report menu
+      # set pricegroup drop down list from report menu
       if ($form->{"sellprice_$i"} != 0) {
         $prices =
           qq|<option value="$form->{"sellprice_$i"}--$form->{"pricegroup_id_$i"}" selected>$form->{"pricegroup_$i"}</option>\n|;
 
         $form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"};
 
-        $column_data{sellprice_drag} =
-          qq|<td align=right><select name="sellprice_drag_$i">$prices</select></td>|;
+        $column_data{sellprice_pg} =
+          qq|<td align=right><select name="sellprice_pg_$i">$prices</select></td>|;
 
       } else {
 
         # for last row
-        $column_data{sellprice_drag} =
-          qq|<td align=right><input name="sellprice_$i" size=9 value=|
-          . $form->format_amount(\%myconfig, $form->{"prices_$i"},
-                                 $decimalplaces)
-          . qq|></td>|;
+        $column_data{sellprice_pg} = qq|<td align=right>&nbsp;</td>|;
       }
 
       $column_data{sellprice} =
@@ -504,13 +500,16 @@ sub display_row {
 # build html-code for pricegroups in variable $form->{prices_$j}
 
 sub set_pricegroup {
-  my $rowcount = shift;
   $lxdebug->enter_sub();
+  my $rowcount = shift;
+  $lxdebug->dump(0, "holy luja!", $form->{PRICES});
   for $j (1 .. $rowcount) {
     my $pricegroup_old = $form->{"pricegroup_old_$i"};
+    $lxdebug->message(0, "klaus1 for j $j");
     if ($form->{PRICES}{$j}) {
+      $lxdebug->message(0, "klaus2");
       $len    = 0;
-      $prices = '';
+      $prices = '<option value="--">' . $locale->text("none (pricegroup)") . '</option>';
       $price  = 0;
       foreach $item (@{ $form->{PRICES}{$j} }) {
 
@@ -520,7 +519,7 @@ sub set_pricegroup {
         $pricegroup_id = $item->{pricegroup_id};
         $pricegroup    = $item->{pricegroup};
 
-        # build dragdrop for pricegroups
+        # build drop down list for pricegroups
         $prices .=
           qq|<option value="$price--$pricegroup_id"$item->{selected}>$pricegroup</option>\n|;
 
@@ -540,10 +539,8 @@ sub set_pricegroup {
         if ($pricegroup_id == 0) {
           $form->{"price_new_$j"} = $form->{"sellprice_$j"};
         }
-        if ($len > 1) {
-          $form->{"prices_$j"} = $prices;
-        }
       }
+      $form->{"prices_$j"} = $prices;
     }
   }
   $lxdebug->leave_sub();
diff --git a/locale/de/all b/locale/de/all
index 9973da2d1..28ad31b0f 100644
--- a/locale/de/all
+++ b/locale/de/all
@@ -1092,6 +1092,7 @@ gestartet',
   'list'                        => 'auflisten',
   'localhost'                   => 'lokaler Rechner',
   'month'                       => 'monatliche Abgabe',
+  'none (pricegroup)'           => 'keine',
   'number'                      => 'Nummer',
   'posted!'                     => 'gebucht',
   'prices updated!'             => ' Preise aktualisiert!',
diff --git a/locale/de/cn b/locale/de/cn
index 2a2484cd5..4147e6b29 100644
--- a/locale/de/cn
+++ b/locale/de/cn
@@ -179,6 +179,7 @@ $self{texts} = {
   'button'                      => '?',
   'ea'                          => 'St.',
   'emailed to'                  => 'gemailt an',
+  'none (pricegroup)'           => 'keine',
   'posted!'                     => 'gebucht',
   'sent'                        => 'gesendet',
   'sent to printer'             => 'an Drucker geschickt',
diff --git a/locale/de/dn b/locale/de/dn
index 478c616f2..4f7068f36 100644
--- a/locale/de/dn
+++ b/locale/de/dn
@@ -171,6 +171,7 @@ gestartet',
   'eMail Send?'                 => 'eMail-Versand?',
   'eMail?'                      => 'eMail?',
   'emailed to'                  => 'gemailt an',
+  'none (pricegroup)'           => 'keine',
   'sent'                        => 'gesendet',
   'sent to printer'             => 'an Drucker geschickt',
 };
diff --git a/locale/de/ic b/locale/de/ic
index b5346aedb..d9dc721ac 100644
--- a/locale/de/ic
+++ b/locale/de/ic
@@ -218,6 +218,7 @@ aktualisieren wollen?',
   'ea'                          => 'St.',
   'emailed to'                  => 'gemailt an',
   'list'                        => 'auflisten',
+  'none (pricegroup)'           => 'keine',
   'number'                      => 'Nummer',
   'prices updated!'             => ' Preise aktualisiert!',
   'sent'                        => 'gesendet',
diff --git a/locale/de/io b/locale/de/io
index f3b7c37c8..a7a413b2f 100644
--- a/locale/de/io
+++ b/locale/de/io
@@ -114,6 +114,7 @@ $self{texts} = {
   'What type of item is this?'  => 'Was ist dieser Artikel?',
   'Zipcode'                     => 'PLZ',
   'emailed to'                  => 'gemailt an',
+  'none (pricegroup)'           => 'keine',
   'sent'                        => 'gesendet',
   'sent to printer'             => 'an Drucker geschickt',
 };
diff --git a/locale/de/ir b/locale/de/ir
index 1f54d75b9..626ac7c55 100644
--- a/locale/de/ir
+++ b/locale/de/ir
@@ -169,6 +169,7 @@ $self{texts} = {
   'button'                      => '?',
   'ea'                          => 'St.',
   'emailed to'                  => 'gemailt an',
+  'none (pricegroup)'           => 'keine',
   'posted!'                     => 'gebucht',
   'sent'                        => 'gesendet',
   'sent to printer'             => 'an Drucker geschickt',
diff --git a/locale/de/is b/locale/de/is
index a6b765c80..7c1d80a0b 100644
--- a/locale/de/is
+++ b/locale/de/is
@@ -194,6 +194,7 @@ $self{texts} = {
   'button'                      => '?',
   'ea'                          => 'St.',
   'emailed to'                  => 'gemailt an',
+  'none (pricegroup)'           => 'keine',
   'posted!'                     => 'gebucht',
   'sent'                        => 'gesendet',
   'sent to printer'             => 'an Drucker geschickt',
diff --git a/locale/de/oe b/locale/de/oe
index 9a4236bd6..e06768150 100644
--- a/locale/de/oe
+++ b/locale/de/oe
@@ -232,6 +232,7 @@ $self{texts} = {
   'days'                        => 'Tage',
   'ea'                          => 'St.',
   'emailed to'                  => 'gemailt an',
+  'none (pricegroup)'           => 'keine',
   'saved!'                      => 'gespeichert',
   'sent'                        => 'gesendet',
   'sent to printer'             => 'an Drucker geschickt',
