From 52b9591efbd5749bea81fa7a50115dc2e18f827d Mon Sep 17 00:00:00 2001
From: Alan Bell <alanbell@ubuntu.com>
Date: Mon, 22 Feb 2016 13:55:57 +0000
Subject: [PATCH] fixes quickcreate field ordering and anything else that needs
 all the fields for the module in the order they appear on the screen in
 blocks ref #115

---
 vtlib/Vtiger/Field.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vtlib/Vtiger/Field.php b/vtlib/Vtiger/Field.php
index 826d49b49..1b370795b 100644
--- a/vtlib/Vtiger/Field.php
+++ b/vtlib/Vtiger/Field.php
@@ -236,7 +236,7 @@ class Vtiger_Field extends Vtiger_FieldBasic {
 		global $adb;
 		$instances = false;
 
-		$query = "SELECT * FROM vtiger_field WHERE tabid=? ORDER BY sequence";
+		$query = "SELECT * FROM vtiger_field left join vtiger_blocks on vtiger_field.block=vtiger_blocks.blockid WHERE vtiger_field.tabid=? ORDER BY vtiger_blocks.sequence,vtiger_field.sequence";
 		$queryParams = Array($moduleInstance->id);
 
 		$result = $adb->pquery($query, $queryParams);
@@ -259,4 +259,4 @@ class Vtiger_Field extends Vtiger_FieldBasic {
 		self::log("Deleting fields of the module ... DONE");
 	}
 }
-?>
\ No newline at end of file
+?>
-- 
GitLab