From 8c5a780343e027058a51692d8b9b8140c88ce6c7 Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 1 Sep 2010 23:39:23 +0000 Subject: RT mandatory custom fields, RT#9260 --- rt/share/html/Admin/CustomFields/Modify.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'rt/share/html/Admin/CustomFields') diff --git a/rt/share/html/Admin/CustomFields/Modify.html b/rt/share/html/Admin/CustomFields/Modify.html index f75607a8d..d2932d2d9 100644 --- a/rt/share/html/Admin/CustomFields/Modify.html +++ b/rt/share/html/Admin/CustomFields/Modify.html @@ -118,6 +118,11 @@ % } +  + /> +<&|/l&>Required for ticket resolution + +   /> @@ -171,11 +176,12 @@ else { } if ( $ARGS{'Update'} && $id ne 'new' ) { - #we're asking about enabled on the web page but really care about disabled. $ARGS{'Disabled'} = $Disabled = $Enabled? 0 : 1; + + $ARGS{'Required'} ||= 0; - my @attribs = qw(Disabled Pattern Name TypeComposite LookupType Description LinkValueTo IncludeContentForValue); + my @attribs = qw(Disabled Required Pattern Name TypeComposite LookupType Description LinkValueTo IncludeContentForValue); push @results, UpdateRecordObject( AttributesRef => \@attribs, Object => $CustomFieldObj, @@ -222,6 +228,9 @@ $id = $CustomFieldObj->id if $CustomFieldObj->id; my $EnabledChecked = qq[checked="checked"]; $EnabledChecked = '' if $CustomFieldObj->Disabled; +my $RequiredChecked = ''; +$RequiredChecked = qq[checked="checked"] if $CustomFieldObj->Required; + my @CFvalidations = ( '(?#Mandatory).', '(?#Digits)^[\d.]+$', -- cgit v1.2.1 From 6889413a55f87e4b7f6b6637773f87a0de52b3b4 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 5 Oct 2010 17:32:24 +0000 Subject: prevent broken custom field values, RT#9959 --- rt/share/html/Admin/CustomFields/Modify.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'rt/share/html/Admin/CustomFields') diff --git a/rt/share/html/Admin/CustomFields/Modify.html b/rt/share/html/Admin/CustomFields/Modify.html index d2932d2d9..fc2c49d59 100644 --- a/rt/share/html/Admin/CustomFields/Modify.html +++ b/rt/share/html/Admin/CustomFields/Modify.html @@ -199,6 +199,15 @@ if ( $ARGS{'Update'} && $id ne 'new' ) { push (@results, $msg); } + # Clean up values + foreach my $param (grep /^$paramtag-/, keys(%ARGS)) { + for ($ARGS{$param}) { + s/\r+\n/\n/g; + s/^\s+//; + s/\s+$//; + } + } + # Update any existing values my $values = $CustomFieldObj->ValuesObj; while ( my $value = $values->Next ) { @@ -206,7 +215,6 @@ if ( $ARGS{'Update'} && $id ne 'new' ) { my $param = join("-", $paramtag, $value->Id, $attr); next unless exists $ARGS{$param}; next if ($value->$attr()||'') eq ($ARGS{$param}||''); - my $mutator = "Set$attr"; my ($id, $msg) = $value->$mutator( $ARGS{$param} ); push (@results, $msg); -- cgit v1.2.1