summaryrefslogtreecommitdiff
path: root/httemplate/edit/process
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit/process')
-rwxr-xr-xhttemplate/edit/process/addr_block/add.cgi20
-rwxr-xr-xhttemplate/edit/process/addr_block/allocate.cgi25
-rwxr-xr-xhttemplate/edit/process/addr_block/deallocate.cgi24
-rwxr-xr-xhttemplate/edit/process/addr_block/split.cgi19
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi4
-rwxr-xr-xhttemplate/edit/process/cust_main_county.cgi6
-rw-r--r--httemplate/edit/process/generic.cgi70
-rwxr-xr-xhttemplate/edit/process/part_svc.cgi2
-rw-r--r--httemplate/edit/process/router.cgi67
-rwxr-xr-xhttemplate/edit/process/svc_acct_sm.cgi34
-rw-r--r--httemplate/edit/process/svc_broadband.cgi45
-rwxr-xr-xhttemplate/edit/process/svc_external.cgi29
12 files changed, 42 insertions, 303 deletions
diff --git a/httemplate/edit/process/addr_block/add.cgi b/httemplate/edit/process/addr_block/add.cgi
deleted file mode 100755
index 34d799ccd..000000000
--- a/httemplate/edit/process/addr_block/add.cgi
+++ /dev/null
@@ -1,20 +0,0 @@
-<%
-
-my $error = '';
-my $ip_gateway = $cgi->param('ip_gateway');
-my $ip_netmask = $cgi->param('ip_netmask');
-
-my $new = new FS::addr_block {
- ip_gateway => $ip_gateway,
- ip_netmask => $ip_netmask,
- routernum => 0 };
-
-$error = $new->insert;
-
-if ( $error ) {
- $cgi->param('error', $error);
- print $cgi->redirect(popurl(4). "browse/addr_block.cgi?". $cgi->query_string );
-} else {
- print $cgi->redirect(popurl(4). "browse/addr_block.cgi");
-}
-%>
diff --git a/httemplate/edit/process/addr_block/allocate.cgi b/httemplate/edit/process/addr_block/allocate.cgi
deleted file mode 100755
index 85b0d7a7a..000000000
--- a/httemplate/edit/process/addr_block/allocate.cgi
+++ /dev/null
@@ -1,25 +0,0 @@
-<%
-my $error = '';
-my $blocknum = $cgi->param('blocknum');
-my $routernum = $cgi->param('routernum');
-
-my $addr_block = qsearchs('addr_block', { blocknum => $blocknum });
-my $router = qsearchs('router', { routernum => $routernum });
-
-if($addr_block) {
- if ($router) {
- $error = $addr_block->allocate($router);
- } else {
- $error = "Cannot find router with routernum $routernum";
- }
-} else {
- $error = "Cannot find block with blocknum $blocknum";
-}
-
-if ( $error ) {
- $cgi->param('error', $error);
- print $cgi->redirect(popurl(4). "browse/addr_block.cgi?" . $cgi->query_string);
-} else {
- print $cgi->redirect(popurl(4). "browse/addr_block.cgi");
-}
-%>
diff --git a/httemplate/edit/process/addr_block/deallocate.cgi b/httemplate/edit/process/addr_block/deallocate.cgi
deleted file mode 100755
index cfb7ed04d..000000000
--- a/httemplate/edit/process/addr_block/deallocate.cgi
+++ /dev/null
@@ -1,24 +0,0 @@
-<%
-my $error = '';
-my $blocknum = $cgi->param('blocknum');
-
-my $addr_block = qsearchs('addr_block', { blocknum => $blocknum });
-
-if($addr_block) {
- my $router = $addr_block->router;
- if ($router) {
- $error = $addr_block->deallocate($router);
- } else {
- $error = "Block is not allocated to a router";
- }
-} else {
- $error = "Cannot find block with blocknum $blocknum";
-}
-
-if ( $error ) {
- $cgi->param('error', $error);
- print $cgi->redirect(popurl(4). "browse/addr_block.cgi?" . $cgi->query_string);
-} else {
- print $cgi->redirect(popurl(4). "browse/addr_block.cgi");
-}
-%>
diff --git a/httemplate/edit/process/addr_block/split.cgi b/httemplate/edit/process/addr_block/split.cgi
deleted file mode 100755
index bb6d4ba3e..000000000
--- a/httemplate/edit/process/addr_block/split.cgi
+++ /dev/null
@@ -1,19 +0,0 @@
-<%
-my $error = '';
-my $blocknum = $cgi->param('blocknum');
-my $addr_block = qsearchs('addr_block', { blocknum => $blocknum });
-
-if ( $addr_block) {
- $error = $addr_block->split_block;
-} else {
- $error = "Unknown blocknum: $blocknum";
-}
-
-
-if ( $error ) {
- $cgi->param('error', $error);
- print $cgi->redirect(popurl(4). "browse/addr_block.cgi?". $cgi->query_string );
-} else {
- print $cgi->redirect(popurl(4). "browse/addr_block.cgi");
-}
-%>
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 25c346e46..718f0e501 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -10,9 +10,9 @@ $cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] );
my $payby = $cgi->param('payby');
if ( $payby ) {
- if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) {
+ if ( $payby eq 'CHEK' ) {
$cgi->param('payinfo',
- $cgi->param($payby. '_payinfo1'). '@'. $cgi->param($payby. '_payinfo2') );
+ $cgi->param('CHEK_payinfo1'). '@'. $cgi->param('CHEK_payinfo2') );
} else {
$cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) );
}
diff --git a/httemplate/edit/process/cust_main_county.cgi b/httemplate/edit/process/cust_main_county.cgi
index 6d80ad512..9287ed150 100755
--- a/httemplate/edit/process/cust_main_county.cgi
+++ b/httemplate/edit/process/cust_main_county.cgi
@@ -7,11 +7,15 @@ foreach ( grep { /^tax\d+$/ } $cgi->param ) {
or die "Couldn't find taxnum $taxnum!";
next unless $old->tax != $cgi->param("tax$taxnum")
|| $old->exempt_amount != $cgi->param("exempt_amount$taxnum")
- || $old->taxname ne $cgi->param("taxname$taxnum");
+ || $old->taxname ne $cgi->param("taxname$taxnum")
+ || $old->setuptax ne $cgi->param("setuptax$taxnum")
+ || $old->recurtax ne $cgi->param("recurtax$taxnum");
my %hash = $old->hash;
$hash{tax} = $cgi->param("tax$taxnum");
$hash{exempt_amount} = $cgi->param("exempt_amount$taxnum");
$hash{taxname} = $cgi->param("taxname$taxnum");
+ $hash{setuptax} = $cgi->param("setuptax$taxnum");
+ $hash{recurtax} = $cgi->param("recurtax$taxnum");
my $new = new FS::cust_main_county \%hash;
my $error = $new->replace($old);
if ( $error ) {
diff --git a/httemplate/edit/process/generic.cgi b/httemplate/edit/process/generic.cgi
deleted file mode 100644
index 9c54feb1d..000000000
--- a/httemplate/edit/process/generic.cgi
+++ /dev/null
@@ -1,70 +0,0 @@
-<%
-
-# Welcome to generic.cgi.
-#
-# This script provides a generic edit/process/ backend for simple table
-# editing. All it knows how to do is take the values entered into
-# the script and insert them into the table specified by $cgi->param('table').
-# If there's an existing record with the same primary key, it will be
-# replaced. (Deletion will be added in the future.)
-#
-# Special cgi params for this script:
-# table: the name of the table to be edited. The script will die horribly
-# if it can't find the table.
-# redirect_ok: URL to be displayed after a successful edit. The value of
-# the record's primary key will be passed as a keyword.
-# Defaults to (freeside root)/view/$table.cgi.
-# redirect_error: URL to be displayed if there's an error. The original
-# query string, plus the error message, will be passed.
-# Defaults to $cgi->referer() (i.e. go back where you
-# came from).
-
-
-use FS::Record qw(qsearchs dbdef);
-use DBIx::DBSchema;
-use DBIx::DBSchema::Table;
-
-
-my $error;
-my $p2 = popurl(2);
-my $p3 = popurl(3);
-my $table = $cgi->param('table');
-my $dbdef = dbdef or die "Cannot fetch dbdef!";
-
-my $dbdef_table = $dbdef->table($table) or die "Cannot fetch schema for $table";
-
-my $pkey = $dbdef_table->primary_key or die "Cannot fetch pkey for $table";
-my $pkey_val = $cgi->param($pkey);
-
-
-#warn "new FS::Record ( $table, (hashref) )";
-my $new = FS::Record::new ( "FS::$table", {
- map { $_, scalar($cgi->param($_)) } fields($table)
-} );
-
-#warn 'created $new of class '.ref($new);
-
-if($pkey_val and (my $old = qsearchs($table, { $pkey, $pkey_val} ))) {
- # edit
- $error = $new->replace($old);
-} else {
- #add
- $error = $new->insert;
- $pkey_val = $new->getfield($pkey);
- # New records usually don't have their primary keys set until after
- # they've been checked/inserted, so grab the new $pkey_val so we can
- # redirect to it.
-}
-
-my $redirect_ok = (($cgi->param('redirect_ok')) ?
- $cgi->param('redirect_ok') : $p3."browse/generic.cgi?$table");
-my $redirect_error = (($cgi->param('redirect_error')) ?
- $cgi->param('redirect_error') : $cgi->referer());
-
-if($error) {
- $cgi->param('error', $error);
- print $cgi->redirect($redirect_error . '?' . $cgi->query_string);
-} else {
- print $cgi->redirect($redirect_ok);
-}
-%>
diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi
index 9633fabdf..859670b17 100755
--- a/httemplate/edit/process/part_svc.cgi
+++ b/httemplate/edit/process/part_svc.cgi
@@ -17,7 +17,7 @@ my $new = new FS::part_svc ( {
push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge
map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } @fields;
} grep defined( $FS::Record::dbdef->table($_) ),
- qw( svc_acct svc_domain svc_forward svc_www svc_broadband )
+ qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www )
)
} );
diff --git a/httemplate/edit/process/router.cgi b/httemplate/edit/process/router.cgi
deleted file mode 100644
index a2fa46dd9..000000000
--- a/httemplate/edit/process/router.cgi
+++ /dev/null
@@ -1,67 +0,0 @@
-<%
-
-local $FS::UID::AutoCommit=0;
-
-sub check {
- my $error = shift;
- if($error) {
- $cgi->param('error', $error);
- print $cgi->redirect(popurl(3) . "edit/router.cgi?". $cgi->query_string);
- dbh->rollback;
- exit;
- }
-}
-
-my $error = '';
-my $routernum = $cgi->param('routernum');
-my $routername = $cgi->param('routername');
-my $old = qsearchs('router', { routernum => $routernum });
-my @old_psr;
-
-my $new = new FS::router {
- map {
- ($_, scalar($cgi->param($_)));
- } fields('router')
-};
-
-if($old) {
- $error = $new->replace($old);
-} else {
- $error = $new->insert;
- $routernum = $new->routernum;
-}
-
-check($error);
-
-if ($old) {
- @old_psr = $old->part_svc_router;
- foreach my $psr (@old_psr) {
- if($cgi->param('svcpart_'.$psr->svcpart) eq 'ON') {
- # do nothing
- } else {
- $error = $psr->delete;
- }
- }
- check($error);
-}
-
-foreach($cgi->param) {
- if($cgi->param($_) eq 'ON' and /^svcpart_(\d+)$/) {
- my $svcpart = $1;
- if(grep {$_->svcpart == $svcpart} @old_psr) {
- # do nothing
- } else {
- my $new_psr = new FS::part_svc_router { svcpart => $svcpart,
- routernum => $routernum };
- $error = $new_psr->insert;
- }
- check($error);
- }
-}
-
-
-# Yay, everything worked!
-dbh->commit or die dbh->errstr;
-print $cgi->redirect(popurl(3). "browse/router.cgi");
-
-%>
diff --git a/httemplate/edit/process/svc_acct_sm.cgi b/httemplate/edit/process/svc_acct_sm.cgi
new file mode 100755
index 000000000..41d03fb92
--- /dev/null
+++ b/httemplate/edit/process/svc_acct_sm.cgi
@@ -0,0 +1,34 @@
+<%
+
+$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
+my $svcnum =$1;
+
+my $old = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}) if $svcnum;
+
+#unmunge domsvc and domuid
+#$cgi->param('domsvc',(split(/:/, $cgi->param('domsvc') ))[0] );
+#$cgi->param('domuid',(split(/:/, $cgi->param('domuid') ))[0] );
+
+my $new = new FS::svc_acct_sm ( {
+ map {
+ ($_, scalar($cgi->param($_)));
+ #} qw(svcnum pkgnum svcpart domuser domuid domsvc)
+ } ( fields('svc_acct_sm'), qw( pkgnum svcpart ) )
+} );
+
+my $error = '';
+if ( $svcnum ) {
+ $error = $new->replace($old);
+} else {
+ $error = $new->insert;
+ $svcnum = $new->getfield('svcnum');
+}
+
+if ($error) {
+ $cgi->param('error', $error);
+ print $cgi->redirect(popurl(2). "svc_acct_sm.cgi?". $cgi->query_string );
+} else {
+ print $cgi->redirect(popurl(3). "view/svc_acct_sm.cgi?$svcnum");
+}
+
+%>
diff --git a/httemplate/edit/process/svc_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi
deleted file mode 100644
index 4912a3a9f..000000000
--- a/httemplate/edit/process/svc_broadband.cgi
+++ /dev/null
@@ -1,45 +0,0 @@
-<%
-
-# If it's stupid but it works, it's not stupid.
-# -- U.S. Army
-
-local $FS::UID::AutoCommit = 0;
-my $dbh = FS::UID::dbh;
-
-$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
-my $svcnum = $1;
-
-my $old;
-if ( $svcnum ) {
- $old = qsearchs('svc_broadband', { 'svcnum' => $svcnum } )
- or die "fatal: can't find broadband service (svcnum $svcnum)!";
-} else {
- $old = '';
-}
-
-my $new = new FS::svc_broadband ( {
- map {
- ($_, scalar($cgi->param($_)));
- } ( fields('svc_broadband'), qw( pkgnum svcpart ) )
-} );
-
-my $error;
-if ( $svcnum ) {
- $error = $new->replace($old);
-} else {
- $error = $new->insert;
- $svcnum = $new->svcnum;
-}
-
-
-if ( $error ) {
- $cgi->param('error', $error);
- $cgi->param('ip_addr', $new->ip_addr);
- $dbh->rollback;
- print $cgi->redirect(popurl(2). "svc_broadband.cgi?". $cgi->query_string );
-} else {
- $dbh->commit or die $dbh->errstr;
- print $cgi->redirect(popurl(3). "view/svc_broadband.cgi?" . $svcnum );
-}
-
-%>
diff --git a/httemplate/edit/process/svc_external.cgi b/httemplate/edit/process/svc_external.cgi
deleted file mode 100755
index 728cd2189..000000000
--- a/httemplate/edit/process/svc_external.cgi
+++ /dev/null
@@ -1,29 +0,0 @@
-<%
-
-$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
-my $svcnum =$1;
-
-my $old = qsearchs('svc_external',{'svcnum'=>$svcnum}) if $svcnum;
-
-my $new = new FS::svc_external ( {
- map {
- ($_, scalar($cgi->param($_)));
- } ( fields('svc_external'), qw( pkgnum svcpart ) )
-} );
-
-my $error = '';
-if ( $svcnum ) {
- $error = $new->replace($old);
-} else {
- $error = $new->insert;
- $svcnum = $new->getfield('svcnum');
-}
-
-if ($error) {
- $cgi->param('error', $error);
- print $cgi->redirect(popurl(2). "svc_external.cgi?". $cgi->query_string );
-} else {
- print $cgi->redirect(popurl(3). "view/svc_external.cgi?$svcnum");
-}
-
-%>