From 40f19df302982c94d02a87a5768171fad687b7b3 Mon Sep 17 00:00:00 2001
From: Robert Munteanu <robert.munteanu@gmail.com>
Date: Fri, 31 Jul 2009 12:30:38 +0300
Subject: [PATCH] Avoid unconditionally referencing project_id

The SOAP api mc_file_get function unconditionally references
$row['project_id'], but that field is only set for 'doc' attachments.
That access is now guarded by if checks, to avoid system notices
and thus errors being sent to the SOAP client.
---
 api/soap/mc_file_api.php |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/api/soap/mc_file_api.php b/api/soap/mc_file_api.php
index b40242d..695ed4a 100644
--- a/api/soap/mc_file_api.php
+++ b/api/soap/mc_file_api.php
@@ -160,7 +160,9 @@ function mci_file_get( $p_file_id, $p_type, $p_user_id ) {
 	$row = db_fetch_array( $result );
 
 	$t_bug_id = $row['bug_id'];
-	$t_project_id = $row['project_id'];
+	if ( $p_type == 'doc' ) {
+		$t_project_id = $row['project_id'];
+	}
 	$t_diskfile = $row['diskfile'];
 	$t_content = base64_encode( $row['content'] );
 
-- 
1.6.3.3

