--- /usr/src/otrs-3.0.10/Kernel/Modules/AdminQueueResponses.pm	2010-11-10 12:04:28.000000000 +0100
+++ /server/otrs/otrs-3.0.10/Kernel/Modules/AdminQueueResponses.pm	2011-11-01 12:46:15.000000000 +0100
@@ -116,15 +116,9 @@ sub Run {
         my $ID = $Self->{ParamObject}->GetParam( Param => 'ID' );
 
         # get user list
-        my %StandardResponseData
-            = $Self->{StandardResponseObject}->StandardResponseList( Valid => 1 );
-        for my $StandardResponseID ( keys %StandardResponseData ) {
-            my $Active = 0;
-            for my $QueueID (@IDs) {
-                next if $QueueID ne $StandardResponseID;
-                $Active = 1;
-                last;
-            }
+	
+        # $QueueID and $Active seem not to be needed here.
+	# This loop just slowed down processing everything massivly.
 
             # update db
             $Self->{DBObject}->Do(
@@ -132,6 +126,7 @@ sub Run {
                 Bind => [ \$ID ],
             );
             for my $NewID (@IDs) {
+		$Self->{LogObject}->Log( Priority => 'error', Message => "add user to groups: \$ID, \$NewID, \$Self->{UserID}, \$Self->{UserID}:  $ID, $NewID, $Self->{UserID}, $Self->{UserID}" );
                 $Self->{DBObject}->Do(
                     SQL => 'INSERT INTO queue_standard_response (queue_id, standard_response_id, '
                         . 'create_time, create_by, change_time, change_by) VALUES '
@@ -139,7 +134,6 @@ sub Run {
                     Bind => [ \$ID, \$NewID, \$Self->{UserID}, \$Self->{UserID} ],
                 );
             }
-        }
 
         return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
     }
@@ -150,34 +144,33 @@ sub Run {
     elsif ( $Self->{Subaction} eq 'ChangeResponse' ) {
 
         # get new role member
-        my @IDs = $Self->{ParamObject}->GetArray( Param => 'Response' );
+	# @IDs are 35 times doubled. Why? Uniq hack:
+        my @IDs = keys  %{{ map { $_ => 1 } $Self->{ParamObject}->GetArray( Param => 'Response' )}};
+	for my $fooID (@IDs) {
+		$Self->{LogObject}->Log( Priority => 'error', Message => "fooID: $fooID\n" );
+	}
 
         my $ID = $Self->{ParamObject}->GetParam( Param => 'ID' );
 
         # get user list
-        my %QueueData = $Self->{QueueObject}->QueueList( Valid => 1 );
-        for my $QueueID ( keys %QueueData ) {
-            my $Active = 0;
-            for my $StandardResponseID (@IDs) {
-                next if $StandardResponseID ne $QueueID;
-                $Active = 1;
-                last;
-            }
-
-            # update db
-            $Self->{DBObject}->Do(
-                SQL  => 'DELETE FROM queue_standard_response WHERE standard_response_id = ?',
-                Bind => [ \$ID ],
-            );
-            for my $NewID (@IDs) {
-                $Self->{DBObject}->Do(
-                    SQL => 'INSERT INTO queue_standard_response (queue_id, standard_response_id, '
-                        . 'create_time, create_by, change_time, change_by) VALUES '
-                        . ' (?, ?, current_timestamp, ?, current_timestamp, ?)',
-                    Bind => [ \$NewID, \$ID, \$Self->{UserID}, \$Self->{UserID} ],
-                );
-            }
-        }
+	# 
+	# $QueueID and Active seem not to be needed here.
+	# This loop just slowed down processing everything massivly.
+
+	    # update db
+	    $Self->{DBObject}->Do(
+		SQL  => 'DELETE FROM queue_standard_response WHERE standard_response_id = ?',
+		Bind => [ \$ID ],
+	    );
+	    for my $NewID (@IDs) {
+		$Self->{LogObject}->Log( Priority => 'error', Message => "groups to user: \$ID, \$NewID, \$Self->{UserID}, \$Self->{UserID}:  $ID, $NewID, $Self->{UserID}, $Self->{UserID}" );
+		$Self->{DBObject}->Do(
+		    SQL => 'INSERT INTO queue_standard_response (queue_id, standard_response_id, '
+			. 'create_time, create_by, change_time, change_by) VALUES '
+			. ' (?, ?, current_timestamp, ?, current_timestamp, ?)',
+		    Bind => [ \$NewID, \$ID, \$Self->{UserID}, \$Self->{UserID} ],
+		);
+	    }
 
         return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
     }
