Skip to content

Commit 01ab40a

Browse files
committed
Issue #3186: Enhanced error handling in AgentReferenceSearch.
1 parent 0ac52e6 commit 01ab40a

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Kernel/Modules/AgentReferenceSearch.pm

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# --
22
# OTOBO is a web-based ticketing system for service organisations.
33
# --
4-
# Copyright (C) 2019-2024 Rother OSS GmbH, https://otobo.de/
4+
# Copyright (C) 2019-2024 Rother OSS GmbH, https://otobo.io/
55
# --
66
# This program is free software: you can redistribute it and/or modify it under
77
# the terms of the GNU General Public License as published by the Free Software
@@ -111,7 +111,14 @@ sub Run {
111111
my $InitialDynamicFieldConfig = $Kernel::OM->Get('Kernel::System::DynamicField')->DynamicFieldGet(
112112
Name => $FieldName,
113113
);
114-
return unless IsHashRefWithData($InitialDynamicFieldConfig);
114+
if ( !IsHashRefWithData($InitialDynamicFieldConfig) ) {
115+
return $LayoutObject->JSONReply(
116+
Data => {
117+
Success => 0,
118+
Messsage => qq{Error reading the dynamic field '$FieldName'!},
119+
},
120+
);
121+
}
115122

116123
# Check if we deal with a reference field
117124
my $IsReferenceField = $DynamicFieldBackendObject->HasBehavior(
@@ -129,7 +136,14 @@ sub Run {
129136
$DynamicFieldConfig = $Kernel::OM->Get('Kernel::System::DynamicField')->DynamicFieldGet(
130137
ID => $InitialDynamicFieldConfig->{Config}{AttributeDF},
131138
);
132-
return unless IsHashRefWithData($DynamicFieldConfig);
139+
if ( !IsHashRefWithData($InitialDynamicFieldConfig) ) {
140+
return $LayoutObject->JSONReply(
141+
Data => {
142+
Success => 0,
143+
Messsage => qq{Error reading the dynamic field '$FieldName'!},
144+
},
145+
);
146+
}
133147

134148
$IsReferenceField = $DynamicFieldBackendObject->HasBehavior(
135149
DynamicFieldConfig => $DynamicFieldConfig,
@@ -141,7 +155,7 @@ sub Run {
141155
Data => {
142156
Success => 0,
143157
Messsage => qq{Error reading the dynamic field '$FieldName'!},
144-
}
158+
},
145159
);
146160
}
147161
}

0 commit comments

Comments
 (0)