diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2019-12-27 05:24:32 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2019-12-27 05:24:32 +0100 |
commit | 7fb10ec5695f534d1fea0c9487cd8f425c45a50f (patch) | |
tree | afbfb4ccadc16c1450aae634d1edc7409b45e526 /includes/model/UserWorkLog_model.php | |
parent | ec47d124bb1626d1aa604d7fdb6ddbbd77c14987 (diff) |
Voucher: Add worklog entries to calculation
Diffstat (limited to 'includes/model/UserWorkLog_model.php')
-rw-r--r-- | includes/model/UserWorkLog_model.php | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/includes/model/UserWorkLog_model.php b/includes/model/UserWorkLog_model.php index cc7686cf..e785067d 100644 --- a/includes/model/UserWorkLog_model.php +++ b/includes/model/UserWorkLog_model.php @@ -22,14 +22,24 @@ function UserWorkLog($user_worklog_id) /** * Returns all work log entries for a user. * - * @param int $userId + * @param int $userId + * @param Carbon|null $sinceTime * @return array[] */ -function UserWorkLogsForUser($userId) +function UserWorkLogsForUser($userId, Carbon $sinceTime = null) { - return Db::select("SELECT * FROM `UserWorkLog` WHERE `user_id`=? ORDER BY `created_timestamp`", [ - $userId - ]); + return Db::select( + ' + SELECT * + FROM `UserWorkLog` + WHERE `user_id`=? + ' . ($sinceTime ? 'AND work_timestamp >= ' . $sinceTime->getTimestamp() : '') . ' + ORDER BY `created_timestamp` + ', + [ + $userId + ] + ); } /** |