mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-01-30 16:38:40 +00:00
docblocks+api functions
This commit is contained in:
parent
d41eb1a094
commit
58682a7fb4
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization\Admin\Install
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -19,7 +19,7 @@ use phpOMS\DataStorage\Database\DatabasePool;
|
|||
/**
|
||||
* Navigation class.
|
||||
*
|
||||
* @package Modules
|
||||
* @package Modules\Organization\Admin\Install
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization\Admin
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -22,7 +22,7 @@ use phpOMS\Module\InstallerAbstract;
|
|||
/**
|
||||
* Organization install class.
|
||||
*
|
||||
* @package Modules
|
||||
* @package Modules\Organization\Admin
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
|
|
@ -43,7 +43,8 @@ class Installer extends InstallerAbstract
|
|||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'organization_unit` (
|
||||
`organization_unit_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`organization_unit_name` varchar(50) DEFAULT NULL,
|
||||
`organization_unit_description` varchar(255) DEFAULT NULL,
|
||||
`organization_unit_description` text DEFAULT NULL,
|
||||
`organization_unit_descriptionraw` text DEFAULT NULL,
|
||||
`organization_unit_parent` int(11) DEFAULT NULL,
|
||||
`organization_unit_status` int(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`organization_unit_id`),
|
||||
|
|
@ -60,7 +61,8 @@ class Installer extends InstallerAbstract
|
|||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'organization_department` (
|
||||
`organization_department_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`organization_department_name` varchar(30) DEFAULT NULL,
|
||||
`organization_department_description` varchar(255) DEFAULT NULL,
|
||||
`organization_department_description` text DEFAULT NULL,
|
||||
`organization_department_descriptionraw` text DEFAULT NULL,
|
||||
`organization_department_parent` int(11) DEFAULT NULL,
|
||||
`organization_department_status` int(3) DEFAULT NULL,
|
||||
`organization_department_unit` int(11) NOT NULL,
|
||||
|
|
@ -80,7 +82,8 @@ class Installer extends InstallerAbstract
|
|||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'organization_position` (
|
||||
`organization_position_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`organization_position_name` varchar(50) DEFAULT NULL,
|
||||
`organization_position_description` varchar(255) DEFAULT NULL,
|
||||
`organization_position_description` text DEFAULT NULL,
|
||||
`organization_position_descriptionraw` text DEFAULT NULL,
|
||||
`organization_position_parent` int(11) DEFAULT NULL,
|
||||
`organization_position_department` int(11) DEFAULT NULL,
|
||||
`organization_position_status` int(3) DEFAULT NULL,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization\Admin
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -21,7 +21,7 @@ use phpOMS\Module\InfoManager;
|
|||
/**
|
||||
* Navigation class.
|
||||
*
|
||||
* @package Modules
|
||||
* @package Modules\Organization\Admin
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization\Admin
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -22,7 +22,7 @@ use phpOMS\Module\InfoManager;
|
|||
/**
|
||||
* Navigation class.
|
||||
*
|
||||
* @package Modules
|
||||
* @package Modules\Organization\Admin
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization\Admin
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -22,7 +22,7 @@ use phpOMS\Module\InfoManager;
|
|||
/**
|
||||
* Navigation class.
|
||||
*
|
||||
* @package Modules
|
||||
* @package Modules\Organization\Admin
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -28,6 +28,7 @@ use phpOMS\Module\ModuleAbstract;
|
|||
use phpOMS\Module\WebInterface;
|
||||
use phpOMS\Views\View;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Utils\Parser\Markdown\Markdown;
|
||||
|
||||
use phpOMS\Account\PermissionType;
|
||||
use Modules\Organization\Models\PermissionState;
|
||||
|
|
@ -35,7 +36,7 @@ use Modules\Organization\Models\PermissionState;
|
|||
/**
|
||||
* Organization Controller class.
|
||||
*
|
||||
* @package Modules
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
|
|
@ -459,7 +460,8 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
{
|
||||
$unit = UnitMapper::get((int) $request->getData('id'));
|
||||
$unit->setName((string) ($request->getData('name') ?? $unit->getName()));
|
||||
$unit->setDescription((string) ($request->getData('description') ?? $unit->getDescription()));
|
||||
$unit->setDescriptionRaw((string) ($request->getData('description') ?? $unit->getDescriptionRaw()));
|
||||
$unit->setDescription(Markdown::parse((string) ($request->getData('description') ?? $unit->getDescriptionRaw())));
|
||||
|
||||
$parent = (int) $request->getData('parent');
|
||||
$unit->setParent(!empty($parent) ? $parent : $unit->getParent());
|
||||
|
|
@ -551,7 +553,8 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
{
|
||||
$unit = new Unit();
|
||||
$unit->setName((string) $request->getData('name'));
|
||||
$unit->setDescription((string) ($request->getData('description') ?? ''));
|
||||
$unit->setDescriptionRaw((string) ($request->getData('description') ?? ''));
|
||||
$unit->setDescription(Markdwon::parse((string) ($request->getData('description') ?? '')));
|
||||
|
||||
$parent = (int) $request->getData('parent');
|
||||
$unit->setParent(!empty($parent) ? $parent : null);
|
||||
|
|
@ -695,7 +698,8 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
{
|
||||
$position = PositionMapper::get((int) $request->getData('id'));
|
||||
$position->setName((string) ($request->getData('name') ?? $position->getName()));
|
||||
$position->setDescription((string) ($request->getData('description') ?? $position->getDescription()));
|
||||
$position->setDescriptionRaw((string) ($request->getData('description') ?? $position->getDescriptionRaw()));
|
||||
$position->setDescription(Markdown::parse((string) ($request->getData('description') ?? $position->getDescriptionRaw())));
|
||||
|
||||
$parent = (int) $request->getData('parent');
|
||||
$position->setParent(!empty($parent) ? $parent : $position->getParent());
|
||||
|
|
@ -759,7 +763,8 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$position = new Position();
|
||||
$position->setName((string) ($request->getData('name')));
|
||||
$position->setStatus((int) $request->getData('status'));
|
||||
$position->setDescription((string) ($request->getData('description') ?? ''));
|
||||
$position->setDescriptionRaw((string) ($request->getData('description') ?? ''));
|
||||
$position->setDescription(Markdown::parse((string) ($request->getData('description') ?? '')));
|
||||
|
||||
$parent = (int) $request->getData('parent');
|
||||
$position->setParent(!empty($parent) ? $parent : null);
|
||||
|
|
@ -873,7 +878,8 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
{
|
||||
$department = DepartmentMapper::get((int) $request->getData('id'));
|
||||
$department->setName((string) ($request->getData('name') ?? $department->getName()));
|
||||
$department->setDescription((string) ($request->getData('description') ?? $department->getDescription()));
|
||||
$department->setDescriptionRaw((string) ($request->getData('description') ?? $department->getDescriptionRaw()));
|
||||
$department->setDescription(Markdown::parse((string) ($request->getData('description') ?? $department->getDescriptionRaw())));
|
||||
|
||||
$parent = (int) $request->getData('parent');
|
||||
$department->setParent(!empty($parent) ? $parent : $department->getParent());
|
||||
|
|
@ -973,7 +979,8 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$parent = (int) $request->getData('parent');
|
||||
$department->setParent(!empty($parent) ? $parent : null);
|
||||
$department->setUnit((int) ($request->getData('unit') ?? 1));
|
||||
$department->setDescription((string) ($request->getData('description') ?? ''));
|
||||
$department->setDescriptionRaw((string) ($request->getData('description') ?? ''));
|
||||
$department->setDescription(Markdown::parse((string) ($request->getData('description') ?? '')));
|
||||
|
||||
return $department;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -14,75 +14,243 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Organization\Models;
|
||||
|
||||
class Department
|
||||
/**
|
||||
* Organization department class.
|
||||
*
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Department implements ArrayableInterface, \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $id = 0;
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* Parent
|
||||
*
|
||||
* @var mixed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $parent = null;
|
||||
|
||||
/**
|
||||
* Status
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $status = Status::INACTIVE;
|
||||
|
||||
/**
|
||||
* Unit this department belongs to
|
||||
*
|
||||
* @var mixed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $unit = 1;
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $description = '';
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $descriptionRaw = '';
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name Name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setName(string $name)
|
||||
{
|
||||
return $this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent ?? new NullDepartment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parent
|
||||
*
|
||||
* @param mixed $parent Parent
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setParent($parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStatus() : int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set status
|
||||
*
|
||||
* @param int $status Status
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setStatus(int $status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unit
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getUnit()
|
||||
{
|
||||
return $this->unit ?? new NullUnit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set unit
|
||||
*
|
||||
* @param mixed $unit Unit
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setUnit($unit)
|
||||
{
|
||||
$this->unit = $unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param int $desc Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescription(string $desc)
|
||||
{
|
||||
$this->description = $desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescriptionRaw() : string
|
||||
{
|
||||
return $this->descriptionRaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param int $desc Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescriptionRaw(string $desc)
|
||||
{
|
||||
$this->descriptionRaw = $desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
|
|
@ -106,11 +274,7 @@ class Department
|
|||
}
|
||||
|
||||
/**
|
||||
* Json serialize.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -16,6 +16,14 @@ namespace Modules\Organization\Models;
|
|||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
|
||||
/**
|
||||
* Organization department mapper class.
|
||||
*
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class DepartmentMapper extends DataMapperAbstract
|
||||
{
|
||||
/**
|
||||
|
|
@ -25,14 +33,21 @@ class DepartmentMapper extends DataMapperAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
'organization_department_id' => ['name' => 'organization_department_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'organization_department_name' => ['name' => 'organization_department_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'organization_department_description' => ['name' => 'organization_department_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'organization_department_parent' => ['name' => 'organization_department_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'organization_department_status' => ['name' => 'organization_department_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'organization_department_unit' => ['name' => 'organization_department_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
'organization_department_id' => ['name' => 'organization_department_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'organization_department_name' => ['name' => 'organization_department_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'organization_department_description' => ['name' => 'organization_department_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'organization_department_descriptionraw' => ['name' => 'organization_department_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
||||
'organization_department_parent' => ['name' => 'organization_department_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'organization_department_status' => ['name' => 'organization_department_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'organization_department_unit' => ['name' => 'organization_department_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $belongsTo = [
|
||||
'unit' => [
|
||||
'mapper' => UnitMapper::class,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -14,6 +14,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Organization\Models;
|
||||
|
||||
/**
|
||||
* Organization null class.
|
||||
*
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class NullDepartment extends Department
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -14,6 +14,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Organization\Models;
|
||||
|
||||
/**
|
||||
* Organization null class.
|
||||
*
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class NullPosition extends Position
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -14,6 +14,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Organization\Models;
|
||||
|
||||
/**
|
||||
* Organization null class.
|
||||
*
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class NullUnit extends Unit
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -19,7 +19,7 @@ use phpOMS\Stdlib\Base\Enum;
|
|||
/**
|
||||
* Permision state enum.
|
||||
*
|
||||
* @package Tasks
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -16,75 +16,243 @@ namespace Modules\Organization\Models;
|
|||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
* Organization position class.
|
||||
*
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Position implements ArrayableInterface, \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $id = 0;
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $name = '';
|
||||
|
||||
/**
|
||||
* Parent
|
||||
*
|
||||
* @var mixed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $parent = null;
|
||||
|
||||
/**
|
||||
* Department
|
||||
*
|
||||
* @var mixed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $department = null;
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $description = '';
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $descriptionRaw = '';
|
||||
|
||||
/**
|
||||
* Status
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $status = Status::INACTIVE;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name Name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent ?? new NullPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parent
|
||||
*
|
||||
* @param mixed $parent Parent
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setParent($parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDepartment()
|
||||
{
|
||||
return $this->department ?? new NullDepartment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set department
|
||||
*
|
||||
* @param mixed $department Department
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDepartment($department)
|
||||
{
|
||||
$this->department = $department;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStatus() : int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set status
|
||||
*
|
||||
* @param int $status Status
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setStatus(int $status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param int $desc Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescription(string $desc)
|
||||
{
|
||||
$this->description = $desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescriptionRaw() : string
|
||||
{
|
||||
return $this->descriptionRaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param int $desc Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescriptionRaw(string $desc)
|
||||
{
|
||||
$this->descriptionRaw = $desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
|
|
@ -109,11 +277,7 @@ class Position implements ArrayableInterface, \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Json serialize.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -16,6 +16,14 @@ namespace Modules\Organization\Models;
|
|||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
|
||||
/**
|
||||
* Organization position mapper class.
|
||||
*
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class PositionMapper extends DataMapperAbstract
|
||||
{
|
||||
|
||||
|
|
@ -26,14 +34,21 @@ class PositionMapper extends DataMapperAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
'organization_position_id' => ['name' => 'organization_position_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'organization_position_name' => ['name' => 'organization_position_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'organization_position_description' => ['name' => 'organization_position_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'organization_position_parent' => ['name' => 'organization_position_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'organization_position_department' => ['name' => 'organization_position_department', 'type' => 'int', 'internal' => 'department'],
|
||||
'organization_position_status' => ['name' => 'organization_position_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'organization_position_id' => ['name' => 'organization_position_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'organization_position_name' => ['name' => 'organization_position_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'organization_position_description' => ['name' => 'organization_position_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'organization_position_descriptionraw' => ['name' => 'organization_position_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
||||
'organization_position_parent' => ['name' => 'organization_position_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'organization_position_department' => ['name' => 'organization_position_department', 'type' => 'int', 'internal' => 'department'],
|
||||
'organization_position_status' => ['name' => 'organization_position_status', 'type' => 'int', 'internal' => 'status'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $belongsTo = [
|
||||
'parent' => [
|
||||
'mapper' => PositionMapper::class,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -19,7 +19,7 @@ use phpOMS\Stdlib\Base\Enum;
|
|||
/**
|
||||
* Accept status enum.
|
||||
*
|
||||
* @package Calendar
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
|
|
|
|||
162
Models/Unit.php
162
Models/Unit.php
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -16,63 +16,209 @@ namespace Modules\Organization\Models;
|
|||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
* Organization unit class.
|
||||
*
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Unit implements ArrayableInterface, \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $id = 0;
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $name = '';
|
||||
|
||||
/**
|
||||
* Parent
|
||||
*
|
||||
* @var mixed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $parent = null;
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $description = '';
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $descriptionRaw = '';
|
||||
|
||||
/**
|
||||
* Status
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $status = Status::INACTIVE;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(string $name)
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name Name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setName(string $name) /* : void */
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent ?? new NullUnit();
|
||||
}
|
||||
|
||||
public function setParent($parent)
|
||||
/**
|
||||
* Set parent
|
||||
*
|
||||
* @param mixed $parent Parent
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setParent($parent) /* : void */
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStatus() : int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setStatus(int $status)
|
||||
/**
|
||||
* Set status
|
||||
*
|
||||
* @param int $status Status
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setStatus(int $status) /* : void */
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(string $desc)
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param int $desc Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescription(string $desc) /* : void */
|
||||
{
|
||||
$this->description = $desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescriptionRaw() : string
|
||||
{
|
||||
return $this->descriptionRaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param int $desc Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescriptionRaw(string $desc)
|
||||
{
|
||||
$this->descriptionRaw = $desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
|
|
@ -96,11 +242,7 @@ class Unit implements ArrayableInterface, \JsonSerializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Json serialize.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @package TBD
|
||||
* @package Modules\Organization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -16,6 +16,14 @@ namespace Modules\Organization\Models;
|
|||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
|
||||
/**
|
||||
* Organization unit mapper class.
|
||||
*
|
||||
* @package Modules\Organization
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class UnitMapper extends DataMapperAbstract
|
||||
{
|
||||
/**
|
||||
|
|
@ -25,13 +33,20 @@ class UnitMapper extends DataMapperAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
'organization_unit_id' => ['name' => 'organization_unit_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'organization_unit_name' => ['name' => 'organization_unit_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'organization_unit_description' => ['name' => 'organization_unit_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'organization_unit_parent' => ['name' => 'organization_unit_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'organization_unit_status' => ['name' => 'organization_unit_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'organization_unit_id' => ['name' => 'organization_unit_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'organization_unit_name' => ['name' => 'organization_unit_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'organization_unit_description' => ['name' => 'organization_unit_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'organization_unit_descriptionraw' => ['name' => 'organization_unit_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
||||
'organization_unit_parent' => ['name' => 'organization_unit_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'organization_unit_status' => ['name' => 'organization_unit_status', 'type' => 'int', 'internal' => 'status'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $belongsTo = [
|
||||
'account' => [
|
||||
'mapper' => UnitMapper::class,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user