3 # make sure global CFs are not applied to local objects
4 my $ocfs = RT::ObjectCustomFields->new( RT->SystemUser );
5 $ocfs->Limit( FIELD => 'ObjectId', OPERATOR => '!=', VALUE => 0 );
6 my $alias = $ocfs->Join(
7 FIELD1 => 'CustomField',
8 TABLE2 => 'ObjectCustomFields',
9 FIELD2 => 'CustomField',
11 $ocfs->Limit( ALIAS => $alias, FIELD => 'ObjectId', VALUE => 0 );
12 while ( my $ocf = $ocfs->Next ) {
18 my $sth = $RT::Handle->dbh->prepare(
19 "SELECT cfs.LookupType, ocfs.id"
20 ." FROM ObjectCustomFields ocfs, CustomFields cfs"
21 ." WHERE cfs.id = ocfs.CustomField"
22 ." ORDER BY cfs.LookupType, ocfs.SortOrder, cfs.Name"
26 my ($i, $prev_type) = (0, '');
27 while ( my ($lt, $id) = $sth->fetchrow_array ) {
28 $i = 0 if $prev_type ne $lt;
29 my $ocf = RT::ObjectCustomField->new( RT->SystemUser );
31 my ($status, $msg) = $ocf->SetSortOrder( $i++ );
32 $RT::Logger->warning("Couldn't set SortOrder: $msg")