fix: [workflow] fix attribute edit module actions

pull/9571/head
Jeroen Pinoy 2024-02-18 18:05:08 +01:00
parent e703307f14
commit 31cd3f2023
No known key found for this signature in database
GPG Key ID: DF33A50B8E4EE081
1 changed files with 3 additions and 8 deletions

View File

@ -39,22 +39,17 @@ class Module_attribute_edition_operation extends WorkflowBaseActionModule
protected function __saveAttributes(array $attributes, array $rData, array $params, array $user): array
{
$success = false;
$attributes = [];
$newAttributes = [];
foreach ($attributes as $k => $attribute) {
$newAttribute = $this->_editAttribute($attribute, $rData, $params);
$newAttributes[] = $newAttribute;
unset($newAttribute['timestamp']);
$result = $this->Attribute->editAttribute($newAttribute, $rData, $user, $newAttribute['object_id']);
if (is_array($result)) {
$attributes[] = $result;
}
$newAttributes[] = $newAttribute;
}
$this->Attribute->editAttributeBulk($attributes, $rData, $user);
$this->Attribute->editAttributeBulk($newAttributes, $rData, $user);
foreach ($attributes as $k => $attribute) {
$saveSuccess = empty($this->Attribute->validationErrors[$k]);
if ($saveSuccess) {
$rData = $this->_overrideAttribute($attribute, $newAttribute, $rData);
$rData = $this->_overrideAttribute($attribute, $newAttributes[$k], $rData);
}
$success = $success || !empty($saveSuccess);
}