projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3145652
)
RT ticket creation export to multiple queues, RT#10363
author
mark
<mark>
Wed, 27 Oct 2010 01:49:29 +0000
(
01:49
+0000)
committer
mark
<mark>
Wed, 27 Oct 2010 01:49:29 +0000
(
01:49
+0000)
FS/FS/part_export/rt_ticket.pm
patch
|
blob
|
history
httemplate/edit/part_export.cgi
patch
|
blob
|
history
diff --git
a/FS/FS/part_export/rt_ticket.pm
b/FS/FS/part_export/rt_ticket.pm
index
87a06dc
..
534924e
100644
(file)
--- 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',
my %queues;
my %template_select = (
type => 'select',
+ freeform => 1,
option_label => sub {
$templates{$_[0]};
},
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', (
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' => {
},
'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' => {
},
'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' => {
},
'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' => {
},
'unsuspend_template' => {
- label => 'Unsuspend',
- %template_select
+ before => '<TD>',
+ %template_select,
+ after => '</TD></TR>
+ </TABLE>
+</TD></TR>',
},
'requestor' => {
},
'requestor' => {
+ freeform => 0,
label => 'Requestor',
'type' => 'select',
option_label => sub {
label => 'Requestor',
'type' => 'select',
option_label => sub {
@@
-92,6
+139,9
@@
sub _export_ticket {
my $msgnum = $self->option($action.'_template');
return if !$msgnum;
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;
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
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'},
'subject' => $msg{'subject'},
'requestor' => $requestor,
'message' => $msg{'html_body'},
diff --git
a/httemplate/edit/part_export.cgi
b/httemplate/edit/part_export.cgi
index
8b697e1
..
a2fad56
100644
(file)
--- a/
httemplate/edit/part_export.cgi
+++ b/
httemplate/edit/part_export.cgi
@@
-77,7
+77,16
@@
my $widget = new HTML::Widgets::SelectLayers(
? $optinfo->{default}
: ''
);
? $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' : '';
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!<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"!;
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";
}
} else {
$html .= "unknown type $type";
}
- $html .= '</TD></TR>';
+ if ( $freeform ) {
+ $html .= $optinfo->{after} || '';
+ }
+ else {
+ $html .= '</TD></TR>';
+ }
}
$html .= '</TABLE>';
}
$html .= '</TABLE>';