<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; " class="">In an extension, I have created a new field using the <font class="Apple-style-span" face="'Courier New'">install_update_db</font> hook. I've managed to get the new field into the DB by running <font class="Apple-style-span" face="'Courier New'"><a href="http://checksetup.pl">checksetup.pl</a></font>, and am able to display it for editing in <font class="Apple-style-span" face="'Courier New'">show_bug.cgi</font> using <<font class="Apple-style-span" face="'Courier New'">template/en/default/hook/bug/edit-after_custom_fields.html.tmpl</font>>.<div><br></div><div>However, whenever I try to set or change the value by submitting my changes (which get handed off to <font class="Apple-style-span" face="'Courier New'">process_bugs.cgi</font> as near as I can tell), the corresponding field is never updated. I have confirmed the new value is being passed to <font class="Apple-style-span" face="'Courier New'">process_bugs.cgi</font> as POST data when submitting the change from <font class="Apple-style-span" face="'Courier New'">show_bugs.cgi</font>.</div><div><br></div><div>I have implemented the <font class="Apple-style-span" face="'Courier New'">object_columns</font> and <font class="Apple-style-span" face="'Courier New'">object_update_columns</font> hooks <a href="http://www.bugzilla.org/docs/4.2/en/html/api/Bugzilla/Hook.html#object_columns">as required</a>, but they do not seem to have any effect:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="webkit-indent-blockquote"><div class=""><font class="Apple-style-span" face="'Courier New'">#---- Extension.pm -------------------------------------------------------</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br></font></div><div class=""><font class="Apple-style-span" face="'Courier New'">...</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br></font></div><div class=""><font class="Apple-style-span" face="'Courier New'">#========================================================================= </font></div><div class=""><font class="Apple-style-span" face="'Courier New'">sub install_update_db {</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> my $dbh = Bugzilla->dbh;</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br class=""></font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> $dbh->bz_add_column('bugs', 'ip_thumb', {</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> TYPE => 'INT3',</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> REFERENCES => {</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> TABLE => 'attachments',</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> COLUMN => 'attach_id',</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> DELETE => 'SET NULL'</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> }</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> });</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br class=""></font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> my $field = new Bugzilla::Field({ name => 'ip_thumb' });</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br class=""></font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> if (! $field) {</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> $field = Bugzilla::Field->create({</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> buglist => 1,</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> description => 'Thumbnail',</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> name => 'ip_thumb',</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> type => Bugzilla::Constants::FIELD_TYPE_FREETEXT,</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> });</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> $field->set_is_numeric(1);</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> $field->update();</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> }</font></div><div class=""><font class="Apple-style-span" face="'Courier New'">}</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br class=""></font></div><div class=""><font class="Apple-style-span" face="'Courier New'">#========================================================================= </font></div><div class=""><font class="Apple-style-span" face="'Courier New'">sub object_columns {</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> my ( $self, $args ) = @_;</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> my ( $class, $columns ) = @$args{qw(class columns)};</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br class=""></font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> if ($class->isa('Bugzilla::Bug')) {</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> push(@$columns, 'ip_thumb');</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> }</font></div><div class=""><font class="Apple-style-span" face="'Courier New'">}</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br class=""></font></div><div class=""><font class="Apple-style-span" face="'Courier New'">#========================================================================= </font></div><div class=""><font class="Apple-style-span" face="'Courier New'">sub object_update_columns {</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> my ( $self, $args ) = @_;</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> my ( $object, $columns ) = @$args{qw(object columns)};</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br class=""></font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> if ($object->isa('Bugzilla::Bug')) {</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> push(@$columns, 'ip_thumb');</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"> }</font></div><div class=""><font class="Apple-style-span" face="'Courier New'">}</font></div><div class=""><font class="Apple-style-span" face="'Courier New'"><br></font></div><div class=""><font class="Apple-style-span" face="'Courier New'">...</font></div></blockquote><div class=""><br class=""></div><div class="">What am I doing wrong? I'm running the extension on 4.2.4. I can't find any guidance from the Example extension, the API documentation, or any other source as to why my new value is not being updated. Any help would be greatly appreciated.<br class=""><div>
<br class="">
<br class="">
--Matt<br class="">
<br class="">
</div>
<br class=""></div></div></body></html>