[Rt-commit] r14314 - in rt/branches/3.999-DANGEROUS: lib/RT/Model
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Sat Jul 19 08:43:46 EDT 2008
Author: sunnavy
Date: Sat Jul 19 08:43:42 2008
New Revision: 14314
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm
Log:
r14755 at sunnavys-mb: sunnavy | 2008-07-19 18:15:06 +0800
fixed bug of _custom_field_decipher
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm Sat Jul 19 08:43:42 2008
@@ -1180,12 +1180,11 @@
my ( $queue, $field, $column ) = ( $string =~ /^(?:(.+?)\.)?{(.+)}(?:\.(.+))?$/ );
$field ||= ( $string =~ /^{(.*?)}$/ )[0] || $string;
- my $cfid;
+ my ($cf, $cfid);
if ($queue) {
my $q = RT::Model::Queue->new;
$q->load($queue);
- my $cf;
if ( $q->id ) {
# $queue = $q->name; # should we normalize the queue?
@@ -1200,7 +1199,20 @@
$field = $cf->name;
}
} else {
- $queue = 0;
+ $queue = '';
+ my $cfs = RT::Model::CustomFieldCollection->new( current_user =>
+ $self->current_user );
+ $cfs->limit( column => 'name', value => $field );
+ $cfs->limit_to_lookup_type('RT::Model::Queue-RT::Model::Ticket');
+
+ # if there is more then one field the current user can
+ # see with the same name then we shouldn't return cf object
+ # as we don't know which one to use
+ $cf = $cfs->first;
+ if ( $cf ) {
+ $cf = undef if $cfs->next;
+ }
+ $cfid = $cf ? $cf->id : 0;
}
return ( $queue, $field, $cfid, $column );
More information about the Rt-commit
mailing list