From 51984ac3d3da3006809c6866fdecd4ad83610731 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 07:36:04 +0000 Subject: templates!!! --- httemplate/edit/cust_pkg.cgi | 171 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100755 httemplate/edit/cust_pkg.cgi (limited to 'httemplate/edit/cust_pkg.cgi') diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi new file mode 100755 index 000000000..637023703 --- /dev/null +++ b/httemplate/edit/cust_pkg.cgi @@ -0,0 +1,171 @@ +<% +# +# $Id: cust_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# this is for changing packages around, not editing things within the package +# +# Usage: cust_pkg.cgi custnum +# http://server.name/path/cust_pkg.cgi?custnum +# +# started with /sales/add/cust_pkg.cgi, which added packages +# ivan@voicenet.com 97-jan-5, 97-mar-21 +# +# Rewrote for new API +# ivan@voicenet.com 97-jul-7 +# +# FS::Search is no more, &cgisuidsetup needs $cgi, ivan@sisd.com 98-mar-7 +# +# Changes to allow page to work at a relative position in server +# Changed to display packages 2-wide in a table +# bmccane@maxbaud.net 98-apr-3 +# +# fixed a pretty cool bug from above which caused a visual glitch ivan@sisd.com +# 98-jun-1 +# +# $Log: cust_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.8 1999/07/21 07:34:13 ivan +# links to package browse and agent type edit if there aren't any packages to +# order. thanks to "Tech Account" +# +# Revision 1.7 1999/04/14 01:03:01 ivan +# oops, in 1.2 tree, can't do searches until [cgi|admin]suidsetup, +# bug is hidden by mod_perl persistance +# +# Revision 1.6 1999/02/28 00:03:36 ivan +# removed misleading comments +# +# Revision 1.5 1999/02/07 09:59:18 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.4 1999/01/19 05:13:38 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.3 1999/01/18 09:41:28 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.2 1998/12/17 06:17:04 ivan +# fix double // in relative URLs, s/CGI::Base/CGI/; +# + +use strict; +use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg + $cust_main $agent $type_pkgs $count %remove_pkg $pkgparts ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs); +use FS::CGI qw(header popurl); +use FS::part_pkg; +use FS::type_pkgs; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +%pkg = (); +%comment = (); +foreach (qsearch('part_pkg', {})) { + $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); + $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); +} + +if ( $cgi->param('error') ) { + $custnum = $cgi->param('custnum'); + %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $custnum = $1; + undef %remove_pkg; +} + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("Add/Edit Packages", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!
!; + +print qq!!; + +#current packages +@cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); + +if (@cust_pkg) { + print <
+END + + my ($count) = 0 ; + print qq!! ; + foreach (@cust_pkg) { + print '' if $count == 0; + my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') ); + print qq!\n!; + $count ++ ; + if ($count == 2) + { + $count = 0 ; + print qq!\n! ; + } + } + print qq!
$pkgnum: $pkg{$pkgpart} - $comment{$pkgpart}


!; +} + +print <
+END + +$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +$agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); + +$count = 0; +$pkgparts = 0; +print qq!!; +foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { + $pkgparts++; + my($pkgpart)=$type_pkgs->pkgpart; + print qq!! if ( $count == 0 ); + my $value = $cgi->param("pkg$pkgpart") || 0; + print < + + $pkgpart: $pkg{$pkgpart} - $comment{$pkgpart}\n +END + $count ++ ; + if ( $count == 2 ) { + print qq!\n! ; + $count = 0; + } +} +print qq!
!; + +unless ( $pkgparts ) { + my $p2 = popurl(2); + my $typenum = $agent->typenum; + my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } ); + my $atype = $agent_type->atype; + print <package definitions, or agent type +$atype not allowed to purchase +any packages.) +END +} + +#submit +print < + + + +END +%> -- cgit v1.2.1 From 3d671921441ba8422650b54435a1959ad1d4c71d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Aug 2001 02:31:57 +0000 Subject: remove $Log$ messages. whew. --- httemplate/edit/cust_pkg.cgi | 53 +------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) (limited to 'httemplate/edit/cust_pkg.cgi') diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index 637023703..729fc7c98 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,56 +1,5 @@ <% -# -# $Id: cust_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# this is for changing packages around, not editing things within the package -# -# Usage: cust_pkg.cgi custnum -# http://server.name/path/cust_pkg.cgi?custnum -# -# started with /sales/add/cust_pkg.cgi, which added packages -# ivan@voicenet.com 97-jan-5, 97-mar-21 -# -# Rewrote for new API -# ivan@voicenet.com 97-jul-7 -# -# FS::Search is no more, &cgisuidsetup needs $cgi, ivan@sisd.com 98-mar-7 -# -# Changes to allow page to work at a relative position in server -# Changed to display packages 2-wide in a table -# bmccane@maxbaud.net 98-apr-3 -# -# fixed a pretty cool bug from above which caused a visual glitch ivan@sisd.com -# 98-jun-1 -# -# $Log: cust_pkg.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.8 1999/07/21 07:34:13 ivan -# links to package browse and agent type edit if there aren't any packages to -# order. thanks to "Tech Account" -# -# Revision 1.7 1999/04/14 01:03:01 ivan -# oops, in 1.2 tree, can't do searches until [cgi|admin]suidsetup, -# bug is hidden by mod_perl persistance -# -# Revision 1.6 1999/02/28 00:03:36 ivan -# removed misleading comments -# -# Revision 1.5 1999/02/07 09:59:18 ivan -# more mod_perl fixes, and bugfixes Peter Wemm sent via email -# -# Revision 1.4 1999/01/19 05:13:38 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.3 1999/01/18 09:41:28 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.2 1998/12/17 06:17:04 ivan -# fix double // in relative URLs, s/CGI::Base/CGI/; -# +# use strict; use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg -- cgit v1.2.1 From 91387f8f489e561deaf1de052d80ef800a4970a3 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 26 Oct 2001 10:24:56 +0000 Subject: cache foo *sigh* --- httemplate/edit/cust_pkg.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/cust_pkg.cgi') diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index 729fc7c98..ea92ac05e 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg @@ -33,7 +33,7 @@ if ( $cgi->param('error') ) { } $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Add/Edit Packages", ''); +print $cgi->header( @FS::CGI::header ), header("Add/Edit Packages", ''); print qq!Error: !, $cgi->param('error'), "" -- cgit v1.2.1 From c14a267229fc0d6f2d2afdebab3bd34d825df2ef Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 30 Oct 2001 14:54:07 +0000 Subject: get rid of header foo in individual templates --- httemplate/edit/cust_pkg.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/cust_pkg.cgi') diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index ea92ac05e..7d5bb3fd3 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg @@ -33,7 +33,7 @@ if ( $cgi->param('error') ) { } $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Add/Edit Packages", ''); +print header("Add/Edit Packages", ''); print qq!Error: !, $cgi->param('error'), "" -- cgit v1.2.1 From cf16b23820da69e3c8d0156ae27e21c635bf1ec5 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 27 Dec 2001 09:26:14 +0000 Subject: service and package disable! --- httemplate/edit/cust_pkg.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/cust_pkg.cgi') diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index 7d5bb3fd3..73b190786 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg @@ -17,7 +17,7 @@ $cgi = new CGI; %pkg = (); %comment = (); -foreach (qsearch('part_pkg', {})) { +foreach (qsearch('part_pkg', { 'disabled' => '' })) { $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); } @@ -83,6 +83,7 @@ print qq!!; foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { $pkgparts++; my($pkgpart)=$type_pkgs->pkgpart; + next unless exists $pkg{$pkgpart}; #skip disabled ones print qq!! if ( $count == 0 ); my $value = $cgi->param("pkg$pkgpart") || 0; print < Date: Wed, 30 Jan 2002 14:18:09 +0000 Subject: remove use Module; and $cgi = new CGI; &cgisuidsetup(); from all templates. should work better under Mason. --- httemplate/edit/cust_pkg.cgi | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) (limited to 'httemplate/edit/cust_pkg.cgi') diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index 73b190786..c11a194b2 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,27 +1,14 @@ + <% -# -use strict; -use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg - $cust_main $agent $type_pkgs $count %remove_pkg $pkgparts ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header popurl); -use FS::part_pkg; -use FS::type_pkgs; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -%pkg = (); -%comment = (); +my %pkg = (); +my %comment = (); foreach (qsearch('part_pkg', { 'disabled' => '' })) { $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); } +my($custnum, %remove_pkg); if ( $cgi->param('error') ) { $custnum = $cgi->param('custnum'); %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); @@ -29,10 +16,10 @@ if ( $cgi->param('error') ) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/; $custnum = $1; - undef %remove_pkg; + %remove_pkg = (); } -$p1 = popurl(1); +my $p1 = popurl(1); print header("Add/Edit Packages", ''); print qq!Error: !, $cgi->param('error'), @@ -44,7 +31,7 @@ print qq!
!; print qq!!; #current packages -@cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); +my @cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); if (@cust_pkg) { print <
END - my ($count) = 0 ; + my $count = 0 ; print qq!
! ; foreach (@cust_pkg) { print '' if $count == 0; @@ -74,13 +61,13 @@ print <
END -$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); -$agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); -$count = 0; -$pkgparts = 0; +my $count = 0; +my $pkgparts = 0; print qq!
!; -foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { +foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { $pkgparts++; my($pkgpart)=$type_pkgs->pkgpart; next unless exists $pkg{$pkgpart}; #skip disabled ones -- cgit v1.2.1 From 22a35047ecdffff80110e06cc08fc84f9ddba9b0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 13:21:31 +0000 Subject: removed from all files to fix any redirects, whew Mason handler.pl overrides CGI::redirect fixed strict; problems in edit/part_pkg.cgi & edit/process/part_pkg.cgi --- httemplate/edit/cust_pkg.cgi | 1 - 1 file changed, 1 deletion(-) (limited to 'httemplate/edit/cust_pkg.cgi') diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index c11a194b2..7fb88c3ce 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,4 +1,3 @@ - <% my %pkg = (); -- cgit v1.2.1 From a4c96748eb6eab29a70f3a944c6520283a635c78 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 16:05:22 +0000 Subject: *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. --- httemplate/edit/cust_pkg.cgi | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate/edit/cust_pkg.cgi') diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index 7fb88c3ce..d546f7409 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,3 +1,4 @@ + <% my %pkg = (); -- cgit v1.2.1 From 81faa8d34d1287a61fd723d73ab02a022cf5d050 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 12 Apr 2002 15:14:58 +0000 Subject: fudge up FS::cust_pkg::order ("Order and cancel packages") to try to move services between svcparts as a last resort... --- httemplate/edit/cust_pkg.cgi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/cust_pkg.cgi') diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index d546f7409..485d601eb 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -3,7 +3,16 @@ my %pkg = (); my %comment = (); -foreach (qsearch('part_pkg', { 'disabled' => '' })) { +my %all_pkg = (); +my %all_comment = (); +#foreach (qsearch('part_pkg', { 'disabled' => '' })) { +# $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); +# $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); +#} +foreach (qsearch('part_pkg', {} )) { + $all_pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); + $all_comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); + next if $_->disabled; $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); } @@ -46,7 +55,7 @@ END my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') ); print qq!\n!; + print qq!>$pkgnum: $all_pkg{$pkgpart} - $all_comment{$pkgpart}\n!; $count ++ ; if ($count == 2) { -- cgit v1.2.1
$pkgnum: $pkg{$pkgpart} - $comment{$pkgpart}