diff --git a/Helper/Data.php b/Helper/Data.php
index 9aae532..16737e0 100644
--- a/Helper/Data.php
+++ b/Helper/Data.php
@@ -39,6 +39,11 @@ class Data extends AbstractHelper
*/
const XML_PATH_PROBANCE_GIVEN_FLOW = 'probance/%s_flow/%s';
+ /**
+ * XML Path to DEBUG mode
+ */
+ const XML_PATH_PROBANCE_DEBUG = 'probance/flow/debug';
+
/**
* @var SequenceFactory
*/
@@ -323,4 +328,9 @@ protected function formatSequenceValue($value)
return '-' . $value;
}
+
+ public function getDebugMode()
+ {
+ return $this->scopeConfig->getValue(self::XML_PATH_PROBANCE_DEBUG);
+ }
}
diff --git a/Model/Export/AbstractFlow.php b/Model/Export/AbstractFlow.php
index 32ab786..179e904 100644
--- a/Model/Export/AbstractFlow.php
+++ b/Model/Export/AbstractFlow.php
@@ -162,23 +162,36 @@ public function export()
$this->probanceHelper->getFlowFormatValue('enclosure')
);
- foreach ($this->getArrayCollection() as $collection) {
- $object = $collection['object'];
- $count = (isset($collection['count']) ? $collection['count'] : $object->count());
-
- if ($this->progressBar) {
- $this->progressBar->setMessage('Starting '.$collection['callback'].' export...', 'status');
- $this->progressBar->start($count ?: 1);
- }
-
- $this->iterator->walk($object->getSelect(), [[$this, $collection['callback']]]);
-
- if (count($this->errors) > 0) {
- $this->addLog(serialize($this->errors));
- }
-
- if ($this->progressBar) {
- $this->progressBar->setMessage($filename . ' was created.', 'status');
+ $debug = $this->probanceHelper->getDebugMode();
+
+ foreach ($this->getArrayCollection() as $collection)
+ {
+ try {
+ $object = $collection['object'];
+ $count = (isset($collection['count']) ? $collection['count'] : $object->count());
+ if ($debug) {
+ $this->addLog('Flow count elements is :'.$count.' // Using this request : '.$collection['object']->getSelect().'');
+ }
+
+ if ($this->progressBar) {
+ $this->progressBar->setMessage('Starting '.$collection['callback'].' export...', 'status');
+ $this->progressBar->start($count ?: 1);
+ }
+
+ $this->iterator->walk($object->getSelect(), [[$this, $collection['callback']]]);
+
+ if (count($this->errors) > 0) {
+ $this->addLog(serialize($this->errors));
+ }
+
+ if ($this->progressBar) {
+ $this->progressBar->setMessage($filename . ' was created.', 'status');
+ }
+ } catch (\Exception $e) {
+ $this->addLog(serialize([
+ 'message' => $e->getMessage(),
+ 'trace' => $e->getTraceAsString(),
+ ]));
}
}
diff --git a/composer.json b/composer.json
index c760abe..76a99b8 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "probance/m2connector",
"description": "Probance module for Magento 2",
"type": "magento2-module",
- "version": "1.2.7",
+ "version": "1.2.8",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index fbf6104..ed48fc4 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -98,6 +98,10 @@
Magento\Config\Model\Config\Source\Locale\Timezone
Magento\Config\Model\Config\Backend\Locale\Timezone
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
diff --git a/etc/module.xml b/etc/module.xml
index 033cb8e..bfe9eaf 100644
--- a/etc/module.xml
+++ b/etc/module.xml
@@ -1,7 +1,7 @@
-
+