use strict;
use vars qw( $AUTOLOAD
- %virtual_fields_cache
+ %virtual_fields_cache %fk_method_cache
$money_char $lat_lower $lon_upper
);
use Carp qw(carp cluck croak confess);
eval "sub PG_BYTEA { die 'guru meditation #9: calling PG_BYTEA when not running Pg?'; }";
}
+ foreach my $table ( dbdef->tables ) {
+ $fk_method_cache{$table} = fk_methods($table);
+ }
+
} );
=head1 NAME
$record->column('value') is a synonym for $record->set('column','value');
+$record->foreign_table_name calls qsearchs and returns a single
+FS::foreign_table record (for tables referenced by a column of this table) or
+qsearch and returns an array of FS::foreign_table records (for tables
+referenced by a column in the foreign table).
+
=cut
# readable/safe
my($self,$value)=@_;
my($field)=$AUTOLOAD;
$field =~ s/.*://;
+
+ #$fk_method_cache{$self->table} ||= fk_methods($self->table);
+ if ( exists($fk_method_cache{$self->table}->{$field}) ) {
+
+ my $fk_info = $fk_method_cache{$self->table}->{$field};
+ my $method = $fk_info->{method} || 'qsearchs';
+ my $table = $fk_info->{table} || $field;
+ my $column = $fk_info->{column};
+ my $foreign_column = $fk_info->{references} || $column;
+
+ eval "use FS::$table";
+ die $@ if $@;
+
+ my $pkey_value = $self->$column();
+ my %search = ( $foreign_column => $pkey_value );
+
+ # FS::Record->$method() ? they're actually just subs :/
+ if ( $method eq 'qsearchs' ) {
+ return $pkey_value ? qsearchs( $table, \%search ) : '';
+ } elsif ( $method eq 'qsearch' ) {
+ return $pkey_value ? qsearch( $table, \%search ) : ();
+ } else {
+ die "unknown method $method";
+ }
+
+ }
+
if ( defined($value) ) {
confess "errant AUTOLOAD $field for $self (arg $value)"
unless blessed($self) && $self->can('setfield');
}
}
-# efficient
+# efficient (also, old, doesn't support FK stuff)
#sub AUTOLOAD {
# my $field = $AUTOLOAD;
# $field =~ s/.*://;
# }
#}
+sub fk_methods {
+ my $table = shift;
+
+ my %hash = ();
+
+ # foreign keys we reference in other tables
+ foreach my $fk (dbdef->table($table)->foreign_keys) {
+
+ my $method = '';
+ if ( scalar( @{$fk->columns} ) == 1 ) {
+ if ( ! @{$fk->references} || $fk->columns->[0] eq $fk->references->[0] ){
+ $method = $fk->table;
+ } else {
+ #some sort of hint in the table.pm or schema for methods not named
+ # after their foreign table (well, not a whole lot different than
+ # just providing a small subroutine...)
+ }
+
+ if ( $method ) {
+ $hash{$method} = { #fk_info
+ 'method' => 'qsearchs',
+ 'column' => $fk->columns->[0],
+ #'references' => $fk->references->[0],
+ };
+ }
+
+ }
+
+ }
+
+ # foreign keys referenced in other tables to us
+ # (alas. why we're cached. still, might this loop better be done once at
+ # schema load time insetad of every time we AUTOLOAD a method on a new
+ # class?)
+ foreach my $f_table ( dbdef->tables ) {
+ foreach my $fk (dbdef->table($f_table)->foreign_keys) {
+
+ next unless $fk->table eq $table;
+
+ my $method = '';
+ if ( scalar( @{$fk->columns} ) == 1 ) {
+ if ( ! @{$fk->references} || $fk->columns->[0] eq $fk->references->[0] ){
+ $method = $f_table;
+ } else {
+ #some sort of hint in the table.pm or schema for methods not named
+ # after their foreign table (well, not a whole lot different than
+ # just providing a small subroutine...)
+ }
+
+ if ( $method ) {
+ $hash{$method} = { #fk_info
+ 'method' => 'qsearch',
+ 'column' => $fk->columns->[0], #references||column
+ #'references' => $fk->column->[0],
+ };
+ }
+
+ }
+
+ }
+
+ }
+
+ \%hash;
+}
+
=item hash
Returns a list of the column/value pairs, usually for assigning to a new hash.
=item check
Checks custom fields. Subclasses should still provide a check method to validate
-non-custom fields, foreign keys, etc., and call this method via $self->SUPER::check.
+non-custom fields, etc., and call this method via $self->SUPER::check.
=cut
{ columns => [ 'billpkgnum' ],
table => 'cust_bill_pkg',
},
- { columns => [ 'pkgnum' ],
- table => 'cust_pkg',
- },
- { columns => [ 'invnum' ],
- table => 'cust_bill',
- },
+ #{ columns => [ 'pkgnum' ],
+ # table => 'cust_pkg',
+ #},
+ #{ columns => [ 'invnum' ],
+ # table => 'cust_bill',
+ #},
{ columns => [ 'classnum' ],
table => 'usage_class',
},
{ columns => [ 'billpkgnum' ],
table => 'cust_bill_pkg_void',
},
- { columns => [ 'pkgnum' ],
- table => 'cust_pkg',
- },
- { columns => [ 'invnum' ],
- table => 'cust_bill',
- },
+ #{ columns => [ 'pkgnum' ],
+ # table => 'cust_pkg',
+ #},
+ #{ columns => [ 'invnum' ],
+ # table => 'cust_bill',
+ #},
{ columns => [ 'classnum' ],
table => 'usage_class',
},
'classname', 'varchar', '', $char_d, '', '',
],
'primary_key' => 'classnum',
- 'unique' => [ ],
- 'index' => [ ],
+ 'unique' => [],
+ 'index' => [],
},
'hardware_type' => {
'disabled', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'statusnum',
- 'unique' => [ ],
- 'index' => [ ],
+ 'unique' => [],
+ 'index' => [],
},
'domain_record' => {
'index' => [],
'foreign_keys' => [
{ columns => [ 'svcnum' ],
- table => 'svc_broadband',
+ table => 'svc_broadband',#no? could be _acct?
+ #remove or cust_svc?
},
],
},
package FS::access_group;
+use base qw( FS::m2m_Common FS::m2name_Common FS::Record );
use strict;
-use base qw(FS::m2m_Common FS::m2name_Common FS::Record);
use FS::Record qw( qsearch qsearchs );
-use FS::access_groupagent;
use FS::access_right;
=head1 NAME
Returns all associated FS::access_groupagent records.
-=cut
-
-sub access_groupagent {
- my $self = shift;
- qsearch('access_groupagent', { 'groupnum' => $self->groupnum } );
-}
-
=item access_rights
Returns all associated FS::access_right records.
package FS::access_groupagent;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-use FS::agent;
-use FS::access_group;
-
-@ISA = qw(FS::Record);
=head1 NAME
Returns the associated FS::agent object.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs('agent', { 'agentnum' => $self->agentnum } );
-}
-
=item access_group
Returns the associated FS::access_group object.
-=cut
-
-sub access_group {
- my $self = shift;
- qsearchs('access_group', { 'groupnum' => $self->groupnum } );
-}
-
=back
=head1 BUGS
package FS::access_user;
+use base qw( FS::m2m_Common FS::option_Common );
use strict;
-use base qw( FS::m2m_Common FS::option_Common );
use vars qw( $DEBUG $me $conf );
use FS::UID;
use FS::Auth;
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh );
-use FS::access_user_pref;
-use FS::access_usergroup;
use FS::agent;
use FS::cust_main;
use FS::sales;
Returns links to the the groups this user is a part of, as FS::access_usergroup
objects (see L<FS::access_usergroup>).
-=cut
-
-sub access_usergroup {
- my $self = shift;
- qsearch( 'access_usergroup', { 'usernum' => $self->usernum } );
-}
-
-#=item access_groups
-#
-#=cut
-#
-#sub access_groups {
-#
-#}
-#
-#=item access_groupnames
-#
-#=cut
-#
-#sub access_groupnames {
-#
-#}
-
=item agentnums
Returns a list of agentnums this user can view (via group membership).
package FS::access_user_pref;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::access_user_session;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearchs ); # qsearch );
-use FS::access_user;
=head1 NAME
Returns the employee (see L<FS::access_user>) for this session.
-=cut
-
-sub access_user {
- my $self = shift;
- qsearchs('access_user', { 'usernum' => $self->usernum });
-}
-
=item touch_last_date
=cut
package FS::access_usergroup;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-use FS::access_user;
-use FS::access_group;
-
-@ISA = qw(FS::Record);
=head1 NAME
=item access_user
-=cut
-
-sub access_user {
- my $self = shift;
- qsearchs( 'access_user', { 'usernum' => $self->usernum } );
-}
-
=item access_group
-=cut
-
-sub access_group {
- my $self = shift;
- qsearchs( 'access_group', { 'groupnum' => $self->groupnum } );
-}
-
=back
=head1 BUGS
package FS::acct_snarf;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
use Tie::IxHash;
use FS::Record qw( qsearchs );
use FS::cust_svc;
-@ISA = qw( FS::Record );
-
=head1 NAME
FS::acct_snarf - Object methods for acct_snarf records
package FS::addr_block;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearchs qsearch dbh );
-use FS::router;
-use FS::addr_range;
-use FS::svc_broadband;
-use FS::Conf;
-use FS::IP_Mixin;
-use NetAddr::IP;
use Carp qw( carp );
use List::Util qw( first );
-
-@ISA = qw( FS::Record );
+use NetAddr::IP;
+use FS::Conf;
+use FS::Record qw( qsearch dbh ); #qsearchs
+use FS::IP_Mixin;
+use FS::addr_range;
=head1 NAME
Returns the FS::router object corresponding to this object. If the
block is unassigned, returns undef.
-=cut
-
-sub router {
- my $self = shift;
- return qsearchs('router', { routernum => $self->routernum });
-}
-
=item svc_broadband
Returns a list of FS::svc_broadband objects associated
with this object.
-=cut
-
-sub svc_broadband {
- my $self = shift;
- return qsearch('svc_broadband', { blocknum => $self->blocknum });
-}
-
=item NetAddr
Returns a NetAddr::IP object for this block's address and netmask.
Returns the agent (see L<FS::agent>) for this address block, if one exists.
-=cut
-
-sub agent {
- qsearchs('agent', { 'agentnum' => shift->agentnum } );
-}
-
=item label
Returns text including the router name, gateway ip, and netmask for this
use FS::Record qw( dbh qsearch qsearchs );
use FS::cust_main;
use FS::cust_pkg;
-use FS::agent_type;
-use FS::agent_currency;
use FS::reg_code;
+use FS::agent_payment_gateway;
use FS::TicketSystem;
use FS::Conf;
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 agent_cust_main
Returns the FS::cust_main object (see L<FS::cust_main>), if any, for this
Returns the FS::agent_currency objects (see L<FS::agent_currency>), if any, for
this agent.
-=cut
-
-sub agent_currency {
- my $self = shift;
- qsearch('agent_currency', { 'agentnum' => $self->agentnum } );
-}
-
=item agent_currency_hashref
Returns a hash references of supported additional currencies for this agent.
package FS::agent_payment_gateway;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-use FS::payment_gateway;
-
-@ISA = qw(FS::Record);
=head1 NAME
=item payment_gateway
-=cut
-
-sub payment_gateway {
- my $self = shift;
- qsearchs('payment_gateway', { 'gatewaynum' => $self->gatewaynum } );
-}
-
=back
=head1 BUGS
package FS::bill_batch;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA $me $DEBUG );
+use vars qw( $me $DEBUG );
use CAM::PDF;
use FS::Conf;
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::agent;
-use FS::cust_bill_batch;
-@ISA = qw( FS::Record );
$me = '[ FS::bill_batch ]';
-$DEBUG=0;
+$DEBUG = 0;
sub table { 'bill_batch' }
my $self = shift;
my $job = shift;
$job->update_statustext(0) if $job;
- my @invoices = sort { $a->invnum <=> $b->invnum }
- qsearch('cust_bill_batch', { batchnum => $self->batchnum });
+ my @invoices = sort { $a->invnum <=> $b->invnum } $self->cust_bill_batch;
return "No invoices in batch ".$self->batchnum.'.' if !@invoices;
my $pdf_out;
Returns the agent (see L<FS::agent>) for this invoice batch.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
-}
-
=back
=head1 SUBROUTINES
package FS::cdr_cust_pkg_usage;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
=head1 NAME
Returns the L<FS::cdr> object that the usage was applied to.
-=cut
-
-sub cust_pkg_usage {
- FS::cust_pkg_usage->by_key($_[0]->pkgusagenum);
-}
-
-sub cdr {
- FS::cdr->by_key($_[0]->acctid);
-}
-
=back
=head1 SEE ALSO
package FS::cgp_rule;
+use base qw( FS::o2m_Common FS::Record );
use strict;
-use base qw( FS::o2m_Common FS::Record );
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::cust_svc;
-use FS::cgp_rule_condition;
-use FS::cgp_rule_action;
+use FS::Record qw( dbh );
=head1 NAME
=cut
-sub insert {
- my $self = shift;
-
- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
- my $oldAutoCommit = $FS::UID::AutoCommit;
- local $FS::UID::AutoCommit = 0;
- my $dbh = dbh;
-
- my $error = $self->SUPER::insert(@_);
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return $error;
- }
-
- #conditions and actions not in yet
- #$error = $self->svc_export;
- #if ( $error ) {
- # $dbh->rollback if $oldAutoCommit;
- # return $error;
- #}
-
- $dbh->commit or die $dbh->errstr if $oldAutoCommit;
- '';
-}
+# sub insert {
+# my $self = shift;
+#
+# local $SIG{HUP} = 'IGNORE';
+# local $SIG{INT} = 'IGNORE';
+# local $SIG{QUIT} = 'IGNORE';
+# local $SIG{TERM} = 'IGNORE';
+# local $SIG{TSTP} = 'IGNORE';
+# local $SIG{PIPE} = 'IGNORE';
+#
+# my $oldAutoCommit = $FS::UID::AutoCommit;
+# local $FS::UID::AutoCommit = 0;
+# my $dbh = dbh;
+#
+# my $error = $self->SUPER::insert(@_);
+# if ( $error ) {
+# $dbh->rollback if $oldAutoCommit;
+# return $error;
+# }
+#
+# #conditions and actions not in yet
+# #$error = $self->svc_export;
+# #if ( $error ) {
+# # $dbh->rollback if $oldAutoCommit;
+# # return $error;
+# #}
+#
+# $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+# '';
+# }
=item delete
=item cust_svc
-=cut
-
-sub cust_svc {
- my $self = shift;
- qsearchs('cust_svc', { 'svcnum' => $self->svcnum } );
-}
-
=item cgp_rule_condition
Returns the conditions associated with this rule, as FS::cgp_rule_condition
objects.
-=cut
-
-sub cgp_rule_condition {
- my $self = shift;
- qsearch('cgp_rule_condition', { 'rulenum' => $self->rulenum } );
-}
-
-=item cgp_rule_action
-
-Returns the actions associated with this rule, as FS::cgp_rule_action
-objects.
-
-=cut
-
-sub cgp_rule_action {
- my $self = shift;
- qsearch('cgp_rule_action', { 'rulenum' => $self->rulenum } );
-}
-
=item arrayref
Returns an arraref representing this rule, suitable for Communigate Pro API
package FS::clientapi_session;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::clientapi_session_field;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
use base qw( FS::Record );
use strict;
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::prospect_main;
-use FS::cust_main;
-use FS::contact_class;
-use FS::cust_location;
-use FS::contact_phone;
-use FS::contact_email;
+use FS::Record qw( qsearchs dbh ); # qw( qsearch qsearchs dbh );
=head1 NAME
$data;
}
-sub cust_location {
- my $self = shift;
- return '' unless $self->locationnum;
- qsearchs('cust_location', { 'locationnum' => $self->locationnum } );
-}
-
-sub contact_class {
- my $self = shift;
- return '' unless $self->classnum;
- qsearchs('contact_class', { 'classnum' => $self->classnum } );
-}
-
sub contact_classname {
my $self = shift;
my $contact_class = $self->contact_class or return '';
$contact_class->classname;
}
-sub contact_phone {
- my $self = shift;
- qsearch('contact_phone', { 'contactnum' => $self->contactnum } );
-}
-
-sub contact_email {
- my $self = shift;
- qsearch('contact_email', { 'contactnum' => $self->contactnum } );
-}
-
-sub cust_main {
- my $self = shift;
- qsearchs('cust_main', { 'custnum' => $self->custnum } );
-}
-
=back
=head1 BUGS
use base qw( FS::Record );
use strict;
-use FS::Record qw( qsearch qsearchs );
-use FS::contact;
=head1 NAME
$self->SUPER::check;
}
-sub contact {
- my $self = shift;
- qsearchs( 'contact', { 'contactnum' => $self->contactnum } );
-}
-
=back
=head1 BUGS
use base qw( FS::Record );
use strict;
-use FS::Record qw( qsearch qsearchs );
-use FS::contact;
-use FS::phone_type;
=head1 NAME
}
-sub contact {
- my $self = shift;
- qsearchs( 'contact', { 'contactnum' => $self->contactnum } );
-}
-
-sub phone_type {
- my $self = shift;
- qsearchs('phone_type', { 'phonetypenum' => $self->phonetypenum } );
-}
-
sub typename {
my $self = shift;
$self->phone_type->typename;
use FS::UID qw( datasrc );
use FS::Misc qw( send_email send_fax do_print );
use FS::Record qw( qsearch qsearchs dbh );
-use FS::cust_main;
use FS::cust_statement;
use FS::cust_bill_pkg;
use FS::cust_bill_pkg_display;
use FS::cust_pkg;
use FS::cust_credit_bill;
use FS::pay_batch;
-use FS::cust_pay_batch;
use FS::cust_bill_event;
use FS::cust_event;
use FS::part_pkg;
use FS::cust_bill_pay;
-use FS::cust_bill_pay_batch;
use FS::part_bill_event;
use FS::payby;
use FS::bill_batch;
qsearch(
{ 'table' => 'cust_bill_pkg',
'hashref' => { 'invnum' => $self->invnum },
- 'order_by' => 'ORDER BY billpkgnum',
+ 'order_by' => 'ORDER BY billpkgnum', #important? otherwise we could use
+ # the AUTLOADED FK search. or should
+ # that default to ORDER by the pkey?
}
);
}
Returns the customer (see L<FS::cust_main>) for this invoice.
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
=item cust_suspend_if_balance_over AMOUNT
Suspends the customer associated with this invoice if the total amount owed on
#;
}
-sub cust_pay_batch {
- my $self = shift;
- qsearch('cust_pay_batch', { 'invnum' => $self->invnum } );
-}
-
-sub cust_bill_pay_batch {
- my $self = shift;
- qsearch('cust_bill_pay_batch', { 'invnum' => $self->invnum } );
-}
-
=item cust_bill_pay
Returns all payment applications (see L<FS::cust_bill_pay>) for this invoice.
package FS::cust_bill_batch;
+use base qw( FS::option_Common );
use strict;
-use vars qw( @ISA $me $DEBUG );
-use FS::Record qw( qsearch qsearchs dbh );
+use vars qw( $me $DEBUG );
-@ISA = qw( FS::option_Common );
$me = '[ FS::cust_bill_batch ]';
-$DEBUG=0;
+$DEBUG = 0;
sub table { 'cust_bill_batch' }
Returns the C<FS::bill_batch> object.
-=cut
-
-sub bill_batch {
- my $self = shift;
- FS::bill_batch->by_key($self->batchnum);
-}
-
=item cust_bill
Returns the C<FS::cust_bill> object.
-=cut
-
-sub cust_bill {
- my $self = shift;
- FS::cust_bill->by_key($self->invnum);
-}
-
=back
=head1 BUGS
package FS::cust_bill_batch_option;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::cust_bill_pay;
+use base qw( FS::cust_main_Mixin FS::cust_bill_ApplicationCommon );
use strict;
-use vars qw( @ISA $conf );
-use FS::Record qw( qsearchs );
-use FS::cust_main_Mixin;
-use FS::cust_bill_ApplicationCommon;
-use FS::cust_bill;
-use FS::cust_pay;
-use FS::cust_pkg;
-
-@ISA = qw( FS::cust_main_Mixin FS::cust_bill_ApplicationCommon );
+use vars qw( $conf );
+use FS::UID;
#ask FS::UID to run this stuff for us later
FS::UID->install_callback( sub {
Returns the payment (see L<FS::cust_pay>)
-=cut
-
-sub cust_pay {
- my $self = shift;
- qsearchs( 'cust_pay', { 'paynum' => $self->paynum } );
-}
-
=item send_receipt HASHREF | OPTION => VALUE ...
Sends a payment receipt for the associated payment, against this specific
package FS::cust_bill_pay_batch;
+use base qw( FS::Record );
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::cust_bill_pay_pkg;
+use base qw( FS::Record );
use strict;
-use vars qw( @ISA );
use FS::Conf;
-use FS::Record qw( qsearch qsearchs );
-use FS::cust_bill_pay;
-use FS::cust_bill_pkg;
-
-@ISA = qw(FS::Record);
=head1 NAME
Returns the FS::cust_bill_pay object (payment application to the overall
invoice).
-=cut
-
-sub cust_bill_pay {
- my $self = shift;
- qsearchs('cust_bill_pay', { 'billpaynum' => $self->billpaynum } );
-}
-
=item cust_bill_pkg
Returns the FS::cust_bill_pkg object (line item to which payment is applied).
-=cut
-
-sub cust_bill_pkg {
- my $self = shift;
- qsearchs('cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } );
-}
-
=item send_receipt
Sends a payment receipt for the associated payment, against this specific
use Text::CSV_XS;
use FS::Record qw( qsearch qsearchs dbh );
use FS::cust_pkg;
-use FS::cust_bill;
use FS::cust_bill_pkg_detail;
use FS::cust_bill_pkg_display;
use FS::cust_bill_pkg_discount;
Returns the invoice (see L<FS::cust_bill>) for this invoice line item.
-=cut
-
-sub cust_bill {
- my $self = shift;
- qsearchs( 'cust_bill', { 'invnum' => $self->invnum } );
-}
-
=item previous_cust_bill_pkg
Returns the previous cust_bill_pkg for this package, if any.
package FS::cust_bill_pkg_discount;
+use base qw( FS::cust_main_Mixin FS::Record );
use strict;
-use base qw( FS::cust_main_Mixin FS::Record );
-use FS::Record qw( qsearch qsearchs );
-use FS::cust_bill_pkg;
-use FS::cust_pkg_discount;
=head1 NAME
Returns the associated line item (see L<FS::cust_bill_pkg>).
-=cut
-
-sub cust_bill_pkg {
- my $self = shift;
- qsearchs( 'cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } ) ;
-}
-
=item cust_pkg_discount
Returns the associated customer discount (see L<FS::cust_pkg_discount>).
-=cut
-
-sub cust_pkg_discount {
- my $self = shift;
- qsearchs( 'cust_pkg_discount', { 'pkgdiscountnum' => $self->pkgdiscountnum });
-}
-
-
=back
=head1 BUGS
package FS::cust_bill_pkg_discount_void;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record; # qw( qsearch qsearchs );
-use FS::cust_bill_pkg_void;
-use FS::cust_pkg_discount;
=head1 NAME
package FS::cust_bill_pkg_display;
+use base qw( FS::Record );
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
Returns the associated cust_bill_pkg (see L<FS::cust_bill_pkg>) for this
line item display object.
-=cut
-
-sub cust_bill_pkg {
- my $self = shift;
- qsearchs( 'cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } ) ;
-}
-
=back
=head1 BUGS
-
=head1 SEE ALSO
L<FS::Record>, L<FS::cust_bill_pkg>, schema.html from the base documentation.
package FS::cust_bill_pkg_tax_location;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
+use List::Util qw(sum min);
+use FS::Record qw( dbh qsearch qsearchs );
use FS::cust_bill_pkg;
use FS::cust_pkg;
-use FS::cust_location;
use FS::cust_bill_pay_pkg;
use FS::cust_credit_bill_pkg;
use FS::cust_main_county;
use FS::Log;
-use List::Util qw(sum min);
-
=head1 NAME
FS::cust_bill_pkg_tax_location - Object methods for cust_bill_pkg_tax_location records
Returns the associated cust_bill_pkg object (i.e. the tax charge).
-=cut
-
-sub cust_bill_pkg {
- my $self = shift;
- qsearchs( 'cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } );
-}
-
=item taxable_cust_bill_pkg
Returns the cust_bill_pkg object for the I<taxable> charge.
Returns the associated cust_location object
-=cut
-
-sub cust_location {
- my $self = shift;
- qsearchs( 'cust_location', { 'locationnum' => $self->locationnum } );
-}
-
=item desc
Returns a description for this tax line item constituent. Currently this
# FS::cust_bill_pkg.
my ($class, %opt) = @_;
- my $dbh = FS::UID::dbh();
+ my $dbh = dbh;
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
my $log = FS::Log->new('upgrade_taxable_billpkgnum');
package FS::cust_bill_pkg_tax_rate_location;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
use FS::Record qw( qsearch qsearchs );
-use FS::cust_bill_pkg;
use FS::cust_pkg;
-use FS::tax_rate_location;
use FS::cust_bill_pay_pkg;
use FS::cust_credit_bill_pkg;
Returns the associated cust_bill_pkg object
-=cut
-
-sub cust_bill_pkg {
- my $self = shift;
- qsearchs( 'cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } );
-}
-
=item tax_rate_location
Returns the associated tax_rate_location object
-=cut
-
-sub tax_rate_location {
- my $self = shift;
- qsearchs( 'tax_rate_location',
- { 'taxratelocationnum' => $self->taxratelocationnum }
- );
-}
-
=item desc
Returns a description for this tax line item constituent. Currently this
use strict;
use FS::Record qw( qsearch qsearchs dbh fields );
-use FS::cust_main;
use FS::cust_statement;
use FS::access_user;
use FS::cust_bill_pkg_void;
=item cust_main
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs('cust_main', { 'custnum' => $self->custnum } );
-}
-
=item cust_bill_pkg
=cut
package FS::cust_class;
+use base qw( FS::class_Common );
use strict;
-use base qw( FS::class_Common );
-use FS::cust_main;
use FS::cust_category;
=head1 NAME
package FS::cust_credit;
+use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Record );
use strict;
-use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Record );
use vars qw( $conf $unsuspendauto $me $DEBUG
$otaker_upgrade_kludge $ignore_empty_reasonnum
);
use FS::Misc qw(send_email);
use FS::Record qw( qsearch qsearchs dbdef );
use FS::CurrentUser;
-use FS::cust_main;
use FS::cust_pkg;
use FS::cust_refund;
use FS::cust_credit_bill;
Returns the customer (see L<FS::cust_main>) for this credit.
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
-
=item reason
Returns the text of the associated reason (see L<FS::reason>) for this credit.
package FS::cust_credit_bill;
+use base qw( FS::cust_main_Mixin FS::cust_bill_ApplicationCommon );
use strict;
-use vars qw( @ISA $conf );
-use FS::Record qw( qsearch qsearchs );
-use FS::cust_main_Mixin;
-use FS::cust_bill_ApplicationCommon;
-use FS::cust_bill;
-use FS::cust_credit;
-use FS::cust_pkg;
-
-@ISA = qw( FS::cust_main_Mixin FS::cust_bill_ApplicationCommon );
+use vars qw( $conf );
+use FS::UID;
#ask FS::UID to run this stuff for us later
FS::UID->install_callback( sub {
Returns the credit (see L<FS::cust_credit>)
-=cut
-
-sub cust_credit {
- my $self = shift;
- qsearchs( 'cust_credit', { 'crednum' => $self->crednum } );
-}
-
=back
=head1 BUGS
package FS::cust_credit_bill_pkg;
+use base qw( FS::cust_main_Mixin FS::Record );
use strict;
-use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs dbh );
-use FS::cust_main_Mixin;
-use FS::cust_credit_bill;
-use FS::cust_bill_pkg;
use FS::cust_bill_pkg_tax_location;
use FS::cust_bill_pkg_tax_rate_location;
use FS::cust_tax_exempt_pkg;
-@ISA = qw( FS::cust_main_Mixin FS::Record );
-
=head1 NAME
FS::cust_credit_bill_pkg - Object methods for cust_credit_bill_pkg records
$self->SUPER::check;
}
-sub cust_credit_bill {
- my $self = shift;
- qsearchs('cust_credit_bill', { 'creditbillnum' => $self->creditbillnum } );
-}
-
-sub cust_bill_pkg {
- my $self = shift;
- qsearchs('cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } );
-}
-
sub cust_bill_pkg_tax_Xlocation {
my $self = shift;
if ($self->billpkgtaxlocationnum) {
package FS::cust_credit_refund;
+use base qw( FS::cust_main_Mixin FS::Record );
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::cust_main_Mixin;
-use FS::cust_credit;
-use FS::cust_refund;
-
-@ISA = qw( FS::cust_main_Mixin FS::Record );
=head1 NAME
return "amount must be > 0" if $self->amount <= 0;
return "unknown cust_credit.crednum: ". $self->crednum
- unless my $cust_credit =
- qsearchs( 'cust_credit', { 'crednum' => $self->crednum } );
+ unless my $cust_credit = $self->cust_credit;
return "Unknown refund"
- unless my $cust_refund =
- qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } );
+ unless my $cust_refund = $self->cust_refund;
$self->_date(time) unless $self->_date;
Returns the refund (see L<FS::cust_refund>)
-=cut
-
-sub cust_refund {
- my $self = shift;
- qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } );
-}
-
=item cust_credit
Returns the credit (see L<FS::cust_credit>)
-=cut
-
-sub cust_credit {
- my $self = shift;
- qsearchs( 'cust_credit', { 'crednum' => $self->crednum } );
-}
-
=back
=head1 BUGS
package FS::cust_credit_void;
+use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Record );
use strict;
-use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Record );
-use FS::Record qw(qsearch qsearchs dbh fields);
+use FS::Record qw(qsearchs); # qsearch qsearchs);
use FS::CurrentUser;
use FS::access_user;
use FS::cust_credit;
Returns the parent customer object (see L<FS::cust_main>).
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
=item void_access_user
Returns the voiding employee object (see L<FS::access_user>).
package FS::cust_event;
+use base qw( FS::cust_main_Mixin FS::Record );
use strict;
-use base qw( FS::cust_main_Mixin FS::Record );
-use vars qw( @ISA $DEBUG $me );
+use vars qw( $DEBUG $me );
use Carp qw( croak confess );
use FS::Record qw( qsearch qsearchs dbdef );
-use FS::part_event;
#for cust_X
use FS::cust_main;
use FS::cust_pkg;
Returns the event definition (see L<FS::part_event>) for this completed event.
-=cut
-
-sub part_event {
- my $self = shift;
- qsearchs( 'part_event', { 'eventpart' => $self->eventpart } );
-}
-
=item cust_X
Returns the customer, package, invoice or batched payment (see
package FS::cust_main;
-
-require 5.006;
-use strict;
-use base qw( FS::cust_main::Packages FS::cust_main::Status
+use base qw( FS::cust_main::Packages
+ FS::cust_main::Status
FS::cust_main::NationalID
- FS::cust_main::Billing FS::cust_main::Billing_Realtime
+ FS::cust_main::Billing
+ FS::cust_main::Billing_Realtime
FS::cust_main::Billing_Discount
FS::cust_main::Billing_ThirdParty
FS::cust_main::Location
FS::o2m_Common
FS::Record
);
+
+require 5.006;
+use strict;
use vars qw( $DEBUG $me $conf
@encrypted_fields
$import
use FS::cust_main_exemption;
use FS::cust_tax_adjustment;
use FS::cust_tax_location;
-use FS::agent;
use FS::agent_currency;
use FS::cust_main_invoice;
use FS::cust_tag;
sub cust_location {
my $self = shift;
- qsearch('cust_location', { 'custnum' => $self->custnum,
+ qsearch('cust_location', { 'custnum' => $self->custnum,
'prospectnum' => '' } );
}
Returns the agent (see L<FS::agent>) for this customer.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
-}
-
=item agent_name
Returns the agent name (see L<FS::agent>) for this customer.
Returns any tags associated with this customer, as FS::cust_tag objects,
or an empty list if there are no tags.
-=cut
-
-sub cust_tag {
- my $self = shift;
- qsearch('cust_tag', { 'custnum' => $self->custnum } );
-}
-
=item part_tag
Returns any tags associated with this customer, as FS::part_tag objects,
Returns the customer class, as an FS::cust_class object, or the empty string
if there is no customer class.
-=cut
-
-sub cust_class {
- my $self = shift;
- if ( $self->classnum ) {
- qsearchs('cust_class', { 'classnum' => $self->classnum } );
- } else {
- return '';
- }
-}
-
=item categoryname
Returns the customer category name, or the empty string if there is no customer
=item cust_main_exemption
-=cut
-
-sub cust_main_exemption {
- my $self = shift;
- qsearch( 'cust_main_exemption', { 'custnum' => $self->custnum } );
-}
-
=item invoicing_list [ ARRAYREF ]
If an arguement is given, sets these email addresses as invoice recipients
package FS::cust_main_county;
+use base qw( FS::Record );
use strict;
-use vars qw( @ISA @EXPORT_OK $conf
+use vars qw( @EXPORT_OK $conf
@cust_main_county %cust_main_county $countyflag ); # $cityflag );
use Exporter;
use FS::Record qw( qsearch qsearchs dbh );
use FS::cust_tax_exempt;
use FS::cust_tax_exempt_pkg;
-@ISA = qw( FS::Record );
@EXPORT_OK = qw( regionselector );
@cust_main_county = ();
package FS::cust_main_exemption;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
use FS::Conf;
-use FS::cust_main;
=head1 NAME
package FS::cust_main_invoice;
+use base qw( FS::Record );
use strict;
-use vars qw(@ISA);
-use Exporter;
use FS::Record qw( qsearchs );
use FS::Conf;
-use FS::cust_main;
use FS::svc_acct;
use FS::Msgcat qw(gettext);
-@ISA = qw( FS::Record );
-
=head1 NAME
FS::cust_main_invoice - Object methods for cust_main_invoice records
;
return $error if $error;
- return "Unknown customer"
- unless qsearchs('cust_main',{ 'custnum' => $self->custnum });
-
$self->SUPER::check;
}
Returns the parent customer object (see L<FS::cust_main>).
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
=back
=head1 BUGS
package FS::cust_main_note;
+use base qw( FS::otaker_Mixin FS::Record );
use strict;
-use base qw( FS::otaker_Mixin FS::Record );
use Carp;
-use FS::Record qw( qsearch qsearchs );
-use FS::cust_note_class;
+use FS::Record qw( qsearchs ); #qw( qsearch qsearchs );
=head1 NAME
Returns the customer note class, as an FS::cust_note_class object, or the empty
string if there is no note class.
-=cut
-
-sub cust_note_class {
- my $self = shift;
- if ( $self->classnum ) {
- qsearchs('cust_note_class', { 'classnum' => $self->classnum } );
- } else {
- return '';
- }
-}
-
=item classname
Returns the customer note class name, or the empty string if there is no
package FS::cust_note_class;
+use base qw( FS::class_Common );
use strict;
-use base qw( FS::class_Common );
-use FS::cust_main_note;
=head1 NAME
package FS::cust_pay_batch;
+use base qw( FS::payinfo_Mixin FS::cust_main_Mixin FS::Record );
use strict;
-use vars qw( @ISA $DEBUG );
+use vars qw( $DEBUG );
use Carp qw( confess );
use Business::CreditCard 0.28;
use FS::Record qw(dbh qsearch qsearchs);
-use FS::payinfo_Mixin;
-use FS::cust_main;
-use FS::cust_bill;
-
-@ISA = qw( FS::payinfo_Mixin FS::cust_main_Mixin FS::Record );
# 1 is mostly method/subroutine entry and options
# 2 traces progress of some operations
Returns the customer (see L<FS::cust_main>) for this batched credit card
payment.
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
=item expmmyy
Returns the credit card expiration date in MMYY format. If this is a
=cut
-sub pay_batch {
- my $self = shift;
- FS::pay_batch->by_key($self->batchnum);
-}
-
#you know what, screw this in the new world of events. we should be able to
#get the event defs to retry (remove once.pm condition, add every.pm) without
#mucking about with statuses of previous cust_event records. right?
package FS::cust_pay_pending;
+use base qw( FS::payinfo_transaction_Mixin FS::cust_main_Mixin FS::Record );
use strict;
-use vars qw( @ISA @encrypted_fields );
-use FS::Record qw( qsearch qsearchs dbh ); #dbh for _upgrade_data
-use FS::payinfo_transaction_Mixin;
-use FS::cust_main_Mixin;
-use FS::cust_main;
-use FS::cust_pkg;
+use vars qw( @encrypted_fields );
+use FS::Record qw( qsearchs dbh ); #dbh for _upgrade_data
use FS::cust_pay;
-@ISA = qw( FS::payinfo_transaction_Mixin FS::cust_main_Mixin FS::Record );
-
@encrypted_fields = ('payinfo');
sub nohistory_fields { ('payinfo'); }
=cut
-sub cust_main {
- my $self = shift;
- qsearchs('cust_main', { custnum => $self->custnum } );
-}
-
-
#these two are kind-of false laziness w/cust_main::realtime_bop
#(currently only used when resolving pending payments manually)
package FS::cust_pay_refund;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA ); #$conf );
use FS::Record qw( qsearchs ); # qsearch );
use FS::cust_main;
-use FS::cust_pay;
-use FS::cust_refund;
-
-@ISA = qw( FS::Record );
#ask FS::UID to run this stuff for us later
#FS::UID->install_callback( sub {
Returns the payment (see L<FS::cust_pay>)
-=cut
-
-sub cust_pay {
- my $self = shift;
- qsearchs( 'cust_pay', { 'paynum' => $self->paynum } );
-}
-
=item cust_refund
Returns the refund (see L<FS::cust_refund>)
-=cut
-
-sub cust_refund {
- my $self = shift;
- qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } );
-}
-
=back
=head1 BUGS
package FS::cust_pay_void;
-
-use strict;
use base qw( FS::otaker_Mixin FS::payinfo_transaction_Mixin FS::cust_main_Mixin
FS::Record );
+
+use strict;
use vars qw( @encrypted_fields $otaker_upgrade_kludge );
use Business::CreditCard;
use FS::Record qw(qsearch qsearchs dbh fields);
#use FS::cust_bill;
#use FS::cust_bill_pay;
#use FS::cust_pay_refund;
-#use FS::cust_main;
use FS::cust_pkg;
@encrypted_fields = ('payinfo');
Returns the parent customer object (see L<FS::cust_main>).
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
=item void_access_user
Returns the voiding employee object (see L<FS::access_user>).
Returns the parent customer object (see L<FS::cust_main>).
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
=item balance
Returns the balance for this specific package, when using
=item cust_pkg_discount
-=cut
-
-sub cust_pkg_discount {
- my $self = shift;
- qsearch('cust_pkg_discount', { 'pkgnum' => $self->pkgnum } );
-}
-
=item cust_pkg_discount_active
=cut
Returns a list of all voice usage counters attached to this package.
-=cut
-
-sub cust_pkg_usage {
- my $self = shift;
- qsearch('cust_pkg_usage', { pkgnum => $self->pkgnum });
-}
-
=item apply_usage OPTIONS
Takes the following options:
package FS::cust_pkg_detail;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record; # qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::cust_pkg_discount;
+use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Record );
use strict;
-use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Record );
-use FS::Record qw( dbh qsearchs ); # qsearch );
-use FS::cust_pkg;
+use FS::Record qw( dbh ); # qsearch qsearchs dbh );
use FS::discount;
=head1 NAME
Returns the customer package (see L<FS::cust_pkg>).
-=cut
-
-sub cust_pkg {
- my $self = shift;
- qsearchs('cust_pkg', { 'pkgnum' => $self->pkgnum } );
-}
-
=item discount
Returns the discount (see L<FS::discount>).
-=cut
-
-sub discount {
- my $self = shift;
- qsearchs('discount', { 'discountnum' => $self->discountnum } );
-}
-
=item increment_months_used MONTHS
Increments months_used by the given parameter
package FS::cust_pkg_option;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::cust_pkg_reason;
+use base qw( FS::otaker_Mixin FS::Record );
use strict;
use vars qw( $ignore_empty_action );
-use base qw( FS::otaker_Mixin FS::Record );
-use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearch ); #qsearchs );
use FS::upgrade_journal;
$ignore_empty_action = 0;
Returns the reason (see L<FS::reason>) associated with this cust_pkg_reason.
-=cut
-
-sub reason {
- my $self = shift;
- qsearchs( 'reason', { 'reasonnum' => $self->reasonnum } );
-}
-
=item reasontext
Returns the text of the reason (see L<FS::reason>) associated with this
package FS::cust_pkg_usage;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::cust_pkg;
-use FS::part_pkg_usage;
-use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearch ); #qsearchs );
=head1 NAME
Return the L<FS::part_pkg_usage> linked to this record.
-=cut
-
-sub cust_pkg {
- my $self = shift;
- FS::cust_pkg->by_key($self->pkgnum);
-}
-
-sub part_pkg_usage {
- my $self = shift;
- FS::part_pkg_usage->by_key($self->pkgusagepart);
-}
-
=back
=head1 SEE ALSO
package FS::cust_svc;
+use base qw( FS::cust_main_Mixin FS::option_Common ); #FS::Record );
use strict;
-use vars qw( @ISA $DEBUG $me $ignore_quantity $conf $ticket_system );
+use vars qw( $DEBUG $me $ignore_quantity $conf $ticket_system );
use Carp;
#use Scalar::Util qw( blessed );
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh str2time_sql );
-use FS::cust_pkg;
use FS::part_pkg;
use FS::part_svc;
use FS::pkg_svc;
#most FS::svc_ classes are autoloaded in svc_x emthod
use FS::svc_acct; #this one is used in the cache stuff
-@ISA = qw( FS::cust_main_Mixin FS::option_Common ); #FS::Record );
$DEBUG = 0;
$me = '[cust_svc]';
Returns the package this service belongs to, as a FS::cust_pkg object (see
L<FS::cust_pkg>).
-=cut
-
-sub cust_pkg {
- my $self = shift;
- qsearchs( 'cust_pkg', { 'pkgnum' => $self->pkgnum } );
-}
-
=item pkg_svc
Returns the pkg_svc record for for this service, if applicable.
package FS::cust_svc_option;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-#use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::cust_tag;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearchs );
-use FS::cust_main;
-use FS::part_tag;
=head1 NAME
=item cust_main
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
=item part_tag
-=cut
-
-sub part_tag {
- my $self = shift;
- qsearchs( 'part_tag', { 'tagnum' => $self->tagnum } );
-}
-
-
=back
=head1 BUGS
package FS::cust_tax_adjustment;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
-use FS::cust_main;
-use FS::cust_bill_pkg;
=head1 NAME
$self->SUPER::check;
}
-sub cust_bill_pkg {
- my $self = shift;
- qsearchs('cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } );
-}
-
=back
=head1 BUGS
package FS::cust_tax_exempt;
+use base qw( FS::cust_main_Mixin FS::Record );
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-use FS::cust_main_Mixin;
-use FS::cust_main;
-use FS::cust_main_county;
-
-@ISA = qw( FS::cust_main_Mixin FS::Record );
=head1 NAME
Returns the FS::cust_main_county object associated with this tax exemption.
-=cut
-
-sub cust_main_county {
- my $self = shift;
- qsearchs( 'cust_main_county', { 'taxnum' => $self->taxnum } );
-}
-
=back
=head1 BUGS
package FS::cust_tax_exempt_pkg;
+use base qw( FS::cust_main_Mixin FS::Record );
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-use FS::cust_main_Mixin;
-use FS::cust_bill_pkg;
-use FS::cust_main_county;
-use FS::cust_credit_bill_pkg;
use FS::UID qw(dbh);
use FS::upgrade_journal;
# some kind of common ancestor with cust_bill_pkg_tax_location would make sense
-@ISA = qw( FS::cust_main_Mixin FS::Record );
-
=head1 NAME
FS::cust_tax_exempt_pkg - Object methods for cust_tax_exempt_pkg records
=cut
-sub cust_main_county {
- my $self = shift;
- qsearchs( 'cust_main_county', { 'taxnum', $self->taxnum } );
-}
-
sub _upgrade_data {
my $class = shift;
package FS::did_order;
+use base qw( FS::o2m_Common FS::Record );
use strict;
-use base qw( FS::o2m_Common FS::Record );
use FS::Record qw( qsearch qsearchs dbh );
=head1 NAME
Returns the did_order_items (see L<FS::did_order_item>) associated with this bulk DID order.
-=cut
-
-sub did_order_item {
- my $self = shift;
- qsearch( 'did_order_item', { 'ordernum' => $self->ordernum } );
-}
-
=item cust_main
Returns all cust_main (see L<FS::cust_main>), if any, associated with this
use base qw( FS::Record );
use strict;
-use FS::Record qw( qsearch qsearchs );
-use FS::discount_class;
=head1 NAME
$discount_class ? $discount_class->classname : '(none)';
}
-sub discount_class {
- my $self = shift;
- qsearchs('discount_class', { 'classnum' => $self->classnum });
-}
-
-
=back
=head1 BUGS
package FS::domain_record;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA $noserial_hack $DEBUG $me );
+use vars qw( $noserial_hack $DEBUG $me );
use FS::Conf;
use FS::Record qw( qsearchs dbh ); #qsearch
-use FS::svc_domain;
use FS::svc_www;
-@ISA = qw(FS::Record);
-
$DEBUG = 0;
$me = '[FS::domain_record]';
Returns the domain (see L<FS::svc_domain>) for this record.
-=cut
-
-sub svc_domain {
- my $self = shift;
- qsearchs('svc_domain', { svcnum => $self->svcnum } );
-}
-
=item zone
Returns the canonical zone name.
package FS::dsl_device;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
-use FS::svc_dsl;
=head1 NAME
=item svc_dsl
-Returns the phone number (see L<FS::svc_dsl>) associated with this customer
+Returns the DSL (see L<FS::svc_dsl>) associated with this customer
device.
-=cut
-
-sub svc_phone {
- my $self = shift;
- qsearchs( 'svc_dsl', { 'svcnum' => $self->svcnum } );
-}
-
=back
=head1 BUGS
package FS::export_device;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::part_export;
-use FS::part_device;
=head1 NAME
Returns the FS::part_export object (see L<FS::part_export>).
-=cut
-
-sub part_export {
- my $self = shift;
- qsearchs( 'part_export', { 'exportnum' => $self->exportnum } );
-}
-
=item part_device
Returns the FS::part_device object (see L<FS::part_device>).
-=cut
-
-sub part_device {
- my $self = shift;
- qsearchs( 'part_device', { 'svcpart' => $self->devicepart } );
-}
-
=back
=head1 BUGS
package FS::export_nas;
+use base qw( FS::Record );
use strict;
use vars qw($noexport_hack);
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
$noexport_hack = '';
$self->SUPER::check;
}
-sub part_export {
- my $self = shift;
- qsearchs('part_export', { 'exportnum' => $self->exportnum });
-}
-
-sub nas {
- my $self = shift;
- qsearchs('nas', { 'nasnum' => $self->nasnum });
-}
-
=back
=head1 BUGS
package FS::export_svc;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::part_export;
-use FS::part_svc;
+use FS::Record qw( dbh qsearch ); #qsearchs );
use FS::svc_export_machine;
-@ISA = qw(FS::Record);
-
=head1 NAME
FS::export_svc - Object methods for export_svc records
Returns the FS::part_export object (see L<FS::part_export>).
-=cut
-
-sub part_export {
- my $self = shift;
- qsearchs( 'part_export', { 'exportnum' => $self->exportnum } );
-}
-
=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 } );
-}
-
=item svc_export_machine
Returns all export hostname records (L<FS::svc_export_machine>) for this
package FS::hardware_class;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearch ); #qsearchs );
=head1 NAME
package FS::hardware_type;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
=head1 NAME
Returns the L<FS::hardware_class> associated with this device.
-=cut
-
-sub hardware_class {
- my $self = shift;
- return qsearchs('hardware_class', { 'classnum' => $self->classnum });
-}
-
=item description
Returns the model and revision number.
package FS::inventory_class;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( dbh qsearch qsearchs );
-
-@ISA = qw(FS::Record);
+use FS::Record qw( dbh ); # qsearch qsearchs dbh );
=head1 NAME
package FS::inventory_item;
+use base qw( FS::cust_main_Mixin FS::Record );
use strict;
-use vars qw( @ISA );
-use FS::Record qw( dbh qsearch qsearchs );
-use FS::cust_main_Mixin;
-use FS::inventory_class;
-use FS::cust_svc;
-
-@ISA = qw( FS::cust_main_Mixin FS::Record );
=head1 NAME
Returns the customer service associated with this inventory item, if the
item has been used (see L<FS::cust_svc>).
-=cut
-
-sub cust_svc {
- my $self = shift;
- return '' unless $self->svcnum;
- qsearchs( 'cust_svc', { 'svcnum' => $self->svcnum } );
-}
-
=item agent
Returns the associated agent for this event, if any, as an FS::agent object.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs('agent', { 'agentnum' => $self->agentnum } );
-}
-
=back
=head1 SUBROUTINES
package FS::legacy_cust_bill;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
-use FS::cust_main;
=head1 NAME
Returns the customer (see L<FS::cust_main>) for this invoice.
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
=back
=head1 BUGS
package FS::mailinglist;
+use base qw(FS::Record);
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::mailinglistmember;
-use FS::svc_mailinglist;
+use FS::Record qw( dbh ); #qw( qsearch qsearchs dbh );
=head1 NAME
=item mailinglistmember
-=cut
-
-sub mailinglistmember {
- my $self = shift;
- qsearch('mailinglistmember', { 'listnum' => $self->listnum } );
-}
-
=item svc_mailinglist
-=cut
-
-sub svc_mailinglist {
- my $self = shift;
- qsearchs('svc_mailinglist', { 'listnum' => $self->listnum } );
-}
-
=back
=head1 BUGS
package FS::mailinglistmember;
+use base qw(FS::Record);
use strict;
-use base qw( FS::Record );
use Scalar::Util qw( blessed );
-use FS::Record qw( dbh qsearchs ); # qsearch );
-use FS::mailinglist;
-use FS::svc_acct;
-use FS::contact_email;
+use FS::Record qw( dbh ); # qsearch qsearchs dbh );
=head1 NAME
=item mailinglist
-=cut
-
-sub mailinglist {
- my $self = shift;
- qsearchs('mailinglist', { 'listnum' => $self->listnum } );
-}
-
=item email_address
=cut
package FS::msg_template;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
+use vars qw( $DEBUG $conf );
+
+use Date::Format qw( time2str );
+use File::Temp;
+use IPC::Run qw(run);
use Text::Template;
+
+use HTML::Entities qw( decode_entities encode_entities ) ;
+use HTML::FormatText;
+use HTML::TreeBuilder;
+use Encode;
+
use FS::Misc qw( generate_email send_email do_print );
use FS::Conf;
use FS::Record qw( qsearch qsearchs );
use FS::cust_msg;
use FS::template_content;
-use Date::Format qw( time2str );
-use HTML::Entities qw( decode_entities encode_entities ) ;
-use HTML::FormatText;
-use HTML::TreeBuilder;
-use Encode;
-
-use File::Temp;
-use IPC::Run qw(run);
-use vars qw( $DEBUG $conf );
-
FS::UID->install_callback( sub { $conf = new FS::Conf; } );
$DEBUG=0;
=cut
-sub agent {
- qsearchs('agent', { 'agentnum' => $_[0]->agentnum });
-}
-
sub _upgrade_data {
my ($self, %opts) = @_;
}
}
-sub access_user {
- my $self = shift;
- qsearchs('access_user', { 'usernum' => $self->usernum } );
-}
-
sub _upgrade_otaker {
my $class = shift;
my $table = $class->table;
use FS::part_event_option;
use FS::part_event_condition;
use FS::cust_event;
-use FS::agent;
$DEBUG = 0;
Returns the conditions associated with this event, as FS::part_event_condition
objects (see L<FS::part_event_condition>)
-=cut
-
-sub part_event_condition {
- my $self = shift;
- qsearch( 'part_event_condition', { 'eventpart' => $self->eventpart } );
-}
-
=item new_cust_event OBJECT, [ OPTION => VALUE ]
Creates a new customer event (see L<FS::cust_event>) for the provided object.
Returns the associated agent for this event, if any, as an FS::agent object.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs('agent', { 'agentnum' => $self->agentnum } );
-}
-
=item templatename
Returns the alternate invoice template name, if any, or false if there is
package FS::part_export;
+use base qw( FS::option_Common FS::m2m_Common );
use strict;
use vars qw( @ISA @EXPORT_OK $DEBUG %exports );
use Exporter;
use Tie::IxHash;
-use base qw( FS::option_Common FS::m2m_Common );
use FS::Record qw( qsearch qsearchs dbh );
use FS::part_svc;
use FS::part_export_option;
use FS::part_export_machine;
use FS::svc_export_machine;
-use FS::export_svc;
#for export modules, though they should probably just use it themselves
use FS::queue;
Returns a list of associated FS::export_svc records.
-=cut
-
-sub export_svc {
- my $self = shift;
- qsearch('export_svc', { 'exportnum' => $self->exportnum } );
-}
-
=item export_device
Returns a list of associated FS::export_device records.
-=cut
-
-sub export_device {
- my $self = shift;
- qsearch('export_device', { 'exportnum' => $self->exportnum } );
-}
-
=item part_export_option
Returns all options as FS::part_export_option objects (see
package FS::part_export_machine;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( dbh qsearch ); #qsearchs );
-use FS::part_export;
-use FS::svc_export_machine;
+use FS::Record qw( dbh ); #qsearch qsearchs );
=head1 NAME
=item svc_export_machine
-=cut
-
-sub svc_export_machine {
- my $self = shift;
- qsearch( 'svc_export_machine', { 'machinenum' => $self->machinenum } );
-}
-
=back
=head1 BUGS
package FS::part_export_option;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-use FS::part_export;
-
-@ISA = qw(FS::Record);
+use FS::Record qw( qsearchs ); #qw( qsearch qsearchs );
=head1 NAME
use FS::agent_type;
use FS::type_pkgs;
use FS::part_pkg_option;
-use FS::pkg_class;
-use FS::agent;
use FS::part_pkg_msgcat;
use FS::part_pkg_taxrate;
use FS::part_pkg_taxoverride;
use FS::part_pkg_taxproduct;
use FS::part_pkg_link;
use FS::part_pkg_discount;
-use FS::part_pkg_usage;
use FS::part_pkg_vendor;
use FS::part_pkg_currency;
Returns the package class, as an FS::pkg_class object, or the empty string
if there is no package class.
-=cut
-
-sub pkg_class {
- my $self = shift;
- if ( $self->classnum ) {
- qsearchs('pkg_class', { 'classnum' => $self->classnum } );
- } else {
- return '';
- }
-}
-
=item addon_pkg_class
Returns the add-on package class, as an FS::pkg_class object, or the empty
Returns the associated agent for this event, if any, as an FS::agent object.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs('agent', { 'agentnum' => $self->agentnum } );
-}
-
=item pkg_svc [ HASHREF | OPTION => VALUE ]
Returns all FS::pkg_svc objects (see L<FS::pkg_svc>) for this package
=cut
-sub type_pkgs {
- my $self = shift;
- qsearch('type_pkgs', { 'pkgpart' => $self->pkgpart } );
-}
-
sub pkg_svc {
my $self = shift;
Returns all vendor/external package ids as FS::part_pkg_vendor objects (see
L<FS::part_pkg_vendor>).
-=cut
-
-sub part_pkg_vendor {
- my $self = shift;
- qsearch('part_pkg_vendor', { 'pkgpart' => $self->pkgpart } );
-}
-
=item vendor_pkg_ids
Returns a list of vendor/external package ids by exportnum
Returns all options as FS::part_pkg_option objects (see
L<FS::part_pkg_option>).
-=cut
-
-sub part_pkg_option {
- my $self = shift;
- qsearch('part_pkg_option', { 'pkgpart' => $self->pkgpart } );
-}
-
=item options
Returns a list of option names and values suitable for assigning to a hash.
Returns the package to discount m2m records (see L<FS::part_pkg_discount>)
for this package.
-=cut
-
-sub part_pkg_discount {
- my $self = shift;
- qsearch('part_pkg_discount', { 'pkgpart' => $self->pkgpart });
-}
-
=item part_pkg_usage
Returns the voice usage pools (see L<FS::part_pkg_usage>) defined for
this package.
-=cut
-
-sub part_pkg_usage {
- my $self = shift;
- qsearch('part_pkg_usage', { 'pkgpart' => $self->pkgpart });
-}
-
=item _rebless
Reblesses the object into the FS::part_pkg::PLAN class (if available), where
use base qw( FS::Record );
use strict;
-#use FS::Record qw( qsearch qsearchs );
-use FS::part_pkg;
=head1 NAME
package FS::part_pkg_discount;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
-use FS::discount;
-use FS::part_pkg;
=head1 NAME
Returns the discount associated with this part_pkg_discount.
-=cut
-
-sub discount {
- my $self = shift;
- qsearchs('discount', { 'discountnum' => $self->discountnum });
-}
-
=back
=head1 BUGS
package FS::part_pkg_msgcat;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
use FS::Locales;
-#use FS::Record qw( qsearch qsearchs );
-use FS::part_pkg;
=head1 NAME
package FS::part_pkg_option;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs dbh );
+use FS::Record qw( dbh ); # qw( qsearch qsearchs dbh );
use FS::part_pkg;
-@ISA = qw(FS::Record);
-
=head1 NAME
FS::part_pkg_option - Object methods for part_pkg_option records
package FS::part_pkg_usage;
+use base qw( FS::m2m_Common FS::Record );
use strict;
-use base qw( FS::m2m_Common FS::Record );
-use FS::Record qw( qsearch qsearchs );
use Scalar::Util qw(blessed);
=head1 NAME
sub classnums {
my $self = shift;
if (!$self->get('classnums')) {
- my $classnums = [
- map { $_->classnum }
- qsearch('part_pkg_usage_class', { 'pkgusagepart' => $self->pkgusagepart })
- ];
+ my $classnums = [ map { $_->classnum } $self->part_pkg_usage_class ];
$self->set('classnums', $classnums);
}
@{ $self->get('classnums') };
package FS::part_pkg_usage_class;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
=head1 NAME
package FS::part_pkg_vendor;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
=head1 NAME
Returns the L<FS::part_export> associated with this vendor/external package id.
-=cut
-sub part_export {
- my $self = shift;
- qsearchs( 'part_export', { 'exportnum' => $self->exportnum } );
-}
-
=back
=head1 SEE ALSO
package FS::part_referral;
+use base qw(FS::Record);
use strict;
use vars qw( @ISA $setup_hack );
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::agent;
+use FS::Record qw( dbh qsearch ); #qsearchs );
@ISA = qw( FS::Record );
$setup_hack = 0;
Returns the associated agent for this referral, if any, as an FS::agent object.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs('agent', { 'agentnum' => $self->agentnum } );
-}
-
=back
=head1 CLASS METHODS
package FS::part_svc;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA $DEBUG );
+use vars qw( $DEBUG );
use Tie::IxHash;
use FS::Record qw( qsearch qsearchs fields dbh );
use FS::Schema qw( dbdef );
use FS::cust_svc;
use FS::part_svc_class;
-@ISA = qw(FS::Record);
-
$DEBUG = 0;
=head1 NAME
package FS::part_svc_router;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw(qsearchs);
-use FS::router;
-use FS::part_svc;
-
-@ISA = qw(FS::Record);
sub table { 'part_svc_router'; }
''; #no error
}
-sub router {
- my $self = shift;
- return qsearchs('router', { routernum => $self->routernum });
-}
-
-sub part_svc {
- my $self = shift;
- return qsearchs('part_svc', { svcpart => $self->svcpart });
-}
-
1;
package FS::part_tag;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearch ); #qsearchs );
=head1 NAME
package FS::part_virtual_field;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record;
-use FS::Schema qw( dbdef );
use CGI qw(escapeHTML);
-
-@ISA = qw( FS::Record );
+use FS::Schema qw( dbdef );
=head1 NAME
package FS::pay_batch;
+use base qw( FS::Record );
use strict;
-use vars qw( @ISA $DEBUG %import_info %export_info $conf );
+use vars qw( $DEBUG %import_info %export_info $conf );
+use Scalar::Util qw(blessed);
+use IO::Scalar;
+use List::Util qw(sum);
use Time::Local;
use Text::CSV_XS;
-use FS::Record qw( dbh qsearch qsearchs );
-use FS::Conf;
-use FS::cust_pay;
-use FS::agent;
use Date::Parse qw(str2time);
use Business::CreditCard qw(cardtype);
-use Scalar::Util 'blessed';
-use IO::Scalar;
use FS::Misc qw(send_email); # for error notification
-use List::Util qw(sum);
-
-@ISA = qw(FS::Record);
+use FS::Record qw( dbh qsearch qsearchs );
+use FS::Conf;
+use FS::cust_pay;
=head1 NAME
Returns the L<FS::agent> object for this batch.
-=cut
-
-sub agent {
- qsearchs('agent', { 'agentnum' => $_[0]->agentnum });
-}
-
=item cust_pay_batch
Returns all L<FS::cust_pay_batch> objects for this batch.
-=cut
-
-sub cust_pay_batch {
- qsearch('cust_pay_batch', { 'batchnum' => $_[0]->batchnum });
-}
-
=item rebalance
=cut
package FS::payment_gateway;
+use base qw( FS::option_Common );
use strict;
-use vars qw( @ISA $me $DEBUG );
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::option_Common;
-use FS::agent_payment_gateway;
+use vars qw( $me $DEBUG );
+use FS::Record qw( qsearch dbh ); #qw( qsearch qsearchs dbh );
-@ISA = qw( FS::option_Common );
$me = '[ FS::payment_gateway ]';
$DEBUG=0;
Returns any agent overrides for this payment gateway.
-=cut
-
-sub agent_payment_gateway {
- my $self = shift;
- qsearch('agent_payment_gateway', { 'gatewaynum' => $self->gatewaynum } );
-}
-
=item disable
Disables this payment gateway: deletes all associated agent_payment_gateway
package FS::payment_gateway_option;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::phone_avail;
+use base qw( FS::cust_main_Mixin FS::Record );
use strict;
-use vars qw( @ISA $DEBUG $me );
+use vars qw( $DEBUG $me );
+use FS::Misc::DateTime qw( parse_datetime );
use FS::Record qw( qsearch qsearchs dbh );
use FS::cust_svc;
-use FS::Misc::DateTime qw( parse_datetime );
use FS::msa;
-use Data::Dumper;
-
-@ISA = qw(FS::cust_main_Mixin FS::Record);
$me = '[FS::phone_avail]';
$DEBUG = 0;
=item part_export
-=cut
-
-sub part_export {
- my $self = shift;
- return '' unless $self->exportnum;
- qsearchs('part_export', { 'exportnum' => $self->exportnum });
-}
-
=item lata
-=cut
-
-sub lata {
- my $self = shift;
- return '' unless $self->latanum;
- qsearchs('lata', { 'latanum' => $self->latanum });
-}
-
=item msa2msanum
Translate free-form MSA name to a msa.msanum
package FS::phone_device;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
use Scalar::Util qw( blessed );
-use FS::Record qw( dbh qsearchs ); # qsearch );
-use FS::part_device;
-use FS::svc_phone;
+use FS::Record qw( dbh ); # qsearch qsearchs dbh );
=head1 NAME
Returns the device type record (see L<FS::part_device>) associated with this
customer device.
-=cut
-
-sub part_device {
- my $self = shift;
- qsearchs( 'part_device', { 'devicepart' => $self->devicepart } );
-}
-
=item svc_phone
Returns the phone number (see L<FS::svc_phone>) associated with this customer
device.
-=cut
-
-sub svc_phone {
- my $self = shift;
- qsearchs( 'svc_phone', { 'svcnum' => $self->svcnum } );
-}
-
=item export HOOK [ EXPORT_ARGS ]
Runs the provided export hook (i.e. "device_insert") for this service.
package FS::phone_type;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
use FS::Record qw( qsearch ); # qsearchs );
=head1 NAME
package FS::pkg_svc;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearchs );
-use FS::part_pkg;
-use FS::part_svc;
-
-@ISA = qw( FS::Record );
=head1 NAME
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 BUGS
package FS::prepay_credit;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA $DEBUG $me );
+use vars qw( $DEBUG $me );
use FS::Record qw(qsearchs dbh);
-use FS::agent;
-
-@ISA = qw(FS::Record);
$DEBUG = 0;
$me = '[FS::prepay_credit]';
Returns the agent (see L<FS::agent>) for this prepaid card, if any.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs('agent', { 'agentnum' => $self->agentnum } );
-}
-
=back
=head1 SUBROUTINES
package FS::prospect_main;
+use base qw( FS::Quotable_Mixin FS::o2m_Common FS::Record );
use strict;
-use base qw( FS::Quotable_Mixin FS::o2m_Common FS::Record );
use vars qw( $DEBUG @location_fields );
use Scalar::Util qw( blessed );
-use FS::Record qw( dbh qsearch qsearchs );
-use FS::agent;
+use FS::Record qw( dbh qsearch ); # qsearchs );
use FS::cust_location;
-use FS::contact;
-use FS::qual;
$DEBUG = 0;
Returns the contacts (see L<FS::contact>) associated with this prospect.
-=cut
-
-sub contact {
- my $self = shift;
- qsearch( 'contact', { 'prospectnum' => $self->prospectnum } );
-}
-
=item cust_location
Returns the locations (see L<FS::cust_location>) associated with this prospect.
Returns the qualifications (see L<FS::qual>) associated with this prospect.
-=cut
-
-sub qual {
- my $self = shift;
- qsearch( 'qual', { 'prospectnum' => $self->prospectnum } );
-}
-
=item agent
Returns the agent (see L<FS::agent>) for this customer.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
-}
-
=item search HASHREF
(Class method)
package FS::qual;
+use base qw( FS::option_Common );
use strict;
-use base qw( FS::option_Common );
-use FS::Record qw( qsearch qsearchs dbh );
+use FS::Record qw(dbh);
=head1 NAME
my @qual_option = ();
if ( $self->exportnum ) {
- my $export = qsearchs( 'part_export', { 'exportnum' => $self->exportnum } )
+ my $export = $self->part_export
or die 'Invalid exportnum';
my $qres = $export->qual($self);
$self->SUPER::check;
}
-sub part_export {
- my $self = shift;
- if ( $self->exportnum ) {
- return qsearchs('part_export', { exportnum => $self->exportnum } )
- or die 'invalid exportnum';
- }
- '';
-}
-
-sub cust_location {
- my $self = shift;
- return '' unless $self->locationnum;
- qsearchs('cust_location', { 'locationnum' => $self->locationnum } );
-}
-
-sub cust_main {
- my $self = shift;
- return '' unless $self->custnum;
- qsearchs('cust_main', { 'custnum' => $self->custnum } );
-}
-
sub location_hash {
my $self = shift;
sub cust_or_prospect {
my $self = shift;
if ( $self->locationnum ) {
- my $l = qsearchs( 'cust_location',
- { 'locationnum' => $self->locationnum });
- return qsearchs('cust_main',{ 'custnum' => $l->custnum })
- if $l->custnum;
- return qsearchs('prospect_main',{ 'prospectnum' => $l->prospectnum })
- if $l->prospectnum;
+ my $l = $self->cust_location;
+ return $l->cust_main if $l->custnum;
+ return $l->prospect_main if $l->prospectnum;
}
- return qsearchs('cust_main', { 'custnum' => $self->custnum })
- if $self->custnum;
- return qsearchs('prospect_main', { 'prospectnum' => $self->prospectnum })
- if $self->prospectnum;
+ return $self->cust_main if $self->custnum;
+ return $self->cust_prospect if $self->prospectnum;
'';
}
package FS::queue;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA @EXPORT_OK $DEBUG $conf $jobnums);
+use vars qw( @EXPORT_OK $DEBUG $conf $jobnums);
use Exporter;
use MIME::Base64;
use Storable qw( nfreeze thaw );
#use FS::queue;
use FS::queue_arg;
use FS::queue_depend;
-use FS::cust_svc;
use FS::CGI qw(rooturl);
-@ISA = qw(FS::Record);
@EXPORT_OK = qw( joblisting );
$DEBUG = 0;
Returns the FS::cust_svc object associated with this job, if any.
-=cut
-
-sub cust_svc {
- my $self = shift;
- qsearchs('cust_svc', { 'svcnum' => $self->svcnum } );
-}
-
=item queue_depend
Returns the FS::queue_depend objects associated with this job, if any.
(Dependancies that must complete before this job can be run).
-=cut
-
-sub queue_depend {
- my $self = shift;
- qsearch('queue_depend', { 'jobnum' => $self->jobnum } );
-}
-
=item depend_insert OTHER_JOBNUM
Inserts a dependancy for this job - it will not be run until the other job
package FS::queue_arg;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::queue_depend;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-use FS::queue;
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::quotation;
-use base qw( FS::Template_Mixin FS::cust_main_Mixin FS::otaker_Mixin FS::Record );
+use base qw( FS::Template_Mixin FS::cust_main_Mixin FS::otaker_Mixin FS::Record
+ );
use strict;
-use FS::Record qw( qsearch qsearchs );
use FS::CurrentUser;
-use FS::cust_main;
-use FS::prospect_main;
-use FS::quotation_pkg;
=head1 NAME
=item prospect_main
-=cut
-
-sub prospect_main {
- my $self = shift;
- qsearchs('prospect_main', { 'prospectnum' => $self->prospectnum } );
-}
-
=item cust_main
-=cut
-
-sub cust_main {
- my $self = shift;
- qsearchs('cust_main', { 'custnum' => $self->custnum } );
-}
-
=item cust_bill_pkg
=cut
sub cust_bill_pkg { #actually quotation_pkg objects
- my $self = shift;
- qsearch('quotation_pkg', { quotationnum=>$self->quotationnum });
+ shift->quotation_pkg(@_);
}
=item total_setup
package FS::quotation_pkg;
+use base qw( FS::TemplateItem_Mixin FS::Record );
use strict;
-use base qw( FS::TemplateItem_Mixin FS::Record );
-use FS::Record qw( qsearchs ); #qsearch
-use FS::part_pkg;
-use FS::cust_location;
-use FS::quotation;
use FS::quotation_pkg_discount; #so its loaded when TemplateItem_Mixin needs it
=head1 NAME
$self->SUPER::check;
}
-sub part_pkg {
- my $self = shift;
- qsearchs('part_pkg', { 'pkgpart' => $self->pkgpart } );
-}
-
sub desc {
my $self = shift;
$self->part_pkg->pkg;
package FS::quotation_pkg_discount;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
=head1 NAME
package FS::radius_attr;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
use vars qw( $noexport_hack );
+use FS::Record qw( qsearch ); #qsearchs );
+
+$noexport_hack = 0;
=head1 NAME
Returns the L<FS::radius_group> object to which this attribute applies.
-=cut
-
-sub radius_group {
- my $self = shift;
- qsearchs('radius_group', { 'groupnum' => $self->groupnum });
-}
-
=back
=head1 CLASS METHODS
package FS::radius_usergroup;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );
use FS::svc_acct;
use FS::radius_group;
-@ISA = qw(FS::Record);
-
=head1 NAME
FS::radius_usergroup - Object methods for radius_usergroup records
=cut
-sub radius_group {
- my $self = shift;
- qsearchs('radius_group', { 'groupnum' => $self->groupnum } );
-}
-
sub _upgrade_data { #class method
my ($class, %opts) = @_;
package FS::rate;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA $DEBUG );
+use vars qw( $DEBUG );
use FS::Record qw( qsearch qsearchs dbh fields );
use FS::rate_detail;
-@ISA = qw(FS::Record);
-
$DEBUG = 0;
=head1 NAME
Returns all region-specific details (see L<FS::rate_detail>) for this rate.
-=cut
-
-sub rate_detail {
- my $self = shift;
- qsearch( 'rate_detail', { 'ratenum' => $self->ratenum } );
-}
-
-
=back
=head1 SUBROUTINES
package FS::rate_detail;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA $DEBUG $me );
+use vars qw( $DEBUG $me );
+use Tie::IxHash;
use FS::Record qw( qsearch qsearchs dbh );
use FS::rate;
use FS::rate_region;
use FS::rate_time;
-use Tie::IxHash;
-
-@ISA = qw(FS::Record);
$DEBUG = 0;
$me = '[FS::rate_detail]';
Returns the parent call plan (see L<FS::rate>) associated with this call plan
rate.
-=cut
-
-sub rate {
- my $self = shift;
- qsearchs('rate', { 'ratenum' => $self->ratenum } );
-}
-
=item orig_region
Returns the origination region (see L<FS::rate_region>) associated with this
package FS::rate_prefix;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::rate_region;
+use FS::Record qw( dbh ); #qw( qsearch qsearchs dbh );
use FS::lata;
-@ISA = qw(FS::Record);
-
=head1 NAME
FS::rate_prefix - Object methods for rate_prefix records
Returns the rate region (see L<FS::rate_region>) for this prefix.
-=cut
-
-sub rate_region {
- my $self = shift;
- qsearchs('rate_region', { 'regionnum' => $self->regionnum } );
-}
-
=back
=head1 CLASS METHODS
package FS::rate_region;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs dbh );
use FS::rate_prefix;
use FS::rate_detail;
-@ISA = qw(FS::Record);
-
=head1 NAME
FS::rate_region - Object methods for rate_region records
package FS::rate_time_interval;
+use base qw(FS::Record);
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
use List::Util 'first';
=head1 NAME
Returns the L<FS::rate_time> comprising this interval.
-=cut
-
-sub rate_time {
- my $self = shift;
- FS::rate_time->by_key($self->ratetimenum);
-}
-
=item description
Returns two strings containing stime and etime, formatted
package FS::reg_code;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw(qsearch dbh);
-use FS::agent;
+use FS::Record qw( dbh ); # qsearch qsearchs dbh );
use FS::reg_code_pkg;
-@ISA = qw(FS::Record);
-
=head1 NAME
FS::reg_code - One-time registration codes
Returns all FS::reg_code_pkg records for this registration code.
-=cut
-
-sub reg_code_pkg {
- my $self = shift;
- qsearch('reg_code_pkg', { 'codenum' => $self->codenum } );
-}
-
-
=back
=head1 BUGS
package FS::reg_code_pkg;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw(qsearchs);
-use FS::reg_code;
-use FS::part_pkg;
-
-@ISA = qw(FS::Record);
=head1 NAME
Returns the package definition (see L<FS::part_pkg>)
-=cut
-
-sub part_pkg {
- my $self = shift;
- qsearchs('part_pkg', { 'pkgpart' => $self->pkgpart } );
-}
-
=back
=head1 BUGS
package FS::registrar;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
=head1 NAME
package FS::router;
+use base qw( FS::m2m_Common FS::Record );
use strict;
-use vars qw( @ISA );
use FS::Record qw( qsearchs qsearch dbh );
use FS::addr_block;
-@ISA = qw( FS::Record FS::m2m_Common );
-
=head1 NAME
FS::router - Object methods for router records
=cut
-sub addr_block {
- my $self = shift;
- return qsearch('addr_block', { routernum => $self->routernum });
-}
-
sub auto_addr_block {
my $self = shift;
return () if $self->manual_addr;
object. This is unlikely to be useful for any purpose other than retrieving
the associated FS::part_svc objects. See below.
-=cut
-
-sub part_svc_router {
- my $self = shift;
- return qsearch('part_svc_router', { routernum => $self->routernum });
-}
-
=item part_svc
Returns a list of FS::part_svc objects associated with this object.
Returns the agent associated with this router, if any.
-=cut
-
-sub agent {
- qsearchs('agent', { 'agentnum' => shift->agentnum });
-}
-
=item cust_svc
Returns the cust_svc associated with this router, if any. This should be
the service that I<provides connectivity to the router>, not any service
connected I<through> the router.
-=cut
-
-sub cust_svc {
- my $svcnum = shift->svcnum or return undef;
- FS::cust_svc->by_key($svcnum);
-}
-
=back
=head1 SEE ALSO
use base qw( FS::Record );
use strict;
-use FS::Record qw( qsearchs ); # qsearch qsearchs );
-use FS::sales;
-use FS::pkg_class;
=head1 NAME
$self->SUPER::check;
}
-sub pkg_class {
- my $self = shift;
- qsearchs('pkg_class', { 'classnum' => $self->classnum });
-}
-
sub classname {
my $self = shift;
my $pkg_class = $self->pkg_class;
package FS::svc_Common;
+use base qw( FS::cust_main_Mixin FS::Record );
use strict;
-use vars qw( @ISA $noexport_hack $DEBUG $me
+use vars qw( $noexport_hack $DEBUG $me
$overlimit_missing_cust_svc_nonfatal_kludge );
use Carp qw( cluck carp croak confess ); #specify cluck have to specify them all
use Scalar::Util qw( blessed );
use Lingua::EN::Inflect qw( PL_N );
use FS::Conf;
use FS::Record qw( qsearch qsearchs fields dbh );
-use FS::cust_main_Mixin;
use FS::cust_svc;
use FS::part_svc;
use FS::queue;
use FS::inventory_class;
use FS::NetworkMonitoringSystem;
-@ISA = qw( FS::cust_main_Mixin FS::Record );
-
$me = '[FS::svc_Common]';
$DEBUG = 0;
=head1 SYNOPSIS
-use FS::svc_Common;
-
-@ISA = qw( FS::svc_Common );
+package svc_myservice;
+use base qw( FS::svc_Common );
=head1 DESCRIPTION
Returns the cust_svc record associated with this svc_ record, as a FS::cust_svc
object (see L<FS::cust_svc>).
-=cut
-
-sub cust_svc {
- my $self = shift;
- qsearchs('cust_svc', { 'svcnum' => $self->svcnum } );
-}
-
=item suspend
Runs export_suspend callbacks.
package FS::svc_Tower_Mixin;
use strict;
-use FS::Record qw(qsearchs); #qsearch;
-use FS::tower_sector;
=item tower_sector
-=cut
-
-sub tower_sector {
- my $self = shift;
- return '' unless $self->sectornum;
- qsearchs('tower_sector', { sectornum => $self->sectornum });
-}
-
=item tower_sector_sql HASHREF
Class method which returns a list of WHERE clause fragments to
package FS::svc_acct;
-
-use strict;
use base qw( FS::svc_Domain_Mixin
FS::svc_CGP_Mixin
FS::svc_CGPRule_Mixin
FS::svc_Tower_Mixin
FS::svc_IP_Mixin
FS::svc_Common );
+
+use strict;
use vars qw( $DEBUG $me $conf $skip_fuzzyfiles
$dir_prefix @shells $usernamemin
$usernamemax $passwordmin $passwordmax
use FS::svc_forward;
use FS::svc_www;
use FS::cdr;
-use FS::acct_snarf;
use FS::tower_sector;
$DEBUG = 0;
=cut
# unused as originally intended, but now by Communigate Pro "RPOP"
-sub acct_snarf {
- my $self = shift;
- qsearch({
- 'table' => 'acct_snarf',
- 'hashref' => { 'svcnum' => $self->svcnum },
- #'order_by' => 'ORDER BY priority ASC',
- });
-}
=item cgp_rpop_hashref
package FS::svc_alarm;
+use base qw( FS::svc_Common );
use strict;
-use base qw( FS::svc_Common );
use Tie::IxHash;
-use FS::Record qw( qsearchs ); # qw( qsearch qsearchs );
use FS::alarm_system;
use FS::alarm_type;
use FS::alarm_station;
$self->SUPER::check;
}
-sub alarm_system {
- qsearchs('alarm_system', { alarmsystemnum => shift->alarmsystemnum } );
-}
-sub alarm_type {
- qsearchs('alarm_type', { alarmtypenum => shift->alarmtypenum } );
-}
-sub alarm_station {
- qsearchs('alarm_station', { alarmstationnum => shift->alarmstationnum } );
-}
-
=back
=head1 SEE ALSO
use strict;
use Tie::IxHash;
-use FS::Record qw( qsearchs ); # qw( qsearch qsearchs );
-use FS::cable_provider;
-use FS::cable_model;
=head1 NAME
Returns the cable_provider object for this record.
-=cut
-
-sub cable_provider {
- my $self = shift;
- qsearchs('cable_provider', { 'providernum'=>$self->providernum } );
-}
-
=item cable_model
Returns the cable_model object for this record.
-=cut
-
-sub cable_model {
- my $self = shift;
- qsearchs('cable_model', { 'modelnum'=>$self->modelnum } );
-}
-
=back
=head1 BUGS
package FS::svc_dsl;
+use base qw(FS::svc_Common);
use strict;
-use vars qw( @ISA $conf $DEBUG $me );
+use vars qw( $conf $DEBUG $me );
+use FS::UID;
use FS::Record qw( qsearch qsearchs );
use FS::svc_Common;
-use FS::dsl_device;
use FS::dsl_note;
use FS::qual;
-@ISA = qw( FS::svc_Common );
$DEBUG = 0;
$me = '[FS::svc_dsl]';
=cut
-sub dsl_device {
- my $self = shift;
- qsearch('dsl_device', { 'svcnum' => $self->svcnum });
-}
-
sub predelete_hook_first {
my $self = shift;
my @exports = $self->part_svc->part_export_dsl_pull;
package FS::svc_export_machine;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearchs ); #qsearch );
use FS::cust_svc;
use FS::part_export;
-use FS::part_export_machine;
sub _svc_child_partfields { ('exportnum') };
=item part_export_machine
-=cut
-
-sub part_export_machine {
- my $self = shift;
- qsearchs('part_export_machine', { 'machinenum' => $self->machinenum } );
-}
-
=back
=head1 BUGS
package FS::svc_hardware;
+use base qw( FS::svc_Common );
use strict;
-use base qw( FS::svc_Common );
use vars qw( $conf );
-use FS::Record qw( qsearch qsearchs );
-use FS::hardware_type;
+use FS::Record qw( qsearchs ); #qsearch qsearchs );
use FS::hardware_status;
use FS::Conf;
Returns the L<FS::hardware_type> object associated with this installation.
-=cut
-
-sub hardware_type {
- my $self = shift;
- return qsearchs('hardware_type', { 'typenum' => $self->typenum });
-}
-
=item status_label
Returns the 'label' field of the L<FS::hardware_status> object associated
package FS::svc_mailinglist;
+use base qw( FS::svc_Domain_Mixin FS::svc_Common );
use strict;
-use base qw( FS::svc_Domain_Mixin FS::svc_Common );
use Scalar::Util qw( blessed );
-use FS::Record qw( qsearchs dbh ); # qsearch );
-use FS::svc_domain;
+use FS::Record qw( dbh ); # qsearch qsearchs dbh );
use FS::mailinglist;
=head1 NAME
=item mailinglist
-=cut
-
-sub mailinglist {
- my $self = shift;
- qsearchs('mailinglist', { 'listnum' => $self->listnum } );
-}
-
=item listname
=cut
package FS::svc_phone;
+use base qw( FS::svc_Domain_Mixin FS::location_Mixin FS::svc_Common );
use strict;
-use base qw( FS::svc_Domain_Mixin FS::location_Mixin FS::svc_Common );
use vars qw( $DEBUG $me @pw_set $conf $phone_name_max
$passwordmin $passwordmax
);
use FS::PagedSearch qw( psearch );
use FS::Msgcat qw(gettext);
use FS::part_svc;
-use FS::phone_device;
use FS::svc_pbx;
use FS::svc_domain;
use FS::cust_location;
=cut
-sub phone_device {
- my $self = shift;
- qsearch('phone_device', { 'svcnum' => $self->svcnum } );
-}
-
#override location_Mixin version cause we want to try the cust_pkg location
#in between us and cust_main
# XXX what to do in the unlinked case??? return a pseudo-object that returns
package FS::svc_www;
+use base qw(FS::svc_Common);
use strict;
-use vars qw(@ISA $conf $apacheip);
+use vars qw($conf $apacheip);
#use FS::Record qw( qsearch qsearchs );
use FS::Record qw( qsearchs dbh );
use FS::svc_Common;
use FS::svc_acct;
use FS::svc_domain;
-@ISA = qw( FS::svc_Common );
-
#ask FS::UID to run this stuff for us later
$FS::UID::callback{'FS::svc_www'} = sub {
$conf = new FS::Conf;
Returns the FS::domain_record record for this web virtual host's zone (see
L<FS::domain_record>).
-=cut
-
-sub domain_record {
- my $self = shift;
- qsearchs('domain_record', { 'recnum' => $self->recnum } );
-}
-
=item svc_acct
Returns the FS::svc_acct record for this web virtual host's owner (see
package FS::tax_rate;
+use base qw( FS::Record );
use strict;
-use vars qw( @ISA $DEBUG $me
+use vars qw( $DEBUG $me
%tax_unittypes %tax_maxtypes %tax_basetypes %tax_authorities
%tax_passtypes %GetInfoType $keep_cch_files );
use Date::Parse;
use IO::File;
use File::Temp;
use Text::CSV_XS;
+use URI::Escape;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use FS::cust_main;
use FS::Misc qw( csv_from_fixed );
-use URI::Escape;
-
-@ISA = qw( FS::Record );
-
$DEBUG = 0;
$me = '[FS::tax_rate]';
$keep_cch_files = 0;
package FS::tower;
+use base qw( FS::o2m_Common FS::Record );
use strict;
-use base qw( FS::o2m_Common FS::Record );
+use List::Util qw( max );
use FS::Record qw( qsearch qsearchs );
use FS::tower_sector;
-use List::Util qw( max );
=head1 NAME
package FS::tower_sector;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearch qsearchs );
-use FS::tower;
-use FS::svc_broadband;
=head1 NAME
Returns the tower for this sector, as an FS::tower object (see L<FS::tower>).
-=cut
-
-sub tower {
- my $self = shift;
- qsearchs('tower', { 'towernum'=>$self->towernum } );
-}
-
=item description
Returns a description for this sector including tower name.
Returns the services on this tower sector.
-=cut
-
-sub svc_broadband {
- my $self = shift;
- qsearch('svc_broadband', { 'sectornum' => $self->sectornum });
-}
-
=back
=head1 BUGS
package FS::type_pkgs;
+use base qw( FS::Record );
use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearchs );
-use FS::agent_type;
-use FS::part_pkg;
-
-@ISA = qw( FS::Record );
=head1 NAME
Returns the FS::part_pkg object associated with this record.
-=cut
-
-sub part_pkg {
- my $self = shift;
- qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
-}
-
=item agent_type
Returns the FS::agent_type object associated with this record.
=cut
-sub agent_type {
- my $self = shift;
- qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
-}
-
-=cut
-
=back
=head1 BUGS
package FS::vend_bill;
+use base qw(FS::Record);
use strict;
-use base qw( FS::Record );
-use FS::Record qw( dbh qsearch qsearchs );
-use FS::vend_main;
+use FS::Record qw( dbh ); # qsearch qsearchs );
use FS::vend_pay;
-use FS::vend_bill_pay;
=head1 NAME
=item vend_main
-=cut
-
-sub vend_main {
- my $self = shift;
- qsearchs('vend_main', { 'vendnum', $self->vendnum });
-}
-
=item vend_bill_pay
-=cut
-
-sub vend_bill_pay {
- my $self = shift;
- qsearch('vend_bill_pay', { 'vendbillnum', $self->vendbillnum });
-}
-
=item search
=cut
package FS::vend_main;
+use base qw( FS::Record );
use strict;
-use base qw( FS::Record );
-use FS::Record qw( qsearchs ); # qsearch qsearchs );
-use FS::vend_class;
=head1 NAME
=item vend_class
-=cut
-
-sub vend_class {
- my $self = shift;
- qsearchs('vend_class', { 'classnum' => $self->classnum } );
-}
-
=back
=head1 BUGS