Kimai_Database_Mysql::get_latest_running_entry PHP Method

get_latest_running_entry() public method

Return the latest running entry with all information required for the buzzer.
Author: sl
public get_latest_running_entry ( ) : array
return array with all data
    public function get_latest_running_entry()
    {
        $table = $this->getTimeSheetTable();
        $projectTable = $this->getProjectTable();
        $activityTable = $this->getActivityTable();
        $customerTable = $this->getCustomerTable();
        $select = "SELECT {$table}.*, {$projectTable}.name AS projectName, {$customerTable}.name AS customerName, {$activityTable}.name AS activityName, {$customerTable}.customerID AS customerID\n          FROM {$table}\n              JOIN {$projectTable} USING(projectID)\n              JOIN {$customerTable} USING(customerID)\n              JOIN {$activityTable} USING(activityID)";
        $result = $this->conn->Query("{$select} WHERE end = 0 AND userID = " . $this->kga['user']['userID'] . " ORDER BY timeEntryID DESC LIMIT 1");
        if (!$result) {
            return null;
        }
        return $this->conn->RowArray(0, MYSQLI_ASSOC);
    }
Kimai_Database_Mysql