Skip to content

Commit

Permalink
fix(targetticket,targetchange): errors while dropping raw queries
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Aug 22, 2019
1 parent 625067b commit 216265d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions inc/target.class.php
Expand Up @@ -401,4 +401,11 @@ public function getTargetsForForm(PluginFormcreatorForm $form) {

return $targets;
}

public function getFromDBByTargetItem(PluginFormcreatorTargetBase $target) {
return $this->getFromDBByCrit([
'itemtype' => $target->getType(),
'items_id' => $target->getID()
]);
}
}
12 changes: 9 additions & 3 deletions inc/targetbase.class.php
Expand Up @@ -1018,7 +1018,7 @@ protected function showActorsSettings() {
]
],
'WHERE' => [
"$section.id" => $section['id'],
"$sectionTable.id" => $section['id'],
[
'AND' => [
"$questionTable.fieldtype" => 'glpiselect',
Expand Down Expand Up @@ -1785,6 +1785,11 @@ protected function prepareTemplate($template, PluginFormcreatorFormAnswer $formA
}

public function showTagsList() {
global $DB;

$target = new PluginFormcreatorTarget();
$target->getFromDBByTargetItem($this);

echo '<table class="tab_cadre_fixe">';

echo '<tr><th colspan="5">' . __('List of available tags') . '</th></tr>';
Expand All @@ -1805,7 +1810,8 @@ public function showTagsList() {
// TODO Factorize with PluginFormceatorQuestion::dropdownForForm()
$questionTable = PluginFormcreatorQuestion::getTable();
$sectionTable = PluginFormcreatorSection::getTable();
$sectionFk = PluginFoirmcreatorSecton::getFoeignKeyField();
$sectionFk = PluginFormcreatorSection::getForeignKeyField();
$formFk = PluginFormcreatorForm::getForeignKeyField();
$result = $DB->request([
'SELECT' => [
$questionTable => ['id', 'name as question'],
Expand All @@ -1821,7 +1827,7 @@ public function showTagsList() {
],
],
'WHERE' => [
"$section.$formFk" => [$target[$formFk]],
"$sectionTable.$formFk" => [$target->fields[$formFk]],
],
'ORDER' => [
"$sectionTable.order", "$questionTable.order"
Expand Down

0 comments on commit 216265d

Please sign in to comment.