- my @values = ();
- if ( ref $value eq 'ARRAY' ) {
- @values = @$value;
- } elsif ( $CF->Type =~ /text/i ) {
- @values = ($value);
- } else {
- @values = split /\r*\n/, ( defined $value ? $value : '');
+ $m->notes(('Field-' . $CF->Id) => $submitted->{Values} // $submitted->{Value});
+
+ my @values = _NormalizeObjectCustomFieldValue(
+ CustomField => $CF,
+ Value => ($submitted->{Values} // $submitted->{Value} // $submitted->{Upload}),
+ );
+ if ($CF->Type =~ /^Date(?:Time)?$/) {
+ if (not @values) {
+ my $values = $Object->CustomFieldValues($CF->Id);
+ while (my $ocfv = $values->Next) {
+ push @values, $ocfv->Content;
+ }
+ }
+ @values = grep {
+ my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
+ $DateObj->Set(
+ Format => 'unknown',
+ Value => $_,
+ ($CF->Type eq "Date" ? (Timezone => 'utc') : ())
+ );
+ $DateObj->IsSet
+ } @values;