method getNextUpdate documentation in bbn\Appui\History
function(string $table, string $id, $from_when, $column = NULL)
{
/** @todo To be redo totally with all the fields' IDs instead of the history column */
if (
Str::checkName($table) &&
($date = self::validDate($from_when)) &&
($db = self::_get_db()) &&
($dbc = self::_get_database()) &&
($id_table = $dbc->tableId($table))
){
self::disable();
$tab = $db->escape(self::$table);
$tab_uids = $db->escape(self::$table_uids);
$uid = $db->cfn('bbn_uid', self::$table_uids);
$id_tab = $db->cfn('bbn_table', self::$table_uids);
$id_col = $db->cfn('col', self::$table);
$line = $db->cfn('uid', self::$table);
$usr = $db->cfn('usr', self::$table);
$chrono = $db->cfn('tst', self::$table);
$where = [
$uid => $id,
$id_tab => $id_table,
[$chrono, '>', $date]
];
if ( $column ){
$where[$id_col] = Str::isUid($column) ? $column : $dbc->columnId($column, $id_table);
}
else {
$w = self::_get_table_where($table);
//$where = $id_col." != UNHEX('$id_column') " . ($w ?: '');
}
$res = $db->rselect([
'tables' => [$tab_uids],
'fields' => [
$line,
$id_col,
$chrono,
'val' => 'IFNULL(val, ref)',
$usr
],
'join' => [[
'table' => $tab,
'on' => [
'logic' => 'AND',
'conditions' => [[
'field' => $uid,
'operator' => '=',
'exp' => $line
]]
]]
],
'where' => $where,
'order' => [$chrono => 'ASC']
]);
self::enable();
return $res;
}
return null;
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2024
BBN Solutions