diff --git a/Admin/Installer.php b/Admin/Installer.php index 8bcf0a3..577580e 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -44,40 +44,6 @@ class Installer extends InstallerAbstract switch ($dbPool->get('core')->getType()) { case DatabaseType::MYSQL: - $dbPool->get('core')->con->prepare( - 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_unit` ( - `riskmngmt_unit_id` int(11) NOT NULL, - `riskmngmt_unit_unit` int(11) NOT NULL, - `riskmngmt_unit_responsible` int(11) NOT NULL, - PRIMARY KEY (`riskmngmt_unit_id`), - KEY `riskmngmt_unit_unit` (`riskmngmt_unit_unit`), - KEY `riskmngmt_unit_responsible` (`riskmngmt_unit_responsible`) - )ENGINE=InnoDB DEFAULT CHARSET=utf8;' - )->execute(); - - $dbPool->get('core')->con->prepare( - 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_unit` - ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_unit_ibfk_1` FOREIGN KEY (`riskmngmt_unit_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_unit` (`organization_unit_id`), - ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_unit_ibfk_2` FOREIGN KEY (`riskmngmt_unit_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' - )->execute(); - - $dbPool->get('core')->con->prepare( - 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_department` ( - `riskmngmt_department_id` int(11) NOT NULL, - `riskmngmt_department_parent` int(11) NOT NULL, - `riskmngmt_department_responsible` int(11) NOT NULL, - PRIMARY KEY (`riskmngmt_department_id`), - KEY `riskmngmt_department_parent` (`riskmngmt_department_parent`), - KEY `riskmngmt_department_responsible` (`riskmngmt_department_responsible`) - )ENGINE=InnoDB DEFAULT CHARSET=utf8;' - )->execute(); - - $dbPool->get('core')->con->prepare( - 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_department` - ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_department_ibfk_1` FOREIGN KEY (`riskmngmt_department_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_department` (`organization_department_id`), - ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_department_ibfk_2` FOREIGN KEY (`riskmngmt_department_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' - )->execute(); - $dbPool->get('core')->con->prepare( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_category` ( `riskmngmt_category_id` int(11) NOT NULL, @@ -96,32 +62,10 @@ class Installer extends InstallerAbstract ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_category_ibfk_2` FOREIGN KEY (`riskmngmt_category_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' )->execute(); - // TODO: more (media, start, end etc...) - $dbPool->get('core')->con->prepare( - 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_project` ( - `riskmngmt_project_id` int(11) NOT NULL, - `riskmngmt_project_name` varchar(50) NOT NULL, - `riskmngmt_project_description` text NOT NULL, - `riskmngmt_project_unit` int(11) NOT NULL, - `riskmngmt_project_responsible` int(11) NOT NULL, - PRIMARY KEY (`riskmngmt_project_id`), - KEY `riskmngmt_project_unit` (`riskmngmt_project_unit`), - KEY `riskmngmt_project_responsible` (`riskmngmt_project_responsible`) - )ENGINE=InnoDB DEFAULT CHARSET=utf8;' - )->execute(); - - $dbPool->get('core')->con->prepare( - 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_project` - ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_project_ibfk_1` FOREIGN KEY (`riskmngmt_project_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'organization_unit` (`organization_unit_id`), - ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_project_ibfk_2` FOREIGN KEY (`riskmngmt_project_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' - )->execute(); - // TODO: more (media, start, end etc...) $dbPool->get('core')->con->prepare( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_process` ( `riskmngmt_process_id` int(11) NOT NULL, - `riskmngmt_process_name` varchar(50) NOT NULL, - `riskmngmt_process_description` text NOT NULL, `riskmngmt_process_unit` int(11) NOT NULL, `riskmngmt_process_responsible` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_process_id`), @@ -139,15 +83,15 @@ class Installer extends InstallerAbstract $dbPool->get('core')->con->prepare( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` ( `riskmngmt_risk_id` int(11) NOT NULL, - `riskmngmt_risk_name` varchar(50) NOT NULL, + `riskmngmt_risk_name` varchar(255) NOT NULL, `riskmngmt_risk_description` text NOT NULL, `riskmngmt_risk_unit` int(11) NOT NULL, - `riskmngmt_risk_deptartment` int(11) NOT NULL, - `riskmngmt_risk_category` int(11) NOT NULL, - `riskmngmt_risk_project` int(11) NOT NULL, - `riskmngmt_risk_process` int(11) NOT NULL, - `riskmngmt_risk_responsible` int(11) NOT NULL, - `riskmngmt_risk_backup` int(11) NOT NULL, + `riskmngmt_risk_deptartment` int(11) DEFAULT NULL, + `riskmngmt_risk_category` int(11) DEFAULT NULL, + `riskmngmt_risk_project` int(11) DEFAULT NULL, + `riskmngmt_risk_process` int(11) DEFAULT NULL, + `riskmngmt_risk_responsible` int(11) DEFAULT NULL, + `riskmngmt_risk_deputy` int(11) DEFAULT NULL, PRIMARY KEY (`riskmngmt_risk_id`), KEY `riskmngmt_risk_unit` (`riskmngmt_risk_unit`), KEY `riskmngmt_risk_responsible` (`riskmngmt_risk_responsible`) @@ -160,6 +104,27 @@ class Installer extends InstallerAbstract ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_ibfk_2` FOREIGN KEY (`riskmngmt_risk_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' )->execute(); + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_eval` ( + `riskmngmt_risk_eval_id` 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_score` int(11) NOT NULL, + `riskmngmt_risk_eval_net_probability` int(11) NOT NULL, + `riskmngmt_risk_eval_net_risk` int(11) NOT NULL, + `riskmngmt_risk_eval_net_score` int(11) NOT NULL, + `riskmngmt_risk_eval_risk` int(11) NOT NULL, + `riskmngmt_risk_eval_date` datetime NOT NULL, + PRIMARY KEY (`riskmngmt_risk_eval_id`), + KEY `riskmngmt_risk_eval_risk` (`riskmngmt_risk_eval_risk`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_eval` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_eval_ibfk_1` FOREIGN KEY (`riskmngmt_risk_eval_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`);' + )->execute(); + $dbPool->get('core')->con->prepare( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object` ( `riskmngmt_risk_object_id` int(11) NOT NULL, @@ -176,18 +141,19 @@ class Installer extends InstallerAbstract )->execute(); $dbPool->get('core')->con->prepare( - 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_eval` ( - `riskmngmt_risk_eval_id` int(11) NOT NULL, - `riskmngmt_risk_eval_val` decimal(11,4) NOT NULL, - `riskmngmt_risk_eval_object` int(11) NOT NULL, - PRIMARY KEY (`riskmngmt_risk_eval_id`), - KEY `riskmngmt_risk_eval_object` (`riskmngmt_risk_eval_object`) + '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_val` decimal(11,4) NOT NULL, + `riskmngmt_risk_object_eval_object` int(11) NOT NULL, + `riskmngmt_risk_object_eval_date` datetime NOT NULL, + PRIMARY KEY (`riskmngmt_risk_object_eval_id`), + KEY `riskmngmt_risk_object_eval_object` (`riskmngmt_risk_object_eval_object`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;' )->execute(); $dbPool->get('core')->con->prepare( - 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_eval` - ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_evaluation_ibfk_1` FOREIGN KEY (`riskmngmt_risk_eval_object`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object` (`riskmngmt_risk_object_id`);' + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object_eval` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object_eval_ibfk_1` FOREIGN KEY (`riskmngmt_risk_object_eval_object`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object` (`riskmngmt_risk_object_id`);' )->execute(); $dbPool->get('core')->con->prepare( diff --git a/Models/Risk.php b/Models/Risk.php index e69de29..25d25ee 100644 --- a/Models/Risk.php +++ b/Models/Risk.php @@ -0,0 +1,211 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +declare(strict_types=1); +namespace Modules\RiskManagement\Models; + +/** + * Risk Management class. + * + * @category Modules + * @package Modules\RiskManagement + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Risk +{ + private $id = 0; + + private $name = ''; + + private $description = ''; + + private $unit = 0; + + private $department = 0; + + private $category = 0; + + private $project = 0; + + private $process = 0; + + private $responseible = 0; + + private $deputy = 0; + + private $histScore = []; + + private $causes = []; + + private $solutions = []; + + private $riskObjects = []; + + private $media = []; + + public function __construct() + { + + } + + public function getId() : int + { + return $this->id; + } + + public function addCause($cause) /* : void */ + { + $this->causes[] = $cause; + } + + public function getCauses() : array + { + return $this->causes; + } + + public function addSolution($solution) /* : solution */ + { + $this->solutions[] = $solution; + } + + public function getSolutions() : array + { + return $this->solutions; + } + + public function getMedia() : array + { + return $this->media; + } + + public function addMedia($media) /* : void */ + { + $this->media[] = $media; + } + + public function addRiskObject($object) /* : void */ + { + $this->riskObjects[] = $object; + } + + public function getRiskObjects() : array + { + return $this->riskObjects; + } + + public function addHistory($history) /* : void */ + { + $this->histScore[] = $history; + } + + public function getHistory() : array + { + return $this->histScore; + } + + public function getName() : string + { + return $this->name; + } + + public function setName(string $name) /* : void */ + { + $this->name = $name; + } + + public function getDescription() : string + { + return $this->description; + } + + public function setDescription(string $description) /* : void */ + { + $this->description = $description; + } + + public function getUnit() + { + return $this->unit; + } + + public function setUnit($unit) /* : void */ + { + $this->unit = $unit; + } + + public function getDepartment() + { + return $this->department; + } + + public function setDepartment($department) /* : void */ + { + $this->department = $department; + } + + public function getcategory() + { + return $this->category; + } + + public function setCategory($category) /* : void */ + { + $this->category = $category; + } + + public function getProject() + { + return $this->project; + } + + public function setProject($project) /* : void */ + { + $this->project = $project; + } + + public function getProcess() + { + return $this->process; + } + + public function setProcess($process) /* : void */ + { + $this->process = $process; + } + + public function getResponsible() + { + return $this->responsible; + } + + public function setResponsible() /* : void */ + { + $this->responsible = $responseible; + } + + public function getDeputy() + { + return $this->deputy; + } + + public function setDeputy($deputy) /* : void */ + { + $this->deputy = $deputy; + } +} \ No newline at end of file diff --git a/Models/Department.php b/Models/RiskObject.php similarity index 100% rename from Models/Department.php rename to Models/RiskObject.php diff --git a/Models/Process.php b/Models/RiskObjectScore.php similarity index 100% rename from Models/Process.php rename to Models/RiskObjectScore.php diff --git a/Models/Project.php b/Models/RiskScore.php similarity index 100% rename from Models/Project.php rename to Models/RiskScore.php diff --git a/Models/Section.php b/Models/Section.php deleted file mode 100644 index e69de29..0000000 diff --git a/Models/Watchlist.php b/Models/Watchlist.php deleted file mode 100644 index e69de29..0000000