summaryrefslogtreecommitdiff
path: root/FS/FS/TicketSystem
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-07-16 15:43:42 -0500
committerJonathan Prykop <jonathan@freeside.biz>2016-08-14 19:16:38 -0500
commit0edd5b9d5c03f02341b1004888f0f712c8defb47 (patch)
tree6b0de01c7062d45ff852a88966e5764efb762ced /FS/FS/TicketSystem
parent630a48c51cc20dd2e2c2a09a61999e5a0ae3e5ba (diff)
RT#38973: Bill for time worked on ticket resolution [checkpoint, not ready for backport]
Diffstat (limited to 'FS/FS/TicketSystem')
-rw-r--r--FS/FS/TicketSystem/RT_Internal.pm47
1 files changed, 47 insertions, 0 deletions
diff --git a/FS/FS/TicketSystem/RT_Internal.pm b/FS/FS/TicketSystem/RT_Internal.pm
index ffee484..01806c1 100644
--- a/FS/FS/TicketSystem/RT_Internal.pm
+++ b/FS/FS/TicketSystem/RT_Internal.pm
@@ -255,7 +255,10 @@ sub _ticket_info {
}
$ticket_info{'owner'} = $t->OwnerObj->Name;
$ticket_info{'queue'} = $t->QueueObj->Name;
+ $ticket_info{'_cf_sort_order'} = {};
+ my $cf_sort = 0;
foreach my $CF ( @{ $t->CustomFields->ItemsArrayRef } ) {
+ $ticket_info{'_cf_sort_order'}{$CF->Name} = $cf_sort++;
my $name = 'CF.{'.$CF->Name.'}';
$ticket_info{$name} = $t->CustomFieldValuesAsString($CF->Id);
}
@@ -649,5 +652,49 @@ sub selfservice_priority {
}
}
+=item custom_fields
+
+Returns a hash of custom field names and descriptions.
+
+Accepts the following options:
+
+lookuptype - limit results to this lookuptype
+
+valuetype - limit results to this valuetype
+
+Fields must be visible to CurrentUser.
+
+=cut
+
+sub custom_fields {
+ my $self = shift;
+ my %opt = @_;
+ my $lookuptype = $opt{lookuptype};
+ my $valuetype = $opt{valuetype};
+
+ 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->UnLimit;
+
+ $CFs->Limit(FIELD => 'LookupType',
+ OPERATOR => 'ENDSWITH',
+ VALUE => $lookuptype)
+ if $lookuptype;
+
+ $CFs->Limit(FIELD => 'Type',
+ VALUE => $valuetype)
+ if $valuetype;
+
+ my @fields;
+ while (my $CF = $CFs->Next) {
+ push @fields, $CF->Name, ($CF->Description || $CF->Name);
+ }
+
+ return @fields;
+}
+
1;