From b991a765c78d5e6c9ecbd23c2ff5e4cd726a8921 Mon Sep 17 00:00:00 2001
From: Robert Munteanu <robert.munteanu@gmail.com>
Date: Fri, 21 Aug 2009 14:03:21 +0300
Subject: [PATCH] Update BugData to allow creation of issue from the SOAP API

The profile_id is now initially set to 0, as indicated by giallu, and
the history_log_event_direct calls are invoked using the object's
fields, rather than parameters.
---
 core/bug_api.php |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/core/bug_api.php b/core/bug_api.php
index 58b3f22..a055510 100644
--- a/core/bug_api.php
+++ b/core/bug_api.php
@@ -99,7 +99,7 @@ class BugData {
 
 	# omitted:
 	# var $bug_text_id
-	protected $profile_id;
+	protected $profile_id = 0;
 
 	# extended info
 	protected $description = '';
@@ -360,8 +360,9 @@ class BugData {
 		history_log_event_special( $this->id, NEW_BUG );
 
 		# log changes, if any (compare happens in history_log_event_direct)
-		history_log_event_direct( $t_bug_id, 'status', $t_original_status, $t_status );
-		history_log_event_direct( $t_bug_id, 'handler_id', 0, $c_handler_id );
+		history_log_event_direct( $this->id, 'status', $t_original_status, $t_status );
+		if ( 0 != $this->handler_id )
+			history_log_event_direct( $this->id, 'handler_id', 0, $this->handler_id );
 
 		return $this->id;
 	}
-- 
1.6.3.3

