More improvements e.g. flags and provision target

This commit is contained in:
2026-08-11 07:48:46 +02:00
parent a3d4825cbd
commit 41556cfe73
22 changed files with 961 additions and 484 deletions
+20 -3
View File
@@ -31,8 +31,9 @@ switch ($submit = form_get_action()) {
case 'filter':
$flt = array();
$flt['prio'] = gpc_get_enum($_POST, 'flt_prio', array_merge(array_keys($opt_priority), ['-2', '-1']));
$flt['stat'] = gpc_get_enum($_POST, 'flt_stat', array_merge(array_keys($opt_state), ['-2', '-1']));
$flt['txt'] = gpc_get_string($_POST, 'flt_txt');
$allowed = db_load_enum('task', 'taskstate');
$flt['stat'] = gpc_get_set($_POST, 'flt_stat', $allowed);
db_save_filter($flt, 206);
$action = ACT_DEFAULT;
break;
@@ -138,10 +139,22 @@ if (strlen($flt->prio) > 2 ) {
} elseif ($flt->prio == -1) {
$w[] = 'priority IS NULL';
}
if (strlen($flt->stat) > 2 ) {
/*if (strlen($flt->stat) > 2 ) {
$w[] = 'taskstate=:taskstate';
$p[':taskstate'] = $flt->stat;
} */
$parts = ["taskstate=''", 'taskstate IS NULL'];
foreach ($flt->stat as $f) {
$parts[] = "FIND_IN_SET('$f', taskstate)";
}
if (!empty($parts)) {
if (count($parts) > 1) {
$w[] = '(' . join(' OR ', $parts) . ')';
} else {
$w[] = $parts[0];
}
}
$where = join(' AND ', $w);
$order = ' ORDER BY t.taskid';
@@ -190,12 +203,16 @@ $res = $sth->fetchAll();
<div class="card-body d-flex flex-wrap gap-3">
<?php
filter_create_select('flt_prio', _('Priority'), $g_opt_all + $g_opt_none + $opt_priority, $flt->prio);
filter_create_select('flt_stat', _('State'), $g_opt_all + $opt_state, $flt->stat);
//filter_create_select('flt_stat', _('State'), $g_opt_all + $opt_state, $flt->stat);
?>
<div class="d-flex flex-nowrap gap-2">
<label for="flt_txt">Text</label>
<input type="text" class="form-control" name="flt_txt" size="15" maxlength="30" value="<?=$flt->txt ?>">
</div>
<?php
$opt_status = db_load_enum('task', 'taskstate', true, true, false);
filter_create_checks('flt_stat', _('Status'), $opt_status, $flt->stat);
?>
</div>
<div class="card-footer">
<button name="submit[filter]" class="btn btn-sm btn-primary" title="<?=_('Apply')?>"><?=_('Go')?></button>