From 75e402c8522193f1e7a9d6f1b987e4cda56373f3 Mon Sep 17 00:00:00 2001 From: satish <satish.dvnk@vtiger.com> Date: Fri, 21 Apr 2017 18:27:31 +0530 Subject: [PATCH] Fixes #473 - vt7 dev release - Bug list columns in module Documents --- modules/Migration/schema/660_to_700.php | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/modules/Migration/schema/660_to_700.php b/modules/Migration/schema/660_to_700.php index ac9ef2666..ddb4cf246 100644 --- a/modules/Migration/schema/660_to_700.php +++ b/modules/Migration/schema/660_to_700.php @@ -2102,6 +2102,37 @@ if(defined('VTIGER_UPGRADE')) { $db->pquery('DELETE FROM vtiger_settings_field WHERE name IN ('.generateQuestionMarks($duplicateOtherBlockFields).') AND blockid=?', array($duplicateOtherBlockFields, $otherBlockId)); //Migration of data to vtiger_settings blocks and fields ends + $result = $db->pquery('SELECT cvid, entitytype FROM vtiger_customview WHERE viewname=?', array('All')); + if ($result && $db->num_rows($result) > 0) { + while ($row = $db->fetch_array($result)) { + $cvId = $row['cvid']; + $cvModel = CustomView_Record_Model::getInstanceById($cvId); + $cvSelectedFields = $cvModel->getSelectedFields(); + + $moduleModel = Vtiger_Module_Model::getInstance($row['entitytype']); + if ($moduleModel) { + $fields = $moduleModel->getFields(); + $cvSelectedFieldModels = array(); + + foreach ($fields as $fieldModel) { + $cvSelectedFieldModels[] = decode_html($fieldModel->getCustomViewColumnName()); + } + + foreach ($cvSelectedFields as $cvSelectedField) { + if (!in_array($cvSelectedField, $cvSelectedFieldModels)) { + $fieldData = explode(':', $cvSelectedField); + $fieldName = $fieldData[2]; + $fieldInstance = Vtiger_Field_Model::getInstance($fieldName, $moduleModel); + if ($fieldInstance) { + $columnname = decode_html($fieldInstance->getCustomViewColumnName()); + $db->pquery('UPDATE vtiger_cvcolumnlist SET columnname=? WHERE cvid=? AND columnname=?', array($columnname, $cvId, $cvSelectedField)); + } + } + } + } + } + } + //Update existing package modules Install_Utils_Model::installModules(); -- GitLab