Started fixing risk management

This commit is contained in:
Dennis Eichhorn 2017-07-03 22:43:14 +02:00
parent 2bf57924df
commit 7e8b17edce
17 changed files with 154 additions and 68 deletions

View File

@ -46,13 +46,13 @@ class Installer extends InstallerAbstract
case DatabaseType::MYSQL: case DatabaseType::MYSQL:
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_category` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_category` (
`riskmngmt_category_id` int(11) NOT NULL, `riskmngmt_category_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_category_name` varchar(50) NOT NULL, `riskmngmt_category_name` varchar(50) NOT NULL,
`riskmngmt_category_description` text NOT NULL, `riskmngmt_category_description` text NOT NULL,
`riskmngmt_category_descriptionraw` text NOT NULL, `riskmngmt_category_descriptionraw` text NOT NULL,
`riskmngmt_category_parent` int(11) DEFAULT NULL, `riskmngmt_category_parent` int(11) DEFAULT NULL,
`riskmngmt_category_responsible` int(11) NOT NULL, `riskmngmt_category_responsible` int(11) DEFAULT NULL,
`riskmngmt_category_deputy` int(11) NOT NULL, `riskmngmt_category_deputy` int(11) DEFAULT NULL,
PRIMARY KEY (`riskmngmt_category_id`), PRIMARY KEY (`riskmngmt_category_id`),
KEY `riskmngmt_category_parent` (`riskmngmt_category_parent`), KEY `riskmngmt_category_parent` (`riskmngmt_category_parent`),
KEY `riskmngmt_category_responsible` (`riskmngmt_category_responsible`), KEY `riskmngmt_category_responsible` (`riskmngmt_category_responsible`),
@ -70,15 +70,17 @@ class Installer extends InstallerAbstract
// TODO: more (media, start, end etc...) // TODO: more (media, start, end etc...)
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_process` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_process` (
`riskmngmt_process_id` int(11) NOT NULL, `riskmngmt_process_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_process_name` text NOT NULL, `riskmngmt_process_name` text NOT NULL,
`riskmngmt_process_description` text NOT NULL, `riskmngmt_process_description` text NOT NULL,
`riskmngmt_process_descriptionraw` text NOT NULL, `riskmngmt_process_descriptionraw` text NOT NULL,
`riskmngmt_process_department` int(11) DEFAULT NULL,
`riskmngmt_process_unit` int(11) NOT NULL, `riskmngmt_process_unit` int(11) NOT NULL,
`riskmngmt_process_responsible` int(11) NOT NULL, `riskmngmt_process_responsible` int(11) DEFAULT NULL,
`riskmngmt_process_deputy` int(11) NOT NULL, `riskmngmt_process_deputy` int(11) DEFAULT NULL,
PRIMARY KEY (`riskmngmt_process_id`), PRIMARY KEY (`riskmngmt_process_id`),
KEY `riskmngmt_process_unit` (`riskmngmt_process_unit`), KEY `riskmngmt_process_unit` (`riskmngmt_process_unit`),
KEY `riskmngmt_process_department` (`riskmngmt_process_department`),
KEY `riskmngmt_process_responsible` (`riskmngmt_process_responsible`), KEY `riskmngmt_process_responsible` (`riskmngmt_process_responsible`),
KEY `riskmngmt_process_deputy` (`riskmngmt_process_deputy`) KEY `riskmngmt_process_deputy` (`riskmngmt_process_deputy`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;' )ENGINE=InnoDB DEFAULT CHARSET=utf8;'
@ -87,17 +89,18 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_process` 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_process`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_1` FOREIGN KEY (`riskmngmt_process_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_unit` (`organization_unit_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_1` FOREIGN KEY (`riskmngmt_process_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_unit` (`organization_unit_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_2` FOREIGN KEY (`riskmngmt_process_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_2` FOREIGN KEY (`riskmngmt_process_department`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_department` (`organization_department_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_3` FOREIGN KEY (`riskmngmt_process_deputy`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_3` FOREIGN KEY (`riskmngmt_process_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_4` FOREIGN KEY (`riskmngmt_process_deputy`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute(); )->execute();
// todo: only install if projectmanagement exists // todo: only install if projectmanagement exists
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_project` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_project` (
`riskmngmt_project_id` int(11) NOT NULL, `riskmngmt_project_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_project_project` int(11) NOT NULL, `riskmngmt_project_project` int(11) NOT NULL,
`riskmngmt_project_responsible` int(11) NOT NULL, `riskmngmt_project_responsible` int(11) DEFAULT NULL,
`riskmngmt_project_deputy` int(11) NOT NULL, `riskmngmt_project_deputy` int(11) DEFAULT NULL,
PRIMARY KEY (`riskmngmt_project_id`), PRIMARY KEY (`riskmngmt_project_id`),
KEY `riskmngmt_project_project` (`riskmngmt_project_project`), KEY `riskmngmt_project_project` (`riskmngmt_project_project`),
KEY `riskmngmt_project_responsible` (`riskmngmt_project_responsible`), KEY `riskmngmt_project_responsible` (`riskmngmt_project_responsible`),
@ -114,10 +117,10 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_department` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_department` (
`riskmngmt_department_id` int(11) NOT NULL, `riskmngmt_department_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_department_department` int(11) NOT NULL, `riskmngmt_department_department` int(11) NOT NULL,
`riskmngmt_department_responsible` int(11) NOT NULL, `riskmngmt_department_responsible` int(11) DEFAULT NULL,
`riskmngmt_department_deputy` int(11) NOT NULL, `riskmngmt_department_deputy` int(11) DEFAULT NULL,
PRIMARY KEY (`riskmngmt_department_id`), PRIMARY KEY (`riskmngmt_department_id`),
KEY `riskmngmt_department_department` (`riskmngmt_department_department`), KEY `riskmngmt_department_department` (`riskmngmt_department_department`),
KEY `riskmngmt_department_responsible` (`riskmngmt_department_responsible`), KEY `riskmngmt_department_responsible` (`riskmngmt_department_responsible`),
@ -134,7 +137,7 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (
`riskmngmt_risk_id` int(11) NOT NULL, `riskmngmt_risk_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_risk_name` varchar(255) NOT NULL, `riskmngmt_risk_name` varchar(255) NOT NULL,
`riskmngmt_risk_description` text NOT NULL, `riskmngmt_risk_description` text NOT NULL,
`riskmngmt_risk_descriptionraw` text NOT NULL, `riskmngmt_risk_descriptionraw` text NOT NULL,
@ -162,7 +165,7 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_eval` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_eval` (
`riskmngmt_risk_eval_id` int(11) NOT NULL, `riskmngmt_risk_eval_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_risk_eval_gross_probability` int(11) NOT NULL, `riskmngmt_risk_eval_gross_probability` int(11) NOT NULL,
`riskmngmt_risk_eval_gross_risk` int(11) NOT NULL, `riskmngmt_risk_eval_gross_risk` int(11) NOT NULL,
`riskmngmt_risk_eval_gross_score` int(11) NOT NULL, `riskmngmt_risk_eval_gross_score` int(11) NOT NULL,
@ -183,7 +186,7 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object` (
`riskmngmt_risk_object_id` int(11) NOT NULL, `riskmngmt_risk_object_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_risk_object_name` varchar(50) NOT NULL, `riskmngmt_risk_object_name` varchar(50) NOT NULL,
`riskmngmt_risk_object_description` text NOT NULL, `riskmngmt_risk_object_description` text NOT NULL,
`riskmngmt_risk_object_descriptionraw` text NOT NULL, `riskmngmt_risk_object_descriptionraw` text NOT NULL,
@ -199,7 +202,7 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object_eval` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object_eval` (
`riskmngmt_risk_object_eval_id` int(11) NOT NULL, `riskmngmt_risk_object_eval_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_risk_object_eval_val` decimal(11,4) NOT NULL, `riskmngmt_risk_object_eval_val` decimal(11,4) NOT NULL,
`riskmngmt_risk_object_eval_object` int(11) NOT NULL, `riskmngmt_risk_object_eval_object` int(11) NOT NULL,
`riskmngmt_risk_object_eval_date` datetime NOT NULL, `riskmngmt_risk_object_eval_date` datetime NOT NULL,
@ -215,7 +218,7 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media` (
`riskmngmt_risk_media_id` int(11) NOT NULL, `riskmngmt_risk_media_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_risk_media_risk` int(11) NOT NULL, `riskmngmt_risk_media_risk` int(11) NOT NULL,
`riskmngmt_risk_media_media` int(11) NOT NULL, `riskmngmt_risk_media_media` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_risk_media_id`), PRIMARY KEY (`riskmngmt_risk_media_id`),
@ -232,16 +235,16 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_cause` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_cause` (
`riskmngmt_cause_id` int(11) NOT NULL, `riskmngmt_cause_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_cause_name` varchar(50) NOT NULL, `riskmngmt_cause_name` varchar(50) NOT NULL,
`riskmngmt_cause_description` text NOT NULL, `riskmngmt_cause_description` text NOT NULL,
`riskmngmt_cause_descriptionRaw` text NOT NULL, `riskmngmt_cause_descriptionraw` text NOT NULL,
`riskmngmt_cause_probability` smallint(6) NOT NULL, `riskmngmt_cause_probability` smallint(6) NOT NULL,
`riskmngmt_cause_deptartment` int(11) DEFAULT NULL, `riskmngmt_cause_department` int(11) DEFAULT NULL,
`riskmngmt_cause_category` int(11) DEFAULT NULL, `riskmngmt_cause_category` int(11) DEFAULT NULL,
`riskmngmt_cause_risk` int(11) DEFAULT NULL, `riskmngmt_cause_risk` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_cause_id`), PRIMARY KEY (`riskmngmt_cause_id`),
KEY `riskmngmt_cause_deptartment` (`riskmngmt_cause_deptartment`), KEY `riskmngmt_cause_department` (`riskmngmt_cause_department`),
KEY `riskmngmt_cause_category` (`riskmngmt_cause_category`), KEY `riskmngmt_cause_category` (`riskmngmt_cause_category`),
KEY `riskmngmt_cause_risk` (`riskmngmt_cause_risk`) KEY `riskmngmt_cause_risk` (`riskmngmt_cause_risk`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;' )ENGINE=InnoDB DEFAULT CHARSET=utf8;'
@ -249,19 +252,21 @@ class Installer extends InstallerAbstract
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_cause` 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_cause`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_cause_ibfk_1` FOREIGN KEY (`riskmngmt_cause_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`);' ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_cause_ibfk_1` FOREIGN KEY (`riskmngmt_cause_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_cause_ibfk_2` FOREIGN KEY (`riskmngmt_cause_category`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_category` (`riskmngmt_category_id`),
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_cause_ibfk_3` FOREIGN KEY (`riskmngmt_cause_department`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_department` (`riskmngmt_department_id`);'
)->execute(); )->execute();
$dbPool->get('core')->con->prepare( $dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_solution` ( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_solution` (
`riskmngmt_solution_id` int(11) NOT NULL, `riskmngmt_solution_id` int(11) NOT NULL AUTO_INCREMENT,
`riskmngmt_solution_name` varchar(50) NOT NULL, `riskmngmt_solution_name` varchar(50) NOT NULL,
`riskmngmt_solution_description` text NOT NULL, `riskmngmt_solution_description` text NOT NULL,
`riskmngmt_solution_descriptionRaw` text NOT NULL, `riskmngmt_solution_descriptionraw` text NOT NULL,
`riskmngmt_solution_probability` smallint(6) NOT NULL, `riskmngmt_solution_probability` smallint(6) NOT NULL,
`riskmngmt_solution_effect` decimal(11,4) DEFAULT NULL, `riskmngmt_solution_effect` decimal(11,4) DEFAULT NULL,
`riskmngmt_solution_cause` int(11) DEFAULT NULL, `riskmngmt_solution_cause` int(11) NOT NULL,
`riskmngmt_solution_risk` int(11) DEFAULT NULL, `riskmngmt_solution_risk` int(11) NOT NULL,
PRIMARY KEY (`riskmngmt_solution_id`), PRIMARY KEY (`riskmngmt_solution_id`),
KEY `riskmngmt_solution_cause` (`riskmngmt_solution_cause`), KEY `riskmngmt_solution_cause` (`riskmngmt_solution_cause`),
KEY `riskmngmt_solution_risk` (`riskmngmt_solution_risk`) KEY `riskmngmt_solution_risk` (`riskmngmt_solution_risk`)

View File

@ -37,11 +37,11 @@ class Category
private $descriptionRaw = ''; private $descriptionRaw = '';
private $parent = 0; private $parent = null;
private $responsible = 0; private $responsible = null;
private $deputy = 0; private $deputy = null;
public function __construct() public function __construct()
{ {

View File

@ -39,11 +39,11 @@ class Cause
private $probability = 0.0; private $probability = 0.0;
private $department = 0; private $department = null;
private $risk = 0; private $risk = null;
private $category = 0; private $category = null;
public function __construct() public function __construct()
{ {

View File

@ -34,12 +34,27 @@ class CauseMapper extends DataMapperAbstract
'riskmngmt_cause_name' => ['name' => 'riskmngmt_cause_name', 'type' => 'string', 'internal' => 'title'], 'riskmngmt_cause_name' => ['name' => 'riskmngmt_cause_name', 'type' => 'string', 'internal' => 'title'],
'riskmngmt_cause_description' => ['name' => 'riskmngmt_cause_description', 'type' => 'string', 'internal' => 'description'], 'riskmngmt_cause_description' => ['name' => 'riskmngmt_cause_description', 'type' => 'string', 'internal' => 'description'],
'riskmngmt_cause_descriptionraw' => ['name' => 'riskmngmt_cause_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'], 'riskmngmt_cause_descriptionraw' => ['name' => 'riskmngmt_cause_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'riskmngmt_cause_department' => ['name' => 'riskmngmt_cause_department', 'type' => 'string', 'internal' => 'department'], 'riskmngmt_cause_department' => ['name' => 'riskmngmt_cause_department', 'type' => 'int', 'internal' => 'department'],
'riskmngmt_cause_category' => ['name' => 'riskmngmt_cause_category', 'type' => 'string', 'internal' => 'category'], 'riskmngmt_cause_category' => ['name' => 'riskmngmt_cause_category', 'type' => 'int', 'internal' => 'category'],
'riskmngmt_cause_risk' => ['name' => 'riskmngmt_cause_risk', 'type' => 'string', 'internal' => 'risk'], 'riskmngmt_cause_risk' => ['name' => 'riskmngmt_cause_risk', 'type' => 'int', 'internal' => 'risk'],
'riskmngmt_cause_probability' => ['name' => 'riskmngmt_cause_probability', 'type' => 'int', 'internal' => 'probability'], 'riskmngmt_cause_probability' => ['name' => 'riskmngmt_cause_probability', 'type' => 'int', 'internal' => 'probability'],
]; ];
protected static $belongsTo = [
'risk' => [
'mapper' => RiskMapper::class,
'dest' => 'riskmngmt_cause_risk',
],
'category' => [
'mapper' => CategoryMapper::class,
'dest' => 'riskmngmt_cause_category',
],
'department' => [
'mapper' => DepartmentMapper::class,
'dest' => 'riskmngmt_cause_department',
],
];
/** /**
* Primary table. * Primary table.
* *

View File

@ -31,11 +31,11 @@ class Department
{ {
private $id = 0; private $id = 0;
private $department = 0; private $department = null;
private $responsible = 0; private $responsible = null;
private $deputy = 0; private $deputy = null;
public function __construct() public function __construct()
{ {

View File

@ -32,7 +32,7 @@ class DepartmentMapper extends DataMapperAbstract
*/ */
protected static $columns = [ protected static $columns = [
'riskmngmt_department_id' => ['name' => 'riskmngmt_department_id', 'type' => 'int', 'internal' => 'id'], 'riskmngmt_department_id' => ['name' => 'riskmngmt_department_id', 'type' => 'int', 'internal' => 'id'],
'riskmngmt_department_department' => ['name' => 'riskmngmt_department_department', 'type' => 'int', 'internal' => 'project'], 'riskmngmt_department_department' => ['name' => 'riskmngmt_department_department', 'type' => 'int', 'internal' => 'department'],
'riskmngmt_department_responsible' => ['name' => 'riskmngmt_department_responsible', 'type' => 'int', 'internal' => 'responsible'], 'riskmngmt_department_responsible' => ['name' => 'riskmngmt_department_responsible', 'type' => 'int', 'internal' => 'responsible'],
'riskmngmt_department_deputy' => ['name' => 'riskmngmt_department_deputy', 'type' => 'int', 'internal' => 'deputy'], 'riskmngmt_department_deputy' => ['name' => 'riskmngmt_department_deputy', 'type' => 'int', 'internal' => 'deputy'],
]; ];
@ -59,10 +59,10 @@ class DepartmentMapper extends DataMapperAbstract
* @var array * @var array
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $ownsOne = [ protected static $belongsTo = [
'source' => [ 'department' => [
'mapper' => \Modules\Organization\Models\DepartmentMapper::class, 'mapper' => \Modules\Organization\Models\DepartmentMapper::class,
'src' => 'riskmngmt_department_department', 'dest' => 'riskmngmt_department_department',
], ],
]; ];

View File

@ -37,13 +37,13 @@ class Process
private $descriptionRaw = ''; private $descriptionRaw = '';
private $department = 0; private $department = null;
private $responsible = 0; private $responsible = null;
private $deputy = 0; private $deputy = null;
private $unit = 0; private $unit = 1;
public function __construct() public function __construct()
{ {
@ -89,6 +89,16 @@ class Process
$this->unit = $unit; $this->unit = $unit;
} }
public function getDepartment()
{
return $this->department;
}
public function setDepartment($department)
{
$this->department = $department;
}
public function getResponsible() public function getResponsible()
{ {
return $this->responsible; return $this->responsible;

View File

@ -16,6 +16,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Modules\RiskManagement\Models; namespace Modules\RiskManagement\Models;
use Modules\Organization\Models\UnitMapper;
use Modules\Media\Models\MediaMapper; use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\DataStorage\Database\Query\Builder;
@ -35,11 +36,23 @@ class ProcessMapper extends DataMapperAbstract
'riskmngmt_process_name' => ['name' => 'riskmngmt_process_name', 'type' => 'string', 'internal' => 'title'], 'riskmngmt_process_name' => ['name' => 'riskmngmt_process_name', 'type' => 'string', 'internal' => 'title'],
'riskmngmt_process_description' => ['name' => 'riskmngmt_process_description', 'type' => 'string', 'internal' => 'description'], 'riskmngmt_process_description' => ['name' => 'riskmngmt_process_description', 'type' => 'string', 'internal' => 'description'],
'riskmngmt_process_descriptionraw' => ['name' => 'riskmngmt_process_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'], 'riskmngmt_process_descriptionraw' => ['name' => 'riskmngmt_process_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'riskmngmt_process_department' => ['name' => 'riskmngmt_process_department', 'type' => 'int', 'internal' => 'department'],
'riskmngmt_process_unit' => ['name' => 'riskmngmt_process_unit', 'type' => 'int', 'internal' => 'unit'], 'riskmngmt_process_unit' => ['name' => 'riskmngmt_process_unit', 'type' => 'int', 'internal' => 'unit'],
'riskmngmt_process_responsible' => ['name' => 'riskmngmt_process_responsible', 'type' => 'int', 'internal' => 'responsible'], 'riskmngmt_process_responsible' => ['name' => 'riskmngmt_process_responsible', 'type' => 'int', 'internal' => 'responsible'],
'riskmngmt_process_deputy' => ['name' => 'riskmngmt_process_deputy', 'type' => 'int', 'internal' => 'deputy'], 'riskmngmt_process_deputy' => ['name' => 'riskmngmt_process_deputy', 'type' => 'int', 'internal' => 'deputy'],
]; ];
protected static $belongsTo = [
'unit' => [
'mapper' => UnitMapper::class,
'dest' => 'riskmngmt_cause_risk',
],
'department' => [
'mapper' => DepartmentMapper::class,
'dest' => 'riskmngmt_cause_department',
],
];
/** /**
* Primary table. * Primary table.
* *

View File

@ -31,11 +31,11 @@ class Project
{ {
private $id = 0; private $id = 0;
private $project = 0; private $project = null;
private $responsible = 0; private $responsible = null;
private $deputy = 0; private $deputy = null;
public function __construct() public function __construct()
{ {

View File

@ -59,10 +59,10 @@ class ProjectMapper extends DataMapperAbstract
* @var array * @var array
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $ownsOne = [ protected static $belongsTo = [
'source' => [ 'project' => [
'mapper' => \Modules\ProjectManagement\Models\ProjectMapper::class, 'mapper' => \Modules\ProjectManagement\Models\ProjectMapper::class,
'src' => 'riskmngmt_project_project', 'dest' => 'riskmngmt_project_project',
], ],
]; ];

View File

@ -37,19 +37,19 @@ class Risk
private $descriptionRaw = ''; private $descriptionRaw = '';
private $unit = 0; private $unit = 1;
private $department = 0; private $department = null;
private $category = 0; private $category = null;
private $project = 0; private $project = null;
private $process = 0; private $process = null;
private $responsible = 0; private $responsible = null;
private $deputy = 0; private $deputy = null;
private $histScore = []; private $histScore = [];
@ -200,7 +200,7 @@ class Risk
return $this->responsible; return $this->responsible;
} }
public function setResponsible() /* : void */ public function setResponsible($responsible) /* : void */
{ {
$this->responsible = $responsible; $this->responsible = $responsible;
} }

View File

@ -17,6 +17,7 @@ declare(strict_types=1);
namespace Modules\RiskManagement\Models; namespace Modules\RiskManagement\Models;
use Modules\Media\Models\MediaMapper; use Modules\Media\Models\MediaMapper;
use Modules\Organization\Models\UnitMapper;
use Modules\RiskManagement\Models\RiskObject; use Modules\RiskManagement\Models\RiskObject;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\DataStorage\Database\Query\Builder;
@ -60,13 +61,36 @@ class RiskMapper extends DataMapperAbstract
'src' => 'riskmngmt_risk_media_risk', 'src' => 'riskmngmt_risk_media_risk',
], ],
'riskObjects' => [ 'riskObjects' => [
'mapper' => RiskObject::class, 'mapper' => RiskObjectMapper::class,
'table' => 'riskmngmt_risk_object', 'table' => 'riskmngmt_risk_object',
'dst' => 'riskmngmt_risk_object_risk', 'dst' => 'riskmngmt_risk_object_risk',
'src' => null, 'src' => null,
], ],
]; ];
protected static $belongsTo = [
'project' => [
'mapper' => ProjectMapper::class,
'dest' => 'riskmngmt_risk_project',
],
'process' => [
'mapper' => ProcessMapper::class,
'dest' => 'riskmngmt_risk_process',
],
'category' => [
'mapper' => CategoryMapper::class,
'dest' => 'riskmngmt_risk_category',
],
'department' => [
'mapper' => DepartmentMapper::class,
'dest' => 'riskmngmt_risk_department',
],
'unit' => [
'mapper' => UnitMapper::class,
'dest' => 'riskmngmt_risk_unit',
],
];
/** /**
* Primary table. * Primary table.
* *

View File

@ -37,7 +37,7 @@ class RiskObject
private $descriptionRaw = ''; private $descriptionRaw = '';
private $risk = 0; private $risk = null;
public function __construct() public function __construct()
{ {

View File

@ -39,6 +39,13 @@ class RiskObjectMapper extends DataMapperAbstract
'riskmngmt_risk_object_risk' => ['name' => 'riskmngmt_risk_object_risk', 'type' => 'int', 'internal' => 'risk'], 'riskmngmt_risk_object_risk' => ['name' => 'riskmngmt_risk_object_risk', 'type' => 'int', 'internal' => 'risk'],
]; ];
protected static $belongsTo = [
'unit' => [
'mapper' => RiskMapper::class,
'dest' => 'riskmngmt_risk_object_risk',
],
];
/** /**
* Primary table. * Primary table.
* *

View File

@ -39,9 +39,9 @@ class Solution
private $probability = 0.0; private $probability = 0.0;
private $cause = 0; private $cause = null;
private $risk = 0; private $risk = null;
public function __construct() public function __construct()
{ {

View File

@ -40,6 +40,17 @@ class SolutionMapper extends DataMapperAbstract
'riskmngmt_solution_risk' => ['name' => 'riskmngmt_solution_risk', 'type' => 'int', 'internal' => 'risk'], 'riskmngmt_solution_risk' => ['name' => 'riskmngmt_solution_risk', 'type' => 'int', 'internal' => 'risk'],
]; ];
protected static $belongsTo = [
'risk' => [
'mapper' => RiskMapper::class,
'dest' => 'riskmngmt_cause_risk',
],
'cause' => [
'mapper' => CauseMapper::class,
'dest' => 'riskmngmt_solution_cause',
],
];
/** /**
* Primary table. * Primary table.
* *

View File

@ -17,7 +17,8 @@
"description": "Risk Management module.", "description": "Risk Management module.",
"directory": "RiskManagement", "directory": "RiskManagement",
"dependencies": { "dependencies": {
"Media": "*" "Media": "*",
"Organization": "*"
}, },
"providing": { "providing": {
"Navigation": "*" "Navigation": "*"