diff --git a/src/Oro/Bundle/IntegrationBundle/Provider/ReverseSyncProcessor.php b/src/Oro/Bundle/IntegrationBundle/Provider/ReverseSyncProcessor.php index 060a9b0251a..d9cd0bb62ab 100644 --- a/src/Oro/Bundle/IntegrationBundle/Provider/ReverseSyncProcessor.php +++ b/src/Oro/Bundle/IntegrationBundle/Provider/ReverseSyncProcessor.php @@ -118,12 +118,17 @@ protected function processExport(Integration $integration, ConnectorInterface $c if ($errors) { $warningsText = 'Some entities were skipped due to warnings:' . PHP_EOL; $warningsText .= implode(PHP_EOL, $errors); - $message .= PHP_EOL . $warningsText; + + if ($integration->getSynchronizationSettings()->offsetGetOr('logWarnings', false)) { + foreach ($errors as $error) { + $this->logger->error($error); + } + } } $status->setCode(Status::STATUS_COMPLETED)->setMessage($message); } else { - $this->logger->error('Errors were occurred:'); + $this->logger->error('Errors have occurred:'); $exceptions = implode(PHP_EOL, $exceptions); $this->logger->error($exceptions); diff --git a/src/Oro/Bundle/IntegrationBundle/Provider/SyncProcessor.php b/src/Oro/Bundle/IntegrationBundle/Provider/SyncProcessor.php index 0994e8a89f1..2cc6d1513c0 100644 --- a/src/Oro/Bundle/IntegrationBundle/Provider/SyncProcessor.php +++ b/src/Oro/Bundle/IntegrationBundle/Provider/SyncProcessor.php @@ -291,13 +291,18 @@ protected function processImport(Integration $integration, ConnectorInterface $c if ($errors) { $warningsText = 'Some entities were skipped due to warnings:' . PHP_EOL; $warningsText .= implode(PHP_EOL, $errors); - $message .= PHP_EOL . $warningsText; + + if ($integration->getSynchronizationSettings()->offsetGetOr('logWarnings', false)) { + foreach ($errors as $error) { + $this->logger->error($error); + } + } } $status->setCode(Status::STATUS_COMPLETED)->setMessage($message); } else { - $this->logger->error('Errors were occurred:'); + $this->logger->error('Errors have occurred:'); $exceptions = implode(PHP_EOL, $exceptions); $this->logger->error($exceptions); diff --git a/src/Oro/Bundle/IntegrationBundle/Resources/config/oro/integrations.yml b/src/Oro/Bundle/IntegrationBundle/Resources/config/oro/integrations.yml index aa396bfb753..4855c4320ea 100644 --- a/src/Oro/Bundle/IntegrationBundle/Resources/config/oro/integrations.yml +++ b/src/Oro/Bundle/IntegrationBundle/Resources/config/oro/integrations.yml @@ -17,3 +17,9 @@ integrations: oro.integration.integration.remote_wins.label: remote oro.integration.integration.local_wins.label: local applicable: "@oro_integration.utils.form_utils->hasTwoWaySyncConnectors($channelType$)" + logWarnings: + type: Symfony\Component\Form\Extension\Core\Type\CheckboxType + options: + label: oro.integration.integration.log_warnings.label + tooltip: oro.integration.integration.log_warnings.tooltip + required: false diff --git a/src/Oro/Bundle/IntegrationBundle/Resources/translations/messages.en.yml b/src/Oro/Bundle/IntegrationBundle/Resources/translations/messages.en.yml index 2c5330ab512..360953c69f8 100644 --- a/src/Oro/Bundle/IntegrationBundle/Resources/translations/messages.en.yml +++ b/src/Oro/Bundle/IntegrationBundle/Resources/translations/messages.en.yml @@ -39,6 +39,8 @@ oro: sync_priority.tooltip: > Select if your local version of the data or the remote application data get priority in the case that both were updated since the last sync process. + log_warnings.label: Log warnings as errors + log_warnings.tooltip: Select if you want warnings during sync to be logged as if they were errors. remote_wins.label: Remote wins local_wins.label: Local wins default_user_owner.label: Default owner