bug fixes

This commit is contained in:
Dennis Eichhorn 2021-06-05 11:01:03 +02:00
parent a0a7cc70be
commit da2000e54a
3 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,20 @@
[
{
"type": "collection",
"create_directory": true,
"name": "Auditor",
"virtualPath": "/Modules",
"user": 1
},
{
"type": "upload",
"create_collection": true,
"name": "Default",
"virtualPath": "/Modules/Auditor",
"path": "/Modules/Media/Files/Modules/Auditor",
"files": [
"/Modules/Auditor/Admin/Install/Media/defaultReport.pdf.php"
],
"user": 1
}
]

50
Admin/Install/Media.php Normal file
View File

@ -0,0 +1,50 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Auditor\Admin\Install
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\Auditor\Admin\Install;
use Model\Setting;
use Model\SettingMapper;
use phpOMS\DataStorage\Database\DatabasePool;
/**
* Media class.
*
* @package Modules\Auditor\Admin\Install
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class Media
{
/**
* Install media providing
*
* @param string $path Module path
* @param DatabasePool $dbPool Database pool for database interaction
*
* @return void
*
* @since 1.0.0
*/
public static function install(string $path, DatabasePool $dbPool) : void
{
$media = \Modules\Media\Admin\Installer::installExternal($dbPool, ['path' => __DIR__ . '/Media.install.json']);
$defaultTemplate = \reset($media['upload'][0]);
$setting = new Setting();
SettingMapper::create($setting->with(0, 'default_pdf_template', (string) $defaultTemplate->getId(), 'Auditor'));
}
}