From cc65688b3da3e16729a1f73dd50fd975bd1ff741 Mon Sep 17 00:00:00 2001
From: hellkat <hellkat@ispconfig3>
Date: Tue, 26 Mar 2013 00:43:51 -0400
Subject: [PATCH]     Merged revisions 3845-3876 and 3879-3918 from stable branch.

---
 interface/lib/classes/listform_actions.inc.php |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php
index ed689eb..aef3371 100644
--- a/interface/lib/classes/listform_actions.inc.php
+++ b/interface/lib/classes/listform_actions.inc.php
@@ -149,7 +149,7 @@
 		if($this->SQLExtWhere != '') {
 			$sql_where .= ' '.$this->SQLExtWhere.' and';
 		}
-
+		
 		$sql_where = $app->listform->getSearchSQL($sql_where);
 		$app->tpl->setVar($app->listform->searchValues);
 		
@@ -171,8 +171,15 @@
 		    $order_by_sql = str_replace('client_id','c.contact_name',$order_by_sql);
 		  } elseif($order == 'parent_domain_id'){
 		    $join .= ' LEFT JOIN web_domain as wd ON '.$app->listform->listDef['table'].'.parent_domain_id = wd.domain_id ';
-		    $order_by_sql = str_replace('parent_domain_id','wd.domain',$order_by_sql);
-		    $sql_where = str_replace('type',$app->listform->listDef['table'].'.type',$sql_where);
+			//$order_by_sql = str_replace(' domain', ' '.$app->listform->listDef['table'].'.domain',$order_by_sql);
+		    //$order_by_sql = str_replace('parent_domain_id','wd.domain',$order_by_sql);
+			$order_by_sql = preg_replace('@( |,|^)(domain)( |,|$)@', '$1'.$app->listform->listDef['table'].'.$2$3', $order_by_sql);
+			$order_by_sql = preg_replace('@( |,|^)(parent_domain_id)( |,|$)@', '$1wd.domain$3', $order_by_sql);
+			
+		    //$sql_where = str_replace('type',$app->listform->listDef['table'].'.type',$sql_where);
+			//$sql_where = str_replace(' domain',' '.$app->listform->listDef['table'].'.domain',$sql_where);
+			$sql_where = preg_replace('@( |,|^)(type)( |,|$)@', '$1'.$app->listform->listDef['table'].'.$2$3', $sql_where);
+			$sql_where = preg_replace('@( |,|^)(domain)( |,|$)@', '$1'.$app->listform->listDef['table'].'.$2$3', $sql_where);
 		  } elseif($order == 'sys_groupid'){
 		    $join .= ' LEFT JOIN sys_group as sg ON '.$app->listform->listDef['table'].'.sys_groupid = sg.groupid ';
 		    $order_by_sql = str_replace('sys_groupid','sg.name',$order_by_sql);

--
Gitblit v1.9.1