[Rt-commit] rt branch, 4.4/default-cfv-dupes, repushed

Shawn Moore shawn at bestpractical.com
Wed Dec 28 12:36:27 EST 2016


The branch 4.4/default-cfv-dupes was deleted and repushed:
       was d4ea52ad789de098ec421b6c20f4265a3bb17ca5
       now 1c5e67fdf07f106516fb74ac882fb4e23da01b1c

1:  d4ea52a ! 1:  1c5e67f Avoid using NamePrefix for CF fields on Defaults admin
    @@ -11,7 +11,8 @@
         means the browser submits multiple values for the same parameter in the
         form, ending up with ARRAY(0x...) in the default value.
         sync_grouped_custom_fields() keeps the current value in each of the
    -    duplicate form fields in sync on each change, and using the regular CF
    +    duplicate form fields in sync on each change (which is why this commit
    +    uses an arbitrary value out of %names), and using the regular CF
         form field name avoids the problem of duplicate parameters coalescing
         into an array reference by using distinct parameter names, as they
         include the custom field grouping name.
    @@ -41,16 +42,20 @@
      }
      elsif ( $ARGS{Update} ) {
     -    for my $cf_id ( map { /^Default-(\d+)-/ ? $1 : ()  } keys %ARGS ) {
    -+    for my $arg (keys %ARGS) {
    -+        my ($cf_id) = $arg =~ /^Object-RT::Asset-\d*-CustomField(?::\w+)?-(\d+)-Values?$/;
    -+        next unless $cf_id;
    ++    my $cfs = _ParseObjectCustomFieldArgs(\%ARGS)->{'RT::Asset'}{0};
    ++    for my $cf_id (keys %$cfs) {
    ++        # there may be multiple values submitted, pull out only the first,
    ++        # as our JS will make sure the values are synced
    ++        my %names = %{ $cfs->{$cf_id} };
    ++        my $value = $names{ (keys %names)[0] }{Value};
    ++
              my $cf = RT::CustomField->new($session{CurrentUser});
              $cf->Load($cf_id);
              if ( $cf->id && $cf->SupportDefaultValues ) {
                  my ($ret, $msg) = $cf->SetDefaultValues(
                      Object => $catalog,
     -                Values => $ARGS{'Default-' . $cf->id . '-Value'} // $ARGS{'Default-' . $cf->id . '-Values'},
    -+                Values => $ARGS{$arg},
    ++                Values => $value,
                  );
                  push @results, $msg;
              }
    @@ -110,9 +115,12 @@
              push @results, $msg;
          }
     -    for my $cf_id ( map { /^Default-(\d+)-/ ? $1 : ()  } keys %ARGS ) {
    -+    for my $arg (keys %ARGS) {
    -+        my ($cf_id) = $arg =~ /^Object-RT::Ticket-\d*-CustomField(?::\w+)?-(\d+)-Values?$/;
    -+        next unless $cf_id;
    ++    my $cfs = _ParseObjectCustomFieldArgs(\%ARGS)->{'RT::Ticket'}{0};
    ++    for my $cf_id (keys %$cfs) {
    ++        # there may be multiple values submitted, pull out only the first,
    ++        # as our JS will make sure the values are synced
    ++        my %names = %{ $cfs->{$cf_id} };
    ++        my $value = $names{ (keys %names)[0] }{Value};
     +
              my $cf = RT::CustomField->new($session{CurrentUser});
              $cf->Load($cf_id);
    @@ -120,7 +128,7 @@
                  my ($ret, $msg) = $cf->SetDefaultValues(
                      Object => $queue,
     -                Values => $ARGS{'Default-' . $cf->id . '-Value'} // $ARGS{'Default-' . $cf->id . '-Values'},
    -+                Values => $ARGS{$arg},
    ++                Values => $value,
                  );
                  push @results, $msg;
              }



More information about the rt-commit mailing list