Commit 46244585 authored by Johan Cwiklinski's avatar Johan Cwiklinski Committed by Johan Cwiklinski
Browse files

Fix missing is_deleted field on some tables; closes #8547

parent ace12315
......@@ -119,16 +119,21 @@ class State extends CommonTreeDropdown {
} else {
$table = getTableForItemType($itemtype);
$WHERE = [];
if ($DB->fieldExists($table, 'is_deleted')) {
$WHERE["$table.is_deleted"] = 0;
}
if ($DB->fieldExists($table, 'is_template')) {
$WHERE["$table.is_template"] = 0;
}
$WHERE += getEntitiesRestrictCriteria($table);
$iterator = $DB->request([
'SELECT' => [
'states_id',
'COUNT' => '* AS cpt'
],
'FROM' => $table,
'WHERE' => [
'is_deleted' => 0,
'is_template' => 0
] + getEntitiesRestrictCriteria($table),
'WHERE' => $WHERE,
'GROUP' => 'states_id'
]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment