From c508cc22602cfd3dc5643563972f26ec7e5571ab Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 6 May 2023 11:42:06 +0000 Subject: [PATCH] make id public, organigram impl. media password/encryption, settings bug fix, Money->FloatInt change, ... --- .../Install/Application/Shop/Application.php | 4 ++- Admin/Settings/Theme/Backend/settings.tpl.php | 4 +-- Controller/ApiController.php | 4 +-- Controller/BackendController.php | 4 +-- Models/SupportApp.php | 2 +- Models/Ticket.php | 2 +- Models/TicketAttribute.php | 2 +- Models/TicketAttributeType.php | 2 +- Models/TicketAttributeValue.php | 2 +- Models/TicketElement.php | 2 +- Theme/Backend/support-list.tpl.php | 6 ++-- Theme/Backend/support-ticket.tpl.php | 32 +++++++++---------- Views/TicketView.php | 2 +- .../Api/ApiControllerAttributeTrait.php | 14 ++++---- .../Api/ApiControllerTicketTrait.php | 10 +++--- tests/Models/NullSupportAppTest.php | 2 +- tests/Models/NullTicketAttributeTest.php | 2 +- tests/Models/NullTicketAttributeTypeTest.php | 2 +- tests/Models/NullTicketAttributeValueTest.php | 2 +- tests/Models/NullTicketElementTest.php | 2 +- tests/Models/NullTicketTest.php | 2 +- tests/Models/SupportAppTest.php | 2 +- tests/Models/TicketAttributeTest.php | 2 +- tests/Models/TicketAttributeTypeTest.php | 2 +- tests/Models/TicketAttributeValueTest.php | 2 +- tests/Models/TicketElementTest.php | 2 +- tests/Models/TicketTest.php | 2 +- tests/Views/TicketViewTest.php | 2 +- 28 files changed, 59 insertions(+), 59 deletions(-) diff --git a/Admin/Install/Application/Shop/Application.php b/Admin/Install/Application/Shop/Application.php index 7051a18..8252002 100755 --- a/Admin/Install/Application/Shop/Application.php +++ b/Admin/Install/Application/Shop/Application.php @@ -151,7 +151,7 @@ final class Application $account = $this->loadAccount($request); - if (!($account instanceof NullAccount)) { + if ($account->id > 0) { $response->header->l11n = $account->l11n; } elseif ($this->app->sessionManager->get('language') !== null && $response->header->l11n->getLanguage() !== $this->app->sessionManager->get('language') @@ -161,6 +161,8 @@ final class Application $this->app->sessionManager->get('language'), $this->app->sessionManager->get('country') ?? '*' ); + } else { + $this->app->setResponseLanguage($request, $response, $this->config); } if (!\in_array($response->getLanguage(), $this->config['language'])) { diff --git a/Admin/Settings/Theme/Backend/settings.tpl.php b/Admin/Settings/Theme/Backend/settings.tpl.php index 43e881a..edb2395 100755 --- a/Admin/Settings/Theme/Backend/settings.tpl.php +++ b/Admin/Settings/Theme/Backend/settings.tpl.php @@ -118,7 +118,7 @@ echo $this->getData('nav')->render(); ?> ?> - getId(); ?> + id; ?> printHtml($application->name); ?> @@ -197,7 +197,7 @@ echo $this->getData('nav')->render(); ?> ?> - getId(); ?> + id; ?> printHtml($setting->name); ?> printHtml($setting->content); ?> printHtml($setting->group); ?> diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 927f85e..7fea279 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -265,7 +265,7 @@ final class ApiController extends Controller $ticketElement = new TicketElement($taskElement); $ticketElement->time = $request->getDataInt('time') ?? 0; - $ticketElement->ticket = $ticket->getId(); + $ticketElement->ticket = $ticket->id; return $ticketElement; } @@ -642,7 +642,7 @@ final class ApiController extends Controller $this->createModelRelation( $request->header->account, (int) $request->getData('type'), - $attrValue->getId(), + $attrValue->id, TicketAttributeTypeMapper::class, 'defaults', '', $request->getOrigin() ); } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 337f622..2f3b0f1 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -252,9 +252,7 @@ final class BackendController extends Controller $id = $request->getDataString('id') ?? ''; $settings = SettingMapper::getAll()->where('module', $id)->execute(); - if (!($settings instanceof NullSetting)) { - $view->setData('settings', !\is_array($settings) ? [$settings] : $settings); - } + $view->setData('settings', $settings); /** @var \Modules\Support\Models\SupportApp[] $applications */ $applications = SupportAppMapper::getAll()->execute(); diff --git a/Models/SupportApp.php b/Models/SupportApp.php index 3de2510..f71109d 100755 --- a/Models/SupportApp.php +++ b/Models/SupportApp.php @@ -30,7 +30,7 @@ class SupportApp implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Application name. diff --git a/Models/Ticket.php b/Models/Ticket.php index 17029d3..78d16d8 100755 --- a/Models/Ticket.php +++ b/Models/Ticket.php @@ -34,7 +34,7 @@ class Ticket * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * The ticket is using a task. diff --git a/Models/TicketAttribute.php b/Models/TicketAttribute.php index 3781c0d..c7e806f 100755 --- a/Models/TicketAttribute.php +++ b/Models/TicketAttribute.php @@ -30,7 +30,7 @@ class TicketAttribute implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Ticket this attribute belongs to diff --git a/Models/TicketAttributeType.php b/Models/TicketAttributeType.php index 3707ecf..a2b2da9 100755 --- a/Models/TicketAttributeType.php +++ b/Models/TicketAttributeType.php @@ -33,7 +33,7 @@ class TicketAttributeType implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Name/string identifier by which it can be found/categorized diff --git a/Models/TicketAttributeValue.php b/Models/TicketAttributeValue.php index f45b4cd..5f77b78 100755 --- a/Models/TicketAttributeValue.php +++ b/Models/TicketAttributeValue.php @@ -36,7 +36,7 @@ class TicketAttributeValue implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Depending attribute type diff --git a/Models/TicketElement.php b/Models/TicketElement.php index 0429e01..653100b 100755 --- a/Models/TicketElement.php +++ b/Models/TicketElement.php @@ -32,7 +32,7 @@ class TicketElement implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Ticket element time diff --git a/Theme/Backend/support-list.tpl.php b/Theme/Backend/support-list.tpl.php index 5ece8b4..b604e2b 100755 --- a/Theme/Backend/support-list.tpl.php +++ b/Theme/Backend/support-list.tpl.php @@ -40,7 +40,7 @@ echo $this->getData('nav')->render(); ?> $ticket) : ++$c; - $url = UriFactory::build('{/base}/support/ticket?{?}&id=' . $ticket->getId()); + $url = UriFactory::build('{/base}/support/ticket?{?}&id=' . $ticket->id); ?> @@ -49,9 +49,9 @@ echo $this->getData('nav')->render(); ?> getHtml('P' . $ticket->task->getPriority(), 'Tasks'); ?> printHtml($ticket->task->title); ?> - printHtml($ticket->task->createdBy->name1); ?> printHtml($ticket->task->createdBy->name2); ?> + printHtml($ticket->task->createdBy->name1); ?> printHtml($ticket->task->createdBy->name2); ?> printHtml($ticket->task->createdBy->name1); ?> printHtml($ticket->task->createdBy->name2); ?> - printHtml($ticket->for->name1); ?> printHtml($ticket->for->name2); ?> + printHtml($ticket->for->name1); ?> printHtml($ticket->for->name2); ?> printHtml($ticket->task->createdAt->format('Y-m-d H:i')); ?> getHtml('Empty', '0', '0'); ?> diff --git a/Theme/Backend/support-ticket.tpl.php b/Theme/Backend/support-ticket.tpl.php index 00ef72b..9df96ec 100755 --- a/Theme/Backend/support-ticket.tpl.php +++ b/Theme/Backend/support-ticket.tpl.php @@ -61,7 +61,7 @@ echo $this->getData('nav')->render(); ?>
- <?= $this->getHtml('User', '0', '0'); ?> + <?= $this->getHtml('User', '0', '0'); ?> printHtml($task->createdBy->name1); ?> - printHtml($task->createdAt->format('Y/m/d H:i')); ?> @@ -88,7 +88,7 @@ echo $this->getData('nav')->render(); ?>
- name; ?> + name; ?>
@@ -106,7 +106,7 @@ echo $this->getData('nav')->render(); ?>
- isEditable && $this->request->header->account === $task->createdBy->getId()) : ?> + isEditable && $this->request->header->account === $task->createdBy->id) : ?>
@@ -180,7 +180,7 @@ echo $this->getData('nav')->render(); ?>
getHtml('status_change', 'Tasks', 'Backend'), - '' . $this->printHtml($element->taskElement->createdBy->name1) . '', + '' . $this->printHtml($element->taskElement->createdBy->name1) . '', $element->taskElement->createdAt->format('Y-m-d H:i') ); ?> @@ -196,7 +196,7 @@ echo $this->getData('nav')->render(); ?>
getHtml('priority_change', 'Tasks', 'Backend'), - '' . $this->printHtml($element->taskElement->createdBy->name1) . '', + '' . $this->printHtml($element->taskElement->createdBy->name1) . '', $element->taskElement->createdAt->format('Y-m-d H:i') ); ?> @@ -207,18 +207,18 @@ echo $this->getData('nav')->render(); ?> taskElement->description !== '') : ?> -
+ data-id="taskElement->id; ?>" + data-uri="taskElement->id .'&csrf={$CSRF}'); ?>">
- <?= $this->getHtml('User', '0', '0'); ?> + <?= $this->getHtml('User', '0', '0'); ?> printHtml($element->taskElement->createdBy->name1); ?> - printHtml($element->taskElement->createdAt->format('Y-m-d H:i')); ?> @@ -239,13 +239,13 @@ echo $this->getData('nav')->render(); ?> taskElement->getMedia(); if (!empty($elementMedia) || ($task->isEditable - && $this->request->header->account === $element->taskElement->createdBy->getId()) + && $this->request->header->account === $element->taskElement->createdBy->id) ) : ?>
@@ -270,10 +270,10 @@ echo $this->getData('nav')->render(); ?> isEditable - && $this->request->header->account === $element->taskElement->createdBy->getId() + && $this->request->header->account === $element->taskElement->createdBy->id ) : ?>
- + @@ -287,14 +287,14 @@ echo $this->getData('nav')->render(); ?> taskElement->getTo(); if (\count($tos) > 1 - || (!empty($tos) && $tos[0]->getRelation()->getId() !== $element->taskElement->createdBy->getId()) + || (!empty($tos) && $tos[0]->getRelation()->id !== $element->taskElement->createdBy->id) ) : ?>
- printHtml($element->taskElement->createdBy->name1); ?> getHtml('forwarded_to'); ?> + printHtml($element->taskElement->createdBy->name1); ?> getHtml('forwarded_to'); ?> - printHtml($to->getRelation()->name1); ?> + printHtml($to->getRelation()->name1); ?> printHtml($to->getRelation()->name); ?> diff --git a/Views/TicketView.php b/Views/TicketView.php index fc68d1a..0ef113a 100755 --- a/Views/TicketView.php +++ b/Views/TicketView.php @@ -70,7 +70,7 @@ class TicketView extends View /** @var \Modules\Profile\Models\Profile $profile */ $profile = ProfileMapper::get()->with('image')->where('account', $account)->execute(); - if (($profile instanceof NullProfile) || $profile->image->getPath() === '') { + if ($profile->id === 0 || $profile->image->getPath() === '') { return UriFactory::build('{/base}/' . $this->defaultProfileImage->getPath()); } diff --git a/tests/Controller/Api/ApiControllerAttributeTrait.php b/tests/Controller/Api/ApiControllerAttributeTrait.php index 30d0e46..c535675 100755 --- a/tests/Controller/Api/ApiControllerAttributeTrait.php +++ b/tests/Controller/Api/ApiControllerAttributeTrait.php @@ -38,7 +38,7 @@ trait ApiControllerAttributeTrait $request->setData('language', ISO639x1Enum::_EN); $this->module->apiTicketAttributeTypeCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -56,7 +56,7 @@ trait ApiControllerAttributeTrait $request->setData('language', ISO639x1Enum::_DE); $this->module->apiTicketAttributeTypeL11nCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -76,7 +76,7 @@ trait ApiControllerAttributeTrait $request->setData('country', ISO3166TwoEnum::_DEU); $this->module->apiTicketAttributeValueCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -95,7 +95,7 @@ trait ApiControllerAttributeTrait $request->setData('country', ISO3166TwoEnum::_DEU); $this->module->apiTicketAttributeValueCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -114,7 +114,7 @@ trait ApiControllerAttributeTrait $request->setData('country', ISO3166TwoEnum::_DEU); $this->module->apiTicketAttributeValueCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -133,7 +133,7 @@ trait ApiControllerAttributeTrait $request->setData('country', ISO3166TwoEnum::_DEU); $this->module->apiTicketAttributeValueCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -151,7 +151,7 @@ trait ApiControllerAttributeTrait $request->setData('type', '1'); $this->module->apiTicketAttributeCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** diff --git a/tests/Controller/Api/ApiControllerTicketTrait.php b/tests/Controller/Api/ApiControllerTicketTrait.php index 25a089c..d67c25d 100755 --- a/tests/Controller/Api/ApiControllerTicketTrait.php +++ b/tests/Controller/Api/ApiControllerTicketTrait.php @@ -35,7 +35,7 @@ trait ApiControllerTicketTrait $request->setData('name', 'TestSupportApp'); $this->module->apiSupportAppCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -70,7 +70,7 @@ trait ApiControllerTicketTrait $request->setData('for', '1'); $this->module->apiTicketCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -86,7 +86,7 @@ trait ApiControllerTicketTrait $request->setData('id', '1'); $this->module->apiTicketGet($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -121,7 +121,7 @@ trait ApiControllerTicketTrait $request->setData('due', (new \DateTime('now'))->format('Y-m-d H:i:s')); $this->module->apiTicketElementCreate($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** @@ -137,7 +137,7 @@ trait ApiControllerTicketTrait $request->setData('id', '1'); $this->module->apiTicketElementGet($request, $response); - self::assertGreaterThan(0, $response->get('')['response']->getId()); + self::assertGreaterThan(0, $response->get('')['response']->id); } /** diff --git a/tests/Models/NullSupportAppTest.php b/tests/Models/NullSupportAppTest.php index 35aadac..3c803ac 100755 --- a/tests/Models/NullSupportAppTest.php +++ b/tests/Models/NullSupportAppTest.php @@ -37,6 +37,6 @@ final class NullSupportAppTest extends \PHPUnit\Framework\TestCase public function testId() : void { $null = new NullSupportApp(2); - self::assertEquals(2, $null->getId()); + self::assertEquals(2, $null->id); } } diff --git a/tests/Models/NullTicketAttributeTest.php b/tests/Models/NullTicketAttributeTest.php index e8bf95a..709a34a 100755 --- a/tests/Models/NullTicketAttributeTest.php +++ b/tests/Models/NullTicketAttributeTest.php @@ -37,6 +37,6 @@ final class NullTicketAttributeTest extends \PHPUnit\Framework\TestCase public function testId() : void { $null = new NullTicketAttribute(2); - self::assertEquals(2, $null->getId()); + self::assertEquals(2, $null->id); } } diff --git a/tests/Models/NullTicketAttributeTypeTest.php b/tests/Models/NullTicketAttributeTypeTest.php index 1e466cd..5f30991 100755 --- a/tests/Models/NullTicketAttributeTypeTest.php +++ b/tests/Models/NullTicketAttributeTypeTest.php @@ -37,6 +37,6 @@ final class NullTicketAttributeTypeTest extends \PHPUnit\Framework\TestCase public function testId() : void { $null = new NullTicketAttributeType(2); - self::assertEquals(2, $null->getId()); + self::assertEquals(2, $null->id); } } diff --git a/tests/Models/NullTicketAttributeValueTest.php b/tests/Models/NullTicketAttributeValueTest.php index e363591..61f977c 100755 --- a/tests/Models/NullTicketAttributeValueTest.php +++ b/tests/Models/NullTicketAttributeValueTest.php @@ -37,6 +37,6 @@ final class NullTicketAttributeValueTest extends \PHPUnit\Framework\TestCase public function testId() : void { $null = new NullTicketAttributeValue(2); - self::assertEquals(2, $null->getId()); + self::assertEquals(2, $null->id); } } diff --git a/tests/Models/NullTicketElementTest.php b/tests/Models/NullTicketElementTest.php index f11ba57..7f8a6cd 100755 --- a/tests/Models/NullTicketElementTest.php +++ b/tests/Models/NullTicketElementTest.php @@ -37,6 +37,6 @@ final class NullTicketElementTest extends \PHPUnit\Framework\TestCase public function testId() : void { $null = new NullTicketElement(2); - self::assertEquals(2, $null->getId()); + self::assertEquals(2, $null->id); } } diff --git a/tests/Models/NullTicketTest.php b/tests/Models/NullTicketTest.php index 0d3821b..5114756 100755 --- a/tests/Models/NullTicketTest.php +++ b/tests/Models/NullTicketTest.php @@ -37,6 +37,6 @@ final class NullTicketTest extends \PHPUnit\Framework\TestCase public function testId() : void { $null = new NullTicket(2); - self::assertEquals(2, $null->getId()); + self::assertEquals(2, $null->id); } } diff --git a/tests/Models/SupportAppTest.php b/tests/Models/SupportAppTest.php index 8a16305..f150c66 100755 --- a/tests/Models/SupportAppTest.php +++ b/tests/Models/SupportAppTest.php @@ -37,7 +37,7 @@ final class SupportAppTest extends \PHPUnit\Framework\TestCase */ public function testDefault() : void { - self::assertEquals(0, $this->app->getId()); + self::assertEquals(0, $this->app->id); self::assertEquals('', $this->app->name); } diff --git a/tests/Models/TicketAttributeTest.php b/tests/Models/TicketAttributeTest.php index 8c84505..1833ce8 100755 --- a/tests/Models/TicketAttributeTest.php +++ b/tests/Models/TicketAttributeTest.php @@ -37,7 +37,7 @@ final class TicketAttributeTest extends \PHPUnit\Framework\TestCase */ public function testDefault() : void { - self::assertEquals(0, $this->attribute->getId()); + self::assertEquals(0, $this->attribute->id); self::assertInstanceOf('\Modules\Support\Models\TicketAttributeType', $this->attribute->type); self::assertInstanceOf('\Modules\Support\Models\TicketAttributeValue', $this->attribute->value); } diff --git a/tests/Models/TicketAttributeTypeTest.php b/tests/Models/TicketAttributeTypeTest.php index a49a4e6..3d61c03 100755 --- a/tests/Models/TicketAttributeTypeTest.php +++ b/tests/Models/TicketAttributeTypeTest.php @@ -37,7 +37,7 @@ final class TicketAttributeTypeTest extends \PHPUnit\Framework\TestCase */ public function testDefault() : void { - self::assertEquals(0, $this->type->getId()); + self::assertEquals(0, $this->type->id); self::assertEquals('', $this->type->getL11n()); } diff --git a/tests/Models/TicketAttributeValueTest.php b/tests/Models/TicketAttributeValueTest.php index 883e6cc..93b7265 100755 --- a/tests/Models/TicketAttributeValueTest.php +++ b/tests/Models/TicketAttributeValueTest.php @@ -38,7 +38,7 @@ final class TicketAttributeValueTest extends \PHPUnit\Framework\TestCase */ public function testDefault() : void { - self::assertEquals(0, $this->value->getId()); + self::assertEquals(0, $this->value->id); self::assertNull($this->value->getValue()); self::assertFalse($this->value->isDefault); } diff --git a/tests/Models/TicketElementTest.php b/tests/Models/TicketElementTest.php index e843b40..7c2f3fa 100755 --- a/tests/Models/TicketElementTest.php +++ b/tests/Models/TicketElementTest.php @@ -37,7 +37,7 @@ final class TicketElementTest extends \PHPUnit\Framework\TestCase */ public function testDefault() : void { - self::assertEquals(0, $this->element->getId()); + self::assertEquals(0, $this->element->id); self::assertEquals(0, $this->element->time); self::assertEquals(0, $this->element->ticket); } diff --git a/tests/Models/TicketTest.php b/tests/Models/TicketTest.php index 1d55f92..d809972 100755 --- a/tests/Models/TicketTest.php +++ b/tests/Models/TicketTest.php @@ -39,7 +39,7 @@ final class TicketTest extends \PHPUnit\Framework\TestCase */ public function testDefault() : void { - self::assertEquals(0, $this->ticket->getId()); + self::assertEquals(0, $this->ticket->id); self::assertNull($this->ticket->for); self::assertEquals([], $this->ticket->getTicketElements()); self::assertEquals([], $this->ticket->getAttributes()); diff --git a/tests/Views/TicketViewTest.php b/tests/Views/TicketViewTest.php index 6c2bf46..0ef87b3 100755 --- a/tests/Views/TicketViewTest.php +++ b/tests/Views/TicketViewTest.php @@ -40,6 +40,6 @@ class TicketViewTest extends \PHPUnit\Framework\TestCase { $view = new TicketView(); - self::assertEquals('Web/Backend/img/default-user.jpg', $view->getAccountImage(1)); + self::assertEquals('/Web/Backend/img/default-user.jpg', $view->getAccountImage(1)); } }