Not saving custom fields in RTFM upon Article creation

I’m using RTFM 2.2.0RC5 with RT 3.6.3. I have created a custom field for the
body of the article. I have setup all permissions on the custom field and
added it to the class that I want it in. When creating a new article it
doesn’t save the value of the custom field that I have. I have to go back in
to the article and modify the field and then it saves ok.

Is this a bug or is there a setting that I’m missing?

Thanks,

-Jeff

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

So I think I figured out what was going on. I have fixed the problem for my
RTFM situation but I need to know if what I did was the right thing or not.
So if one of the developers would like to look this over that would be
fantastic, and let me know if I broke anything else or not.

I found the problem to be that the format for
ProcessObjectCustomFieldUpdates in /rt3/ lib/RT/Interface/Web.pm. The format
for the custom object that it is expecting is: # format: Object---CustomField--

However when you load /rt3/share/html/RTFM/Article/Edit.html for the first
time to create an article there is no initial object id. So the field end up
being Object-–CustomField-- with a missing
object id section.

When ProcessObjectCustomFieldUpdates runs the first loop:

foreach my $arg ( keys %$ARGSRef ) {

    # format: Object-<object class>-<object id>-CustomField-<CF

id>-

    next unless $arg =~

/^Object-([\w:]+)-(\d*)-CustomField-(\d+)-(.*)$/;

    # For each of those objects, find out what custom fields we want to

work with.

    $custom_fields_to_mod{ $1 }{ $2 || 0 }{ $3 }{ $4 } = $ARGSRef->{

$arg };

}

It ends up setting the ID field to 0 cause it doesn’t exist. Then when it
loops through the class and id’s later and tries to get the $Object:

$Object->Load( $id ) unless ($Object->id || 0) == $id;

It resets the object id to the wrong thing because the article has already
been created by this point and it has an id but the custom fields don’t
associate with that object id

I don’t know if I’m making any sense with this anymore.

Here is what I did to fix the issue:

foreach my $arg ( keys %$ARGSRef ) {

    # format: Object-<object class>-<object id>-CustomField-<CF

id>-

    next unless $arg =~

/^Object-([\w:]+)-(\d*)-CustomField-(\d+)-(.*)$/;

    my $Object = $args{'Object'} if exists $args{'Object'};

    my $id = $Object->id || 0;



    # For each of those objects, find out what custom fields we want to

work with.

    $custom_fields_to_mod{ $1 }{ $2 || $id }{ $3 }{ $4 } = $ARGSRef->{

$arg };

}

I changed the first loop to pull the object if it was passed in and set the
id to the object->id or to 0. So it should default back to what it was doing
before if no object is currently passed in.

Someone please take the time to read this and let me know if what I did is
good or not. If ne1 else is having this issue and needs a patch file I can
create one and send / post it somewhere, just lmk.

Thanks for all the help this list has been so far.

-Jeff

[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Jeff PlatterSent: Tuesday, June 12, 2007 4:36 PM
To: rt-users@lists.bestpractical.com
Subject: [FILTER] [rt-users] Not saving custom fields in RTFM upon Article
creation

I’m using RTFM 2.2.0RC5 with RT 3.6.3. I have created a custom field for the
body of the article. I have setup all permissions on the custom field and
added it to the class that I want it in. When creating a new article it
doesn’t save the value of the custom field that I have. I have to go back in
to the article and modify the field and then it saves ok.

Is this a bug or is there a setting that I’m missing?

Thanks,

-Jeff

This message has been scanned for viruses and
dangerous content by http://www.mailscanner.info/ MailScanner, and is
believed to be clean.

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Jeff Platter wrote:

I�m using RTFM 2.2.0RC5 with RT 3.6.3. I have created a custom field for
the body of the article. I have setup all permissions on the custom
field and added it to the class that I want it in. When creating a new
article it doesn�t save the value of the custom field that I have. I
have to go back in to the article and modify the field and then it saves ok.

Is this a bug or is there a setting that I�m missing?
Probably a bug since it sounds familiar to me, but I have recently
upgraded my test instance to rt-3.6.4rc1, need todo rc2, and upgraded
RTFM to the latest (2.2.0RC6) and the problem doesn’t show up in this
configuration and it doesn’t for our production environment which is
rt-3.6.3 with RTFM v2.2.0RC6 but it did with the previous version of
RTFM. I’m not entirely sure that was RC5 but judging from my directories
at the server probably not but RC3.

So try RC6,

Joop

Hi Joop!
Sorry, I can’t find RC6, is it available, yet? I would like to test, too!
Regards, Ulrike

Joop wrote:

Jeff Platter wrote:

I�m using RTFM 2.2.0RC5 with RT 3.6.3. I have created a custom field
for the body of the article. I have setup all permissions on the
custom field and added it to the class that I want it in. When
creating a new article it doesn�t save the value of the custom field
that I have. I have to go back in to the article and modify the field
and then it saves ok.

Is this a bug or is there a setting that I�m missing?
Probably a bug since it sounds familiar to me, but I have recently
upgraded my test instance to rt-3.6.4rc1, need todo rc2, and upgraded
RTFM to the latest (2.2.0RC6) and the problem doesn’t show up in this
configuration and it doesn’t for our production environment which is
rt-3.6.3 with RTFM v2.2.0RC6 but it did with the previous version of
RTFM. I’m not entirely sure that was RC5 but judging from my directories
at the server probably not but RC3.

So try RC6,

Joop


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media. Buy
a copy at http://rtbook.bestpractical.com

Ulrike Lindemann, Ulrike.Lindemann@desy.de
DESY IT, Benutzerservice
Notkestr. 85, 22607 Hamburg
Tel: +49-40-8998-2549
Fax: +49-40-8994-2549

Ulrike Lindemann wrote:

Hi Joop!
Sorry, I can’t find RC6, is it available, yet? I would like to test, too!
Regards, Ulrike

Joop wrote:

Jeff Platter wrote:

I�m using RTFM 2.2.0RC5 with RT 3.6.3. I have created a custom field
for the body of the article. I have setup all permissions on the
custom field and added it to the class that I want it in. When
creating a new article it doesn�t save the value of the custom field
that I have. I have to go back in to the article and modify the field
and then it saves ok.

Is this a bug or is there a setting that I�m missing?
Probably a bug since it sounds familiar to me, but I have recently
upgraded my test instance to rt-3.6.4rc1, need todo rc2, and upgraded
RTFM to the latest (2.2.0RC6) and the problem doesn’t show up in
this configuration and it doesn’t for our production environment which
is rt-3.6.3 with RTFM v2.2.0RC6 but it did with the previous version
of RTFM. I’m not entirely sure that was RC5 but judging from my
directories at the server probably not but RC3.

So try RC6,
RC6 is available through svn.

Joop

Hi Joop!
Sorry, I can’t find RC6, is it available, yet? I would like to
test, too!

You can snag a copy at:

PGP.sig (186 Bytes)

Thanks, Jesse, we will test it!
Ulrike

Jesse Vincent wrote:

Hi Joop!
Sorry, I can’t find RC6, is it available, yet? I would like to test, too!

You can snag a copy at:

http://download.bestpractical.com/pub/rt/devel/RTIR_M3/RTFM-2.2.0RC6.tar.gz

Regards, Ulrike

Ulrike Lindemann, Ulrike.Lindemann@desy.de
DESY IT, Benutzerservice
Notkestr. 85, 22607 Hamburg
Tel: +49-40-8998-2549
Fax: +49-40-8994-2549

So I think I figured out what was going on. I have fixed the problem
for my RTFM situation but I need to know if what I did was the right
thing or not. So if one of the developers would like to look this over
that would be fantastic, and let me know if I broke anything else or
not.

I found the problem to be that the format for
ProcessObjectCustomFieldUpdates in /rt3/ lib/RT/Interface/Web.pm. The
format for the custom object that it is expecting is: # format:
Object---CustomField--

However when you load /rt3/share/html/RTFM/Article/Edit.html for the
first time to create an article there is no initial object id. So the
field end up being Object-–CustomField-- with a missing object id section.

When ProcessObjectCustomFieldUpdates runs the first loop:

foreach my $arg ( keys %$ARGSRef ) {

    # format: Object-<object class>-<object id>-CustomField-<CF

id>-

    next unless $arg =~ /^Object-([\w:]+)-(\d*)-CustomField-(\d

+)-(.*)$/;

    # For each of those objects, find out what custom fields we

want to work with.

    $custom_fields_to_mod{ $1 }{ $2 || 0 }{ $3 }{ $4 } =

$ARGSRef->{ $arg };

}

It ends up setting the ID field to 0 cause it doesn’t exist. Then when
it loops through the class and id’s later and tries to get the
$Object:

$Object->Load( $id ) unless ($Object->id || 0) == $id;

It resets the object id to the wrong thing because the article has
already been created by this point and it has an id but the custom
fields don’t associate with that object id

I don’t know if I’m making any sense with this anymore.

Here is what I did to fix the issue:

foreach my $arg ( keys %$ARGSRef ) {

    # format: Object-<object class>-<object id>-CustomField-<CF

id>-

    next unless $arg =~ /^Object-([\w:]+)-(\d*)-CustomField-(\d

+)-(.*)$/;

    my $Object = $args{'Object'} if exists $args{'Object'};

    my $id = $Object->id || 0;



    # For each of those objects, find out what custom fields we

want to work with.

    $custom_fields_to_mod{ $1 }{ $2 || $id }{ $3 }{ $4 } =

$ARGSRef->{ $arg };

}

I changed the first loop to pull the object if it was passed in and
set the id to the object->id or to 0. So it should default back to
what it was doing before if no object is currently passed in.

Someone please take the time to read this and let me know if what I
did is good or not. If ne1 else is having this issue and needs a patch
file I can create one and send / post it somewhere, just lmk.

Thanks for all the help this list has been so far.

-Jeff

From:rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Jeff
Platter
Sent: Tuesday, June 12, 2007 4:36 PM
To: rt-users@lists.bestpractical.com
Subject: [FILTER] [rt-users] Not saving custom fields in RTFM upon
Article creation

I’m using RTFM 2.2.0RC5 with RT 3.6.3. I have created a custom field
for the body of the article. I have setup all permissions on the
custom field and added it to the class that I want it in. When
creating a new article it doesn’t save the value of the custom field
that I have. I have to go back in to the article and modify the field
and then it saves ok.

Is this a bug or is there a setting that I’m missing?

Thanks,

-Jeff

Hi,

Jeff, thanks very much for this email. It solved the problem we were
having with RTFM too when upgrading from 3.4 to 3.6 and trying to
extract RTFM articles. Has this been verified as a bug, or is there
possibly something wrong with my installation?

Currently running RT 3.6.4 and RTFM 2.2.0RC5. Also had the same problem
with RT 3.6.4 and RTFM 2.0.4. With this patch for now it appears that
all is working flawlessly.

Thanks to all on the list for help and to the devs for a great product
in RT and RTFM,
Dave

Patch generated from Jeff’s suggestions:

[root@rt Interface]# diff -u Web.pm.20070706 Web.pm
— Web.pm.20070706 2007-07-06 09:34:50.000000000 -0400
+++ Web.pm 2007-07-06 09:36:36.000000000 -0400
@@ -1198,8 +1198,14 @@
# format: Object---CustomField--
next unless $arg =~ /^Object-([\w:]+)-(\d*)-CustomField-(\d
+)-(.*)$/;

  •   # added by dbh for rtfm issue
    
  •   my $Object = $args{'Object'} if exists $args{'Object'};
    
  •    my $id = $Object->id || 0;
       # For each of those objects, find out what custom fields we
    

want to work with.

  •    $custom_fields_to_mod{ $1 }{ $2 || 0 }{ $3 }{ $4 } =
    

$ARGSRef->{ $arg };

  •    #$custom_fields_to_mod{ $1 }{ $2 || 0 }{ $3 }{ $4 } =
    

$ARGSRef->{ $arg };

  •    # this line modified by dbh too, for rtfm issue
    
  •   $custom_fields_to_mod{ $1 }{ $2 || $id }{ $3 }{ $4 } =
    

$ARGSRef->{ $arg };
}

 # For each of those objects