From 632b719fa1880a7bd3877584d9deec1473568833 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 5 Mar 2021 21:01:37 +0100 Subject: [PATCH] fix php version, lang files, basic tpl and sales impl. --- Admin/Hooks/Web/Api.php | 20 ++++++++++++++++---- Controller/ApiController.php | 6 +++--- Theme/Backend/Lang/de.lang.php | 1 + Theme/Backend/Lang/en.lang.php | 13 +++++++------ tests/Controller/ApiControllerTest.php | 8 ++++---- 5 files changed, 31 insertions(+), 17 deletions(-) mode change 100755 => 100644 Theme/Backend/Lang/de.lang.php mode change 100755 => 100644 Theme/Backend/Lang/en.lang.php diff --git a/Admin/Hooks/Web/Api.php b/Admin/Hooks/Web/Api.php index 6e403a2..e00137f 100755 --- a/Admin/Hooks/Web/Api.php +++ b/Admin/Hooks/Web/Api.php @@ -1,13 +1,25 @@ - [ - 'callback' => ['\Modules\Auditor\Controller\ApiController:apiLogCreate'], + 'callback' => ['\Modules\Auditor\Controller\ApiController:eventLogCreate'], ], '/POST:Module:.*?\-update/' => [ - 'callback' => ['\Modules\Auditor\Controller\ApiController:apiLogUpdate'], + 'callback' => ['\Modules\Auditor\Controller\ApiController:eventLogUpdate'], ], '/POST:Module:.*?\-delete/' => [ - 'callback' => ['\Modules\Auditor\Controller\ApiController:apiLogDelete'], + 'callback' => ['\Modules\Auditor\Controller\ApiController:eventLogDelete'], ], ]; diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 44ec491..fdaaff4 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -48,7 +48,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiLogCreate( + public function eventLogCreate( int $account, mixed $old, mixed $new, @@ -85,7 +85,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiLogUpdate( + public function eventLogUpdate( int $account, mixed $old, mixed $new, @@ -128,7 +128,7 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiLogDelete( + public function eventLogDelete( int $account, mixed $old, mixed $new, diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php old mode 100755 new mode 100644 index a33a399..2074c88 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -4,6 +4,7 @@ * * PHP Version 8.0 * + * @package Modules\Localization * @copyright Dennis Eichhorn * @license OMS License 1.0 * @version 1.0.0 diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php old mode 100755 new mode 100644 index 7cdecc8..b6c51dc --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -4,6 +4,7 @@ * * PHP Version 8.0 * + * @package Modules\Localization * @copyright Dennis Eichhorn * @license OMS License 1.0 * @version 1.0.0 @@ -12,14 +13,14 @@ declare(strict_types=1); return ['Auditor' => [ - 'Action' => '', + 'Action' => 'Action', 'Audit' => 'Audit', 'Auditor' => 'Auditor', 'Audits' => 'Audits', 'By' => 'By', - 'CREATE' => '', + 'CREATE' => 'Create', 'Content' => 'Content', - 'DELETE' => '', + 'DELETE' => 'Delete', 'Date' => 'Date', 'Email' => 'Email', 'Module' => 'Module', @@ -28,8 +29,8 @@ return ['Auditor' => [ 'Old' => 'Old', 'Ref' => 'Ref', 'Subtype' => 'Subtype', - 'Trigger' => '', + 'Trigger' => 'Trigger', 'Type' => 'Type', - 'UNKNOWN' => '', - 'UPDATE' => '', + 'UNKNOWN' => 'Unknown', + 'UPDATE' => 'Update', ]]; diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index b8d3188..2baba22 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -89,7 +89,7 @@ class ApiControllerTest extends \PHPUnit\Framework\TestCase */ public function testLogCreate() : void { - $this->module->apiLogCreate(1, null, ['id' => 1, 'test' => true], 1, 'test-trigger', 'Auditor', 'abc', 'def'); + $this->module->eventLogCreate(1, null, ['id' => 1, 'test' => true], 1, 'test-trigger', 'Auditor', 'abc', 'def'); $logs = AuditMapper::getAll(); foreach($logs as $log) { @@ -117,7 +117,7 @@ class ApiControllerTest extends \PHPUnit\Framework\TestCase */ public function testLogUpdate() : void { - $this->module->apiLogUpdate(1, ['id' => 2, 'test' => true], ['id' => 1, 'test' => true], 1, 'test-trigger', 'Auditor', 'abc', 'def'); + $this->module->eventLogUpdate(1, ['id' => 2, 'test' => true], ['id' => 1, 'test' => true], 1, 'test-trigger', 'Auditor', 'abc', 'def'); $logs = AuditMapper::getAll(); $found = false; @@ -146,7 +146,7 @@ class ApiControllerTest extends \PHPUnit\Framework\TestCase public function testLogUpdateWithoutChange() : void { $logs = AuditMapper::getAll(); - $this->module->apiLogUpdate(1, ['id' => 2, 'test' => true], ['id' => 2, 'test' => true], 1, 'test-trigger', 'Auditor', 'abc', 'def'); + $this->module->eventLogUpdate(1, ['id' => 2, 'test' => true], ['id' => 2, 'test' => true], 1, 'test-trigger', 'Auditor', 'abc', 'def'); $logs2 = AuditMapper::getAll(); self::assertGreaterThan(0, \count($logs)); @@ -160,7 +160,7 @@ class ApiControllerTest extends \PHPUnit\Framework\TestCase */ public function testLogDelete() : void { - $this->module->apiLogDelete(1, ['id' => 1, 'test' => true], null, 1, 'test-trigger', 'Auditor', 'abc', 'def'); + $this->module->eventLogDelete(1, ['id' => 1, 'test' => true], null, 1, 'test-trigger', 'Auditor', 'abc', 'def'); $logs = AuditMapper::getAll(); foreach($logs as $log) {