Skip to content

Commit

Permalink
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion hook.php
Original file line number Diff line number Diff line change
@@ -130,7 +130,9 @@ function plugin_formcreator_addDefaultWhere($itemtype) {
case PluginFormcreatorFormAnswer::class:
if (isset($_SESSION['formcreator']['form_search_answers'])
&& $_SESSION['formcreator']['form_search_answers']) {
$condition = "`$table`.`".PluginFormcreatorFormAnswer::$items_id."` = ".
// Context is displaying the answers for a given form
$formFk = PluginFormcreatorForm::getForeignKeyField();
$condition = "`$table`.`$formFk` = ".
$_SESSION['formcreator']['form_search_answers'];
} else {
$condition = plugin_formcreator_getCondition($itemtype);
6 changes: 2 additions & 4 deletions inc/formanswer.class.php
Original file line number Diff line number Diff line change
@@ -41,9 +41,6 @@ class PluginFormcreatorFormAnswer extends CommonDBTM
public $usenotepad = true;
public $usenotepadrights = true;

static public $itemtype = "PluginFormcreatorForm";
static public $items_id = "plugin_formcreator_forms_id";

const SOPTION_ANSWER = 900000;

/**
@@ -354,10 +351,11 @@ public function defineTabs($options = []) {
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
if ($item instanceof PluginFormcreatorForm) {
$dbUtils = new DbUtils();
$formFk = PluginFormcreatorForm::getForeignKeyField();
$number = $dbUtils->countElementsInTableForMyEntities(
static::getTable(),
[
self::$items_id => $item->getID()
$formFk => $item->getID()
]
);
return self::createTabEntry(self::getTypeName($number), $number);

0 comments on commit 1e65276

Please sign in to comment.