Skip to content

Commit

Permalink
fix(abstracttarget): retrieve sub itemtype from question
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Jun 8, 2022
1 parent 8086121 commit eccf3d1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion inc/abstracttarget.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ protected function prepareActors(PluginFormcreatorForm $form, PluginFormcreatorF
if ($question->isNewItem()) {
continue 2;
}
$itemtype = $question->fields['values'];
$itemtype = DropdownField::getSubItemtypeForValues($question->fields['values']);
if (!is_subclass_of($itemtype, CommonDBTM::class)) {
continue 2;
}
Expand Down
38 changes: 28 additions & 10 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ $(function() {
if (searchInput.length == 1) {
// Dynamically update forms and faq items while the user types in the search bar
var timer = getTimer(searchInput);
if ($('#plugin_formcreator_kb_categories .category_active').length > 0) {
if ($('#plugin_formcreator_kb_categories').length > 0) {
var callback = function() {
updateKbitemsView(currentCategory);
}
Expand All @@ -174,13 +174,25 @@ $(function() {
$('#plugin_formcreator_searchBar input').focus(function(event) {
if (searchInput.val().length > 0) {
searchInput.val('');
updateWizardFormsView(currentCategory);
$.when(getFormAndFaqItems(0)).then(
function (response) {
tiles = response;
showTiles(tiles.forms);
}
);
if ($('#plugin_formcreator_kb_categories').length > 0) {
updateKbitemsView(null);
$.when(getFaqItems(0))
.then(
function (response) {
tiles = response;
showTiles(tiles.forms);
}
);
} else {
updateWizardFormsView(null);
$.when(getFormAndFaqItems(0))
.then(
function (response) {
tiles = response;
showTiles(tiles.forms);
}
);
}
}
});
}
Expand Down Expand Up @@ -285,7 +297,8 @@ function getFaqItems(categoryId) {
data: {
categoriesId: categoryId,
keywords: keywords,
helpdeskHome: 0},
helpdeskHome: 0
},
dataType: "json"
}).done(function (response) {
deferred.resolve(response);
Expand All @@ -304,7 +317,12 @@ function getFormAndFaqItems(categoryId) {
var deferred = jQuery.Deferred();
$.post({
url: formcreatorRootDoc + '/ajax/homepage_wizard.php',
data: {wizard: 'forms', categoriesId: categoryId, keywords: keywords, helpdeskHome: 0},
data: {
wizard: 'forms',
categoriesId: categoryId,
keywords: keywords,
helpdeskHome: 0
},
dataType: "json"
}).done(function (response) {
deferred.resolve(response);
Expand Down

0 comments on commit eccf3d1

Please sign in to comment.