Skip to content

vt71: Import does not de-activate fields according to presence configuration

Import does not de-activate fields according to presence configuration in vtiger_field table.

Steps:

  1. Go to Ticket => All => Import => Step 2

In code the column is compared as number but the field is loaded as string. So far i have not found the cause of the type as string since the database field is defined as int.

A quick fix could be comparing the value as a string but it does not feel like the right solution.

   if($fieldInstance->getPresence() === '1') {
     continue;
   }

Source code 1 Source code 2

diff --git a/modules/Vtiger/models/ModuleMeta.php b/modules/Vtiger/models/ModuleMeta.php
index b083a16..b83db69 100644
--- a/modules/Vtiger/models/ModuleMeta.php
+++ b/modules/Vtiger/models/ModuleMeta.php
@@ -69,7 +69,7 @@ class Vtiger_ModuleMeta_Model extends Vtiger_Base_Model {
 		$moduleFields = $meta->getModuleFields();
 		$accessibleFields = array();
 		foreach($moduleFields as $fieldName => $fieldInstance) {
-			if($fieldInstance->getPresence() === 1) {
+			if($fieldInstance->getPresence() === '1') {
 				continue;
 			}
 			$accessibleFields[$fieldName] = $fieldInstance;
@@ -85,7 +85,7 @@ class Vtiger_ModuleMeta_Model extends Vtiger_Base_Model {
 		$accessibleFields = $this->getAccessibleFields($this->moduleName);
 		$mergableFields = array();
 		foreach($accessibleFields as $fieldName => $fieldInstance) {
-			if($fieldInstance->getPresence() === 1) {
+			if($fieldInstance->getPresence() === '1') {
 				continue;
 			}
 			// We need to avoid Last Modified by or any such User reference field

a9a33374f4c4ee4cbb2861201e2c8dc10c7b782a.diff.txt