From cbef9bb267e9ffbbdaae0937401f716c3216dcc4 Mon Sep 17 00:00:00 2001 From: Thomas Casteleyn Date: Fri, 17 Sep 2021 15:06:01 +0200 Subject: [PATCH] Allow binary data to be imported/synchronised with the synchro_import.php --- synchro/synchro_import.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/synchro/synchro_import.php b/synchro/synchro_import.php index 7e4b55ea2..9ece8bc64 100644 --- a/synchro/synchro_import.php +++ b/synchro/synchro_import.php @@ -435,6 +435,7 @@ try $aIsDateToTransform = array(); $aDateToTransformReport = array(); + $aIsBinaryToTransform = array(); foreach ($aInputColumns as $iFieldId => $sInputColumn) { if (array_key_exists($sInputColumn, $aDateColumns)) @@ -456,6 +457,7 @@ try { throw new ExchangeException("Unknown column '$sInputColumn' (class: '$sClass')"); } + $aIsBinaryToTransform[$iFieldId] = $aColumns[$sInputColumn] === 'LONGBLOB'; } if (!isset($iPrimaryKeyCol)) { @@ -535,6 +537,10 @@ try $aValues[] = $sDate; } } + elseif ($aIsBinaryToTransform[$iCol]) + { + $aValues[] = base64_decode($value); + } else { $aValues[] = $value; @@ -600,6 +606,10 @@ try $aValuePairs[] = "`$sCol` = ".CMDBSource::Quote($sDate); } } + elseif ($aIsBinaryToTransform[$iCol]) + { + $aValuePairs[] = "`$sCol` = FROM_BASE64(".CMDBSource::Quote($aRow[$iCol], true).")"; + } else { $aValuePairs[] = "`$sCol` = ".CMDBSource::Quote($aRow[$iCol]);