function invoice_add_to_array(&$array, $row, $short_form)
{
global $activityIndexMap;
if ($short_form && $row['type'] == 'timeSheet') {
if (isset($activityIndexMap[$row['desc']])) {
$index = $activityIndexMap[$row['desc']];
$totalTime = $array[$index]['hour'];
$totalAmount = $array[$index]['amount'];
$start = $array[$index]['start'];
$end = $array[$index]['end'];
$duration = $array[$index]['duration'];
$array[$index] = array('type' => 'timeSheet', 'desc' => $row['desc'], 'start' => $start < $row['start'] ? $start : $row['start'], 'end' => $end > $row['end'] ? $end : $row['end'], 'hour' => $totalTime + $row['hour'], 'fDuration' => Kimai_Format::formatDuration($duration + $row['duration']), 'duration' => $duration + $row['duration'], 'timestamp' => $start < $row['start'] ? $start : $row['start'], 'amount' => $totalAmount + $row['amount'], 'description' => $row['description'], 'rate' => ($totalAmount + $row['amount']) / ($totalTime + $row['hour']), 'comment' => $row['comment'], 'username' => $row['username'], 'useralias' => $row['useralias'], 'location' => $row['location'], 'trackingNr' => $row['trackingNr'], 'projectID' => $row['projectID'], 'projectName' => $row['projectName'], 'projectComment' => $row['projectComment'], 'date' => date("m/d/Y", $row['timestamp']));
return;
} else {
$activityIndexMap[$row['desc']] = count($array);
}
}
$array[] = $row;
}