Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.5' into 1.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
  • Loading branch information
mattamon committed Sep 2, 2024
2 parents 4dff99b + 28f6e32 commit 6000b11
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 36 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"cbschuld/browser.php": "^1.9.6",
"phpoffice/phpspreadsheet": "^1.24 || ^2.1",
"pimcore/pimcore": "^11.3.1",
"phpoffice/phpspreadsheet": "^1.24 || ^2.2",
"pimcore/pimcore": "11.3.1",
"symfony/webpack-encore-bundle": "^1.13.2"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion public/js/pimcore/object/folder/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ pimcore.object.search = Class.create(pimcore.object.helpers.gridTabAbstract, {
}

menu.add(new Ext.menu.Item({
hidden: data.data.locked,
hidden: data.data.locked || !data.data.permissions.delete,
text: t('delete'),
iconCls: "pimcore_icon_delete",
handler: function (data) {
Expand Down
5 changes: 5 additions & 0 deletions public/js/pimcore/object/tags/quantityValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ pimcore.object.tags.quantityValue = Class.create(pimcore.object.tags.abstract, {
});

var updateCompatibleUnitsToolTipContent = function() {
if(pimcore.globalmanager.get("user").isAllowed('quantityValueUnits') !== true) {
compatibleUnitsButton.hide();
return false;
}

if (this.inputField.value === '' || this.inputField.value === null || !this.unitField.value) {
compatibleUnitsButton.hide();
return false;
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/Admin/DataObject/DataObjectActionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ private function prepareObjectData(

$fieldGetter = 'get' . ucfirst($brickField);
$brickGetter = 'get' . ucfirst($brickType);
$valueSetter = 'set' . ucfirst($brickKey);

$brick = $object->$fieldGetter()->$brickGetter();
if (empty($brick)) {
Expand Down Expand Up @@ -257,7 +256,7 @@ private function prepareObjectData(
$localizedFields = $brick->getLocalizedfields();
$localizedFields->setLocalizedValue($brickKey, $value);
} else {
$brick->$valueSetter($value);
$brick->setObjectVar($brickKey, $value);
}
} else {
if ($languagePermissions) {
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Admin/DataObject/DataObjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ static function (Task $task) {

try {
$this->getDataForObject($object, $objectFromVersion);
} catch(\Throwable $e) {
} catch (\Throwable $e) {
$object = $objectFromDatabase;
$this->getDataForObject($object, false);
}
Expand Down Expand Up @@ -1352,7 +1352,7 @@ public function saveAction(Request $request): JsonResponse
if ($request->get('data')) {
try {
$this->applyChanges($object, $this->decodeJson($request->get('data')));
} catch(\Throwable $e) {
} catch (\Throwable $e) {
$this->applyChanges($objectFromDatabase, $this->decodeJson($request->get('data')));
}
}
Expand Down
47 changes: 26 additions & 21 deletions src/Controller/Admin/DataObject/DataObjectHelperController.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function doGetGridColumnConfig(Request $request, Config $config, bool $is
$setAsFavourite = $savedGridConfig->isSetAsFavourite();
$saveFilters = $savedGridConfig->isSaveFilters();

foreach($gridConfig['columns'] as &$column) {
foreach ($gridConfig['columns'] as &$column) {
if (array_key_exists('isOperator', $column) && $column['isOperator']) {
$colAttributes = &$column['fieldConfig']['attributes'];
SecurityHelper::convertHtmlSpecialCharsArrayKeys($colAttributes, ['label', 'attribute', 'param1']);
Expand Down Expand Up @@ -360,12 +360,9 @@ public function doGetGridColumnConfig(Request $request, Config $config, bool $is
'key' => $key,
'type' => 'system',
'label' => $key,
'locked' => $sc['locked'] ?? null,
'position' => $sc['position'],
];
if (isset($sc['width'])) {
$colConfig['width'] = $sc['width'];
}
$this->injectCustomLayoutValues($colConfig, $sc);
$availableFields[] = $colConfig;
} else {
$keyParts = explode('~', $key);
Expand All @@ -387,9 +384,7 @@ public function doGetGridColumnConfig(Request $request, Config $config, bool $is
if ($fieldConfig) {
$fieldConfig['key'] = $key;
$fieldConfig['label'] = '#' . $keyFieldDef->getTitle();
if (isset($sc['locked'])) {
$fieldConfig['locked'] = $sc['locked'];
}
$fieldConfig = $this->injectCustomLayoutValues($fieldConfig, $sc);
$availableFields[] = $fieldConfig;
}
}
Expand Down Expand Up @@ -427,12 +422,7 @@ public function doGetGridColumnConfig(Request $request, Config $config, bool $is
if ($fd !== null) {
$fieldConfig = $this->getFieldGridConfig($fd, $gridType, (string)$sc['position'], true, $keyPrefix, $class, $objectId);
if (!empty($fieldConfig)) {
if (isset($sc['width'])) {
$fieldConfig['width'] = $sc['width'];
}
if (isset($sc['locked'])) {
$fieldConfig['locked'] = $sc['locked'];
}
$fieldConfig = $this->injectCustomLayoutValues($fieldConfig, $sc);
$availableFields[] = $fieldConfig;
}
}
Expand All @@ -457,12 +447,7 @@ public function doGetGridColumnConfig(Request $request, Config $config, bool $is
if (!empty($fd)) {
$fieldConfig = $this->getFieldGridConfig($fd, $gridType, (string)$sc['position'], true, null, $class, $objectId);
if (!empty($fieldConfig)) {
if (isset($sc['width'])) {
$fieldConfig['width'] = $sc['width'];
}
if (isset($sc['locked'])) {
$fieldConfig['locked'] = $sc['locked'];
}
$fieldConfig = $this->injectCustomLayoutValues($fieldConfig, $sc);
$availableFields[] = $fieldConfig;
}
}
Expand Down Expand Up @@ -530,6 +515,26 @@ public function doGetGridColumnConfig(Request $request, Config $config, bool $is
];
}

private function injectCustomLayoutValues(array $fieldConfig, array $savedColumn): array
{
$keys = ['width', 'locked'];
foreach ($keys as $key) {
if (isset($savedColumn[$key])) {
$fieldConfig[$key] = $savedColumn[$key];
}
}

$fieldConfigKeys = ['noteditable'];
foreach ($fieldConfigKeys as $fieldConfigKey) {
if (isset($savedColumn['fieldConfig']['layout'][$fieldConfigKey])) {
$setter = 'set' . ucfirst($fieldConfigKey);
$fieldConfig['layout']->$setter($savedColumn['fieldConfig']['layout'][$fieldConfigKey]);
}
}

return $fieldConfig;
}

/**
* @param DataObject\ClassDefinition\Data[]|null $fields
*/
Expand Down Expand Up @@ -1179,7 +1184,7 @@ public function getExportJobsAction(Request $request, GridHelperService $gridHel
//prepare fields
$fieldnames = [];
$fields = json_decode($allParams['fields'][0], true);
foreach($fields as $field) {
foreach ($fields as $field) {
$fieldnames[] = $field['key'];
}
$allParams['fields'] = $fieldnames;
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Admin/ElementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ public function getRequiresDependenciesAction(Request $request): JsonResponse
'requires' => [], // Initialize 'requires' as an empty array
];

if(count($elements) > 0) {
if (count($elements) > 0) {
$result = Model\Element\Service::getFilterRequiresForFrontend($elements);
$result['total'] = count($result['requires']);

Expand Down Expand Up @@ -765,7 +765,7 @@ public function getRequiredByDependenciesAction(Request $request): JsonResponse
'requiredBy' => [], // Initialize 'requiredBy' as an empty array
];

if(count($elements) > 0) {
if (count($elements) > 0) {
$result = Model\Element\Service::getFilterRequiredByPathForFrontend($elements);
$result['total'] = count($result['requiredBy']);

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/MiscController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function jsonTranslationsSystemAction(Request $request, TranslatorInterfa
public function scriptProxyAction(Request $request): Response
{
$storageFile = $request->get('storageFile');
if(!$storageFile) {
if (!$storageFile) {
throw new \InvalidArgumentException('The parameter storageFile is required');
}

Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Admin/TranslationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,10 @@ protected function getGridFilterCondition(Request $request, string $tableName, b
];
}

if(!empty($conditionFilters)) {
if (!empty($conditionFilters)) {
$conditions = [];
$params = [];
foreach($conditionFilters as $conditionFilter) {
foreach ($conditionFilters as $conditionFilter) {
$conditions[] = $conditionFilter['condition'];
$params[$conditionFilter['field']] = $conditionFilter['value'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/GridHelperService.php
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ public function prepareListingForGrid(array $requestParams, string $requestedLan
if (isset($requestParams['filter_by_object_type'])) {
if ($requestParams['filter_by_object_type'] === 'only_objects') {
$list->setObjectTypes([DataObject::OBJECT_TYPE_OBJECT]);
} elseif($requestParams['filter_by_object_type'] === 'only_variant_objects') {
} elseif ($requestParams['filter_by_object_type'] === 'only_variant_objects') {
$list->setObjectTypes([DataObject::OBJECT_TYPE_VARIANT]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/PreviewGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected function getSitePreviewConfig(Concrete $object): array
$domains = $site->getDomains();
array_unshift($domains, $site->getMainDomain());

if(is_null($preSelectedSite) && in_array(Tool::getHostname(), $domains)) {
if (is_null($preSelectedSite) && in_array(Tool::getHostname(), $domains)) {
$preSelectedSite = $sitesOptions[$label];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/System/AdminConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static function get(): array

// If the read target is settings-store and no data is found there,
// load the data from the container config
if(!$data && $loadType === $repository::LOCATION_SETTINGS_STORE) {
if (!$data && $loadType === $repository::LOCATION_SETTINGS_STORE) {
$containerConfig = \Pimcore::getContainer()->getParameter('pimcore_admin.config');
$data[self::BRANDING] = $containerConfig[self::BRANDING];
$data[self::ASSETS] = $containerConfig[self::ASSETS];
Expand Down

0 comments on commit 6000b11

Please sign in to comment.