Skip to content

EspoCRM – Open Source CRM Application

Import update skip setting updateBy attribute value

Yurii4473dc95650a
diff --git a/application/Espo/Tools/Import/Import.php b/application/Espo/Tools/Import/Import.php
index 54a6a5aee2..2688597460 100644
--- a/application/Espo/Tools/Import/Import.php
+++ b/application/Espo/Tools/Import/Import.php
@@ -501,7 +501,7 @@ class Import
$value = $row[$i];
try {
- $this->processRowItem($entity, $attribute, $value, $valueMap);
+ $this->processRowItem($entity, $attribute, $value, $valueMap, $updateByAttributeList);
} catch (ValidationError $e) {
$failureList[] = $e->getFailure();
}
@@ -695,6 +695,7 @@ class Import
}
/**
+ * @param string[] $updateByAttributeList
* @throws ValidationError
*/
private function processRowItem(
@@ -702,6 +703,7 @@ class Import
string $attribute,
string $value,
stdClass $valueMap,
+ array $updateByAttributeList,
): void {
assert(is_string($this->entityType));
@@ -718,6 +720,14 @@ class Import
return;
}
+ if (
+ in_array($action, [Params::ACTION_CREATE_AND_UPDATE, Params::ACTION_UPDATE]) &&
+ in_array($attribute, $updateByAttributeList) &&
+ !$entity->isNew()
+ ) {
+ return;
+ }
+
if ($entity->hasAttribute($attribute)) {
$attributeType = $entity->getAttributeType($attribute);