@@ -700,10 +700,6 @@ public function parseObjectProperties(
700
700
// $questionID = $question->fields['id'];
701
701
$ questionID = $ this ->getQuestion ()->getID ();
702
702
703
- // We need english locale to search searchOptions by name
704
- $ oldLocale = $ TRANSLATE ->getLocale ();
705
- $ TRANSLATE ->setLocale ("en_GB " );
706
-
707
703
// Load target item from DB
708
704
$ itemtype = $ this ->question ->fields ['itemtype ' ];
709
705
@@ -712,6 +708,10 @@ public function parseObjectProperties(
712
708
return $ content ;
713
709
}
714
710
711
+ // We need english locale to search searchOptions by name
712
+ $ oldLocale = $ TRANSLATE ->getLocale ();
713
+ $ TRANSLATE ->setLocale ("en_GB " );
714
+
715
715
$ item = new $ itemtype ;
716
716
$ item ->getFromDB ($ answer );
717
717
@@ -726,6 +726,11 @@ public function parseObjectProperties(
726
726
// Convert Property_Name to Property Name
727
727
$ property = str_replace ("_ " , " " , $ property );
728
728
$ searchOption = $ item ->getSearchOptionByField ("name " , $ property );
729
+ if (count ($ searchOption ) == 0 ) {
730
+ trigger_error ("No search option found for $ property " , E_USER_WARNING );
731
+ $ TRANSLATE ->setLocale ($ oldLocale );
732
+ return $ content ;
733
+ }
729
734
730
735
// Execute search
731
736
$ data = Search::prepareDatasForSearch (get_class ($ item ), [
0 commit comments