summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2010-10-27 01:49:29 +0000
committermark <mark>2010-10-27 01:49:29 +0000
commit03870c8fda3909d8aeb9d7120bc1debc3935f1c3 (patch)
tree1efde8a5bf6d6a2b1ff20ded0e569028c636e075
parent314565233e336063494acdcbf22077043ce54d88 (diff)
RT ticket creation export to multiple queues, RT#10363
-rw-r--r--FS/FS/part_export/rt_ticket.pm94
-rw-r--r--httemplate/edit/part_export.cgi20
2 files changed, 89 insertions, 25 deletions
diff --git a/FS/FS/part_export/rt_ticket.pm b/FS/FS/part_export/rt_ticket.pm
index 87a06dcfd..534924eb0 100644
--- a/FS/FS/part_export/rt_ticket.pm
+++ b/FS/FS/part_export/rt_ticket.pm
@@ -14,6 +14,7 @@ my %templates;
my %queues;
my %template_select = (
type => 'select',
+ freeform => 1,
option_label => sub {
$templates{$_[0]};
},
@@ -29,39 +30,85 @@ my %template_select = (
},
);
+my %queue_select = (
+ type => 'select',
+ freeform => 1,
+ option_label => sub {
+ $queues{$_[0]};
+ },
+ option_values => sub {
+ %queues = (0 => '', FS::TicketSystem->queues());
+ sort {$queues{$a} cmp $queues{$b}} keys %queues;
+ },
+);
+
tie my %options, 'Tie::IxHash', (
- 'queue' => {
- label => 'Queue',
- type => 'select',
- option_label => sub {
- $queues{$_[0]};
- },
- option_values => sub {
- %queues = FS::TicketSystem->queues();
- sort {$queues{$a} cmp $queues{$b}} keys %queues;
- },
+ 'insert_queue' => {
+ before => '
+<TR><TD COLSPAN=2>
+<TABLE>
+ <TR><TH></TH><TH>Queue</TH><TH>Template</TH></TR>
+ <TR><TD>New service</TD><TD>',
+ %queue_select,
+ after => '</TD>'
},
'insert_template' => {
- label => 'Insert',
- %template_select
+ before => '<TD>',
+ %template_select,
+ after => '</TD></TR>
+',
},
- 'replace_template' => {
- label => 'Replace',
- %template_select
+ 'delete_queue' => {
+ before => '
+ <TR><TD>Delete</TD><TD>',
+ %queue_select,
+ after => '</TD>',
},
'delete_template' => {
- label => 'Delete',
- %template_select
+ before => '<TD>',
+ %template_select,
+ after => '</TD></TR>
+',
+ },
+ 'replace_queue' => {
+ before => '
+ <TR><TD>Modify</TD><TD>',
+ %queue_select,
+ after => '</TD>',
+ },
+ 'replace_template' => {
+ before => '<TD>',
+ %template_select,
+ after => '</TD></TR>
+',
+ },
+ 'suspend_queue' => {
+ before => '
+ <TR><TD>Suspend</TD><TD>',
+ %queue_select,
+ after => '</TD>',
},
'suspend_template' => {
- label => 'Suspend',
- %template_select
+ before => '<TD>',
+ %template_select,
+ after => '</TD></TR>
+',
+ },
+ 'unsuspend_queue' => {
+ before => '
+ <TR><TD>Unsuspend</TD><TD>',
+ %queue_select,
+ after => '</TD>',
},
'unsuspend_template' => {
- label => 'Unsuspend',
- %template_select
+ before => '<TD>',
+ %template_select,
+ after => '</TD></TR>
+ </TABLE>
+</TD></TR>',
},
'requestor' => {
+ freeform => 0,
label => 'Requestor',
'type' => 'select',
option_label => sub {
@@ -92,6 +139,9 @@ sub _export_ticket {
my $msgnum = $self->option($action.'_template');
return if !$msgnum;
+ my $queue = $self->option($action.'_queue');
+ return if !$queue;
+
my $msg_template = FS::msg_template->by_key($msgnum);
return "Template $msgnum not found\n" if !$msg_template;
@@ -121,7 +171,7 @@ sub _export_ticket {
my $err_or_ticket = FS::TicketSystem->create_ticket(
'', #session should already exist
- 'queue' => $self->option('queue'),
+ 'queue' => $queue,
'subject' => $msg{'subject'},
'requestor' => $requestor,
'message' => $msg{'html_body'},
diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi
index 8b697e142..a2fad56a3 100644
--- a/httemplate/edit/part_export.cgi
+++ b/httemplate/edit/part_export.cgi
@@ -77,7 +77,16 @@ my $widget = new HTML::Widgets::SelectLayers(
? $optinfo->{default}
: ''
);
- $html .= qq!<TR><TD ALIGN="right">$label</TD><TD>!;
+ # 'freeform': disables table formatting of options. Instead, each
+ # option can define "before" and "after" strings which are inserted
+ # around the selector.
+ my $freeform = $optinfo->{freeform};
+ if ( $freeform ) {
+ $html .= $optinfo->{before} || '';
+ }
+ else {
+ $html .= qq!<TR><TD ALIGN="right">$label</TD><TD>!;
+ }
if ( $type eq 'select' ) {
my $size = defined($optinfo->{size}) ? " SIZE=" . $optinfo->{size} : '';
my $multi = defined($optinfo->{multi}) ? ' MULTIPLE' : '';
@@ -108,7 +117,7 @@ my $widget = new HTML::Widgets::SelectLayers(
$html .= qq!<TEXTAREA NAME="$option" COLS=80 ROWS=8 WRAP="virtual">!.
encode_entities($value). '</TEXTAREA>';
} elsif ( $type eq 'text' ) {
- $html .= qq!<INPUT TYPE="text" NAME="$option" VALUE="!.
+ $html .= qq!<INPUT TYPE="text" NAME="$option" VALUE="!. #"
encode_entities($value). '" SIZE=64>';
} elsif ( $type eq 'checkbox' ) {
$html .= qq!<INPUT TYPE="checkbox" NAME="$option" VALUE="1"!;
@@ -117,7 +126,12 @@ my $widget = new HTML::Widgets::SelectLayers(
} else {
$html .= "unknown type $type";
}
- $html .= '</TD></TR>';
+ if ( $freeform ) {
+ $html .= $optinfo->{after} || '';
+ }
+ else {
+ $html .= '</TD></TR>';
+ }
}
$html .= '</TABLE>';