diff options
Diffstat (limited to 'rt/share/html/Admin/CustomFields/Modify.html')
| -rw-r--r-- | rt/share/html/Admin/CustomFields/Modify.html | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/rt/share/html/Admin/CustomFields/Modify.html b/rt/share/html/Admin/CustomFields/Modify.html index c94c560ec..5ef32127b 100644 --- a/rt/share/html/Admin/CustomFields/Modify.html +++ b/rt/share/html/Admin/CustomFields/Modify.html @@ -82,6 +82,14 @@ Default => $CustomFieldObj->LookupType, &> </td></tr> +% if ( $CustomFieldObj->Id +% and $CustomFieldObj->LookupType =~ /RT::Transaction/ ) { +<tr><td class="label"><&|/l&>Display with</&></td> +<td><& /Admin/Elements/EditCustomFieldUILocation, + CustomField => $CustomFieldObj &> +</td></tr> +% } + <tr><td class="label"><&|/l&>Validation</&></td> <td><& /Widgets/ComboBox, Name => 'Pattern', @@ -119,6 +127,11 @@ % } <tr><td class="label"> </td><td> +<input type="checkbox" class="checkbox" name="Required" value="1" <% $RequiredChecked |n%> /> +<&|/l&>Required for ticket resolution</&> +</td></tr> + +<tr><td class="label"> </td><td> <input type="hidden" class="hidden" name="SetEnabled" value="1" /> <input type="checkbox" class="checkbox" name="Enabled" value="1" <% $EnabledChecked |n%> /> <&|/l&>Enabled (Unchecking this box disables this custom field)</&> @@ -171,11 +184,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, @@ -185,6 +199,8 @@ if ( $ARGS{'Update'} && $id ne 'new' ) { $CustomFieldObj->SetBasedOn( $BasedOn ); + $CustomFieldObj->SetUILocation( $UILocation ); + my $paramtag = "CustomField-". $CustomFieldObj->Id ."-Value"; # Delete any fields that want to be deleted foreach my $key ( keys %ARGS ) { @@ -193,6 +209,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 ) { @@ -202,7 +227,6 @@ if ( $ARGS{'Update'} && $id ne 'new' ) { $ARGS{$param} =~ s/^\s+//; $ARGS{$param} =~ s/\s+$//; next if ($value->$attr()||'') eq ($ARGS{$param}||''); - my $mutator = "Set$attr"; my ($id, $msg) = $value->$mutator( $ARGS{$param} ); push (@results, $msg); @@ -226,6 +250,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.]+$', @@ -250,4 +277,5 @@ $ValuesClass => 'RT::CustomFieldValues' $LinkValueTo => undef $IncludeContentForValue => undef $BasedOn => undef +$UILocation => undef </%ARGS> |
