[Rt-commit] rt branch, 4.6/fix-asset-search-bug, repushed
Michel Rodriguez
michel at bestpractical.com
Wed Feb 12 15:33:30 EST 2020
The branch 4.6/fix-asset-search-bug was deleted and repushed:
was bbdfe1db1b61e549dd670147f1c48551016463d9
now 0a06406c50a3ee2b70cb16194704fb7257641a26
1: bbdfe1db1b ! 1: 0a06406c50 Fix bug searching for assets when an asset does not have an owner.
@@ -1,6 +1,10 @@
Author: michel <michel at bestpractical.com>
Fix bug searching for assets when an asset does not have an owner.
+
+ The original code was calling $_[0]->OwnerObj->Id, which crashes
+ when the object does not have an OwnerObj (like when an asset has
+ no owner).
diff --git a/share/html/Elements/ColumnMap b/share/html/Elements/ColumnMap
--- a/share/html/Elements/ColumnMap
@@ -12,8 +16,8 @@
- return \($m->scomp('/Elements/SelectOwner', TicketObj => $_[0], Name => 'Owner', Default => $_[0]->OwnerObj->Id, DefaultValue => 0));
+ my $owner = $_[0]->OwnerObj;
+ # if owner is missing (asset with no owner) $owner contains the error message, not an object
-+ my $owner_id = ref( $_[0]->OwnerObj ) ? $_[0]->OwnerObj->Id : '';
-+ return \($m->scomp('/Elements/SelectOwner', TicketObj => $_[0], Name => 'Owner', Default => $owner_id, DefaultValue => 0));
++ if( ! ref $owner ) { $owner = RT->Nobody; }
++ return \($m->scomp('/Elements/SelectOwner', TicketObj => $_[0], Name => 'Owner', Default => $owner->Id, DefaultValue => 0));
};
}
More information about the rt-commit
mailing list