From 32072dbf59a054529f5304574c0f56f9567d14d0 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sat, 28 Dec 2013 16:11:46 -0800 Subject: [PATCH] autoload methods returning foreign records, RT#13971 --- FS/FS/Record.pm | 108 ++++++++++++++++++++++++++++++- FS/FS/Schema.pm | 35 +++++----- FS/FS/access_group.pm | 10 +-- FS/FS/access_groupagent.pm | 21 +----- FS/FS/access_user.pm | 27 +------- FS/FS/access_user_pref.pm | 5 +- FS/FS/access_user_session.pm | 11 +--- FS/FS/access_usergroup.pm | 21 +----- FS/FS/acct_snarf.pm | 4 +- FS/FS/addr_block.pm | 36 ++--------- FS/FS/agent.pm | 17 +---- FS/FS/agent_payment_gateway.pm | 13 +--- FS/FS/bill_batch.pm | 19 ++---- FS/FS/cdr_cust_pkg_usage.pm | 13 +--- FS/FS/cgp_rule.pm | 93 +++++++++----------------- FS/FS/clientapi_session.pm | 5 +- FS/FS/clientapi_session_field.pm | 5 +- FS/FS/contact.pm | 35 +--------- FS/FS/contact_email.pm | 7 -- FS/FS/contact_phone.pm | 13 ---- FS/FS/cust_bill.pm | 24 +------ FS/FS/cust_bill_batch.pm | 21 +----- FS/FS/cust_bill_batch_option.pm | 5 +- FS/FS/cust_bill_pay.pm | 19 +----- FS/FS/cust_bill_pay_batch.pm | 5 +- FS/FS/cust_bill_pay_pkg.pm | 21 +----- FS/FS/cust_bill_pkg.pm | 8 --- FS/FS/cust_bill_pkg_discount.pm | 20 +----- FS/FS/cust_bill_pkg_discount_void.pm | 5 +- FS/FS/cust_bill_pkg_display.pm | 13 +--- FS/FS/cust_bill_pkg_tax_location.pm | 24 ++----- FS/FS/cust_bill_pkg_tax_rate_location.pm | 20 +----- FS/FS/cust_bill_void.pm | 8 --- FS/FS/cust_class.pm | 3 +- FS/FS/cust_credit.pm | 11 +--- FS/FS/cust_credit_bill.pm | 19 +----- FS/FS/cust_credit_bill_pkg.pm | 17 +---- FS/FS/cust_credit_refund.pm | 28 +------- FS/FS/cust_credit_void.pm | 11 +--- FS/FS/cust_event.pm | 12 +--- FS/FS/cust_main.pm | 47 +++----------- FS/FS/cust_main_county.pm | 4 +- FS/FS/cust_main_exemption.pm | 4 +- FS/FS/cust_main_invoice.pm | 16 +---- FS/FS/cust_main_note.pm | 16 +---- FS/FS/cust_note_class.pm | 3 +- FS/FS/cust_pay_batch.pm | 20 +----- FS/FS/cust_pay_pending.pm | 17 +---- FS/FS/cust_pay_refund.pm | 20 +----- FS/FS/cust_pay_void.pm | 12 +--- FS/FS/cust_pkg.pm | 21 ------ FS/FS/cust_pkg_detail.pm | 5 +- FS/FS/cust_pkg_discount.pm | 19 +----- FS/FS/cust_pkg_option.pm | 5 +- FS/FS/cust_pkg_reason.pm | 11 +--- FS/FS/cust_pkg_usage.pm | 18 +----- FS/FS/cust_svc.pm | 12 +--- FS/FS/cust_svc_option.pm | 5 +- FS/FS/cust_tag.pm | 20 +----- FS/FS/cust_tax_adjustment.pm | 10 +-- FS/FS/cust_tax_exempt.pm | 15 +---- FS/FS/cust_tax_exempt_pkg.pm | 14 +--- FS/FS/did_order.pm | 9 +-- FS/FS/discount.pm | 8 --- FS/FS/domain_record.pm | 13 +--- FS/FS/dsl_device.pm | 13 +--- FS/FS/export_device.pm | 19 +----- FS/FS/export_nas.pm | 13 +--- FS/FS/export_svc.pm | 22 +------ FS/FS/hardware_class.pm | 4 +- FS/FS/hardware_type.pm | 10 +-- FS/FS/inventory_class.pm | 6 +- FS/FS/inventory_item.pm | 23 +------ FS/FS/legacy_cust_bill.pm | 11 +--- FS/FS/mailinglist.pm | 20 +----- FS/FS/mailinglistmember.pm | 14 +--- FS/FS/msg_template.pm | 27 ++++---- FS/FS/otaker_Mixin.pm | 5 -- FS/FS/part_event.pm | 15 ----- FS/FS/part_export.pm | 17 +---- FS/FS/part_export_machine.pm | 13 +--- FS/FS/part_export_option.pm | 7 +- FS/FS/part_pkg.pm | 54 ---------------- FS/FS/part_pkg_currency.pm | 2 - FS/FS/part_pkg_discount.pm | 12 +--- FS/FS/part_pkg_msgcat.pm | 4 +- FS/FS/part_pkg_option.pm | 6 +- FS/FS/part_pkg_usage.pm | 8 +-- FS/FS/part_pkg_usage_class.pm | 3 +- FS/FS/part_pkg_vendor.pm | 9 +-- FS/FS/part_referral.pm | 11 +--- FS/FS/part_svc.pm | 5 +- FS/FS/part_svc_router.pm | 17 +---- FS/FS/part_tag.pm | 4 +- FS/FS/part_virtual_field.pm | 7 +- FS/FS/pay_batch.pm | 30 +++------ FS/FS/payment_gateway.pm | 15 +---- FS/FS/payment_gateway_option.pm | 5 +- FS/FS/phone_avail.pm | 24 +------ FS/FS/phone_device.pm | 20 +----- FS/FS/phone_type.pm | 2 +- FS/FS/pkg_svc.pm | 21 +----- FS/FS/prepay_credit.pm | 13 +--- FS/FS/prospect_main.pm | 28 +------- FS/FS/qual.pm | 42 +++--------- FS/FS/queue.pm | 19 +----- FS/FS/queue_arg.pm | 5 +- FS/FS/queue_depend.pm | 6 +- FS/FS/quotation.pm | 24 +------ FS/FS/quotation_pkg.pm | 11 +--- FS/FS/quotation_pkg_discount.pm | 3 +- FS/FS/radius_attr.pm | 13 ++-- FS/FS/radius_usergroup.pm | 9 +-- FS/FS/rate.pm | 13 +--- FS/FS/rate_detail.pm | 14 +--- FS/FS/rate_prefix.pm | 14 +--- FS/FS/rate_region.pm | 4 +- FS/FS/rate_time_interval.pm | 10 +-- FS/FS/reg_code.pm | 15 +---- FS/FS/reg_code_pkg.pm | 14 +--- FS/FS/registrar.pm | 5 +- FS/FS/router.pm | 29 +-------- FS/FS/sales_pkg_class.pm | 8 --- FS/FS/svc_Common.pm | 18 ++---- FS/FS/svc_Tower_Mixin.pm | 10 --- FS/FS/svc_acct.pm | 13 +--- FS/FS/svc_alarm.pm | 13 +--- FS/FS/svc_cable.pm | 17 ----- FS/FS/svc_dsl.pm | 11 +--- FS/FS/svc_export_machine.pm | 11 +--- FS/FS/svc_hardware.pm | 12 +--- FS/FS/svc_mailinglist.pm | 12 +--- FS/FS/svc_phone.pm | 8 +-- FS/FS/svc_www.pm | 12 +--- FS/FS/tax_rate.pm | 8 +-- FS/FS/tower.pm | 4 +- FS/FS/tower_sector.pm | 19 +----- FS/FS/type_pkgs.pm | 21 +----- FS/FS/vend_bill.pm | 20 +----- FS/FS/vend_main.pm | 11 +--- 140 files changed, 390 insertions(+), 1763 deletions(-) diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 493734729..835b73d8f 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -3,7 +3,7 @@ use base qw( Exporter ); 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); @@ -73,6 +73,10 @@ FS::UID->install_callback( sub { 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 @@ -962,6 +966,11 @@ $record->column is a synonym for $record->get('column'); $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 @@ -969,6 +978,33 @@ sub AUTOLOAD { 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'); @@ -980,7 +1016,7 @@ sub AUTOLOAD { } } -# efficient +# efficient (also, old, doesn't support FK stuff) #sub AUTOLOAD { # my $field = $AUTOLOAD; # $field =~ s/.*://; @@ -991,6 +1027,72 @@ sub AUTOLOAD { # } #} +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. @@ -1516,7 +1618,7 @@ sub rep { =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 diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 647e2b106..926a0e6c8 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -1003,12 +1003,12 @@ sub tables_hashref { { 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', }, @@ -1176,12 +1176,12 @@ sub tables_hashref { { 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', }, @@ -3656,8 +3656,8 @@ sub tables_hashref { 'classname', 'varchar', '', $char_d, '', '', ], 'primary_key' => 'classnum', - 'unique' => [ ], - 'index' => [ ], + 'unique' => [], + 'index' => [], }, 'hardware_type' => { @@ -3684,8 +3684,8 @@ sub tables_hashref { 'disabled', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'statusnum', - 'unique' => [ ], - 'index' => [ ], + 'unique' => [], + 'index' => [], }, 'domain_record' => { @@ -3890,7 +3890,8 @@ sub tables_hashref { 'index' => [], 'foreign_keys' => [ { columns => [ 'svcnum' ], - table => 'svc_broadband', + table => 'svc_broadband',#no? could be _acct? + #remove or cust_svc? }, ], }, diff --git a/FS/FS/access_group.pm b/FS/FS/access_group.pm index 11b2640f7..a2b977409 100644 --- a/FS/FS/access_group.pm +++ b/FS/FS/access_group.pm @@ -1,9 +1,8 @@ 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 @@ -108,13 +107,6 @@ sub check { 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. diff --git a/FS/FS/access_groupagent.pm b/FS/FS/access_groupagent.pm index bacc01331..b0c4bb3f4 100644 --- a/FS/FS/access_groupagent.pm +++ b/FS/FS/access_groupagent.pm @@ -1,12 +1,7 @@ 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 @@ -114,24 +109,10 @@ sub check { 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 diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index b740e47a4..0a441c45a 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -1,14 +1,12 @@ 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; @@ -265,29 +263,6 @@ sub report_sales { Returns links to the the groups this user is a part of, as FS::access_usergroup objects (see L). -=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). diff --git a/FS/FS/access_user_pref.pm b/FS/FS/access_user_pref.pm index a445d3115..954eaa71e 100644 --- a/FS/FS/access_user_pref.pm +++ b/FS/FS/access_user_pref.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/access_user_session.pm b/FS/FS/access_user_session.pm index df112f984..7845d92aa 100644 --- a/FS/FS/access_user_session.pm +++ b/FS/FS/access_user_session.pm @@ -1,9 +1,7 @@ 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 @@ -114,13 +112,6 @@ sub check { Returns the employee (see L) for this session. -=cut - -sub access_user { - my $self = shift; - qsearchs('access_user', { 'usernum' => $self->usernum }); -} - =item touch_last_date =cut diff --git a/FS/FS/access_usergroup.pm b/FS/FS/access_usergroup.pm index 8511fe5be..44ad45b85 100644 --- a/FS/FS/access_usergroup.pm +++ b/FS/FS/access_usergroup.pm @@ -1,12 +1,7 @@ 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 @@ -113,22 +108,8 @@ sub check { =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 diff --git a/FS/FS/acct_snarf.pm b/FS/FS/acct_snarf.pm index 9816de965..40d21d0f2 100644 --- a/FS/FS/acct_snarf.pm +++ b/FS/FS/acct_snarf.pm @@ -1,13 +1,11 @@ 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 diff --git a/FS/FS/addr_block.pm b/FS/FS/addr_block.pm index 778c124f2..8dd09ab96 100755 --- a/FS/FS/addr_block.pm +++ b/FS/FS/addr_block.pm @@ -1,18 +1,14 @@ 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 @@ -184,25 +180,11 @@ sub check { 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. @@ -393,12 +375,6 @@ To be implemented. Returns the agent (see L) 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 diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index d70ff18b4..b476847c5 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -7,9 +7,8 @@ use Business::CreditCard 0.28; 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; @@ -157,13 +156,6 @@ sub check { Returns the FS::agent_type object (see L) 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), if any, for this @@ -181,13 +173,6 @@ sub agent_cust_main { Returns the FS::agent_currency objects (see L), 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. diff --git a/FS/FS/agent_payment_gateway.pm b/FS/FS/agent_payment_gateway.pm index bd99d0ccd..e71ed2118 100644 --- a/FS/FS/agent_payment_gateway.pm +++ b/FS/FS/agent_payment_gateway.pm @@ -1,11 +1,7 @@ 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 @@ -117,13 +113,6 @@ sub check { =item payment_gateway -=cut - -sub payment_gateway { - my $self = shift; - qsearchs('payment_gateway', { 'gatewaynum' => $self->gatewaynum } ); -} - =back =head1 BUGS diff --git a/FS/FS/bill_batch.pm b/FS/FS/bill_batch.pm index 1a46db0b2..fb41e0e6b 100644 --- a/FS/FS/bill_batch.pm +++ b/FS/FS/bill_batch.pm @@ -1,16 +1,13 @@ 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' } @@ -61,8 +58,7 @@ sub print_pdf { 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; @@ -118,13 +114,6 @@ sub check { Returns the agent (see L) for this invoice batch. -=cut - -sub agent { - my $self = shift; - qsearchs( 'agent', { 'agentnum' => $self->agentnum } ); -} - =back =head1 SUBROUTINES diff --git a/FS/FS/cdr_cust_pkg_usage.pm b/FS/FS/cdr_cust_pkg_usage.pm index 6ef7f2dea..7de876413 100644 --- a/FS/FS/cdr_cust_pkg_usage.pm +++ b/FS/FS/cdr_cust_pkg_usage.pm @@ -1,8 +1,7 @@ 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 @@ -102,16 +101,6 @@ Returns the L object that this usage allocation came from. Returns the L 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 diff --git a/FS/FS/cgp_rule.pm b/FS/FS/cgp_rule.pm index e9c50901a..1029f5a17 100644 --- a/FS/FS/cgp_rule.pm +++ b/FS/FS/cgp_rule.pm @@ -1,11 +1,8 @@ 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 @@ -80,36 +77,36 @@ otherwise returns false. =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 @@ -291,37 +288,11 @@ sub clone { =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 diff --git a/FS/FS/clientapi_session.pm b/FS/FS/clientapi_session.pm index f71a126bd..02edbda55 100644 --- a/FS/FS/clientapi_session.pm +++ b/FS/FS/clientapi_session.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/clientapi_session_field.pm b/FS/FS/clientapi_session_field.pm index 085e95642..d9bd697f5 100644 --- a/FS/FS/clientapi_session_field.pm +++ b/FS/FS/clientapi_session_field.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index da6f2eb99..b76f0d9ac 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -2,13 +2,7 @@ package FS::contact; 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 @@ -411,39 +405,12 @@ sub line { $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 diff --git a/FS/FS/contact_email.pm b/FS/FS/contact_email.pm index 4f787358b..a0ff27393 100644 --- a/FS/FS/contact_email.pm +++ b/FS/FS/contact_email.pm @@ -2,8 +2,6 @@ package FS::contact_email; use base qw( FS::Record ); use strict; -use FS::Record qw( qsearch qsearchs ); -use FS::contact; =head1 NAME @@ -112,11 +110,6 @@ sub check { $self->SUPER::check; } -sub contact { - my $self = shift; - qsearchs( 'contact', { 'contactnum' => $self->contactnum } ); -} - =back =head1 BUGS diff --git a/FS/FS/contact_phone.pm b/FS/FS/contact_phone.pm index 610753fc0..46d6a9b6b 100644 --- a/FS/FS/contact_phone.pm +++ b/FS/FS/contact_phone.pm @@ -2,9 +2,6 @@ package FS::contact_phone; use base qw( FS::Record ); use strict; -use FS::Record qw( qsearch qsearchs ); -use FS::contact; -use FS::phone_type; =head1 NAME @@ -140,16 +137,6 @@ sub phonenum_pretty { } -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; diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index d0e7048b7..cdce7be47 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -15,7 +15,6 @@ use GD::Barcode; 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; @@ -25,12 +24,10 @@ use FS::cust_pay; 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; @@ -492,7 +489,9 @@ sub cust_bill_pkg { 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? } ); } @@ -634,13 +633,6 @@ sub num_cust_event { Returns the customer (see L) 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 @@ -701,16 +693,6 @@ sub cust_pay { #; } -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) for this invoice. diff --git a/FS/FS/cust_bill_batch.pm b/FS/FS/cust_bill_batch.pm index 4569e6bc8..fcbda7f70 100644 --- a/FS/FS/cust_bill_batch.pm +++ b/FS/FS/cust_bill_batch.pm @@ -1,12 +1,11 @@ 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' } @@ -38,24 +37,10 @@ following fields are currently supported: Returns the C object. -=cut - -sub bill_batch { - my $self = shift; - FS::bill_batch->by_key($self->batchnum); -} - =item cust_bill Returns the C object. -=cut - -sub cust_bill { - my $self = shift; - FS::cust_bill->by_key($self->invnum); -} - =back =head1 BUGS diff --git a/FS/FS/cust_bill_batch_option.pm b/FS/FS/cust_bill_batch_option.pm index 9bba830fd..7ca2f53fc 100644 --- a/FS/FS/cust_bill_batch_option.pm +++ b/FS/FS/cust_bill_batch_option.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/cust_bill_pay.pm b/FS/FS/cust_bill_pay.pm index 3f787d3b7..25bd61977 100644 --- a/FS/FS/cust_bill_pay.pm +++ b/FS/FS/cust_bill_pay.pm @@ -1,15 +1,9 @@ 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 { @@ -143,13 +137,6 @@ sub check { Returns the payment (see L) -=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 diff --git a/FS/FS/cust_bill_pay_batch.pm b/FS/FS/cust_bill_pay_batch.pm index 30fb74432..8a8bef315 100644 --- a/FS/FS/cust_bill_pay_batch.pm +++ b/FS/FS/cust_bill_pay_batch.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/cust_bill_pay_pkg.pm b/FS/FS/cust_bill_pay_pkg.pm index eb2e80c78..0a17469e5 100644 --- a/FS/FS/cust_bill_pay_pkg.pm +++ b/FS/FS/cust_bill_pay_pkg.pm @@ -1,13 +1,8 @@ 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 @@ -171,24 +166,10 @@ sub check { 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 diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index f94bf9b19..c71ebf414 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -8,7 +8,6 @@ use List::Util qw( sum min ); 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; @@ -511,13 +510,6 @@ sub regularize_details { Returns the invoice (see L) 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. diff --git a/FS/FS/cust_bill_pkg_discount.pm b/FS/FS/cust_bill_pkg_discount.pm index dfa83d393..534a067ad 100644 --- a/FS/FS/cust_bill_pkg_discount.pm +++ b/FS/FS/cust_bill_pkg_discount.pm @@ -1,10 +1,7 @@ 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 @@ -125,25 +122,10 @@ sub check { Returns the associated line item (see L). -=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). -=cut - -sub cust_pkg_discount { - my $self = shift; - qsearchs( 'cust_pkg_discount', { 'pkgdiscountnum' => $self->pkgdiscountnum }); -} - - =back =head1 BUGS diff --git a/FS/FS/cust_bill_pkg_discount_void.pm b/FS/FS/cust_bill_pkg_discount_void.pm index 859ef3cf2..cc28f13a9 100644 --- a/FS/FS/cust_bill_pkg_discount_void.pm +++ b/FS/FS/cust_bill_pkg_discount_void.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/cust_bill_pkg_display.pm b/FS/FS/cust_bill_pkg_display.pm index d7c147281..e3afded4b 100644 --- a/FS/FS/cust_bill_pkg_display.pm +++ b/FS/FS/cust_bill_pkg_display.pm @@ -1,10 +1,7 @@ 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 @@ -146,18 +143,10 @@ sub check { Returns the associated cust_bill_pkg (see L) 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, L, schema.html from the base documentation. diff --git a/FS/FS/cust_bill_pkg_tax_location.pm b/FS/FS/cust_bill_pkg_tax_location.pm index 140982e53..468e6ae99 100644 --- a/FS/FS/cust_bill_pkg_tax_location.pm +++ b/FS/FS/cust_bill_pkg_tax_location.pm @@ -1,18 +1,16 @@ 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 @@ -138,13 +136,6 @@ sub check { 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 charge. @@ -153,13 +144,6 @@ Returns the cust_bill_pkg object for the I 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 @@ -243,7 +227,7 @@ sub upgrade_taxable_billpkgnum { # 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'); diff --git a/FS/FS/cust_bill_pkg_tax_rate_location.pm b/FS/FS/cust_bill_pkg_tax_rate_location.pm index 39b2bb95a..3e8098c3a 100644 --- a/FS/FS/cust_bill_pkg_tax_rate_location.pm +++ b/FS/FS/cust_bill_pkg_tax_rate_location.pm @@ -1,11 +1,9 @@ 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; @@ -128,26 +126,10 @@ sub check { 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 diff --git a/FS/FS/cust_bill_void.pm b/FS/FS/cust_bill_void.pm index cce77b3aa..b829b8d09 100644 --- a/FS/FS/cust_bill_void.pm +++ b/FS/FS/cust_bill_void.pm @@ -3,7 +3,6 @@ use base qw( FS::Template_Mixin FS::cust_main_Mixin FS::otaker_Mixin FS::Record 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; @@ -248,13 +247,6 @@ sub void_access_user { =item cust_main -=cut - -sub cust_main { - my $self = shift; - qsearchs('cust_main', { 'custnum' => $self->custnum } ); -} - =item cust_bill_pkg =cut diff --git a/FS/FS/cust_class.pm b/FS/FS/cust_class.pm index 7cbc9b818..25360586d 100644 --- a/FS/FS/cust_class.pm +++ b/FS/FS/cust_class.pm @@ -1,8 +1,7 @@ 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 diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm index c459d827b..7845a205a 100644 --- a/FS/FS/cust_credit.pm +++ b/FS/FS/cust_credit.pm @@ -1,7 +1,7 @@ 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 ); @@ -11,7 +11,6 @@ use FS::UID qw( dbh ); 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; @@ -448,14 +447,6 @@ sub credited { Returns the customer (see L) 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) for this credit. diff --git a/FS/FS/cust_credit_bill.pm b/FS/FS/cust_credit_bill.pm index 9ecb7e048..ad5c7129d 100644 --- a/FS/FS/cust_credit_bill.pm +++ b/FS/FS/cust_credit_bill.pm @@ -1,15 +1,9 @@ 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 { @@ -143,13 +137,6 @@ sub check { Returns the credit (see L) -=cut - -sub cust_credit { - my $self = shift; - qsearchs( 'cust_credit', { 'crednum' => $self->crednum } ); -} - =back =head1 BUGS diff --git a/FS/FS/cust_credit_bill_pkg.pm b/FS/FS/cust_credit_bill_pkg.pm index 657a88904..be9cd70bd 100644 --- a/FS/FS/cust_credit_bill_pkg.pm +++ b/FS/FS/cust_credit_bill_pkg.pm @@ -1,17 +1,12 @@ 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 @@ -292,16 +287,6 @@ sub check { $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) { diff --git a/FS/FS/cust_credit_refund.pm b/FS/FS/cust_credit_refund.pm index 9fc03f2d3..a0aeca744 100644 --- a/FS/FS/cust_credit_refund.pm +++ b/FS/FS/cust_credit_refund.pm @@ -1,13 +1,7 @@ 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 @@ -126,12 +120,10 @@ sub check { 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; @@ -148,24 +140,10 @@ sub check { Returns the refund (see L) -=cut - -sub cust_refund { - my $self = shift; - qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } ); -} - =item cust_credit Returns the credit (see L) -=cut - -sub cust_credit { - my $self = shift; - qsearchs( 'cust_credit', { 'crednum' => $self->crednum } ); -} - =back =head1 BUGS diff --git a/FS/FS/cust_credit_void.pm b/FS/FS/cust_credit_void.pm index ac47d954a..f76f79442 100644 --- a/FS/FS/cust_credit_void.pm +++ b/FS/FS/cust_credit_void.pm @@ -1,8 +1,8 @@ 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; @@ -100,13 +100,6 @@ sub check { Returns the parent customer object (see L). -=cut - -sub cust_main { - my $self = shift; - qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); -} - =item void_access_user Returns the voiding employee object (see L). diff --git a/FS/FS/cust_event.pm b/FS/FS/cust_event.pm index 30dea6e28..6a67c087b 100644 --- a/FS/FS/cust_event.pm +++ b/FS/FS/cust_event.pm @@ -1,11 +1,10 @@ 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; @@ -151,13 +150,6 @@ sub check { Returns the event definition (see L) 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 diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index a1d7d87d0..0a93764c1 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1,10 +1,9 @@ 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 @@ -13,6 +12,9 @@ use base qw( FS::cust_main::Packages FS::cust_main::Status FS::o2m_Common FS::Record ); + +require 5.006; +use strict; use vars qw( $DEBUG $me $conf @encrypted_fields $import @@ -60,7 +62,6 @@ use FS::cust_class; 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; @@ -2100,7 +2101,7 @@ Returns all locations (see L) for this customer. sub cust_location { my $self = shift; - qsearch('cust_location', { 'custnum' => $self->custnum, + qsearch('cust_location', { 'custnum' => $self->custnum, 'prospectnum' => '' } ); } @@ -2330,13 +2331,6 @@ sub notes { Returns the agent (see L) for this customer. -=cut - -sub agent { - my $self = shift; - qsearchs( 'agent', { 'agentnum' => $self->agentnum } ); -} - =item agent_name Returns the agent name (see L) for this customer. @@ -2353,13 +2347,6 @@ sub agent_name { 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, @@ -2378,17 +2365,6 @@ sub part_tag { 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 @@ -3062,13 +3038,6 @@ sub tax_exemption { =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 diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm index 10a007c57..5c1be7b46 100644 --- a/FS/FS/cust_main_county.pm +++ b/FS/FS/cust_main_county.pm @@ -1,7 +1,8 @@ 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 ); @@ -12,7 +13,6 @@ use FS::part_pkg; use FS::cust_tax_exempt; use FS::cust_tax_exempt_pkg; -@ISA = qw( FS::Record ); @EXPORT_OK = qw( regionselector ); @cust_main_county = (); diff --git a/FS/FS/cust_main_exemption.pm b/FS/FS/cust_main_exemption.pm index c6f3d5e6e..6492e2286 100644 --- a/FS/FS/cust_main_exemption.pm +++ b/FS/FS/cust_main_exemption.pm @@ -1,10 +1,8 @@ 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 diff --git a/FS/FS/cust_main_invoice.pm b/FS/FS/cust_main_invoice.pm index ec01842a7..b6ef26066 100644 --- a/FS/FS/cust_main_invoice.pm +++ b/FS/FS/cust_main_invoice.pm @@ -1,16 +1,12 @@ 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 @@ -104,9 +100,6 @@ sub check { ; return $error if $error; - return "Unknown customer" - unless qsearchs('cust_main',{ 'custnum' => $self->custnum }); - $self->SUPER::check; } @@ -167,13 +160,6 @@ sub address { Returns the parent customer object (see L). -=cut - -sub cust_main { - my $self = shift; - qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); -} - =back =head1 BUGS diff --git a/FS/FS/cust_main_note.pm b/FS/FS/cust_main_note.pm index 06da0965a..712580764 100644 --- a/FS/FS/cust_main_note.pm +++ b/FS/FS/cust_main_note.pm @@ -1,10 +1,9 @@ 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 @@ -124,17 +123,6 @@ sub check { 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 diff --git a/FS/FS/cust_note_class.pm b/FS/FS/cust_note_class.pm index 0cb967754..e66c3a27c 100644 --- a/FS/FS/cust_note_class.pm +++ b/FS/FS/cust_note_class.pm @@ -1,8 +1,7 @@ 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 diff --git a/FS/FS/cust_pay_batch.pm b/FS/FS/cust_pay_batch.pm index db53b19c9..d4d40b580 100644 --- a/FS/FS/cust_pay_batch.pm +++ b/FS/FS/cust_pay_batch.pm @@ -1,15 +1,11 @@ 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 @@ -205,13 +201,6 @@ sub check { Returns the customer (see L) 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 @@ -236,11 +225,6 @@ Returns the payment batch this payment belongs to (Lby_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? diff --git a/FS/FS/cust_pay_pending.pm b/FS/FS/cust_pay_pending.pm index 572a2ade2..f5de73dbe 100644 --- a/FS/FS/cust_pay_pending.pm +++ b/FS/FS/cust_pay_pending.pm @@ -1,16 +1,11 @@ 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'); } @@ -260,12 +255,6 @@ Returns the associated L record if any. Otherwise returns false. =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) diff --git a/FS/FS/cust_pay_refund.pm b/FS/FS/cust_pay_refund.pm index b799f69e7..28f757d66 100644 --- a/FS/FS/cust_pay_refund.pm +++ b/FS/FS/cust_pay_refund.pm @@ -1,13 +1,9 @@ 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 { @@ -152,24 +148,10 @@ sub check { Returns the payment (see L) -=cut - -sub cust_pay { - my $self = shift; - qsearchs( 'cust_pay', { 'paynum' => $self->paynum } ); -} - =item cust_refund Returns the refund (see L) -=cut - -sub cust_refund { - my $self = shift; - qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } ); -} - =back =head1 BUGS diff --git a/FS/FS/cust_pay_void.pm b/FS/FS/cust_pay_void.pm index c42dc18e0..55b6c6743 100644 --- a/FS/FS/cust_pay_void.pm +++ b/FS/FS/cust_pay_void.pm @@ -1,8 +1,8 @@ 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); @@ -12,7 +12,6 @@ use FS::cust_pay; #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'); @@ -207,13 +206,6 @@ sub check { Returns the parent customer object (see L). -=cut - -sub cust_main { - my $self = shift; - qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); -} - =item void_access_user Returns the voiding employee object (see L). diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 8d12ab9c7..ce9869056 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -3313,13 +3313,6 @@ sub _labels_short { Returns the parent customer object (see L). -=cut - -sub cust_main { - my $self = shift; - qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); -} - =item balance Returns the balance for this specific package, when using @@ -3865,13 +3858,6 @@ sub recharge { =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 @@ -3885,13 +3871,6 @@ sub cust_pkg_discount_active { 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: diff --git a/FS/FS/cust_pkg_detail.pm b/FS/FS/cust_pkg_detail.pm index e2d8987bd..d7ac7a3c3 100644 --- a/FS/FS/cust_pkg_detail.pm +++ b/FS/FS/cust_pkg_detail.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/cust_pkg_discount.pm b/FS/FS/cust_pkg_discount.pm index d82d94990..b74a23111 100644 --- a/FS/FS/cust_pkg_discount.pm +++ b/FS/FS/cust_pkg_discount.pm @@ -1,9 +1,8 @@ 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 @@ -184,24 +183,10 @@ sub check { Returns the customer package (see L). -=cut - -sub cust_pkg { - my $self = shift; - qsearchs('cust_pkg', { 'pkgnum' => $self->pkgnum } ); -} - =item discount Returns the discount (see L). -=cut - -sub discount { - my $self = shift; - qsearchs('discount', { 'discountnum' => $self->discountnum } ); -} - =item increment_months_used MONTHS Increments months_used by the given parameter diff --git a/FS/FS/cust_pkg_option.pm b/FS/FS/cust_pkg_option.pm index 43a153095..c44bfa2d4 100644 --- a/FS/FS/cust_pkg_option.pm +++ b/FS/FS/cust_pkg_option.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/cust_pkg_reason.pm b/FS/FS/cust_pkg_reason.pm index c29a2f928..d11d05e95 100644 --- a/FS/FS/cust_pkg_reason.pm +++ b/FS/FS/cust_pkg_reason.pm @@ -1,9 +1,9 @@ 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; @@ -117,13 +117,6 @@ sub check { Returns the reason (see L) 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) associated with this diff --git a/FS/FS/cust_pkg_usage.pm b/FS/FS/cust_pkg_usage.pm index 0eefd7480..d29584290 100644 --- a/FS/FS/cust_pkg_usage.pm +++ b/FS/FS/cust_pkg_usage.pm @@ -1,10 +1,8 @@ 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 @@ -139,18 +137,6 @@ Return the L linked to this record. Return the L 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 diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm index 958209049..7bf41ee5d 100644 --- a/FS/FS/cust_svc.pm +++ b/FS/FS/cust_svc.pm @@ -1,12 +1,12 @@ 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; @@ -18,7 +18,6 @@ use FS::UI::Web; #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]'; @@ -409,13 +408,6 @@ sub part_svc { Returns the package this service belongs to, as a FS::cust_pkg object (see L). -=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. diff --git a/FS/FS/cust_svc_option.pm b/FS/FS/cust_svc_option.pm index 07fec90d0..43006c623 100644 --- a/FS/FS/cust_svc_option.pm +++ b/FS/FS/cust_svc_option.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/cust_tag.pm b/FS/FS/cust_tag.pm index 5dfd156b4..88cf117db 100644 --- a/FS/FS/cust_tag.pm +++ b/FS/FS/cust_tag.pm @@ -1,10 +1,7 @@ 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 @@ -116,23 +113,8 @@ sub check { =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 diff --git a/FS/FS/cust_tax_adjustment.pm b/FS/FS/cust_tax_adjustment.pm index 5891368c5..c09da2611 100644 --- a/FS/FS/cust_tax_adjustment.pm +++ b/FS/FS/cust_tax_adjustment.pm @@ -1,10 +1,7 @@ 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 @@ -130,11 +127,6 @@ sub check { $self->SUPER::check; } -sub cust_bill_pkg { - my $self = shift; - qsearchs('cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } ); -} - =back =head1 BUGS diff --git a/FS/FS/cust_tax_exempt.pm b/FS/FS/cust_tax_exempt.pm index 045421c99..45eab42f5 100644 --- a/FS/FS/cust_tax_exempt.pm +++ b/FS/FS/cust_tax_exempt.pm @@ -1,13 +1,7 @@ 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 @@ -128,13 +122,6 @@ sub check { 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 diff --git a/FS/FS/cust_tax_exempt_pkg.pm b/FS/FS/cust_tax_exempt_pkg.pm index bbabb5b0a..b64ef515d 100644 --- a/FS/FS/cust_tax_exempt_pkg.pm +++ b/FS/FS/cust_tax_exempt_pkg.pm @@ -1,19 +1,12 @@ 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 @@ -183,11 +176,6 @@ Otherwise returns false. =cut -sub cust_main_county { - my $self = shift; - qsearchs( 'cust_main_county', { 'taxnum', $self->taxnum } ); -} - sub _upgrade_data { my $class = shift; diff --git a/FS/FS/did_order.pm b/FS/FS/did_order.pm index d004f2308..1479565b1 100644 --- a/FS/FS/did_order.pm +++ b/FS/FS/did_order.pm @@ -1,7 +1,7 @@ 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 @@ -254,13 +254,6 @@ sub check { Returns the did_order_items (see L) 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), if any, associated with this diff --git a/FS/FS/discount.pm b/FS/FS/discount.pm index e66d78ced..43ad4909e 100644 --- a/FS/FS/discount.pm +++ b/FS/FS/discount.pm @@ -2,8 +2,6 @@ package FS::discount; use base qw( FS::Record ); use strict; -use FS::Record qw( qsearch qsearchs ); -use FS::discount_class; =head1 NAME @@ -206,12 +204,6 @@ sub classname { $discount_class ? $discount_class->classname : '(none)'; } -sub discount_class { - my $self = shift; - qsearchs('discount_class', { 'classnum' => $self->classnum }); -} - - =back =head1 BUGS diff --git a/FS/FS/domain_record.pm b/FS/FS/domain_record.pm index cd881ae08..e180e4b66 100644 --- a/FS/FS/domain_record.pm +++ b/FS/FS/domain_record.pm @@ -1,14 +1,12 @@ 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]'; @@ -370,13 +368,6 @@ sub increment_serial { Returns the domain (see L) for this record. -=cut - -sub svc_domain { - my $self = shift; - qsearchs('svc_domain', { svcnum => $self->svcnum } ); -} - =item zone Returns the canonical zone name. diff --git a/FS/FS/dsl_device.pm b/FS/FS/dsl_device.pm index 2efe1f56e..39e8c3468 100644 --- a/FS/FS/dsl_device.pm +++ b/FS/FS/dsl_device.pm @@ -1,9 +1,7 @@ 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 @@ -115,16 +113,9 @@ sub check { =item svc_dsl -Returns the phone number (see L) associated with this customer +Returns the DSL (see L) associated with this customer device. -=cut - -sub svc_phone { - my $self = shift; - qsearchs( 'svc_dsl', { 'svcnum' => $self->svcnum } ); -} - =back =head1 BUGS diff --git a/FS/FS/export_device.pm b/FS/FS/export_device.pm index 69e382649..d3795c6cb 100644 --- a/FS/FS/export_device.pm +++ b/FS/FS/export_device.pm @@ -1,10 +1,7 @@ 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 @@ -103,24 +100,10 @@ sub check { Returns the FS::part_export object (see L). -=cut - -sub part_export { - my $self = shift; - qsearchs( 'part_export', { 'exportnum' => $self->exportnum } ); -} - =item part_device Returns the FS::part_device object (see L). -=cut - -sub part_device { - my $self = shift; - qsearchs( 'part_device', { 'svcpart' => $self->devicepart } ); -} - =back =head1 BUGS diff --git a/FS/FS/export_nas.pm b/FS/FS/export_nas.pm index 5282503d0..3e5b84112 100644 --- a/FS/FS/export_nas.pm +++ b/FS/FS/export_nas.pm @@ -1,9 +1,8 @@ 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 = ''; @@ -125,16 +124,6 @@ sub check { $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 diff --git a/FS/FS/export_svc.pm b/FS/FS/export_svc.pm index b08f8f7c3..5ef50b648 100644 --- a/FS/FS/export_svc.pm +++ b/FS/FS/export_svc.pm @@ -1,14 +1,10 @@ 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 @@ -319,24 +315,10 @@ sub check { Returns the FS::part_export object (see L). -=cut - -sub part_export { - my $self = shift; - qsearchs( 'part_export', { 'exportnum' => $self->exportnum } ); -} - =item part_svc Returns the FS::part_svc object (see L). -=cut - -sub part_svc { - my $self = shift; - qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } ); -} - =item svc_export_machine Returns all export hostname records (L) for this diff --git a/FS/FS/hardware_class.pm b/FS/FS/hardware_class.pm index 791653baa..a76de0097 100644 --- a/FS/FS/hardware_class.pm +++ b/FS/FS/hardware_class.pm @@ -1,8 +1,8 @@ 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 diff --git a/FS/FS/hardware_type.pm b/FS/FS/hardware_type.pm index f19a3f683..615c314b0 100644 --- a/FS/FS/hardware_type.pm +++ b/FS/FS/hardware_type.pm @@ -1,8 +1,7 @@ package FS::hardware_type; +use base qw( FS::Record ); use strict; -use base qw( FS::Record ); -use FS::Record qw( qsearch qsearchs ); =head1 NAME @@ -115,13 +114,6 @@ sub check { Returns the L 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. diff --git a/FS/FS/inventory_class.pm b/FS/FS/inventory_class.pm index 4747241d7..dacbc512f 100644 --- a/FS/FS/inventory_class.pm +++ b/FS/FS/inventory_class.pm @@ -1,10 +1,8 @@ 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 diff --git a/FS/FS/inventory_item.pm b/FS/FS/inventory_item.pm index 477c93410..eef8880b8 100644 --- a/FS/FS/inventory_item.pm +++ b/FS/FS/inventory_item.pm @@ -1,13 +1,7 @@ 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 @@ -123,25 +117,10 @@ sub check { Returns the customer service associated with this inventory item, if the item has been used (see L). -=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 diff --git a/FS/FS/legacy_cust_bill.pm b/FS/FS/legacy_cust_bill.pm index b2bfeaaad..6b43c2f2b 100644 --- a/FS/FS/legacy_cust_bill.pm +++ b/FS/FS/legacy_cust_bill.pm @@ -1,9 +1,7 @@ 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 @@ -144,13 +142,6 @@ sub check { Returns the customer (see L) for this invoice. -=cut - -sub cust_main { - my $self = shift; - qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); -} - =back =head1 BUGS diff --git a/FS/FS/mailinglist.pm b/FS/FS/mailinglist.pm index 129461092..22ef82083 100644 --- a/FS/FS/mailinglist.pm +++ b/FS/FS/mailinglist.pm @@ -1,10 +1,8 @@ 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 @@ -142,22 +140,8 @@ sub check { =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 diff --git a/FS/FS/mailinglistmember.pm b/FS/FS/mailinglistmember.pm index 49688d812..5986bba64 100644 --- a/FS/FS/mailinglistmember.pm +++ b/FS/FS/mailinglistmember.pm @@ -1,12 +1,9 @@ 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 @@ -203,13 +200,6 @@ sub check { =item mailinglist -=cut - -sub mailinglist { - my $self = shift; - qsearchs('mailinglist', { 'listnum' => $self->listnum } ); -} - =item email_address =cut diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index 4e1f4da24..588592175 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -1,8 +1,19 @@ 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 ); @@ -12,16 +23,6 @@ use FS::cust_main; 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; @@ -693,10 +694,6 @@ Returns the L object for this template. =cut -sub agent { - qsearchs('agent', { 'agentnum' => $_[0]->agentnum }); -} - sub _upgrade_data { my ($self, %opts) = @_; diff --git a/FS/FS/otaker_Mixin.pm b/FS/FS/otaker_Mixin.pm index af61a85ac..6e465f06a 100644 --- a/FS/FS/otaker_Mixin.pm +++ b/FS/FS/otaker_Mixin.pm @@ -33,11 +33,6 @@ sub otaker { } } -sub access_user { - my $self = shift; - qsearchs('access_user', { 'usernum' => $self->usernum } ); -} - sub _upgrade_otaker { my $class = shift; my $table = $class->table; diff --git a/FS/FS/part_event.pm b/FS/FS/part_event.pm index a740bb836..9354f4d1e 100644 --- a/FS/FS/part_event.pm +++ b/FS/FS/part_event.pm @@ -9,7 +9,6 @@ use FS::Conf; use FS::part_event_option; use FS::part_event_condition; use FS::cust_event; -use FS::agent; $DEBUG = 0; @@ -169,13 +168,6 @@ sub _rebless { Returns the conditions associated with this event, as FS::part_event_condition objects (see L) -=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) for the provided object. @@ -223,13 +215,6 @@ sub reasontext { confess "part_event->reasontext deprecated"; } 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 diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index 28cb1419d..8b1624851 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -1,16 +1,15 @@ 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; @@ -449,24 +448,10 @@ sub part_export_machine { 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 diff --git a/FS/FS/part_export_machine.pm b/FS/FS/part_export_machine.pm index 1598e0372..86dd9e7ec 100644 --- a/FS/FS/part_export_machine.pm +++ b/FS/FS/part_export_machine.pm @@ -1,10 +1,8 @@ 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 @@ -134,13 +132,6 @@ sub check { =item svc_export_machine -=cut - -sub svc_export_machine { - my $self = shift; - qsearch( 'svc_export_machine', { 'machinenum' => $self->machinenum } ); -} - =back =head1 BUGS diff --git a/FS/FS/part_export_option.pm b/FS/FS/part_export_option.pm index e75940429..17bcf0059 100644 --- a/FS/FS/part_export_option.pm +++ b/FS/FS/part_export_option.pm @@ -1,11 +1,8 @@ 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 diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 9ce2e9687..47555289d 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -16,15 +16,12 @@ use FS::cust_pkg; 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; @@ -844,17 +841,6 @@ sub custom_comment { 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 @@ -920,13 +906,6 @@ sub addon_classname { 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) for this package @@ -945,11 +924,6 @@ definition. =cut -sub type_pkgs { - my $self = shift; - qsearch('type_pkgs', { 'pkgpart' => $self->pkgpart } ); -} - sub pkg_svc { my $self = shift; @@ -1205,13 +1179,6 @@ sub plandata { Returns all vendor/external package ids as FS::part_pkg_vendor objects (see L). -=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 @@ -1228,13 +1195,6 @@ sub vendor_pkg_ids { Returns all options as FS::part_pkg_option objects (see L). -=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. @@ -1553,25 +1513,11 @@ sub part_pkg_taxrate { Returns the package to discount m2m records (see L) 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) 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 diff --git a/FS/FS/part_pkg_currency.pm b/FS/FS/part_pkg_currency.pm index 246abee8b..71f122c1f 100644 --- a/FS/FS/part_pkg_currency.pm +++ b/FS/FS/part_pkg_currency.pm @@ -2,8 +2,6 @@ package FS::part_pkg_currency; use base qw( FS::Record ); use strict; -#use FS::Record qw( qsearch qsearchs ); -use FS::part_pkg; =head1 NAME diff --git a/FS/FS/part_pkg_discount.pm b/FS/FS/part_pkg_discount.pm index 06a0fb97f..73c7c8bcc 100644 --- a/FS/FS/part_pkg_discount.pm +++ b/FS/FS/part_pkg_discount.pm @@ -1,10 +1,7 @@ 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 @@ -108,13 +105,6 @@ sub check { Returns the discount associated with this part_pkg_discount. -=cut - -sub discount { - my $self = shift; - qsearchs('discount', { 'discountnum' => $self->discountnum }); -} - =back =head1 BUGS diff --git a/FS/FS/part_pkg_msgcat.pm b/FS/FS/part_pkg_msgcat.pm index 7c00c26ac..bda73bd3e 100644 --- a/FS/FS/part_pkg_msgcat.pm +++ b/FS/FS/part_pkg_msgcat.pm @@ -1,10 +1,8 @@ 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 diff --git a/FS/FS/part_pkg_option.pm b/FS/FS/part_pkg_option.pm index 142622bf5..2858ba788 100644 --- a/FS/FS/part_pkg_option.pm +++ b/FS/FS/part_pkg_option.pm @@ -1,12 +1,10 @@ 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 diff --git a/FS/FS/part_pkg_usage.pm b/FS/FS/part_pkg_usage.pm index 99014d398..008a2a933 100644 --- a/FS/FS/part_pkg_usage.pm +++ b/FS/FS/part_pkg_usage.pm @@ -1,8 +1,7 @@ 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 @@ -138,10 +137,7 @@ pool. 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') }; diff --git a/FS/FS/part_pkg_usage_class.pm b/FS/FS/part_pkg_usage_class.pm index 9a99783af..e7bcdcc97 100644 --- a/FS/FS/part_pkg_usage_class.pm +++ b/FS/FS/part_pkg_usage_class.pm @@ -1,8 +1,7 @@ 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 diff --git a/FS/FS/part_pkg_vendor.pm b/FS/FS/part_pkg_vendor.pm index 6b91f7535..bb37f1b1f 100644 --- a/FS/FS/part_pkg_vendor.pm +++ b/FS/FS/part_pkg_vendor.pm @@ -1,8 +1,7 @@ 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 @@ -122,12 +121,6 @@ sub check { Returns the L associated with this vendor/external package id. -=cut -sub part_export { - my $self = shift; - qsearchs( 'part_export', { 'exportnum' => $self->exportnum } ); -} - =back =head1 SEE ALSO diff --git a/FS/FS/part_referral.pm b/FS/FS/part_referral.pm index 992e1c52a..e4a582374 100644 --- a/FS/FS/part_referral.pm +++ b/FS/FS/part_referral.pm @@ -1,9 +1,9 @@ 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; @@ -115,13 +115,6 @@ sub check { 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 diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index a1168199c..27f0063a5 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -1,7 +1,8 @@ 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 ); @@ -11,8 +12,6 @@ use FS::export_svc; use FS::cust_svc; use FS::part_svc_class; -@ISA = qw(FS::Record); - $DEBUG = 0; =head1 NAME diff --git a/FS/FS/part_svc_router.pm b/FS/FS/part_svc_router.pm index df04cc9fb..1dff9c62a 100755 --- a/FS/FS/part_svc_router.pm +++ b/FS/FS/part_svc_router.pm @@ -1,12 +1,7 @@ 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'; } @@ -20,14 +15,4 @@ sub check { ''; #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; diff --git a/FS/FS/part_tag.pm b/FS/FS/part_tag.pm index ed3192969..b5295bed1 100644 --- a/FS/FS/part_tag.pm +++ b/FS/FS/part_tag.pm @@ -1,8 +1,8 @@ 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 diff --git a/FS/FS/part_virtual_field.pm b/FS/FS/part_virtual_field.pm index 4e6d2e4bd..0011ec6d3 100755 --- a/FS/FS/part_virtual_field.pm +++ b/FS/FS/part_virtual_field.pm @@ -1,12 +1,9 @@ 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 diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm index 8c6c36845..9ce6a8312 100644 --- a/FS/FS/pay_batch.pm +++ b/FS/FS/pay_batch.pm @@ -1,21 +1,19 @@ 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 @@ -147,22 +145,10 @@ sub check { Returns the L object for this batch. -=cut - -sub agent { - qsearchs('agent', { 'agentnum' => $_[0]->agentnum }); -} - =item cust_pay_batch Returns all L objects for this batch. -=cut - -sub cust_pay_batch { - qsearch('cust_pay_batch', { 'batchnum' => $_[0]->batchnum }); -} - =item rebalance =cut diff --git a/FS/FS/payment_gateway.pm b/FS/FS/payment_gateway.pm index 68d841855..95b7c40c8 100644 --- a/FS/FS/payment_gateway.pm +++ b/FS/FS/payment_gateway.pm @@ -1,12 +1,10 @@ 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; @@ -171,13 +169,6 @@ sub check { 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 diff --git a/FS/FS/payment_gateway_option.pm b/FS/FS/payment_gateway_option.pm index 057602291..6f4bb9dc0 100644 --- a/FS/FS/payment_gateway_option.pm +++ b/FS/FS/payment_gateway_option.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/phone_avail.pm b/FS/FS/phone_avail.pm index 6d49507b3..52bbdeb10 100644 --- a/FS/FS/phone_avail.pm +++ b/FS/FS/phone_avail.pm @@ -1,14 +1,12 @@ 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; @@ -176,24 +174,8 @@ sub cust_svc { =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 diff --git a/FS/FS/phone_device.pm b/FS/FS/phone_device.pm index ba765e026..d5f80a2c5 100644 --- a/FS/FS/phone_device.pm +++ b/FS/FS/phone_device.pm @@ -1,11 +1,9 @@ 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 @@ -208,25 +206,11 @@ sub check { Returns the device type record (see L) 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) 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. diff --git a/FS/FS/phone_type.pm b/FS/FS/phone_type.pm index d2ef465bd..ded6b918a 100644 --- a/FS/FS/phone_type.pm +++ b/FS/FS/phone_type.pm @@ -1,7 +1,7 @@ package FS::phone_type; +use base qw( FS::Record ); use strict; -use base qw( FS::Record ); use FS::Record qw( qsearch ); # qsearchs ); =head1 NAME diff --git a/FS/FS/pkg_svc.pm b/FS/FS/pkg_svc.pm index f79bb5e2d..4efffd9b3 100644 --- a/FS/FS/pkg_svc.pm +++ b/FS/FS/pkg_svc.pm @@ -1,12 +1,7 @@ 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 @@ -130,24 +125,10 @@ sub check { Returns the FS::part_pkg object (see L). -=cut - -sub part_pkg { - my $self = shift; - qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } ); -} - =item part_svc Returns the FS::part_svc object (see L). -=cut - -sub part_svc { - my $self = shift; - qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } ); -} - =back =head1 BUGS diff --git a/FS/FS/prepay_credit.pm b/FS/FS/prepay_credit.pm index c93999c6d..a0fd7f9a3 100644 --- a/FS/FS/prepay_credit.pm +++ b/FS/FS/prepay_credit.pm @@ -1,11 +1,9 @@ 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]'; @@ -126,13 +124,6 @@ sub check { Returns the agent (see L) for this prepaid card, if any. -=cut - -sub agent { - my $self = shift; - qsearchs('agent', { 'agentnum' => $self->agentnum } ); -} - =back =head1 SUBROUTINES diff --git a/FS/FS/prospect_main.pm b/FS/FS/prospect_main.pm index a18c8ff67..55b12f241 100644 --- a/FS/FS/prospect_main.pm +++ b/FS/FS/prospect_main.pm @@ -1,14 +1,11 @@ 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; @@ -275,13 +272,6 @@ sub name { Returns the contacts (see L) associated with this prospect. -=cut - -sub contact { - my $self = shift; - qsearch( 'contact', { 'prospectnum' => $self->prospectnum } ); -} - =item cust_location Returns the locations (see L) associated with this prospect. @@ -298,24 +288,10 @@ sub cust_location { Returns the qualifications (see L) associated with this prospect. -=cut - -sub qual { - my $self = shift; - qsearch( 'qual', { 'prospectnum' => $self->prospectnum } ); -} - =item agent Returns the agent (see L) for this customer. -=cut - -sub agent { - my $self = shift; - qsearchs( 'agent', { 'agentnum' => $self->agentnum } ); -} - =item search HASHREF (Class method) diff --git a/FS/FS/qual.pm b/FS/FS/qual.pm index 07878e9c2..c11b4608e 100644 --- a/FS/FS/qual.pm +++ b/FS/FS/qual.pm @@ -1,8 +1,8 @@ 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 @@ -102,7 +102,7 @@ sub insert { 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); @@ -176,27 +176,6 @@ sub check { $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; @@ -221,17 +200,12 @@ sub location_hash { 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; ''; } diff --git a/FS/FS/queue.pm b/FS/FS/queue.pm index 8ebadd417..1b52ac4fc 100644 --- a/FS/FS/queue.pm +++ b/FS/FS/queue.pm @@ -1,7 +1,8 @@ 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 ); @@ -11,10 +12,8 @@ use FS::Record qw( qsearch qsearchs dbh ); #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; @@ -268,25 +267,11 @@ sub args { 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 diff --git a/FS/FS/queue_arg.pm b/FS/FS/queue_arg.pm index 8e9a10d28..09c01668a 100644 --- a/FS/FS/queue_arg.pm +++ b/FS/FS/queue_arg.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/queue_depend.pm b/FS/FS/queue_depend.pm index 99a22c5c6..cd3f7872f 100644 --- a/FS/FS/queue_depend.pm +++ b/FS/FS/queue_depend.pm @@ -1,11 +1,7 @@ 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 diff --git a/FS/FS/quotation.pm b/FS/FS/quotation.pm index 47f13e6dc..cf6652f95 100644 --- a/FS/FS/quotation.pm +++ b/FS/FS/quotation.pm @@ -1,12 +1,9 @@ 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 @@ -122,29 +119,14 @@ sub check { =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 diff --git a/FS/FS/quotation_pkg.pm b/FS/FS/quotation_pkg.pm index efff9683f..c9724d141 100644 --- a/FS/FS/quotation_pkg.pm +++ b/FS/FS/quotation_pkg.pm @@ -1,11 +1,7 @@ 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 @@ -130,11 +126,6 @@ sub check { $self->SUPER::check; } -sub part_pkg { - my $self = shift; - qsearchs('part_pkg', { 'pkgpart' => $self->pkgpart } ); -} - sub desc { my $self = shift; $self->part_pkg->pkg; diff --git a/FS/FS/quotation_pkg_discount.pm b/FS/FS/quotation_pkg_discount.pm index 34e13a610..19930ac64 100644 --- a/FS/FS/quotation_pkg_discount.pm +++ b/FS/FS/quotation_pkg_discount.pm @@ -1,8 +1,7 @@ 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 diff --git a/FS/FS/radius_attr.pm b/FS/FS/radius_attr.pm index cc03b4df9..16d3f62a3 100644 --- a/FS/FS/radius_attr.pm +++ b/FS/FS/radius_attr.pm @@ -1,9 +1,11 @@ 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 @@ -174,13 +176,6 @@ sub check { Returns the L object to which this attribute applies. -=cut - -sub radius_group { - my $self = shift; - qsearchs('radius_group', { 'groupnum' => $self->groupnum }); -} - =back =head1 CLASS METHODS diff --git a/FS/FS/radius_usergroup.pm b/FS/FS/radius_usergroup.pm index 8085fe805..9c78796c4 100644 --- a/FS/FS/radius_usergroup.pm +++ b/FS/FS/radius_usergroup.pm @@ -1,13 +1,11 @@ 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 @@ -127,11 +125,6 @@ Returns the RADIUS group associated with this record (see L). =cut -sub radius_group { - my $self = shift; - qsearchs('radius_group', { 'groupnum' => $self->groupnum } ); -} - sub _upgrade_data { #class method my ($class, %opts) = @_; diff --git a/FS/FS/rate.pm b/FS/FS/rate.pm index 49ac938fd..405280747 100644 --- a/FS/FS/rate.pm +++ b/FS/FS/rate.pm @@ -1,12 +1,11 @@ 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 @@ -382,14 +381,6 @@ sub dest_detail { Returns all region-specific details (see L) for this rate. -=cut - -sub rate_detail { - my $self = shift; - qsearch( 'rate_detail', { 'ratenum' => $self->ratenum } ); -} - - =back =head1 SUBROUTINES diff --git a/FS/FS/rate_detail.pm b/FS/FS/rate_detail.pm index f3ee84c74..66c5c9740 100644 --- a/FS/FS/rate_detail.pm +++ b/FS/FS/rate_detail.pm @@ -1,14 +1,13 @@ 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]'; @@ -147,13 +146,6 @@ sub check { Returns the parent call plan (see L) 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) associated with this diff --git a/FS/FS/rate_prefix.pm b/FS/FS/rate_prefix.pm index 93349f04d..37c61cbc7 100644 --- a/FS/FS/rate_prefix.pm +++ b/FS/FS/rate_prefix.pm @@ -1,13 +1,10 @@ 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 @@ -122,13 +119,6 @@ sub check { Returns the rate region (see L) for this prefix. -=cut - -sub rate_region { - my $self = shift; - qsearchs('rate_region', { 'regionnum' => $self->regionnum } ); -} - =back =head1 CLASS METHODS diff --git a/FS/FS/rate_region.pm b/FS/FS/rate_region.pm index d42fdb41e..fec540ec7 100644 --- a/FS/FS/rate_region.pm +++ b/FS/FS/rate_region.pm @@ -1,13 +1,11 @@ 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 diff --git a/FS/FS/rate_time_interval.pm b/FS/FS/rate_time_interval.pm index 6a9986b0c..8d4e8b170 100644 --- a/FS/FS/rate_time_interval.pm +++ b/FS/FS/rate_time_interval.pm @@ -1,8 +1,7 @@ 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 @@ -136,13 +135,6 @@ sub check { Returns the L 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 diff --git a/FS/FS/reg_code.pm b/FS/FS/reg_code.pm index f48ccf048..fd944d212 100644 --- a/FS/FS/reg_code.pm +++ b/FS/FS/reg_code.pm @@ -1,13 +1,10 @@ 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 @@ -198,14 +195,6 @@ sub part_pkg { 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 diff --git a/FS/FS/reg_code_pkg.pm b/FS/FS/reg_code_pkg.pm index 837b755e6..f438f6745 100644 --- a/FS/FS/reg_code_pkg.pm +++ b/FS/FS/reg_code_pkg.pm @@ -1,12 +1,7 @@ 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 @@ -115,13 +110,6 @@ sub check { Returns the package definition (see L) -=cut - -sub part_pkg { - my $self = shift; - qsearchs('part_pkg', { 'pkgpart' => $self->pkgpart } ); -} - =back =head1 BUGS diff --git a/FS/FS/registrar.pm b/FS/FS/registrar.pm index cf5dc4907..70a925adb 100644 --- a/FS/FS/registrar.pm +++ b/FS/FS/registrar.pm @@ -1,10 +1,7 @@ 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 diff --git a/FS/FS/router.pm b/FS/FS/router.pm index 937dc1f45..21011e7d7 100755 --- a/FS/FS/router.pm +++ b/FS/FS/router.pm @@ -1,12 +1,10 @@ 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 @@ -209,11 +207,6 @@ is enabled. =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; @@ -227,13 +220,6 @@ Returns a list of FS::part_svc_router objects associated with this 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. @@ -250,25 +236,12 @@ sub part_svc { 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, not any service connected I the router. -=cut - -sub cust_svc { - my $svcnum = shift->svcnum or return undef; - FS::cust_svc->by_key($svcnum); -} - =back =head1 SEE ALSO diff --git a/FS/FS/sales_pkg_class.pm b/FS/FS/sales_pkg_class.pm index 90867a828..b14003527 100644 --- a/FS/FS/sales_pkg_class.pm +++ b/FS/FS/sales_pkg_class.pm @@ -2,9 +2,6 @@ package FS::sales_pkg_class; use base qw( FS::Record ); use strict; -use FS::Record qw( qsearchs ); # qsearch qsearchs ); -use FS::sales; -use FS::pkg_class; =head1 NAME @@ -110,11 +107,6 @@ sub check { $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; diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm index 659255eaa..4a2d61786 100644 --- a/FS/FS/svc_Common.pm +++ b/FS/FS/svc_Common.pm @@ -1,14 +1,14 @@ 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; @@ -17,8 +17,6 @@ use FS::inventory_item; use FS::inventory_class; use FS::NetworkMonitoringSystem; -@ISA = qw( FS::cust_main_Mixin FS::Record ); - $me = '[FS::svc_Common]'; $DEBUG = 0; @@ -30,9 +28,8 @@ FS::svc_Common - Object method for all svc_ records =head1 SYNOPSIS -use FS::svc_Common; - -@ISA = qw( FS::svc_Common ); +package svc_myservice; +use base qw( FS::svc_Common ); =head1 DESCRIPTION @@ -1010,13 +1007,6 @@ sub release_router { Returns the cust_svc record associated with this svc_ record, as a FS::cust_svc object (see L). -=cut - -sub cust_svc { - my $self = shift; - qsearchs('cust_svc', { 'svcnum' => $self->svcnum } ); -} - =item suspend Runs export_suspend callbacks. diff --git a/FS/FS/svc_Tower_Mixin.pm b/FS/FS/svc_Tower_Mixin.pm index 3da07c1cd..2555b9e50 100644 --- a/FS/FS/svc_Tower_Mixin.pm +++ b/FS/FS/svc_Tower_Mixin.pm @@ -1,19 +1,9 @@ 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 diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 26d6e5b72..3ca40a3f5 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -1,6 +1,4 @@ package FS::svc_acct; - -use strict; use base qw( FS::svc_Domain_Mixin FS::svc_CGP_Mixin FS::svc_CGPRule_Mixin @@ -8,6 +6,8 @@ use base qw( FS::svc_Domain_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 @@ -55,7 +55,6 @@ use FS::part_export; use FS::svc_forward; use FS::svc_www; use FS::cdr; -use FS::acct_snarf; use FS::tower_sector; $DEBUG = 0; @@ -1903,14 +1902,6 @@ Returns an array of FS::acct_snarf records associated with the account. =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 diff --git a/FS/FS/svc_alarm.pm b/FS/FS/svc_alarm.pm index 4a355c7c1..fafd9e886 100644 --- a/FS/FS/svc_alarm.pm +++ b/FS/FS/svc_alarm.pm @@ -1,9 +1,8 @@ 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; @@ -209,16 +208,6 @@ sub check { $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 diff --git a/FS/FS/svc_cable.pm b/FS/FS/svc_cable.pm index 5d281135b..3a1dc5ae9 100644 --- a/FS/FS/svc_cable.pm +++ b/FS/FS/svc_cable.pm @@ -5,9 +5,6 @@ use base qw( FS::svc_MAC_Mixin use strict; use Tie::IxHash; -use FS::Record qw( qsearchs ); # qw( qsearch qsearchs ); -use FS::cable_provider; -use FS::cable_model; =head1 NAME @@ -175,24 +172,10 @@ sub check { 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 diff --git a/FS/FS/svc_dsl.pm b/FS/FS/svc_dsl.pm index 8c47f8887..570476005 100644 --- a/FS/FS/svc_dsl.pm +++ b/FS/FS/svc_dsl.pm @@ -1,14 +1,14 @@ 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]'; @@ -296,11 +296,6 @@ objects. =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; diff --git a/FS/FS/svc_export_machine.pm b/FS/FS/svc_export_machine.pm index 7ca20ccb6..e22af6a01 100644 --- a/FS/FS/svc_export_machine.pm +++ b/FS/FS/svc_export_machine.pm @@ -1,11 +1,9 @@ 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') }; @@ -107,13 +105,6 @@ sub check { =item part_export_machine -=cut - -sub part_export_machine { - my $self = shift; - qsearchs('part_export_machine', { 'machinenum' => $self->machinenum } ); -} - =back =head1 BUGS diff --git a/FS/FS/svc_hardware.pm b/FS/FS/svc_hardware.pm index b28cc9ef5..dc9ac59df 100644 --- a/FS/FS/svc_hardware.pm +++ b/FS/FS/svc_hardware.pm @@ -1,10 +1,9 @@ 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; @@ -200,13 +199,6 @@ sub check { Returns the L 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 object associated diff --git a/FS/FS/svc_mailinglist.pm b/FS/FS/svc_mailinglist.pm index 8cab3986d..e0ff7fb21 100644 --- a/FS/FS/svc_mailinglist.pm +++ b/FS/FS/svc_mailinglist.pm @@ -1,10 +1,9 @@ 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 @@ -290,13 +289,6 @@ sub check { =item mailinglist -=cut - -sub mailinglist { - my $self = shift; - qsearchs('mailinglist', { 'listnum' => $self->listnum } ); -} - =item listname =cut diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index eb06dc15e..36d57a596 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -1,7 +1,7 @@ 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 ); @@ -13,7 +13,6 @@ use FS::Record qw( qsearch qsearchs dbh ); 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; @@ -696,11 +695,6 @@ Returns any FS::phone_device records associated with this service. =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 diff --git a/FS/FS/svc_www.pm b/FS/FS/svc_www.pm index 19f270063..ed079f80b 100644 --- a/FS/FS/svc_www.pm +++ b/FS/FS/svc_www.pm @@ -1,7 +1,8 @@ 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; @@ -10,8 +11,6 @@ use FS::domain_record; 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; @@ -252,13 +251,6 @@ sub check { Returns the FS::domain_record record for this web virtual host's zone (see L). -=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 diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm index 095939f9a..27df9e731 100644 --- a/FS/FS/tax_rate.pm +++ b/FS/FS/tax_rate.pm @@ -1,7 +1,8 @@ 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; @@ -11,6 +12,7 @@ use Storable qw( thaw nfreeze ); use IO::File; use File::Temp; use Text::CSV_XS; +use URI::Escape; use LWP::UserAgent; use HTTP::Request; use HTTP::Response; @@ -29,10 +31,6 @@ use FS::part_pkg_taxproduct; 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; diff --git a/FS/FS/tower.pm b/FS/FS/tower.pm index 5497c7217..f371ec9c7 100644 --- a/FS/FS/tower.pm +++ b/FS/FS/tower.pm @@ -1,10 +1,10 @@ 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 diff --git a/FS/FS/tower_sector.pm b/FS/FS/tower_sector.pm index 70642fb18..7e6819a3d 100644 --- a/FS/FS/tower_sector.pm +++ b/FS/FS/tower_sector.pm @@ -1,10 +1,7 @@ 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 @@ -123,13 +120,6 @@ sub check { Returns the tower for this sector, as an FS::tower object (see L). -=cut - -sub tower { - my $self = shift; - qsearchs('tower', { 'towernum'=>$self->towernum } ); -} - =item description Returns a description for this sector including tower name. @@ -150,13 +140,6 @@ sub description { Returns the services on this tower sector. -=cut - -sub svc_broadband { - my $self = shift; - qsearch('svc_broadband', { 'sectornum' => $self->sectornum }); -} - =back =head1 BUGS diff --git a/FS/FS/type_pkgs.pm b/FS/FS/type_pkgs.pm index 650375524..d06050e4b 100644 --- a/FS/FS/type_pkgs.pm +++ b/FS/FS/type_pkgs.pm @@ -1,12 +1,7 @@ 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 @@ -95,26 +90,12 @@ sub check { 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 diff --git a/FS/FS/vend_bill.pm b/FS/FS/vend_bill.pm index c8fcdd746..5ea91fb58 100644 --- a/FS/FS/vend_bill.pm +++ b/FS/FS/vend_bill.pm @@ -1,11 +1,9 @@ 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 @@ -169,22 +167,8 @@ sub check { =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 diff --git a/FS/FS/vend_main.pm b/FS/FS/vend_main.pm index ef79c0090..2e5e1505a 100644 --- a/FS/FS/vend_main.pm +++ b/FS/FS/vend_main.pm @@ -1,9 +1,7 @@ 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 @@ -103,13 +101,6 @@ sub check { =item vend_class -=cut - -sub vend_class { - my $self = shift; - qsearchs('vend_class', { 'classnum' => $self->classnum } ); -} - =back =head1 BUGS -- 2.11.0