[Rt-commit] rt branch, 4.0-trunk, updated. rt-4.0.13-133-g830c7b2

Alex Vandiver alexmv at bestpractical.com
Mon Jul 8 15:52:03 EDT 2013


The branch, 4.0-trunk has been updated
       via  830c7b2920d5cc5a9f34e9b978246f09a53f1f88 (commit)
       via  228451ce0c60bac20bf329d0896c7312db3af318 (commit)
       via  565b40eaf184d846c20da315b5247fd7c86c2e17 (commit)
       via  94aeca9f47f7923b8fe82c02e02d7f9e892716a7 (commit)
       via  be665348b78679d0a31900afb788517f9a10fda6 (commit)
       via  daf0a6c18f1ef822349e1d89d12be827b356d02e (commit)
       via  d39521de41ec430ddcaab92f7efbad0d93de77ac (commit)
       via  eb7dff164d3a37da0da73ca414c37fb91f42c4ba (commit)
       via  a9ae79a1ee31dff81b9712493da1cf9bbd39f488 (commit)
       via  f0ea5922e8c14114e3d1698f526634acff567dff (commit)
       via  5088509209ccc5ecdfe9e905959c3f4b096cb5ae (commit)
       via  7e5b1ccb0955d8c730d99a6a14b6cc05ec4b6960 (commit)
       via  e37801b72138e97fd23ad9e2a6e95d8ef96032d5 (commit)
      from  ee0712ae5cb0f9097ba2f68e97491589636f88c2 (commit)

Summary of changes:
 lib/RT/CustomField.pm                              |  55 ++++++-
 lib/RT/CustomFields.pm                             |  33 ++--
 lib/RT/Record.pm                                   |   2 +-
 lib/RT/Tickets.pm                                  | 166 ++++++++++++---------
 share/html/Search/Build.html                       |   8 +-
 share/html/Search/Elements/PickCFs                 |  12 +-
 share/html/Search/Elements/PickCriteria            |   5 +-
 .../Elements/PickTicketCFs}                        |  19 ++-
 t/shredder/utils.pl                                |   8 +-
 9 files changed, 198 insertions(+), 110 deletions(-)
 copy share/html/{Elements/ShowCustomFieldText => Search/Elements/PickTicketCFs} (82%)

- Log -----------------------------------------------------------------
commit 830c7b2920d5cc5a9f34e9b978246f09a53f1f88
Merge: ee0712a 228451c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 8 15:49:38 2013 -0400

    Merge branch '4.0/extensible-ticketsql-cf-limits' into 4.0-trunk
    
    Conflicts:
    	lib/RT/Tickets.pm
    	share/html/Search/Build.html

diff --cc lib/RT/Tickets.pm
index 4130062,b2480b0..480b8b3
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@@ -1317,30 -1319,39 +1319,39 @@@ Takes an optional second parameter of t
  =cut
  
  sub _CustomFieldDecipher {
-     my ($self, $string) = @_;
+     my ($self, $string, $lookuptype) = @_;
+     $lookuptype ||= $self->_SingularClass->CustomFieldLookupType;
+ 
 -    my ($object, $field, $column) = ($string =~ /^(?:(.+?)\.)?{(.+)}(?:\.(Content|LargeContent))?$/);
++    my ($object, $field, $column) = ($string =~ /^(?:(.+?)\.)?\{(.+)\}(?:\.(Content|LargeContent))?$/);
+     $field ||= ($string =~ /^{(.*?)}$/)[0] || $string;
  
-     my ($queue, $field, $column) = ($string =~ /^(?:(.+?)\.)?\{(.+)\}(?:\.(Content|LargeContent))?$/);
-     $field ||= ($string =~ /^\{(.*?)\}$/)[0] || $string;
+     my ($cf, $applied_to);
  
-     my $cf;
-     if ( $queue ) {
-         my $q = RT::Queue->new( $self->CurrentUser );
-         $q->Load( $queue );
+     if ( $object ) {
+         my $record_class = RT::CustomField->RecordClassFromLookupType($lookuptype);
+         $applied_to = $record_class->new( $self->CurrentUser );
+         $applied_to->Load( $object );
  
-         if ( $q->id ) {
-             # $queue = $q->Name; # should we normalize the queue?
-             $cf = $q->CustomField( $field );
+         if ( $applied_to->id ) {
+             RT->Logger->debug("Limiting to CFs identified by '$field' applied to $record_class #@{[$applied_to->id]} (loaded via '$object')");
          }
          else {
-             $RT::Logger->warning("Queue '$queue' doesn't exist, parsed from '$string'");
-             $queue = 0;
+             RT->Logger->warning("$record_class '$object' doesn't exist, parsed from '$string'");
+             $object = 0;
+             undef $applied_to;
          }
      }
-     elsif ( $field =~ /\D/ ) {
-         $queue = '';
+ 
+     if ( $field =~ /\D/ ) {
+         $object ||= '';
          my $cfs = RT::CustomFields->new( $self->CurrentUser );
-         $cfs->Limit( FIELD => 'Name', VALUE => $field );
-         $cfs->LimitToLookupType('RT::Queue-RT::Ticket');
+         $cfs->Limit( FIELD => 'Name', VALUE => $field, ($applied_to ? (CASESENSITIVE => 0) : ()) );
+         $cfs->LimitToLookupType($lookuptype);
+ 
+         if ($applied_to) {
+             $cfs->SetContextObject($applied_to);
+             $cfs->LimitToObjectId($applied_to->id);
+         }
  
          # if there is more then one field the current user can
          # see with the same name then we shouldn't return cf object

-----------------------------------------------------------------------


More information about the Rt-commit mailing list