mirror of
https://github.com/Karaka-Management/oms-HumanResourceTimeRecording.git
synced 2026-01-11 03:48:40 +00:00
many bug fixes
This commit is contained in:
parent
9c3e50d46e
commit
bf9a78b535
|
|
@ -16,6 +16,7 @@ namespace Modules\HumanResourceTimeRecording\Controller;
|
|||
|
||||
use Modules\Dashboard\Models\DashboardElementInterface;
|
||||
use Modules\HumanResourceManagement\Models\EmployeeMapper;
|
||||
use Modules\HumanResourceTimeRecording\Models\ClockingTypeMapper;
|
||||
use Modules\HumanResourceTimeRecording\Models\NullSession;
|
||||
use Modules\HumanResourceTimeRecording\Models\SessionMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
|
|
@ -61,6 +62,11 @@ final class BackendController extends Controller implements DashboardElementInte
|
|||
|
||||
$view->data['sessions'] = $sessions;
|
||||
|
||||
$view->data['session_types'] = ClockingTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['employees'] = EmployeeMapper::getAll()
|
||||
->with('profile')
|
||||
->with('profile/account')
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace Modules\HumanResourceTimeRecording\Models;
|
|||
use Modules\Admin\Models\AccountMapper;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\DataStorage\Database\Query\ColumnName;
|
||||
use phpOMS\Stdlib\Base\SmartDateTime;
|
||||
|
||||
/**
|
||||
|
|
@ -124,6 +125,7 @@ final class SessionMapper extends DataMapperFactory
|
|||
*/
|
||||
public static function getLastSessionsFromAllEmployees() : array
|
||||
{
|
||||
/*
|
||||
$join = new Builder(self::$db);
|
||||
$join->select(self::TABLE . '.hr_timerecording_session_employee')
|
||||
->selectAs('MAX(hr_timerecording_session_start)', 'maxDate')
|
||||
|
|
@ -134,6 +136,16 @@ final class SessionMapper extends DataMapperFactory
|
|||
$query->leftJoin($join, 'tm')
|
||||
->on(self::TABLE . '_d1.hr_timerecording_session_employee', '=', 'tm.hr_timerecording_session_employee')
|
||||
->andOn(self::TABLE . '_d1.hr_timerecording_session_start', '=', 'tm.maxDate');
|
||||
*/
|
||||
|
||||
// @bug How to handle multiple start values in the same day
|
||||
$subquery = new Builder(self::$db);
|
||||
$subquery->select('MAX(t2.hr_timerecording_session_start)')
|
||||
->fromAs(self::TABLE, 't2')
|
||||
->where('t2.hr_timerecording_session_employee', '=', new ColumnName(self::TABLE . '_d1.hr_timerecording_session_employee'));
|
||||
|
||||
$query = self::getQuery();
|
||||
$query->where(self::TABLE . '_d1.hr_timerecording_session_start', '=', $subquery);
|
||||
|
||||
return self::getAll()
|
||||
->executeGetArray($query);
|
||||
|
|
|
|||
|
|
@ -18,13 +18,6 @@ return ['HumanResourceTimeRecording' => [
|
|||
':CS2' => 'Pause',
|
||||
':CS3' => 'Continue',
|
||||
':CS4' => 'End',
|
||||
':CT1' => 'Office',
|
||||
':CT2' => 'Home',
|
||||
':CT3' => 'Remote',
|
||||
':CT4' => 'Vacation',
|
||||
':CT5' => 'Sick',
|
||||
':CT6' => 'On the move',
|
||||
':CT-1' => 'No data',
|
||||
':D0' => 'Sunday',
|
||||
':D1' => 'Monday',
|
||||
':D2' => 'Tuesday',
|
||||
|
|
|
|||
|
|
@ -43,7 +43,13 @@ echo $this->data['nav']->render(); ?>
|
|||
?>
|
||||
<tr>
|
||||
<td><?= $session?->start->format('Y-m-d H:i:s') ?? $date->format('Y-m-d H:i:s'); ?>
|
||||
<td><span class="tag"><?= $this->getHtml(':CT' . ($session?->type ?? ClockingType::NO_DATA)); ?></span>
|
||||
<td><?php if ($session === NULL) : ?>
|
||||
<span class="tag hl-1">-----</span>
|
||||
<?php else : ?>
|
||||
<span class="tag">
|
||||
<?= $this->printHtml($this->data['session_types'][$session?->type->id]?->getL11n() ?? ''); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<td><a class="content" href="<?= $employeeUrl; ?>">
|
||||
<?= $this->printHtml($employee->profile->account->name1); ?>,
|
||||
<?= $this->printHtml($employee->profile->account->name2); ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user