Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/10.5' into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dvesh3 committed Dec 19, 2022
2 parents 520f220 + ed1eafe commit 44b23c3
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ pimcore.helpers.grid.buildDefaultPagingToolbar = function (store, options) {
store: store,
displayInfo: true,
displayMsg: '{0} - {1} / {2}',
emptyMsg: t("no_items_found")
emptyMsg: t("no_items_found"),
scrollable: true
};
if (typeof options !== "undefined") {
config = Ext.applyIf(options, config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Pimcore\Model\DataObject\ClassDefinition\Data\EncryptedField::setStrictMode(fals

A slug is the part of a URL which identifies a particular page on a website in an easy
to read form. In other words, it’s the part of the URL that explains the page’s content.
For example, if the URL is `https://demo.pimcore.fun/slug`, and the slug simply is `/slug`.
For example, if the URL is `https://demo.pimcore.fun/slug`, then the slug simply is `/slug`.

![URL Slug](../../../img/classes-datatypes-urlslug.png)

Expand Down
2 changes: 0 additions & 2 deletions lib/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ public function trans(string $id, array $parameters = [], string $domain = null,
$domain = Translation::DOMAIN_DEFAULT;
}

$id = (string) $id;

if ($domain === Translation::DOMAIN_ADMIN && !empty($this->adminTranslationMapping)) {
if (null === $locale) {
$locale = $this->getLocale();
Expand Down
2 changes: 1 addition & 1 deletion models/DataObject/ClassDefinition/Data/QuantityValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ public function getVersionPreview($data, $object = null, $params = [])
}
}

return htmlspecialchars($data->getValue() . $unit, ENT_QUOTES, 'UTF-8');
return htmlspecialchars((string)$data->getValue() . $unit, ENT_QUOTES, 'UTF-8');
}

return '';
Expand Down
2 changes: 1 addition & 1 deletion models/DataObject/ClassDefinition/Data/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public function getDataFromEditmode($data, $object = null, $params = [])
*/
public function getVersionPreview($data, $object = null, $params = [])
{
return htmlspecialchars($data, ENT_QUOTES, 'UTF-8');
return htmlspecialchars((string)$data, ENT_QUOTES, 'UTF-8');
}

/**
Expand Down
5 changes: 4 additions & 1 deletion models/DataObject/ClassDefinition/Data/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ public function getDataForSearchIndex($object, $params = [])
public static function __set_state($data)
{
$obj = parent::__set_state($data);
$obj->configureOptions();

if (\Pimcore::inAdmin()) {
$obj->configureOptions();
}

return $obj;
}
Expand Down
3 changes: 3 additions & 0 deletions models/DataObject/Concrete.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,9 @@ public function save()
// the inheritance enabled flag has been changed in the meantime
if ($this->getClass()->getModificationDate() >= $this->getModificationDate() && $this->getId()) {
DataObject::disableDirtyDetection();
} elseif ($this->getClass()->getAllowInherit() && $this->isFieldDirty('parentId')) {
// if inherit is enabled and the data object is moved the query table should be updated
DataObject::disableDirtyDetection();
}

try {
Expand Down
89 changes: 89 additions & 0 deletions tests/Unit/Models/DataObject/ClassDefinition/Data/UserTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Tests\Unit\Model\DataObject\ClassDefinition\Data;

use function PHPUnit\Framework\assertEmpty;
use function PHPUnit\Framework\assertNotEmpty;
use Pimcore\Model\DataObject\ClassDefinition\Data\User;
use Pimcore\Tests\Test\TestCase;

class UserTest extends TestCase
{
private const SAMPLE_USER_DATA = [
'name' => 'pimcoreUser',
'title' => 'Pimcore User',
'tooltip' => '',
'mandatory' => false,
'noteditable' => false,
'index' => false,
'locked' => false,
'style' => '',
'permissions' => null,
'datatype' => 'data',
'fieldtype' => 'user',
'relationType' => false,
'invisible' => false,
'visibleGridView' => false,
'visibleSearch' => false,
'blockedVarsForExport' => [],
'options' => null,
'width' => '',
'defaultValue' => null,
'optionsProviderClass' => null,
'optionsProviderData' => null,
'columnLength' => 190,
'dynamicOptions' => false,
'defaultValueGenerator' => '',
'unique' => false,
];

private bool $inAdmin;

protected function setUp(): void
{
parent::setUp();
$this->inAdmin = \Pimcore::inAdmin();
}

protected function tearDown(): void
{
if ($this->inAdmin) {
\Pimcore::setAdminMode();
} else {
\Pimcore::unsetAdminMode();
}

parent::tearDown();
}

public function test__set_stateDoesNotPopulateSelectOptionsWhenNotInAdminMode()
{
\Pimcore::unsetAdminMode();

$user = User::__set_state(self::SAMPLE_USER_DATA);

assertEmpty($user->getOptions());
}

public function test__set_statePopulatesSelectOptionsIbAdminMode()
{
\Pimcore::setAdminMode();

$user = User::__set_state(self::SAMPLE_USER_DATA);

assertNotEmpty($user->getOptions());
}
}

0 comments on commit 44b23c3

Please sign in to comment.