소스 검색

Show messages to groups the user and destination number are both assigned to

FusionPBX 2 년 전
부모
커밋
9d1f31746e
1개의 변경된 파일12개의 추가작업 그리고 4개의 파일을 삭제
  1. 12 4
      messages_contacts.php

+ 12 - 4
messages_contacts.php

@@ -101,7 +101,11 @@
 	$sql .= "		and ( \n";
 	$sql .= "		and ( \n";
 	$sql .= "			user_uuid = :user_uuid \n";
 	$sql .= "			user_uuid = :user_uuid \n";
 	$sql .= "			or \n";
 	$sql .= "			or \n";
-	$sql .= "			group_uuid in (".$group_uuids_in.") \n";
+	$sql .= "			group_uuid in (\n";
+	$sql .= "				select group_uuid from v_destinations \n";
+	$sql .= "				where group_uuid in (".$group_uuids_in.") \n";
+	$sql .= "				and domain_uuid = :domain_uuid \n";
+	$sql .= "			) \n";
 	$sql .= "		)\n";
 	$sql .= "		)\n";
 	$sql .= "		and message_from ~'^\+?([0-9]+\.?[0-9]*|\.[0-9]+)$' \n";
 	$sql .= "		and message_from ~'^\+?([0-9]+\.?[0-9]*|\.[0-9]+)$' \n";
 	$sql .= "		union \n";
 	$sql .= "		union \n";
@@ -112,8 +116,12 @@
 	$sql .= "		and ( \n";
 	$sql .= "		and ( \n";
 	$sql .= "			user_uuid = :user_uuid \n";
 	$sql .= "			user_uuid = :user_uuid \n";
 	$sql .= "			or \n";
 	$sql .= "			or \n";
-	$sql .= "			group_uuid in (".$group_uuids_in.") \n";
-	$sql .= "		)\n";
+	$sql .= "			group_uuid in (\n";
+	$sql .= "				select group_uuid from v_destinations \n";
+	$sql .= "				where group_uuid in (".$group_uuids_in.") \n";
+	$sql .= "				and domain_uuid = :domain_uuid \n";
+	$sql .= "			) \n";
+	$sql .= "		) \n";
 	$sql .= "		and message_to ~'^\+?([0-9]+\.?[0-9]*|\.[0-9]+)$' \n";
 	$sql .= "		and message_to ~'^\+?([0-9]+\.?[0-9]*|\.[0-9]+)$' \n";
 	$sql .= "	) as nested \n";
 	$sql .= "	) as nested \n";
 	$sql .= "	where number not in \n";
 	$sql .= "	where number not in \n";
@@ -389,4 +397,4 @@
 	//echo "</center>\n";
 	//echo "</center>\n";
 
 
 	echo "</html>\n";
 	echo "</html>\n";
-?>
+?>