[Rt-commit] rt branch, 4.4/unique-custom-fields, repushed

Shawn Moore shawn at bestpractical.com
Fri May 20 16:32:57 EDT 2016


The branch 4.4/unique-custom-fields was deleted and repushed:
       was 3cb75521659c698e61ada915c424d6f38e50731e
       now 080f81f5850b67f850d9a8062b97adbed0715e3e

1:  0d0362f ! 1:  a31e8a9 Add UniqueValues column to Custom Fields
    @@ -83,6 +83,61 @@
     diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
     --- a/lib/RT/CustomField.pm
     +++ b/lib/RT/CustomField.pm
    +@@
    + sub Create {
    +     my $self = shift;
    +     my %args = (
    +-        Name        => '',
    +-        Type        => '',
    +-        MaxValues   => 0,
    +-        Pattern     => '',
    +-        Description => '',
    +-        Disabled    => 0,
    +-        LookupType  => '',
    +-        LinkValueTo => '',
    ++        Name         => '',
    ++        Type         => '',
    ++        MaxValues    => 0,
    ++        Pattern      => '',
    ++        Description  => '',
    ++        Disabled     => 0,
    ++        LookupType   => '',
    ++        LinkValueTo  => '',
    +         IncludeContentForValue => '',
    +-        EntryHint   => undef,
    ++        EntryHint    => undef,
    ++        UniqueValues => 0,
    +         @_,
    +     );
    + 
    +@@
    +     $args{'Disabled'} ||= 0;
    + 
    +     (my $rv, $msg) = $self->SUPER::Create(
    +-        Name        => $args{'Name'},
    +-        Type        => $args{'Type'},
    +-        RenderType  => $args{'RenderType'},
    +-        MaxValues   => $args{'MaxValues'},
    +-        Pattern     => $args{'Pattern'},
    +-        BasedOn     => $args{'BasedOn'},
    +-        ValuesClass => $args{'ValuesClass'},
    +-        Description => $args{'Description'},
    +-        Disabled    => $args{'Disabled'},
    +-        LookupType  => $args{'LookupType'},
    ++        Name         => $args{'Name'},
    ++        Type         => $args{'Type'},
    ++        RenderType   => $args{'RenderType'},
    ++        MaxValues    => $args{'MaxValues'},
    ++        Pattern      => $args{'Pattern'},
    ++        BasedOn      => $args{'BasedOn'},
    ++        ValuesClass  => $args{'ValuesClass'},
    ++        Description  => $args{'Description'},
    ++        Disabled     => $args{'Disabled'},
    ++        LookupType   => $args{'LookupType'},
    ++        UniqueValues => $args{'UniqueValues'},
    +     );
    + 
    +     if ($rv) {
     @@
              {read => 1, write => 1, sql_type => 12, length => 255,  is_blob => 0,  is_numeric => 0,  type => 'varchar(255)', default => ''},
              EntryHint =>
2:  3cb7552 ! 2:  d6ec455 Enforce CustomField UniqueValues
    @@ -1,10 +1,6 @@
     Author: Shawn M Moore <shawn at bestpractical.com>
     
    -    First pass at limiting unique custom fields
    -    
    -        This doesn't handle the case where the OCFV sticks around
    -        but isn't the current value of a record. Probably need to join
    -        the $CF->LookupType table.
    +    Enforce CustomField UniqueValues
     
     diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
     --- a/lib/RT/CustomField.pm
    @@ -20,6 +16,7 @@
     +            Content      => $args{'Content'},
     +            LargeContent => $args{'LargeContent'},
     +            ContentType  => $args{'ContentType'},
    ++            Disabled     => 0,
     +        );
     +        if ($existing->Id) {
     +            $RT::Logger->debug( "Non-unique custom field value for CF #" . $self->Id ." with object custom field value " . $existing->Id );
    @@ -31,3 +28,4 @@
          my $newval = RT::ObjectCustomFieldValue->new( $self->CurrentUser );
          my ($val, $msg) = $newval->Create(
              ObjectType   => ref($obj),
    +
-:  ------- > 3:  080f81f Basic tests for unique custom field values



More information about the rt-commit mailing list