From d5367a4ca80fbadf2851aefbe0c6cf9267be2fb3 Mon Sep 17 00:00:00 2001
From: yogeshwar <yogeshwar.g@vtigersolutions.com>
Date: Mon, 29 Apr 2024 11:01:42 +0530
Subject: [PATCH] Fixe #1802:Handled initializeListViewContents being called
 twice on each list

---
 modules/Portal/views/List.php                               | 6 +++---
 modules/Reports/views/List.php                              | 6 +++---
 modules/Settings/Vtiger/views/List.php                      | 6 +++---
 modules/Vtiger/views/FindDuplicates.php                     | 6 +++---
 modules/Vtiger/views/List.php                               | 6 +++---
 .../EmailTemplates/modules/EmailTemplates/views/List.php    | 6 +++---
 .../modules/RecycleBin/modules/RecycleBin/views/List.php    | 6 +++---
 7 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/modules/Portal/views/List.php b/modules/Portal/views/List.php
index 8fd305bf5..2e0bef6cf 100644
--- a/modules/Portal/views/List.php
+++ b/modules/Portal/views/List.php
@@ -10,7 +10,7 @@
 
 class Portal_List_View extends Vtiger_Index_View {
 
-	protected $fncalled = false;
+	protected $listviewinitcalled  = false;
 
 	public function requiresPermission(Vtiger_Request $request){
 		$permissions = parent::requiresPermission($request);
@@ -40,7 +40,7 @@ class Portal_List_View extends Vtiger_Index_View {
 
 	public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
 
-	if($this->fncalled==false){
+	if($this->listviewinitcalled == false){
 		$moduleName = $request->getModule();
 		$pageNumber = $request->get('page');
 		$orderBy = $request->get('orderby');
@@ -130,7 +130,7 @@ class Portal_List_View extends Vtiger_Index_View {
 		$viewer->assign('PAGE_NUMBER', $pagingModel->get('page'));
 		$viewer->assign('NO_OF_ENTRIES', count($listviewEntries));
 
-		$this->fncalled=true;
+		$this->listviewinitcalled = true;
 	}
 	}
 	function getHeaderScripts(Vtiger_Request $request) {
diff --git a/modules/Reports/views/List.php b/modules/Reports/views/List.php
index 75335fdeb..5eac8e4fd 100644
--- a/modules/Reports/views/List.php
+++ b/modules/Reports/views/List.php
@@ -13,7 +13,7 @@ class Reports_List_View extends Vtiger_Index_View {
 	protected $listViewHeaders = false;
 	protected $listViewEntries = false;
 	protected $listViewCount   = false;
-	protected $fncalled        = false;
+	protected $listviewinitcalled = false;
 
 	function preProcess(Vtiger_Request $request, $display=true) {
 		parent::preProcess($request, false);
@@ -100,7 +100,7 @@ class Reports_List_View extends Vtiger_Index_View {
 
 	public function initializeListViewContents(Vtiger_Request $request) {
 
-		if($this->fncalled == false){
+		if($this->listviewinitcalled == false){
 			$moduleName = $request->getModule();
 			$viewer = $this->getViewer($request);
 			$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
@@ -238,7 +238,7 @@ class Reports_List_View extends Vtiger_Index_View {
 		}
 		$viewer->assign('DASHBOARD_TABS', $activeTabs);
 
-		$this->fncalled=true;
+		$this->listviewinitcalled=true;
 	}
 }
 
diff --git a/modules/Settings/Vtiger/views/List.php b/modules/Settings/Vtiger/views/List.php
index 9df1c76a0..234d1ca02 100644
--- a/modules/Settings/Vtiger/views/List.php
+++ b/modules/Settings/Vtiger/views/List.php
@@ -11,7 +11,7 @@
 class Settings_Vtiger_List_View extends Settings_Vtiger_Index_View {
 	protected $listViewEntries = false;
 	protected $listViewHeaders = false;
-	protected $fncalled        = false;
+	protected $listviewinitcalled = false;
 
 	function __construct() {
 		parent::__construct();
@@ -38,7 +38,7 @@ class Settings_Vtiger_List_View extends Settings_Vtiger_Index_View {
 	 */
 	public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
 
-		if($this->fncalled==false){
+		if($this->listviewinitcalled ==false){
 			$moduleName = $request->getModule();
 			$qualifiedModuleName = $request->getModule(false);
 			$pageNumber = $request->get('page');
@@ -139,7 +139,7 @@ class Settings_Vtiger_List_View extends Settings_Vtiger_Index_View {
 			$viewer->assign('LISTVIEW_COUNT', $totalCount);
 		}
 
-		$this->fncalled=true;
+		$this->listviewinitcalled =true;
 	}
 }
     
diff --git a/modules/Vtiger/views/FindDuplicates.php b/modules/Vtiger/views/FindDuplicates.php
index 8f8ec8e72..c03bb6af8 100644
--- a/modules/Vtiger/views/FindDuplicates.php
+++ b/modules/Vtiger/views/FindDuplicates.php
@@ -10,7 +10,7 @@
 
 class Vtiger_FindDuplicates_View extends Vtiger_List_View {
 
-	protected $fncalled = false;
+	protected $listviewinitcalled = false;
 
 	function preProcess(Vtiger_Request $request, $display = true) {
 		$viewer = $this->getViewer ($request);
@@ -58,7 +58,7 @@ class Vtiger_FindDuplicates_View extends Vtiger_List_View {
 	 */
 	public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
 
-		if($this->fncalled == false){
+		if($this->listviewinitcalled == false){
 			$currentUser = vglobal('current_user');
 			$viewer = $this->getViewer ($request);
 			$module = $request->getModule();
@@ -124,7 +124,7 @@ class Vtiger_FindDuplicates_View extends Vtiger_List_View {
 		$customViewModel = CustomView_Record_Model::getAllFilterByModule($module);
 		$viewer->assign('VIEW_NAME', $customViewModel->getId());
 
-		$this->fncalled = true;
+		$this->listviewinitcalled = true;
 	}
 }
 
diff --git a/modules/Vtiger/views/List.php b/modules/Vtiger/views/List.php
index 16dbf7faa..9a37df8b5 100644
--- a/modules/Vtiger/views/List.php
+++ b/modules/Vtiger/views/List.php
@@ -16,7 +16,7 @@ class Vtiger_List_View extends Vtiger_Index_View {
 	protected $noOfEntries = false;
 	protected $pagingModel = false;
 	protected $listViewModel = false;
-	protected $fncalled= false;
+	protected $listviewinitcalled = false;
 	function __construct() {
 		parent::__construct();
 	}
@@ -161,7 +161,7 @@ class Vtiger_List_View extends Vtiger_Index_View {
 	 */
 	public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
 
-		if($this->fncalled==false){
+		if($this->listviewinitcalled == false){
 			$moduleName = $request->getModule();
 			$cvId = $this->viewName;
 			$pageNumber = $request->get('page');
@@ -439,7 +439,7 @@ class Vtiger_List_View extends Vtiger_Index_View {
 		$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
 		$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE',Zend_Json::encode($picklistDependencyDatasource));
 
-		$this->fncalled=true;
+		$this->listviewinitcalled = true;
 	}
 }
 
diff --git a/pkg/vtiger/modules/EmailTemplates/modules/EmailTemplates/views/List.php b/pkg/vtiger/modules/EmailTemplates/modules/EmailTemplates/views/List.php
index 90e00167e..9acf159c8 100644
--- a/pkg/vtiger/modules/EmailTemplates/modules/EmailTemplates/views/List.php
+++ b/pkg/vtiger/modules/EmailTemplates/modules/EmailTemplates/views/List.php
@@ -11,7 +11,7 @@
 class EmailTemplates_List_View extends Vtiger_Index_View {
 
 
-	protected $fncalled = false;
+	protected $listviewinitcalled = false;
 
 	function __construct() {
 		parent::__construct();
@@ -87,7 +87,7 @@ class EmailTemplates_List_View extends Vtiger_Index_View {
 	 */
 	public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
 
-		if($this->fncalled == false){
+		if($this->listviewinitcalled == false){
 			$moduleName = $request->getModule();
 			$cvId = $request->get('viewname');
 			$viewType = $request->get('viewType');
@@ -226,7 +226,7 @@ class EmailTemplates_List_View extends Vtiger_Index_View {
 		$viewer->assign('IS_MODULE_EDITABLE', $listViewModel->getModule()->isPermitted('EditView'));
 		$viewer->assign('IS_MODULE_DELETABLE', $listViewModel->getModule()->isPermitted('Delete'));
 
-		$this->fncalled = true;
+		$this->listviewinitcalled = true;
 	}
 }
 
diff --git a/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/views/List.php b/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/views/List.php
index fa917d434..5b61b4e0f 100644
--- a/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/views/List.php
+++ b/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/views/List.php
@@ -10,7 +10,7 @@
 
 class RecycleBin_List_View extends Vtiger_Index_View {
 
-	protected $fncalled = false;
+	protected $listviewinitcalled = false;
 
 	function checkPermission(Vtiger_Request $request) {
 		$moduleName = $request->getModule();
@@ -71,7 +71,7 @@ class RecycleBin_List_View extends Vtiger_Index_View {
 	 */
 	public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
 
-		if($this->fncalled==false){
+		if($this-> listviewinitcalled == false){
 			$moduleName = $request->getModule();
 			$sourceModule = $request->get('sourceModule');
 
@@ -222,7 +222,7 @@ class RecycleBin_List_View extends Vtiger_Index_View {
 		}
 		$viewer->assign('IS_MODULE_DELETABLE', $listViewModel->getModule()->isPermitted('Delete'));
 
-		$this->fncalled = true;
+		$this-> listviewinitcalled = true;
 
 	}
 }
-- 
GitLab