diff --git a/lib/Lacuna/DB/Result/Map/Body.pm b/lib/Lacuna/DB/Result/Map/Body.pm
index 96f38011..674c3259 100644
--- a/lib/Lacuna/DB/Result/Map/Body.pm
+++ b/lib/Lacuna/DB/Result/Map/Body.pm
@@ -225,8 +225,8 @@ sub gas_giant_types {return 5;};
# RELATIONSHIPS
__PACKAGE__->belongs_to('star', 'Lacuna::DB::Result::Map::Star', 'star_id');
-__PACKAGE__->belongs_to('alliance', 'Lacuna::DB::Result::Alliance', 'alliance_id', { on_delete => 'set null' });
-__PACKAGE__->belongs_to('empire', 'Lacuna::DB::Result::Empire', 'empire_id');
+__PACKAGE__->belongs_to('alliance', 'Lacuna::DB::Result::Alliance', 'alliance_id', { join_type => 'left', on_delete => 'set null' });
+__PACKAGE__->belongs_to('empire', 'Lacuna::DB::Result::Empire', 'empire_id', {join_type => 'left'});
__PACKAGE__->has_many('_buildings','Lacuna::DB::Result::Building','body_id');
__PACKAGE__->has_many('foreign_ships','Lacuna::DB::Result::Ships','foreign_body_id');
diff --git a/lib/Lacuna/Web/Admin.pm b/lib/Lacuna/Web/Admin.pm
index 16812da4..154f874e 100644
--- a/lib/Lacuna/Web/Admin.pm
+++ b/lib/Lacuna/Web/Admin.pm
@@ -309,7 +309,7 @@ use Encode;
sub www_search_bodies {
my ($self, $request) = @_;
my $page_number = $request->param('page_number') || 1;
- my $bodies = Lacuna->db->resultset('Lacuna::DB::Result::Map::Body')->search(undef, {order_by => ['me.name'], rows => 25, page => $page_number, prefetch=>[qw/star/] });
+ my $bodies = Lacuna->db->resultset('Lacuna::DB::Result::Map::Body')->search(undef, {order_by => ['me.name'], rows => 25, page => $page_number, prefetch=>[qw/empire star/] });
my $name = decode_utf8($request->param('name') || '');
my $pager = 'name';
@@ -331,10 +331,10 @@ sub www_search_bodies {
}
my $out = '
Search Bodies
';
$out .= '';
- $out .= '| Id | Name | X | Y | O | Zone | Star | Type | Happiness | Empire |
';
+ $out .= '| Id | Name | X | Y | Zone | Star | O | Type | Happiness | Empire |
';
while (my $body = $bodies->next) {
- $out .= sprintf('| %s | %s | %s | %s | %s | %s | %s (%d) | %s | %s | %s |
',
- $body->id, $body->id, $body->name, $body->x, $body->y, $body->orbit, $body->zone, $body->star_id, $body->star->name,$body->star_id, $body->image_name, kmbtq($body->happiness),
+ $out .= sprintf('| %s | %s | %s | %s | %s | %s (%d) | %s | %s | %s | %s |
',
+ $body->id, $body->id, $body->name, $body->x, $body->y, $body->zone, $body->star_id, $body->star->name,$body->star_id, $body->orbit, $body->image_name, kmbtq($body->happiness),
$body->empire_id || '', $body->empire_id ? sprintf("%s (%s)",$body->empire->name,$body->empire_id) : '' );
}
$out .= '
';