Changes to extension-created field aren't written to DB from process_bug.cgi?

Matthew Bogosian mtb19 at columbia.edu
Tue Jan 8 01:46:54 UTC 2013


In an extension, I have created a new field using the install_update_db hook. I've managed to get the new field into the DB by running checksetup.pl, and am able to display it for editing in show_bug.cgi using <template/en/default/hook/bug/edit-after_custom_fields.html.tmpl>.

However, whenever I try to set or change the value by submitting my changes (which get handed off to process_bugs.cgi as near as I can tell), the corresponding field is never updated. I have confirmed the new value is being passed to process_bugs.cgi as POST data when submitting the change from show_bugs.cgi.

I have implemented the object_columns and object_update_columns hooks as required, but they do not seem to have any effect:

#---- Extension.pm -------------------------------------------------------

...

#=========================================================================                                                                     
sub install_update_db {
    my $dbh = Bugzilla->dbh;

    $dbh->bz_add_column('bugs', 'ip_thumb', {
            TYPE => 'INT3',
            REFERENCES => {
                TABLE  =>  'attachments',
                COLUMN => 'attach_id',
                DELETE => 'SET NULL'
            }
        });

    my $field = new Bugzilla::Field({ name => 'ip_thumb' });

    if (! $field) {
        $field = Bugzilla::Field->create({
                buglist => 1,
                description => 'Thumbnail',
                name => 'ip_thumb',
                type => Bugzilla::Constants::FIELD_TYPE_FREETEXT,
            });
        $field->set_is_numeric(1);
        $field->update();
    }
}

#=========================================================================                                                                     
sub object_columns {
    my ( $self, $args ) = @_;
    my ( $class, $columns ) = @$args{qw(class columns)};

    if ($class->isa('Bugzilla::Bug')) {
        push(@$columns, 'ip_thumb');
    }
}

#=========================================================================                                                                     
sub object_update_columns {
    my ( $self, $args ) = @_;
    my ( $object, $columns ) = @$args{qw(object columns)};

    if ($object->isa('Bugzilla::Bug')) {
        push(@$columns, 'ip_thumb');
    }
}

...

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.


    --Matt


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bugzilla.org/pipermail/developers/attachments/20130107/1559a197/attachment.html>


More information about the developers mailing list