diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index adb8716..75cb759 100755 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -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.' diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 8237070..f356e42 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -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", diff --git a/Controller/ApiController.php b/Controller/ApiController.php index d1a95fd..5918762 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -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' diff --git a/Models/Employee.php b/Models/Employee.php index 12cb86a..c93b94e 100755 --- a/Models/Employee.php +++ b/Models/Employee.php @@ -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. * diff --git a/Models/EmployeeEducationHistory.php b/Models/EmployeeEducationHistory.php index 6fc1ba4..64fe066 100755 --- a/Models/EmployeeEducationHistory.php +++ b/Models/EmployeeEducationHistory.php @@ -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} */ diff --git a/Models/EmployeeHistory.php b/Models/EmployeeHistory.php index 1773956..5c19963 100755 --- a/Models/EmployeeHistory.php +++ b/Models/EmployeeHistory.php @@ -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} */ diff --git a/Models/EmployeeMapper.php b/Models/EmployeeMapper.php index c90c80e..346c4dd 100755 --- a/Models/EmployeeMapper.php +++ b/Models/EmployeeMapper.php @@ -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]], diff --git a/Models/EmployeeStatus.php b/Models/EmployeeStatus.php new file mode 100644 index 0000000..1d1594a --- /dev/null +++ b/Models/EmployeeStatus.php @@ -0,0 +1,34 @@ +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} */ diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index 3284880..837aed6 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -48,4 +48,7 @@ return ['HumanResourceManagement' => [ 'Work' => 'Arbeiten', 'Total' => 'Gesamt', 'FTE' => 'MAK', + ':status-1' => 'Aktiv', + ':status-2' => 'Inaktiv', + ':status-3' => 'Nicht Verfügbar', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 851d380..d77732f 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -48,4 +48,7 @@ return ['HumanResourceManagement' => [ 'Work' => 'Work', 'Total' => 'Total', 'FTE' => 'FTE', + ':status-1' => 'Active', + ':status-2' => 'Inactive', + ':status-3' => 'Unavailable', ]]; diff --git a/Theme/Backend/department-list.tpl.php b/Theme/Backend/department-list.tpl.php index 02437b3..29b89be 100755 --- a/Theme/Backend/department-list.tpl.php +++ b/Theme/Backend/department-list.tpl.php @@ -24,7 +24,7 @@ echo $this->data['nav']->render(); ?>
-
+
getHtml('Departments'); ?>download
@@ -48,6 +48,6 @@ echo $this->data['nav']->render(); ?>
-
+
diff --git a/Theme/Backend/staff-view.tpl.php b/Theme/Backend/staff-view.tpl.php index 28a32f1..53aff81 100644 --- a/Theme/Backend/staff-view.tpl.php +++ b/Theme/Backend/staff-view.tpl.php @@ -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(); ?>
@@ -59,6 +62,14 @@ echo $this->data['nav']->render(); ?> : UriFactory::build($employee->image->getPath()); ?>" > +
+ + +
getHtml('Position'); ?>