[Rt-commit] rt branch, 4.2-trunk, updated. rt-4.2.4-96-g254e615

Alex Vandiver alexmv at bestpractical.com
Fri May 30 14:07:40 EDT 2014


The branch, 4.2-trunk has been updated
       via  254e6155c61a252cd8b8a1e2482af39fc080757d (commit)
       via  ad4294ae5e51aa6e815f59d13ce7975cd934293f (commit)
       via  713df3ba3387a1ccd8733541e754f45d2ac122d2 (commit)
       via  2c95572fd6975e58d78ce0e4bb02f6c0b0d439fe (commit)
       via  fb1fecb5943704590268cf2aa0708c3bec96254a (commit)
       via  35d6c986a3b0f487f8d5cafc84fe1c628e2a9bdd (commit)
       via  24c2534a3afe01cbd3cfd4624732e9d01764fc27 (commit)
       via  1133ba4cba56df0d1986af64b16e2ea62c889f74 (commit)
       via  5e473ab55ba1353890bb53ca8f83e239bfff46f8 (commit)
       via  43945ccae1fee7eae759f3ed59cb93ea0502bb61 (commit)
       via  e03fff3d75acc2763d1e4d20855b96f142849639 (commit)
       via  2f420f0e5d4a059c458613427aa9fab0ed00f9f5 (commit)
       via  761d7472d205c68cbed4a5a74221d0f23764fa63 (commit)
       via  a6c136ec7ded8ba19f9f0bcefa6fed1170881304 (commit)
       via  0fa56055533b55d23b197022bdf6e9b4f687a242 (commit)
       via  7232c56f5822d5770cf1823cd25bf65f6ca7affc (commit)
       via  8cfb6206b643984d0f8fca8ed5544fd0ecfc5c7c (commit)
       via  85315d8826d2bb47f91670097a5be339e17e7c1c (commit)
       via  2742ef9bb5e8df89d9839a8b28ddd3413e689731 (commit)
       via  cdcc4929605d37dfe84d264199b219872573f6c0 (commit)
       via  ffc51a3253f1fffe1a5ff09fac01d4548c303979 (commit)
       via  902cde6f2294f3909cabbcb8596f492be4a864e4 (commit)
       via  79b4a58dd0f9270a29b35206c4e5ef0974fa774e (commit)
       via  4b881724cb477a1618b65e81863f107bf5890818 (commit)
      from  5ab4598801ce5bf78a0d664909e8618e91b80f7a (commit)

Summary of changes:
 docs/backups.pod                           |   2 +-
 docs/customizing/search_result_columns.pod | 180 +++++++++++++++++++++++++++++
 docs/full_text_indexing.pod                |  21 +++-
 lib/RT/Interface/Web.pm                    |  22 ++--
 lib/RT/ObjectCustomFieldValues.pm          |  38 +++++-
 lib/RT/Record.pm                           |  34 ++----
 lib/RT/Test.pm                             |   5 +-
 sbin/rt-fulltext-indexer.in                |  16 ++-
 sbin/rt-test-dependencies.in               |   5 +-
 t/customfields/repeated_values.t           | 134 +++++++++++++++++++++
 10 files changed, 407 insertions(+), 50 deletions(-)
 create mode 100644 docs/customizing/search_result_columns.pod
 create mode 100644 t/customfields/repeated_values.t

- Log -----------------------------------------------------------------
commit 254e6155c61a252cd8b8a1e2482af39fc080757d
Merge: 5ab4598 ad4294a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri May 30 13:31:34 2014 -0400

    Merge branch '4.0-trunk' into 4.2-trunk
    
    Conflicts:
    	etc/RT_Config.pm.in
    	etc/RT_SiteConfig.pm
    	sbin/rt-test-dependencies.in
    	share/html/Admin/Elements/EditRights
    
    	share/html/Search/Bulk.html
    
        Bulk CF update moved to ProcessRecordBulkCustomFields in
        RT::Interface::Web in 4.2; move the change to there.  It also
        requires protecting the new "update a single value" (added in
        bcb8f0f6) case to skip if HasEntry.  Finally, drop the Repeated
        check, as the Repeated column was removed in d28b0a67.

diff --cc lib/RT/Interface/Web.pm
index c1eb0e1,b1f8429..e7dfa8e
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@@ -3602,95 -3120,6 +3602,89 @@@ sub ProcessTransactionSquelching 
      return %squelched;
  }
  
 +sub ProcessRecordBulkCustomFields {
 +    my %args = (RecordObj => undef, ARGSRef => {}, @_);
 +
 +    my $ARGSRef = $args{'ARGSRef'};
 +
 +    my %data;
 +
 +    my @results;
 +    foreach my $key ( keys %$ARGSRef ) {
 +        next unless $key =~ /^Bulk-(Add|Delete)-CustomField-(\d+)-(.*)$/;
 +        my ($op, $cfid, $rest) = ($1, $2, $3);
 +        next if $rest =~ /-Category$/;
 +
 +        my $res = $data{$cfid} ||= {};
 +        unless (keys %$res) {
 +            my $cf = RT::CustomField->new( $session{'CurrentUser'} );
 +            $cf->Load( $cfid );
 +            next unless $cf->Id;
 +
 +            $res->{'cf'} = $cf;
 +        }
 +
 +        if ( $op eq 'Delete' && $rest eq 'AllValues' ) {
 +            $res->{'DeleteAll'} = $ARGSRef->{$key};
 +            next;
 +        }
 +
 +        my @values = _NormalizeObjectCustomFieldValue(
 +            CustomField => $res->{'cf'},
 +            Value => $ARGSRef->{$key},
 +            Param => $key,
 +        );
 +        next unless @values;
 +        $res->{$op} = \@values;
 +    }
 +
 +    while ( my ($cfid, $data) = each %data ) {
++        my $current_values = $args{'RecordObj'}->CustomFieldValues( $cfid );
++
 +        # just add one value for fields with single value
 +        if ( $data->{'Add'} && $data->{'cf'}->MaxValues == 1 ) {
++            next if $current_values->HasEntry($data->{Add}[-1]);
++
 +            my ( $id, $msg ) = $args{'RecordObj'}->AddCustomFieldValue(
 +                Field => $cfid,
 +                Value => $data->{'Add'}[-1],
 +            );
 +            push @results, $msg;
 +            next;
 +        }
 +
-         my $current_values = $args{'RecordObj'}->CustomFieldValues( $cfid );
 +        if ( $data->{'DeleteAll'} ) {
 +            while ( my $value = $current_values->Next ) {
 +                my ( $id, $msg ) = $args{'RecordObj'}->DeleteCustomFieldValue(
 +                    Field   => $cfid,
 +                    ValueId => $value->id,
 +                );
 +                push @results, $msg;
 +            }
 +        }
 +        foreach my $value ( @{ $data->{'Delete'} || [] } ) {
-             # Convert for timezone. Without converstion,
-             # HasEntry and DeleteCustomFieldValue fail because
-             # the value in the DB is converted.
-             if ($data->{'cf'}->Type eq 'DateTime' or $data->{'cf'}->Type eq 'Date') {
-                 my $DateObj = RT::Date->new( $session{'CurrentUser'} );
-                 $DateObj->Set( Format => 'unknown',
-                                Value  => $value );
-                 $value = $data->{'cf'}->Type eq 'DateTime' ? $DateObj->ISO
-                     : $DateObj->ISO(Time => 0, Seconds => 0);
-             }
-             next unless $current_values->HasEntry($value);
++            my $entry = $current_values->HasEntry($value);
++            next unless $entry;
 +
 +            my ( $id, $msg ) = $args{'RecordObj'}->DeleteCustomFieldValue(
-                 Field => $cfid,
-                 Value => $value
++                Field   => $cfid,
++                ValueId => $entry->id,
 +            );
 +            push @results, $msg;
 +        }
 +        foreach my $value ( @{ $data->{'Add'} || [] } ) {
 +            next if $current_values->HasEntry($value);
 +
 +            my ( $id, $msg ) = $args{'RecordObj'}->AddCustomFieldValue(
 +                Field => $cfid,
 +                Value => $value
 +            );
 +            push @results, $msg;
 +        }
 +    }
 +    return @results;
 +}
 +
  =head2 _UploadedFile ( $arg );
  
  Takes a CGI parameter name; if a file is uploaded under that name,
diff --cc lib/RT/Record.pm
index 9f12722,45ec7cf..3da6608
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@@ -2089,6 -1817,13 +2072,11 @@@ sub _AddCustomFieldValue 
  
      # otherwise, just add a new value and record "new value added"
      else {
 -        if ( !$cf->Repeated ) {
 -            my $values = $cf->ValuesForObject($self);
 -            if ( my $entry = $values->HasEntry($args{'Value'}, $args{'LargeContent'}) ) {
 -                return $entry->id;
 -            }
++        my $values = $cf->ValuesForObject($self);
++        if ( my $entry = $values->HasEntry($args{'Value'}, $args{'LargeContent'}) ) {
++            return $entry->id;
+         }
+ 
          my ($new_value_id, $msg) = $cf->AddValueForObject(
              Object       => $self,
              Content      => $args{'Value'},
diff --cc sbin/rt-test-dependencies.in
index 2e9e59c,7506713..f48c921
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@@ -205,103 -195,119 +205,103 @@@ Devel::StackTrace 1.1
  Digest::base
  Digest::MD5 2.27
  Digest::SHA
 -DBI 1.37
 -Class::ReturnValue 0.40
 -DBIx::SearchBuilder 1.59
 -Text::Template 1.44
 +Email::Address 1.897
 +Email::Address::List 0.02
 +Encode 2.39
 +Errno
 +File::Glob
  File::ShareDir
  File::Spec 0.8
 +File::Temp 0.19
 +HTML::Entities
 +HTML::FormatText::WithLinks 0.14
 +HTML::FormatText::WithLinks::AndTables
 +HTML::Mason 1.43
 +HTML::Mason::PSGIHandler 0.52
  HTML::Quoted
 +HTML::RewriteAttributes 0.05
  HTML::Scrubber 0.08
 -HTML::TreeBuilder
 -HTML::FormatText
 -Log::Dispatch 2.23
 -Sys::Syslog 0.16
 +HTTP::Message 6.0
 +IPC::Run3
 +JSON
 +LWP::Simple
 +List::MoreUtils
  Locale::Maketext 1.06
 +Locale::Maketext::Fuzzy 0.11
  Locale::Maketext::Lexicon 0.32
 -Locale::Maketext::Fuzzy
 -MIME::Entity 5.425
 +Log::Dispatch 2.30
 +Mail::Header 2.12
  Mail::Mailer 1.57
 -Email::Address
 -Text::Wrapper 
 -Time::ParseDate
 -Time::HiRes 
 -File::Temp 0.19
 -Text::Quoted 2.02
 -Tree::Simple 1.04
 -UNIVERSAL::require
 -Regexp::Common
 -Scalar::Util
 +MIME::Entity 5.504
 +Module::Refresh 0.03
  Module::Versions::Report 1.05
 -Cache::Simple::TimedExpiry
 -Encode 2.39
 -CSS::Squish 0.06
 -File::Glob
 -Devel::StackTrace 1.19
 -Text::Password::Pronounceable
 -Devel::GlobalDestruction
 -List::MoreUtils
  Net::CIDR
 +Plack 1.0002
 +Plack::Handler::Starlet
 +Regexp::Common
  Regexp::Common::net::CIDR
  Regexp::IPv6
 -.
 -
 -$deps{'MASON'} = [ text_to_hash( << '.') ];
 -HTML::Mason 1.43
 -Errno
 -Digest::MD5 2.27
 -CGI::Cookie 1.20
 +Role::Basic 0.12
 +Scalar::Util
  Storable 2.08
 -Apache::Session 1.53
 -XML::RSS 1.05
 +Symbol::Global::Name 0.04
 +Sys::Syslog 0.16
 +Text::Password::Pronounceable
 +Text::Quoted 2.07
 +Text::Template 1.44
  Text::WikiFormat 0.76
 -CSS::Squish 0.06
 -Devel::StackTrace 1.19
 -JSON
 -IPC::Run3
 -.
 -
 -$deps{'PSGI'} = [ text_to_hash( << '.') ];
 -CGI 3.38
 -CGI::PSGI 0.12
 -HTML::Mason::PSGIHandler 0.52
 -Plack 0.9971
 -Plack::Handler::Starlet
 -CGI::Emulate::PSGI
 +Text::Wrapper
 +Time::HiRes
 +Time::ParseDate
 +Tree::Simple 1.04
 +UNIVERSAL::require
 +XML::RSS 1.05
  .
 -set_dep( PSGI => CGI => 4.00 ) if $] > 5.019003;
 -
 +set_dep( CORE => 'Symbol::Global::Name' => 0.05 ) if $] >= 5.019003;
- 
++set_dep( CORE => CGI => 4.00 )                    if $] > 5.019003;
  
  $deps{'MAILGATE'} = [ text_to_hash( << '.') ];
 -Getopt::Long
 -LWP::UserAgent
 -Pod::Usage
 -.
 -
 -$deps{'SSL-MAILGATE'} = [ text_to_hash( << '.') ];
  Crypt::SSLeay
 -Net::SSL
 -LWP::UserAgent 6.0
 +Getopt::Long
  LWP::Protocol::https
 +LWP::UserAgent 6.0
  Mozilla::CA
 +Net::SSL
 +Pod::Usage
  .
  
  $deps{'CLI'} = [ text_to_hash( << '.') ];
  Getopt::Long 2.24
 -LWP
  HTTP::Request::Common
 -Text::ParseWords
 -Term::ReadLine
 +LWP
  Term::ReadKey
 +Term::ReadLine
 +Text::ParseWords
  .
  
 -$deps{'DEV'} = [ text_to_hash( << '.') ];
 +$deps{'DEVELOPER'} = [ text_to_hash( << '.') ];
  Email::Abstract
 -Test::Email
 -HTML::Form
 -HTML::TokeParser
 -WWW::Mechanize 1.52
 -Test::WWW::Mechanize 1.30
 -Module::Refresh 0.03
 -Test::Expect 0.31
 -XML::Simple
  File::Find
 -Test::Deep 0 # needed for shredder tests
 -String::ShellQuote 0 # needed for gnupg-incoming.t
 -Log::Dispatch::Perl
 -Test::Warn
 -Test::Builder 0.90 # needed for is_passing
 -Test::MockTime
 +File::Which
 +Locale::PO
  Log::Dispatch::Perl
 -Test::WWW::Mechanize::PSGI
 +Mojo::DOM
- Plack::Middleware::Test::StashWarnings 0.06
+ Plack::Middleware::Test::StashWarnings 0.08
 +Set::Tiny
 +String::ShellQuote 0 # needed for gnupg-incoming.t
 +Test::Builder 0.90 # needed for is_passing
 +Test::Deep 0 # needed for shredder tests
 +Test::Email
 +Test::Expect 0.31
  Test::LongString
 +Test::MockTime
  Test::NoWarnings
 -Locale::PO
 +Test::Pod
 +Test::Warn
 +Test::WWW::Mechanize 1.30
 +Test::WWW::Mechanize::PSGI
 +WWW::Mechanize 1.52
 +XML::Simple
  .
  
  $deps{'FASTCGI'} = [ text_to_hash( << '.') ];
@@@ -456,7 -461,8 +456,8 @@@ sub test_dep 
          print $module, ': ', $version || 0, "\n"; 
      }
      else {
+         no warnings 'deprecated';
 -        eval "use $module $version ()";
 +        eval "{ local \$ENV{__WARN__}; use $module $version () }";
          if ( my $error = $@ ) {
              return 0 unless wantarray;
  

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


More information about the rt-commit mailing list