summaryrefslogtreecommitdiff
path: root/httemplate/edit/part_export.cgi
diff options
context:
space:
mode:
authorivan <ivan>2002-04-11 22:05:31 +0000
committerivan <ivan>2002-04-11 22:05:31 +0000
commita7c1b602f88c177db34477ed4cdc1f72603f8995 (patch)
tree116d090127ee48b041eeb9ff21a0d62c0c768250 /httemplate/edit/part_export.cgi
parent52a07a405e197fda1654fc61eefa538450f269e8 (diff)
(almost) everything for bug#375 - create export_svc table - part_svc to
part_export is now properly many-to-many, not one-to-many still need to finish service editing (choosing exports) in httemplate/edit/part_svc.cgi and httemplate/edti/process/part_svc.cgi and do somethinga about that manual $svcdb = 'svc_acct' in httemplate/edit/part_export.cgi (do part_export records need a svcdb? probably not... should be able to just pass an svcdb on creation of new exports, move the big %exports hash into part_export.pm and allow httemplate/edit/part_svc.cgi to query it for exports that can apply to a given svcdb....
Diffstat (limited to 'httemplate/edit/part_export.cgi')
-rw-r--r--httemplate/edit/part_export.cgi39
1 files changed, 9 insertions, 30 deletions
diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi
index 0ca964e..f312740 100644
--- a/httemplate/edit/part_export.cgi
+++ b/httemplate/edit/part_export.cgi
@@ -6,34 +6,18 @@
#} else {
# $cgi->param('clone', '');
#}
-#if ( $cgi->param('svcpart') && $cgi->param('svcpart') =~ /^(\d+)$/ ) {
-# $cgi->param('svcpart', $1);
-#} else {
-# $cgi->param('svcpart', '');
-#}
my($query) = $cgi->keywords;
my $action = '';
my $part_export = '';
-my $options = {};
if ( $cgi->param('error') ) {
$part_export = new FS::part_export ( {
map { $_, scalar($cgi->param($_)) } fields('part_export')
} );
-}
-
-#warn "***$query***";
-if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
- $action = 'Add';
- my $old_part_export = qsearchs('part_export', { 'exportnum' => $1 } );
- unless ( $part_export ) {
- ($part_export, $options) = $old_part_export->clone($cgi->param('svcpart'));
- }
-} elsif ( $cgi->param('new_with_svcpart')
- && $cgi->param('new_with_svcpart') =~ /^(\d+)$/ ) {
- $part_export ||= new FS::part_export ( { 'svcpart' => $1 } );
} elsif ( $query =~ /^(\d+)$/ ) {
- $part_export ||= qsearchs('part_export', { 'exportnum' => $1 } );
+ $part_export = qsearchs('part_export', { 'exportnum' => $1 } );
+} else {
+ $part_export = new FS::part_export;
}
$action ||= $part_export->exportnum ? 'Edit' : 'Add';
@@ -101,18 +85,20 @@ my %exports = (
);
-my $svcdb = $part_export->part_svc->svcdb;
+#my $svcdb = $part_export->part_svc->svcdb;
+#YUCK
+my $svcdb = 'svc_acct';
+
my %layers = map { $_ => "$_ - ". $exports{$svcdb}{$_}{desc} }
keys %{$exports{$svcdb}};
$layers{''}='';
my $widget = new HTML::Widgets::SelectLayers(
'selected_layer' => $part_export->exporttype,
- 'selected_layer' => $part_export->exporttype,
'options' => \%layers,
'form_name' => 'dummy',
'form_action' => 'process/part_export.cgi',
- 'form_text' => [qw( exportnum svcpart machine )],
+ 'form_text' => [qw( exportnum machine )],
# 'form_checkbox' => [qw()],
'html_between' => "</TD></TR></TABLE>\n",
'layer_callback' => sub {
@@ -123,7 +109,7 @@ my $widget = new HTML::Widgets::SelectLayers(
# foreach my $option ( qw(url login password groupID ) ) {
my $optinfo = $exports{$svcdb}->{$layer}{options}{$option};
my $label = $optinfo->{label};
- my $value = $part_export->option($option);
+ my $value = $cgi->param($option) || $part_export->option($option);
$html .= qq!<TR><TD ALIGN="right">$label</TD><TD>!.
qq!<TD><INPUT TYPE="text" NAME="$option" VALUE="$value"></TD>!.
'</TR>';
@@ -160,13 +146,6 @@ my $widget = new HTML::Widgets::SelectLayers(
<%= ntable("#cccccc",2) %>
<TR>
- <TD ALIGN="right">Service</TD>
- <TD BGCOLOR="#ffffff">
- <%= $part_export->svcpart %> - <%= $part_export->part_svc->svc %>
- <INPUT TYPE="hidden" NAME="svcpart" VALUE="<%= $part_export->svcpart %>">
- </TD>
-</TR>
-<TR>
<TD ALIGN="right">Export host</TD>
<TD>
<INPUT TYPE="text" NAME="machine" VALUE="<%= $part_export->machine %>">