get rid of header foo in individual templates
[freeside.git] / httemplate / edit / svc_acct_sm.cgi
index 891c3e1..baf0a7e 100755 (executable)
@@ -1,67 +1,5 @@
 <%
-#
-# $Id: svc_acct_sm.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
-#
-# Usage: svc_acct_sm.cgi {svcnum} | pkgnum{pkgnum}-svcpart{svcpart}
-#        http://server.name/path/svc_acct_sm.cgi? {svcnum} | pkgnum{pkgnum}-svcpart{svcpart}
-#
-# use {svcnum} for edit, pkgnum{pkgnum}-svcpart{svcpart} for add
-#
-# should error out in a more CGI-friendly way, and should have more error checking (sigh).
-#
-# ivan@voicenet.com 97-jan-5
-#
-# added debugging code; fixed CPU-sucking problem with trying to edit an (unaudited) mail alias (no pkgnum)
-#
-# ivan@voicenet.com 97-may-7
-#
-# fixed uid selection
-# ivan@voicenet.com 97-jun-4
-#
-# uid selection across _CUSTOMER_, not just _PACKAGE_
-#
-# ( i need to be rewritten with fast searches)
-#
-# ivan@voicenet.com 97-oct-3
-#
-# added fast searches in some of the places where it is sorely needed...
-# I see DBI::mysql in your future...
-# ivan@voicenet.com 97-oct-23
-#
-# rewrite ivan@sisd.com 98-mar-15
-#
-# /var/spool/freeside/conf/domain ivan@sisd.com 98-jul-26
-#
-# $Log: svc_acct_sm.cgi,v $
-# Revision 1.1  2001-07-30 07:36:04  ivan
-# templates!!!
-#
-# Revision 1.9  1999/02/28 00:03:38  ivan
-# removed misleading comments
-#
-# Revision 1.8  1999/02/07 09:59:24  ivan
-# more mod_perl fixes, and bugfixes Peter Wemm sent via email
-#
-# Revision 1.7  1999/01/19 05:13:45  ivan
-# for mod_perl: no more top-level my() variables; use vars instead
-# also the last s/create/new/;
-#
-# Revision 1.6  1999/01/18 09:41:34  ivan
-# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
-# (good idea anyway)
-#
-# Revision 1.5  1998/12/30 23:03:24  ivan
-# bugfixes; fields isn't exported by derived classes
-#
-# Revision 1.4  1998/12/23 02:58:45  ivan
-# $cgi->keywords instead of $cgi->query_string
-#
-# Revision 1.3  1998/12/17 06:17:11  ivan
-# fix double // in relative URLs, s/CGI::Base/CGI/;
-#
-# Revision 1.2  1998/12/16 05:19:15  ivan
-# use FS::Conf
-#
+#<!-- $Id: svc_acct_sm.cgi,v 1.6 2001-10-30 14:54:07 ivan Exp $ -->
 
 use strict;
 use vars qw( $conf $cgi $mydomain $action $svcnum $svc_acct_sm $pkgnum $svcpart
@@ -119,11 +57,12 @@ if ( $cgi->param('error') ) {
     $svcnum='';
 
     #set fixed and default fields from part_svc
-    my($field);
-    foreach $field ( fields('svc_acct_sm') ) {
-      if ( $part_svc->getfield('svc_acct_sm__'. $field. '_flag') ne '' ) {
-        $svc_acct_sm->setfield($field,$part_svc->getfield('svc_acct_sm__'. $field) );
-      }
+    foreach my $part_svc_column (
+      grep { $_->columnflag } $part_svc->all_part_svc_column
+    ) {
+      $svc_acct_sm->setfield( $part_svc_column->columnname,
+                              $part_svc_column->columnvalue,
+                            );
     }
 
   }
@@ -134,15 +73,15 @@ if ($pkgnum) {
 
   #find all possible uids (and usernames)
 
-  my($u_part_svc,@u_acct_svcparts);
-  foreach $u_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_acct'}) ) {
+  my @u_acct_svcparts = ();
+  foreach my $u_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_acct'}) ) {
     push @u_acct_svcparts,$u_part_svc->getfield('svcpart');
   }
 
   my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
   my($custnum)=$cust_pkg->getfield('custnum');
-  my($i_cust_pkg);
-  foreach $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) {
+  %username = ();
+  foreach my $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) {
     my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum');
     my($acct_svcpart);
     foreach $acct_svcpart (@u_acct_svcparts) {   #now find the corresponding 
@@ -158,11 +97,12 @@ if ($pkgnum) {
 
   #find all possible domains (and domsvc's)
 
-  my($d_part_svc,@d_acct_svcparts);
-  foreach $d_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_domain'}) ) {
+  my @d_acct_svcparts = ();
+  foreach my $d_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_domain'}) ) {
     push @d_acct_svcparts,$d_part_svc->getfield('svcpart');
   }
 
+  %domain = ();
   foreach $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) {
     my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum');
     my($acct_svcpart);
@@ -188,7 +128,7 @@ if ($pkgnum) {
 }
 
 $p1 = popurl(1);
-print $cgi->header( '-expires' => 'now' ), header("Mail Alias $action", '');
+print header("Mail Alias $action", '');
 
 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
       "</FONT>"