X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fsvc_acct_sm.cgi;h=baf0a7eb2ff3d6cc8a9b4636f3c9f54356c87ec6;hp=891c3e1f6cca2c39db403e2e5235cb8e585e6a3b;hb=c14a267229fc0d6f2d2afdebab3bd34d825df2ef;hpb=51984ac3d3da3006809c6866fdecd4ad83610731 diff --git a/httemplate/edit/svc_acct_sm.cgi b/httemplate/edit/svc_acct_sm.cgi index 891c3e1f6..baf0a7eb2 100755 --- a/httemplate/edit/svc_acct_sm.cgi +++ b/httemplate/edit/svc_acct_sm.cgi @@ -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 -# +# 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!Error: !, $cgi->param('error'), ""