Skip to content

Commit 216265d

Browse files
committed
fix(targetticket,targetchange): errors while dropping raw queries
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent 625067b commit 216265d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

inc/target.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,4 +401,11 @@ public function getTargetsForForm(PluginFormcreatorForm $form) {
401401

402402
return $targets;
403403
}
404+
405+
public function getFromDBByTargetItem(PluginFormcreatorTargetBase $target) {
406+
return $this->getFromDBByCrit([
407+
'itemtype' => $target->getType(),
408+
'items_id' => $target->getID()
409+
]);
410+
}
404411
}

inc/targetbase.class.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ protected function showActorsSettings() {
10181018
]
10191019
],
10201020
'WHERE' => [
1021-
"$section.id" => $section['id'],
1021+
"$sectionTable.id" => $section['id'],
10221022
[
10231023
'AND' => [
10241024
"$questionTable.fieldtype" => 'glpiselect',
@@ -1785,6 +1785,11 @@ protected function prepareTemplate($template, PluginFormcreatorFormAnswer $formA
17851785
}
17861786

17871787
public function showTagsList() {
1788+
global $DB;
1789+
1790+
$target = new PluginFormcreatorTarget();
1791+
$target->getFromDBByTargetItem($this);
1792+
17881793
echo '<table class="tab_cadre_fixe">';
17891794

17901795
echo '<tr><th colspan="5">' . __('List of available tags') . '</th></tr>';
@@ -1805,7 +1810,8 @@ public function showTagsList() {
18051810
// TODO Factorize with PluginFormceatorQuestion::dropdownForForm()
18061811
$questionTable = PluginFormcreatorQuestion::getTable();
18071812
$sectionTable = PluginFormcreatorSection::getTable();
1808-
$sectionFk = PluginFoirmcreatorSecton::getFoeignKeyField();
1813+
$sectionFk = PluginFormcreatorSection::getForeignKeyField();
1814+
$formFk = PluginFormcreatorForm::getForeignKeyField();
18091815
$result = $DB->request([
18101816
'SELECT' => [
18111817
$questionTable => ['id', 'name as question'],
@@ -1821,7 +1827,7 @@ public function showTagsList() {
18211827
],
18221828
],
18231829
'WHERE' => [
1824-
"$section.$formFk" => [$target[$formFk]],
1830+
"$sectionTable.$formFk" => [$target->fields[$formFk]],
18251831
],
18261832
'ORDER' => [
18271833
"$sectionTable.order", "$questionTable.order"

0 commit comments

Comments
 (0)