Skip to content

Commit 5bc3cd4

Browse files
committed
fix(issue): add missing joins
1 parent db2d27f commit 5bc3cd4

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

hook.php

+33-2
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,43 @@ function plugin_formcreator_addDefaultJoin($itemtype, $ref_table, &$already_link
8585
case PluginFormcreatorIssue::class:
8686
// Get default joins for tickets
8787
$join = Search::addDefaultJoin(Ticket::getType(), Ticket::getTable(), $already_link_tables);
88-
$join .= Search::addLeftJoin($itemtype, $ref_table, $already_link_tables, Group::getTable(), 'groups_id_validator');
88+
// $join .= Search::addLeftJoin($itemtype, $ref_table, $already_link_tables, Group::getTable(), 'groups_id_validator');
8989
// but we want to join in issues
9090
$join = str_replace('`glpi_tickets`.`id`', '`glpi_plugin_formcreator_issues`.`itemtype` = "Ticket" AND `glpi_plugin_formcreator_issues`.`items_id`', $join);
9191
$join = str_replace('`glpi_tickets`', '`glpi_plugin_formcreator_issues`', $join);
9292
$join = str_replace('`users_id_recipient`', '`requester_id`', $join);
93-
}
93+
$issueSo = Search::getOptions($itemtype);
94+
$join .= Search::addLeftJoin(
95+
$itemtype,
96+
$ref_table,
97+
$already_link_tables,
98+
$issueSo[9]['table'],
99+
'users_id_validator',
100+
0,
101+
0,
102+
$issueSo[9]['joinparams']
103+
);
104+
$join .= Search::addLeftJoin(
105+
$itemtype,
106+
$ref_table,
107+
$already_link_tables,
108+
$issueSo[11]['table'],
109+
'users_id_validate',
110+
0,
111+
0,
112+
$issueSo[11]['joinparams']
113+
);
114+
$join .= Search::addLeftJoin(
115+
$itemtype,
116+
$ref_table,
117+
$already_link_tables,
118+
$issueSo[16]['table'],
119+
'groups_id_validator',
120+
0,
121+
0,
122+
$issueSo[16]['joinparams']
123+
);
124+
}
94125
return $join;
95126
}
96127

0 commit comments

Comments
 (0)