Hi,

Issue root cause is that Bugzilla->check() is fully functional since
Bugzilla 3.4 but not in 3.2.x yet. Here is the relevant section from release
notes http://www.bugzilla.org/releases/3.4/release-notes.html:

> We now use Bugzilla::Bug->check() instead of ValidateBugId.
>

I'm attaching a patch which corrects the problem in my environment (tested
with Bugzilla 3.2.7).
* Note: The patch is on top of my customized (not original one) scmbug
0.26.19 which I've uploaded today to another thread. (Easier for me to
implement the change on top of that; and also this patch illustrates
introduction of version-specific changes which we discussed in the other
thread).

Regards,
Yavor

On Fri, Jul 23, 2010 at 08:35, Yavor Nikolov <[email protected]>wrote:

> I just tested with bugzilla 3.2.3 and bugzilla 3.2.7 using just
> add_comment( $comment ) /without extra params/: and I also got an error:
> ** Scmbug error 7: Error while adding bug comment: DBD::Pg::db do failed:
> ERROR:  null value in column "assigned_to" violates not-null constraint [for
> Statement "UPDATE bugs SET assigned_to = ?, bug_file_loc = ?, bug_severity =
> ?, bug_status = ?, cclist_accessible = ?, component_id = ?, estimated_time =
> ?, everconfirmed = ?, op_sys = ?, priority = ?, product_id = ?,
> remaining_time = ?, rep_platform = ?, reporter_accessible = ?, resolution =
> ?, short_desc = ?, status_whiteboard = ?, target_milestone = ?, version = ?
> WHERE bug_id = ?"]
>
> which is issued on $bug->update()
>
> (Maybe mysql doesn't have such not null constraints and updates fields to
> null).
>
> Regards,
> Yavor
>
>
=== modified file 'scmbug/lib/Scmbug/Daemon/Bugzilla.pm'
--- scmbug/lib/Scmbug/Daemon/Bugzilla.pm	2010-07-21 22:24:36 +0000
+++ scmbug/lib/Scmbug/Daemon/Bugzilla.pm	2010-07-23 20:45:06 +0000
@@ -57,6 +57,7 @@
 my $VERSION_3_0_0  = "3.0.0";
 my $VERSION_3_1_3  = "3.1.3";
 my $VERSION_3_2_0  = "3.2.0";
+my $VERSION_3_3_0  = "3.3.0";
 my $VERSION_3_5_0  = "3.5.0";
 my $VERSION_LATEST = "3.6.99";
 
@@ -394,6 +395,35 @@
 
 
 
+# Validate the given bugid and return Bugzilla::Bug instance for it.
+#
+# PARAMETERS:
+# $1 - The bug id
+#
+# RETURNS:
+# - A Bugzilla::Bug instance representing the given bug id
+#   if it's a valid one.
+# - Throws exception otherwise (die issued by Bugzilla or here).
+sub bugzilla_bug_check {
+	my $self = shift;
+	my $bugid = shift;
+
+	my $bug = undef;
+	if ( $self->is_version_lt( $VERSION_3_3_0 ) ) {
+		$bug = Bugzilla::Bug::ValidateBugID( $bugid );
+		$bug = new Bugzilla::Bug( $bugid );
+		if ( !defined( $bug ) ) {
+			die( "Invalid bugid: '$bugid'\n" );
+		}
+	} else {
+		$bug = Bugzilla::Bug->check( $bugid );
+	}
+
+	return $bug;
+}
+
+
+
 # Do the bulk of the work required for integration_get_vdd
 #
 # PARAMETERS:
@@ -652,7 +682,7 @@
         my @ret_list = eval {
             my $user = Bugzilla::User->check( $username );
             Bugzilla->set_user( $user );
-            my $bug = Bugzilla::Bug->check( $bugid );
+            my $bug = $self->bugzilla_bug_check( $bugid );
             $dbh->bz_start_transaction();
             $bug->add_comment( $comment );
             $bug->update();
@@ -866,7 +896,7 @@
         my @ret_list = eval {
         my $user = Bugzilla::User->check($username);
         Bugzilla->set_user($user);
-        my $bug = Bugzilla::Bug->check($bugid);
+        my $bug = $self->bugzilla_bug_check( $bugid );
         
         my $has_changed = 0;
         

_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users

Reply via email to