From 79b41ee662f515b436d5f023ac99bc67b04595c6 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Date: Fri, 25 Jan 2019 16:26:59 -0600 Subject: [PATCH] Importing with CSV into Encrypted Custom [ch86] (#6642) --- app/Importer/AssetImporter.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php index e0977eac6c..b477e4e580 100644 --- a/app/Importer/AssetImporter.php +++ b/app/Importer/AssetImporter.php @@ -28,8 +28,13 @@ class AssetImporter extends ItemImporter foreach ($this->customFields as $customField) { $customFieldValue = $this->array_smart_custom_field_fetch($row, $customField); if ($customFieldValue) { - $this->item['custom_fields'][$customField->db_column_name()] = $customFieldValue; - $this->log('Custom Field '. $customField->name.': '.$customFieldValue); + if($customField->field_encrypted == 1){ + $this->item['custom_fields'][$customField->db_column_name()] = \Crypt::encrypt($customFieldValue); + $this->log('Custom Field '. $customField->name.': '.\Crypt::encrypt($customFieldValue)); + } else { + $this->item['custom_fields'][$customField->db_column_name()] = $customFieldValue; + $this->log('Custom Field '. $customField->name.': '.$customFieldValue); + } } else { // Clear out previous data. $this->item['custom_fields'][$customField->db_column_name()] = null;