bug fixes

This commit is contained in:
Dennis Eichhorn 2024-05-12 00:06:28 +00:00
parent fbbc8a12a9
commit dfb60a76a8
13 changed files with 63 additions and 170 deletions

View File

@ -9,5 +9,5 @@ jobs:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Thank you for createing this issue. We will check it as soon as possible.'
issue-message: 'Thank you for creating this issue. We will check it as soon as possible.'
pr-message: 'Thank you for your pull request. We will check it as soon as possible.'

View File

@ -9,6 +9,11 @@
"primary": true,
"autoincrement": true
},
"hr_staff_status": {
"name": "hr_staff_status",
"type": "TINYINT(1)",
"null": false
},
"hr_staff_profile": {
"name": "hr_staff_profile",
"type": "INT",

View File

@ -478,7 +478,7 @@ final class ApiController extends Controller
pathSettings: PathSettings::FILE_PATH,
hasAccountRelation: false,
readContent: $request->getDataBool('parse_content') ?? false,
type: $request->getDataInt('type'),
tag: $request->getDataInt('tag'),
rel: $employee->id,
mapper: EmployeeMapper::class,
field: 'files'

View File

@ -26,12 +26,6 @@ use Modules\Profile\Models\Profile;
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @question Consider to add employee status (active, inactive, ...)
* We might not need it because we can see the activity from the workHistory.
* However, we have no easy way to see if someone is on maternity leave etc.
* We would have to parse TimeRecording for this which may not be installed.
* https://github.com/Karaka-Management/oms-HumanResourceManagement/issues/10
*/
class Employee implements \JsonSerializable
{
@ -54,6 +48,8 @@ class Employee implements \JsonSerializable
*/
public Profile $profile;
public int $status = EmployeeStatus::ACTIVE;
/**
* Employee image.
*
@ -152,46 +148,6 @@ class Employee implements \JsonSerializable
return \hash_equals($this->semiPrivateHash, $hash);
}
/**
* Get media file by type
*
* @param int $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByType(int $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeId($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* Get all media files by type name
*
* @param string $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByTypeName(string $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeName($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* Get employee company history.
*

View File

@ -82,46 +82,6 @@ class EmployeeEducationHistory implements \JsonSerializable
$this->address = new Address();
}
/**
* Get media file by type
*
* @param int $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByType(int $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeId($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* Get all media files by type name
*
* @param string $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByTypeName(string $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeName($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* {@inheritdoc}
*/

View File

@ -106,46 +106,6 @@ class EmployeeHistory implements \JsonSerializable
$this->position = new NullPosition();
}
/**
* Get media file by type
*
* @param int $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByType(int $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeId($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* Get all media files by type name
*
* @param string $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByTypeName(string $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeName($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* {@inheritdoc}
*/

View File

@ -40,6 +40,7 @@ final class EmployeeMapper extends DataMapperFactory
*/
public const COLUMNS = [
'hr_staff_id' => ['name' => 'hr_staff_id', 'type' => 'int', 'internal' => 'id'],
'hr_staff_status' => ['name' => 'hr_staff_status', 'type' => 'int', 'internal' => 'status'],
'hr_staff_profile' => ['name' => 'hr_staff_profile', 'type' => 'int', 'internal' => 'profile'],
'hr_staff_smiPHash' => ['name' => 'hr_staff_smiPHash', 'type' => 'string', 'internal' => 'semiPrivateHash', 'private' => true],
'hr_staff_image' => ['name' => 'hr_staff_image', 'type' => 'int', 'internal' => 'image', 'annotations' => ['gdpr' => true]],

34
Models/EmployeeStatus.php Normal file
View File

@ -0,0 +1,34 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\HumanResourceManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\HumanResourceManagement\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Employee status enum.
*
* @package Modules\HumanResourceManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class EmployeeStatus extends Enum
{
public const ACTIVE = 1;
public const INACTIVE = 2;
public const UNAVAILABLE = 3;
}

View File

@ -78,46 +78,6 @@ class EmployeeWorkHistory implements \JsonSerializable
$this->address = new Address();
}
/**
* Get media file by type
*
* @param int $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByType(int $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeId($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* Get all media files by type name
*
* @param string $type Media type
*
* @return Media
*
* @since 1.0.0
*/
public function getFileByTypeName(string $type) : Media
{
foreach ($this->files as $file) {
if ($file->hasMediaTypeName($type)) {
return $file;
}
}
return new NullMedia();
}
/**
* {@inheritdoc}
*/

View File

@ -48,4 +48,7 @@ return ['HumanResourceManagement' => [
'Work' => 'Arbeiten',
'Total' => 'Gesamt',
'FTE' => 'MAK',
':status-1' => 'Aktiv',
':status-2' => 'Inaktiv',
':status-3' => 'Nicht Verfügbar',
]];

View File

@ -48,4 +48,7 @@ return ['HumanResourceManagement' => [
'Work' => 'Work',
'Total' => 'Total',
'FTE' => 'FTE',
':status-1' => 'Active',
':status-2' => 'Inactive',
':status-3' => 'Unavailable',
]];

View File

@ -24,7 +24,7 @@ echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Departments'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table class="default sticky">
@ -48,6 +48,6 @@ echo $this->data['nav']->render(); ?>
<?php endif; ?>
</table>
</div>
</div>
</section>
</div>
</div>

View File

@ -12,6 +12,7 @@
*/
declare(strict_types=1);
use Modules\HumanResourceManagement\Models\EmployeeStatus;
use Modules\HumanResourceTimeRecording\Models\ClockingStatus;
use Modules\HumanResourceTimeRecording\Models\ClockingType;
use phpOMS\Stdlib\Base\SmartDateTime;
@ -23,6 +24,8 @@ $education = $employee->getEducationHistory();
$work = $employee->getWorkHistory();
$recentHistory = $employee->getNewestHistory();
$staffStatus = EmployeeStatus::getConstants();
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2">
<div class="box">
@ -59,6 +62,14 @@ echo $this->data['nav']->render(); ?>
: UriFactory::build($employee->image->getPath()); ?>"
>
</span>
<div class="form-group">
<label for="iStatus"><?= $this->getHtml('Status'); ?></label>
<select id="iStatus" name="status">
<?php foreach ($staffStatus as $status) : ?>
<option value="<?= $status; ?>"<?= $employee->status === $status ? ' selected': ''; ?>><?= $this->getHtml(':status-' . $status); ?>
<?php endforeach; ?>
</select>
</div>
<table class="list">
<tr>
<th><?= $this->getHtml('Position'); ?>