Index: /trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Buildnet.pm
===================================================================
--- /trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Buildnet.pm	(revision 2057)
+++ /trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Task/Buildnet.pm	(revision 2058)
@@ -368,6 +368,9 @@
             $ozone->get_attributes('netExclude')))
         if ($ozone->get_attributes('netExclude'));
-    if ($ozone->get_attributes('type') eq 'dhcp') {
-        push(@output, 'This dhcp zone include dynamic IP address')
+    if ($ozone->get_attributes('type') =~ /^(dhcp|radius)$/) {
+        my @dynFrom = grep { $_ } $ozone->get_attributes('dynFrom');
+        push(@output, sprintf('This zone include host from zone: %s', join(', ', sort @dynFrom)))
+            if (@dynFrom);
+        push(@output, 'This zone include dynamic IP address')
             if ($ozone->get_attributes('allow_dyn'));
     }
@@ -796,5 +799,5 @@
     }
 
-    my @parameters = $outzone->get_attributes('hostParams');
+    my %hosts;
 
     {
@@ -828,36 +831,8 @@
         };
         while (my $res = $find->fetchrow_hashref) {
-            my $nethost = $res->{name};
-
-            my $obj = $self->_base->get_object('nethost', $nethost) or do {
-                la_log LA_ERR, "Cannot fetch host %s", $res->{name};
-                return;
-            };
-
-            my $retainip;
-            if (@net) {
-                foreach my $inet (@net) {
-                    ($retainip) = grep { $_ && $inet->overlaps(Net::IP->new($_)) } $obj->get_attributes('ip')
-                        and last;
-                }
-            }
-
-            $obj->get_attributes('noDynamic') && !$retainip and next;
-
-            my $desc = $self->_comment_nethost($obj);
-            foreach my $mac (sort grep { $_ } $obj->get_attributes('macaddr')) {
-                $output .= $desc
-                ? '# ' . $desc . "\n"
-                : '';
-                my $fmac = $mac;
-                $fmac =~ s/://g;
-                $output .= sprintf("%s Auth-Type := EAP, User-Password == \"%s\"\n", $nethost, lc($fmac));
-                $output .= join (",\n", map { "    $_" } @parameters);
-                $output .= "\n\n";
-            }
+            $hosts{ $res->{name} } = 1;
         }
     }
     if ($ozone->get_attributes('allow_dyn')) {
-        $output .= "\n# Host without IP:\n";
         my @dynfrom = grep { $_ } $ozone->get_attributes('dynFrom');
         my $find = $self->_base->db->prepare(q{
@@ -906,22 +881,27 @@
         };
         while (my $res = $find->fetchrow_hashref) {
-            my $nethost = $res->{name};
-
-            my $obj = $self->_base->get_object('nethost', $nethost);
-
-            $obj->get_attributes('noDynamic') and next;
-
-            my $desc = $self->_comment_nethost($obj);
-            foreach my $mac (sort grep { $_ } $obj->get_attributes('macaddr')) {
-                $output .= $desc
-                ? '# ' . $desc . "\n"
-                : '';
-                my $fmac = $mac;
-                $fmac =~ s/://g;
-                $output .= sprintf("%s Auth-Type := EAP, User-Password == \"%s\"\n", $nethost, lc($fmac));
-                $output .= join (",\n", map { "    $_" } @parameters);
-                $output .= "\n\n";
-            }
-        }
+            $hosts{ $res->{name} } = 1;
+        }
+    }
+
+    my @parameters = grep { $_ } $outzone->get_attributes('hostParams');
+    foreach my $nethost (sort keys %hosts) {
+        my $obj = $self->_base->get_object('nethost', $nethost);
+
+        $obj->get_attributes('noDynamic') and next;
+
+        $output .= "# Host: $nethost\n";
+        my $desc = $self->_comment_nethost($obj);
+        $output .= $desc
+            ? '# ' . $desc . "\n"
+            : '';
+        foreach my $mac (sort grep { $_ } $obj->get_attributes('macaddr')) {
+            my $fmac = $mac;
+            $fmac =~ s/://g;
+            $output .= sprintf("%s Auth-Type := EAP, User-Password == \"%s\"\n", lc($fmac), lc($fmac));
+            $output .= join (",\n", map { "    $_" } @parameters) . "\n" if(@parameters);
+            $output .= "\n";
+        }
+        $output .= "\n";
     }
 
