Will things ever be the same again?
[freeside.git] / httemplate / edit / process / part_svc.cgi
index 4c972e4..97abc5b 100755 (executable)
@@ -1,30 +1,4 @@
-<%
-
-my $svcpart = $cgi->param('svcpart');
-
-my $old = qsearchs('part_svc',{'svcpart'=>$svcpart}) if $svcpart;
-
-my $new = new FS::part_svc ( {
-  map {
-    $_, scalar($cgi->param($_));
-#  } qw(svcpart svc svcdb)
-  } fields('part_svc')
-} );
-
-my $error;
-if ( $svcpart ) {
-  $error = $new->replace($old);
-} else {
-  $error = $new->insert;
-  $svcpart=$new->getfield('svcpart');
-}
-
-if ( $error ) {
-  $cgi->param('error', $error);
-  $Response->Redirect(popurl(2). "part_svc.cgi?". $cgi->query_string );
-} else {
-  warn "redirecting to ". popurl(3)."browse/part_svc.cgi via $Response";
-  $Response->Redirect(popurl(3)."browse/part_svc.cgi");
-}
-
-%>
+%
+%  my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process', $cgi;
+%
+<% $server->process %>