summaryrefslogtreecommitdiff
path: root/site_perl
diff options
context:
space:
mode:
authorivan <ivan>1999-07-20 10:37:05 +0000
committerivan <ivan>1999-07-20 10:37:05 +0000
commit19c3d2717fb417187fb0f020a7ba2b065f3f8e30 (patch)
tree888c6c1941833e15a0d5ebeb33addb4ca292c559 /site_perl
parentd605e2e68f3c388bd0479fb0aba1bb1bc8e61e73 (diff)
cleaned up the new one-screen signup bits in htdocs/edit/cust_main.cgi to
prepare for a signup server
Diffstat (limited to 'site_perl')
-rw-r--r--site_perl/agent.pm37
-rw-r--r--site_perl/agent_type.pm55
-rw-r--r--site_perl/cust_main.pm10
-rw-r--r--site_perl/cust_main_county.pm9
-rw-r--r--site_perl/cust_pkg.pm20
-rw-r--r--site_perl/part_pkg.pm49
-rw-r--r--site_perl/pkg_svc.pm43
7 files changed, 190 insertions, 33 deletions
diff --git a/site_perl/agent.pm b/site_perl/agent.pm
index cc4fb1088..dab157b3f 100644
--- a/site_perl/agent.pm
+++ b/site_perl/agent.pm
@@ -27,6 +27,11 @@ FS::agent - Object methods for agent records
$error = $record->check;
+ $agent_type = $record->agent_type;
+
+ $hashref = $record->pkgpart_hashref;
+ #may purchase $pkgpart if $hashref->{$pkgpart};
+
=head1 DESCRIPTION
An FS::agent object represents an agent. Every customer has an agent. Agents
@@ -106,24 +111,48 @@ sub check {
return $error if $error;
return "Unknown typenum!"
- unless qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
+ unless $self->agent_type;
'';
}
+=item agent_type
+
+Returns the FS::agent_type object (see L<FS::agent_type>) for this agent.
+
+=cut
+
+sub agent_type {
+ my $self = shift;
+ qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
+}
+
+=item pkgpart_hashref
+
+Returns a hash reference. The keys of the hash are pkgparts. The value is
+true iff this agent may purchase the specified package definition. See
+L<FS::part_pkg>.
+
+=cut
+
+sub pkgpart_hashref {
+ my $self = shift;
+ $self->agent_type->pkgpart_hashref;
+}
+
=back
=head1 VERSION
-$Id: agent.pm,v 1.4 1998-12-30 00:30:44 ivan Exp $
+$Id: agent.pm,v 1.5 1999-07-20 10:37:05 ivan Exp $
=head1 BUGS
=head1 SEE ALSO
-L<FS::Record>, L<FS::agent_type>, L<FS::cust_main>, schema.html from the base
-documentation.
+L<FS::Record>, L<FS::agent_type>, L<FS::cust_main>, L<FS::part_pkg>,
+schema.html from the base documentation.
=head1 HISTORY
diff --git a/site_perl/agent_type.pm b/site_perl/agent_type.pm
index 54a91c8bf..6ea3d2a70 100644
--- a/site_perl/agent_type.pm
+++ b/site_perl/agent_type.pm
@@ -3,6 +3,8 @@ package FS::agent_type;
use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch );
+use FS::agent;
+use FS::type_pkgs;
@ISA = qw( FS::Record );
@@ -25,6 +27,13 @@ FS::agent_type - Object methods for agent_type records
$error = $record->check;
+ $hashref = $record->pkgpart_hashref;
+ #may purchase $pkgpart if $hashref->{$pkgpart};
+
+ @type_pkgs = $record->type_pkgs;
+
+ @pkgparts = $record->pkgpart;
+
=head1 DESCRIPTION
An FS::agent_type object represents an agent type. Every agent (see
@@ -97,11 +106,49 @@ sub check {
}
+=item pkgpart_hashref
+
+Returns a hash reference. The keys of the hash are pkgparts. The value is
+true iff this agent may purchase the specified package definition. See
+L<FS::part_pkg>.
+
+=cut
+
+sub pkgpart_hashref {
+ my $self = shift;
+ my %pkgpart;
+ $pkgpart{$_}++ foreach $self->pkgpart;
+ \%pkgpart;
+}
+
+=item type_pkgs
+
+Returns all FS::type_pkgs objects (see L<FS::type_pkgs>) for this agent type.
+
+=cut
+
+sub type_pkgs {
+ my $self = shift;
+ qsearch('type_pkgs', { 'typenum' => $self->typenum } );
+}
+
+=item pkgpart
+
+Returns the pkgpart of all package definitions (see L<FS::part_pkg>) for this
+agent type.
+
+=cut
+
+sub pkgpart {
+ my $self = shift;
+ map $_->pkgpart, $self->type_pkgs;
+}
+
=back
=head1 VERSION
-$Id: agent_type.pm,v 1.2 1998-12-29 11:59:35 ivan Exp $
+$Id: agent_type.pm,v 1.3 1999-07-20 10:37:05 ivan Exp $
=head1 BUGS
@@ -126,7 +173,11 @@ Changed 'type' to 'atype' because Pg6.3 reserves the type word
pod, added check in delete ivan@sisd.com 98-sep-21
$Log: agent_type.pm,v $
-Revision 1.2 1998-12-29 11:59:35 ivan
+Revision 1.3 1999-07-20 10:37:05 ivan
+cleaned up the new one-screen signup bits in htdocs/edit/cust_main.cgi to
+prepare for a signup server
+
+Revision 1.2 1998/12/29 11:59:35 ivan
mostly properly OO, some work still to be done with svc_ stuff
diff --git a/site_perl/cust_main.pm b/site_perl/cust_main.pm
index d67e6811f..6140dcc29 100644
--- a/site_perl/cust_main.pm
+++ b/site_perl/cust_main.pm
@@ -143,6 +143,8 @@ FS::Record. The following fields are currently supported:
=item night - phone (optional)
+=item fax - phone (optional)
+
=item payby - `CARD' (credit cards), `BILL' (billing), or `COMP' (free)
=item payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)
@@ -928,7 +930,7 @@ sub check_invoicing_list {
=head1 VERSION
-$Id: cust_main.pm,v 1.23 1999-07-17 02:24:14 ivan Exp $
+$Id: cust_main.pm,v 1.24 1999-07-20 10:37:05 ivan Exp $
=head1 BUGS
@@ -987,7 +989,11 @@ enable cybercash, cybercash v3 support, don't need to import
FS::UID::{datasrc,checkruid} ivan@sisd.com 98-sep-19-21
$Log: cust_main.pm,v $
-Revision 1.23 1999-07-17 02:24:14 ivan
+Revision 1.24 1999-07-20 10:37:05 ivan
+cleaned up the new one-screen signup bits in htdocs/edit/cust_main.cgi to
+prepare for a signup server
+
+Revision 1.23 1999/07/17 02:24:14 ivan
bug noticed by Steve Gertz <sglist@hollywood.mwis.net>
Revision 1.22 1999/04/15 16:44:36 ivan
diff --git a/site_perl/cust_main_county.pm b/site_perl/cust_main_county.pm
index 1ecaed1ec..1418ca1ea 100644
--- a/site_perl/cust_main_county.pm
+++ b/site_perl/cust_main_county.pm
@@ -86,6 +86,7 @@ sub check {
$self->ut_numbern('taxnum')
|| $self->ut_textn('state')
|| $self->ut_textn('county')
+ || $self->ut_text('country')
|| $self->ut_float('tax')
;
@@ -95,7 +96,7 @@ sub check {
=head1 VERSION
-$Id: cust_main_county.pm,v 1.3 1998-12-29 11:59:41 ivan Exp $
+$Id: cust_main_county.pm,v 1.4 1999-07-20 10:37:05 ivan Exp $
=head1 BUGS
@@ -114,7 +115,11 @@ Changed check for 'tax' to use the new ut_float subroutine
pod ivan@sisd.com 98-sep-21
$Log: cust_main_county.pm,v $
-Revision 1.3 1998-12-29 11:59:41 ivan
+Revision 1.4 1999-07-20 10:37:05 ivan
+cleaned up the new one-screen signup bits in htdocs/edit/cust_main.cgi to
+prepare for a signup server
+
+Revision 1.3 1998/12/29 11:59:41 ivan
mostly properly OO, some work still to be done with svc_ stuff
Revision 1.2 1998/11/18 09:01:43 ivan
diff --git a/site_perl/cust_pkg.pm b/site_perl/cust_pkg.pm
index aa68f608f..bbd242972 100644
--- a/site_perl/cust_pkg.pm
+++ b/site_perl/cust_pkg.pm
@@ -396,18 +396,12 @@ L<FS::pkg_svc>).
sub order {
my($custnum,$pkgparts,$remove_pkgnums)=@_;
- my(%part_pkg);
# generate %part_pkg
# $part_pkg{$pkgpart} is true iff $custnum may purchase $pkgpart
- my($cust_main)=qsearchs('cust_main',{'custnum'=>$custnum});
- my($agent)=qsearchs('agent',{'agentnum'=> $cust_main->agentnum });
-
- my($type_pkgs);
- foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) {
- my($pkgpart)=$type_pkgs->pkgpart;
- $part_pkg{$pkgpart}++;
- }
#
+ my($cust_main)=qsearchs('cust_main',{'custnum'=>$custnum});
+ my($agent)=qsearchs('agent',{'agentnum'=> $cust_main->agentnum });
+ my %part_pkg = %{ $agent->pkgpart_hashref };
my(%svcnum);
# generate %svcnum
@@ -496,7 +490,7 @@ sub order {
=head1 VERSION
-$Id: cust_pkg.pm,v 1.9 1999-03-29 01:11:51 ivan Exp $
+$Id: cust_pkg.pm,v 1.10 1999-07-20 10:37:05 ivan Exp $
=head1 BUGS
@@ -527,7 +521,11 @@ fixed for new agent->agent_type->type_pkgs in &order ivan@sisd.com 98-mar-7
pod ivan@sisd.com 98-sep-21
$Log: cust_pkg.pm,v $
-Revision 1.9 1999-03-29 01:11:51 ivan
+Revision 1.10 1999-07-20 10:37:05 ivan
+cleaned up the new one-screen signup bits in htdocs/edit/cust_main.cgi to
+prepare for a signup server
+
+Revision 1.9 1999/03/29 01:11:51 ivan
use FS::type_pkgs
Revision 1.8 1999/03/25 13:48:14 ivan
diff --git a/site_perl/part_pkg.pm b/site_perl/part_pkg.pm
index 4b6cc09a4..556146e38 100644
--- a/site_perl/part_pkg.pm
+++ b/site_perl/part_pkg.pm
@@ -2,7 +2,8 @@ package FS::part_pkg;
use strict;
use vars qw( @ISA );
-use FS::Record;
+use FS::Record qw( qsearch );
+use FS::pkg_svc;
@ISA = qw( FS::Record );
@@ -27,6 +28,11 @@ FS::part_pkg - Object methods for part_pkg objects
$error = $record->check;
+ @pkg_svc = $record->pkg_svc;
+
+ $svcnum = $record->svcpart;
+ $svcnum = $record->svcpart( 'svc_acct' );
+
=head1 DESCRIPTION
An FS::part_pkg object represents a billing item definition. FS::part_pkg
@@ -125,16 +131,45 @@ sub check {
;
}
+=item pkg_svc
+
+Returns all FS::pkg_svc objects (see L<FS::pkg_svc>) for this package
+definition.
+
+=cut
+
+sub pkg_svc {
+ my $self = shift;
+ qsearch( 'pkg_svc', { 'pkgpart' => $self->pkgpart } );
+}
+
+=item svcpart [ SVCDB ]
+
+Returns the svcpart of a single service definition (see L<FS::part_svc>)
+associated with this billing item definition (see L<FS::pkg_svc>). Returns
+false if there not exactly one service definition with quantity 1, or if
+SVCDB is specified and does not match the svcdb of the service definition,
+
+=cut
+
+sub svcpart {
+ my $self = shift;
+ my $svcdb = shift;
+ my @pkg_svc = $self->pkg_svc;
+ return '' if scalar(@pkg_svc) != 1
+ || $pkg_svc[0]->quantity != 1
+ || ( $svcdb && $pkg_svc[0]->part_svc->svcdb ne $svcdb );
+ $pkg_svc[0]->svcpart;
+}
+
=back
=head1 VERSION
-$Id: part_pkg.pm,v 1.5 1998-12-31 01:04:16 ivan Exp $
+$Id: part_pkg.pm,v 1.6 1999-07-20 10:37:05 ivan Exp $
=head1 BUGS
-It doesn't properly override FS::Record yet.
-
The delete method is unimplemented.
setup and recur semantics are not yet defined (and are implemented in
@@ -152,7 +187,11 @@ ivan@sisd.com 97-dec-5
pod ivan@sisd.com 98-sep-21
$Log: part_pkg.pm,v $
-Revision 1.5 1998-12-31 01:04:16 ivan
+Revision 1.6 1999-07-20 10:37:05 ivan
+cleaned up the new one-screen signup bits in htdocs/edit/cust_main.cgi to
+prepare for a signup server
+
+Revision 1.5 1998/12/31 01:04:16 ivan
doc
Revision 1.3 1998/11/15 13:00:15 ivan
diff --git a/site_perl/pkg_svc.pm b/site_perl/pkg_svc.pm
index ee4ad629e..f28745d28 100644
--- a/site_perl/pkg_svc.pm
+++ b/site_perl/pkg_svc.pm
@@ -3,6 +3,8 @@ package FS::pkg_svc;
use strict;
use vars qw( @ISA );
use FS::Record qw( qsearchs );
+use FS::part_pkg;
+use FS::part_svc;
@ISA = qw( FS::Record );
@@ -25,6 +27,10 @@ FS::pkg_svc - Object methods for pkg_svc records
$error = $record->check;
+ $part_pkg = $record->part_pkg;
+
+ $part_svc = $record->part_svc;
+
=head1 DESCRIPTION
An FS::pkg_svc record links a billing item definition (see L<FS::part_pkg>) to
@@ -99,20 +105,39 @@ sub check {
;
return $error if $error;
- return "Unknown pkgpart!"
- unless qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
-
- return "Unknown svcpart!"
- unless qsearchs('part_svc', { 'svcpart' => $self->svcpart } );
+ return "Unknown pkgpart!" unless $self->part_pkg;
+ return "Unknown svcpart!" unless $self->part_svc;
''; #no error
}
+=item part_pkg
+
+Returns the FS::part_pkg object (see L<FS::part_pkg>).
+
+=cut
+
+sub part_pkg {
+ my $self = shift;
+ qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
+}
+
+=item part_svc
+
+Returns the FS::part_svc object (see L<FS::part_svc>).
+
+=cut
+
+sub part_svc {
+ my $self = shift;
+ qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } );
+}
+
=back
=head1 VERSION
-$Id: pkg_svc.pm,v 1.3 1999-01-18 21:58:08 ivan Exp $
+$Id: pkg_svc.pm,v 1.4 1999-07-20 10:37:05 ivan Exp $
=head1 BUGS
@@ -131,7 +156,11 @@ ivan@sisd.com 97-nov-13
pod ivan@sisd.com 98-sep-22
$Log: pkg_svc.pm,v $
-Revision 1.3 1999-01-18 21:58:08 ivan
+Revision 1.4 1999-07-20 10:37:05 ivan
+cleaned up the new one-screen signup bits in htdocs/edit/cust_main.cgi to
+prepare for a signup server
+
+Revision 1.3 1999/01/18 21:58:08 ivan
esthetic: eq and ne were used in a few places instead of == and !=
Revision 1.2 1998/12/29 11:59:51 ivan