diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-07-16 15:43:42 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-08-23 21:08:46 -0500 |
commit | 3f9532d7ae26b995d2292568801122050dc4b989 (patch) | |
tree | 17aca432542d4616283531f542026f557835ee26 /httemplate | |
parent | f6a37fa1d6a30484ce8a268de170ecc8d5c31a23 (diff) |
RT#38973: Bill for time worked on ticket resolution [checkpoint, not ready for backport]
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/part_pkg.cgi | 10 | ||||
-rw-r--r-- | httemplate/elements/select-rt-customfield.html | 34 |
2 files changed, 25 insertions, 19 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index eed466ee2..7b1e864f5 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -867,6 +867,16 @@ my $html_bottom = sub { : '' ). '>'; + } elsif ( $href->{$field}{'type'} eq 'select-rt-customfield' ) { + + $html .= include('/elements/select-rt-customfield.html', + 'name' => $layer.'__'.$field, + 'curr_value' => $options{$field}, + map { $_ => $href->{$field}{$_} } + grep { $_ !~ /^(name|type|parse)$/ } + keys %{ $href->{$field} } + ); + } elsif ( $href->{$field}{'type'} eq 'select-rate' ) { $html .= include('/elements/select-rate.html', diff --git a/httemplate/elements/select-rt-customfield.html b/httemplate/elements/select-rt-customfield.html index 85758d585..488accac3 100644 --- a/httemplate/elements/select-rt-customfield.html +++ b/httemplate/elements/select-rt-customfield.html @@ -1,31 +1,27 @@ -<SELECT NAME="<% $opt{name} %>"> +<SELECT NAME="<% $opt{'name'} %>"<% $opt{'multiple'} ? ' MULTIPLE' : '' %>> % while ( @fields ) { -<OPTION VALUE="<% shift @fields %>"><% shift @fields %></OPTION> +% my $value = shift @fields; +% my $label = shift @fields; +<OPTION VALUE="<% $value %>"<% $curr_value{$value} ? ' SELECTED' : '' %>><% $label %></OPTION> % } </SELECT> <%init> my %opt = @_; -my $lookuptype = $opt{lookuptype}; -my $valuetype = $opt{valuetype}; -# get a list of TimeValue-type custom fields -my $CurrentUser = RT::CurrentUser->new(); -$CurrentUser->LoadByName($FS::CurrentUser::CurrentUser->username); -die "RT not configured" unless $CurrentUser->id; -my $CFs = RT::CustomFields->new($CurrentUser); -$CFs->Limit(FIELD => 'LookupType', - OPERATOR => 'ENDSWITH', - VALUE => $lookuptype) - if $lookuptype; - -$CFs->Limit(FIELD => 'Type', - VALUE => $valuetype) - if $valuetype; +my %curr_value = map { $_ => 1 } split(', ',$opt{'curr_value'}); my @fields; push @fields, '', $opt{empty_label} if exists($opt{empty_label}); -while (my $CF = $CFs->Next) { - push @fields, $CF->Name, ($CF->Description || $CF->Name); +my $conf = new FS::Conf; + +if ($conf->config('ticket_system') eq 'RT_Internal') { + + push @fields, FS::TicketSystem->custom_fields( + lookuptype => $opt{lookuptype}, + valuetype => $opt{valuetype}, + ); + } + </%init> |