mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
N°1556 Advanced Search : fix removing only criteria in first row (was generating "AND 1")
This commit is contained in:
@@ -229,32 +229,38 @@ $(function()
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
// - Retrieve criterion
|
// - Retrieve criterion
|
||||||
this.elements.criterion_area.find('.sf_criterion_row').each(function(iIdx){
|
var iCurrentCriterionRow = 0;
|
||||||
var oCriterionRowElem = $(this);
|
this.elements.criterion_area.find('.sf_criterion_row').each(function (iDomCriterionRowIdx) {
|
||||||
|
var isFirstRow = (iDomCriterionRowIdx === 0),
|
||||||
|
oCriterionRowElem = $(this),
|
||||||
|
oCriteriaRowCriterias = oCriterionRowElem.find('.search_form_criteria');
|
||||||
|
|
||||||
if (oCriterionRowElem.find('.search_form_criteria').length == 0 && iIdx > 0)
|
if (oCriteriaRowCriterias.length === 0)
|
||||||
|
{
|
||||||
|
if (!isFirstRow)
|
||||||
{
|
{
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oCriterionRowElem.find('.search_form_criteria').each(function ()
|
oCriteriaRowCriterias.each(function () {
|
||||||
{
|
|
||||||
var oCriteriaData = $(this).triggerHandler('itop.search.criteria.get_data');
|
var oCriteriaData = $(this).triggerHandler('itop.search.criteria.get_data');
|
||||||
|
|
||||||
if (null != oCriteriaData)
|
if (null != oCriteriaData)
|
||||||
{
|
{
|
||||||
if (!oCriterion['or'][iIdx])
|
if (!oCriterion['or'][iCurrentCriterionRow])
|
||||||
{
|
{
|
||||||
oCriterion['or'][iIdx] = {'and': []};
|
oCriterion['or'][iCurrentCriterionRow] = {'and': []};
|
||||||
}
|
}
|
||||||
oCriterion['or'][iIdx]['and'].push(oCriteriaData);
|
oCriterion['or'][iCurrentCriterionRow]['and'].push(oCriteriaData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
iCurrentCriterionRow++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// - Update search
|
// - Update search
|
||||||
|
|||||||
Reference in New Issue
Block a user