autoload methods returning foreign records, RT#13971
authorIvan Kohler <ivan@freeside.biz>
Sun, 29 Dec 2013 00:11:46 +0000 (16:11 -0800)
committerIvan Kohler <ivan@freeside.biz>
Sun, 29 Dec 2013 00:11:46 +0000 (16:11 -0800)
140 files changed:
FS/FS/Record.pm
FS/FS/Schema.pm
FS/FS/access_group.pm
FS/FS/access_groupagent.pm
FS/FS/access_user.pm
FS/FS/access_user_pref.pm
FS/FS/access_user_session.pm
FS/FS/access_usergroup.pm
FS/FS/acct_snarf.pm
FS/FS/addr_block.pm
FS/FS/agent.pm
FS/FS/agent_payment_gateway.pm
FS/FS/bill_batch.pm
FS/FS/cdr_cust_pkg_usage.pm
FS/FS/cgp_rule.pm
FS/FS/clientapi_session.pm
FS/FS/clientapi_session_field.pm
FS/FS/contact.pm
FS/FS/contact_email.pm
FS/FS/contact_phone.pm
FS/FS/cust_bill.pm
FS/FS/cust_bill_batch.pm
FS/FS/cust_bill_batch_option.pm
FS/FS/cust_bill_pay.pm
FS/FS/cust_bill_pay_batch.pm
FS/FS/cust_bill_pay_pkg.pm
FS/FS/cust_bill_pkg.pm
FS/FS/cust_bill_pkg_discount.pm
FS/FS/cust_bill_pkg_discount_void.pm
FS/FS/cust_bill_pkg_display.pm
FS/FS/cust_bill_pkg_tax_location.pm
FS/FS/cust_bill_pkg_tax_rate_location.pm
FS/FS/cust_bill_void.pm
FS/FS/cust_class.pm
FS/FS/cust_credit.pm
FS/FS/cust_credit_bill.pm
FS/FS/cust_credit_bill_pkg.pm
FS/FS/cust_credit_refund.pm
FS/FS/cust_credit_void.pm
FS/FS/cust_event.pm
FS/FS/cust_main.pm
FS/FS/cust_main_county.pm
FS/FS/cust_main_exemption.pm
FS/FS/cust_main_invoice.pm
FS/FS/cust_main_note.pm
FS/FS/cust_note_class.pm
FS/FS/cust_pay_batch.pm
FS/FS/cust_pay_pending.pm
FS/FS/cust_pay_refund.pm
FS/FS/cust_pay_void.pm
FS/FS/cust_pkg.pm
FS/FS/cust_pkg_detail.pm
FS/FS/cust_pkg_discount.pm
FS/FS/cust_pkg_option.pm
FS/FS/cust_pkg_reason.pm
FS/FS/cust_pkg_usage.pm
FS/FS/cust_svc.pm
FS/FS/cust_svc_option.pm
FS/FS/cust_tag.pm
FS/FS/cust_tax_adjustment.pm
FS/FS/cust_tax_exempt.pm
FS/FS/cust_tax_exempt_pkg.pm
FS/FS/did_order.pm
FS/FS/discount.pm
FS/FS/domain_record.pm
FS/FS/dsl_device.pm
FS/FS/export_device.pm
FS/FS/export_nas.pm
FS/FS/export_svc.pm
FS/FS/hardware_class.pm
FS/FS/hardware_type.pm
FS/FS/inventory_class.pm
FS/FS/inventory_item.pm
FS/FS/legacy_cust_bill.pm
FS/FS/mailinglist.pm
FS/FS/mailinglistmember.pm
FS/FS/msg_template.pm
FS/FS/otaker_Mixin.pm
FS/FS/part_event.pm
FS/FS/part_export.pm
FS/FS/part_export_machine.pm
FS/FS/part_export_option.pm
FS/FS/part_pkg.pm
FS/FS/part_pkg_currency.pm
FS/FS/part_pkg_discount.pm
FS/FS/part_pkg_msgcat.pm
FS/FS/part_pkg_option.pm
FS/FS/part_pkg_usage.pm
FS/FS/part_pkg_usage_class.pm
FS/FS/part_pkg_vendor.pm
FS/FS/part_referral.pm
FS/FS/part_svc.pm
FS/FS/part_svc_router.pm
FS/FS/part_tag.pm
FS/FS/part_virtual_field.pm
FS/FS/pay_batch.pm
FS/FS/payment_gateway.pm
FS/FS/payment_gateway_option.pm
FS/FS/phone_avail.pm
FS/FS/phone_device.pm
FS/FS/phone_type.pm
FS/FS/pkg_svc.pm
FS/FS/prepay_credit.pm
FS/FS/prospect_main.pm
FS/FS/qual.pm
FS/FS/queue.pm
FS/FS/queue_arg.pm
FS/FS/queue_depend.pm
FS/FS/quotation.pm
FS/FS/quotation_pkg.pm
FS/FS/quotation_pkg_discount.pm
FS/FS/radius_attr.pm
FS/FS/radius_usergroup.pm
FS/FS/rate.pm
FS/FS/rate_detail.pm
FS/FS/rate_prefix.pm
FS/FS/rate_region.pm
FS/FS/rate_time_interval.pm
FS/FS/reg_code.pm
FS/FS/reg_code_pkg.pm
FS/FS/registrar.pm
FS/FS/router.pm
FS/FS/sales_pkg_class.pm
FS/FS/svc_Common.pm
FS/FS/svc_Tower_Mixin.pm
FS/FS/svc_acct.pm
FS/FS/svc_alarm.pm
FS/FS/svc_cable.pm
FS/FS/svc_dsl.pm
FS/FS/svc_export_machine.pm
FS/FS/svc_hardware.pm
FS/FS/svc_mailinglist.pm
FS/FS/svc_phone.pm
FS/FS/svc_www.pm
FS/FS/tax_rate.pm
FS/FS/tower.pm
FS/FS/tower_sector.pm
FS/FS/type_pkgs.pm
FS/FS/vend_bill.pm
FS/FS/vend_main.pm

index 4937347..835b73d 100644 (file)
@@ -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
 
index 647e2b1..926a0e6 100644 (file)
@@ -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?
                           },
                         ],
     },
index 11b2640..a2b9774 100644 (file)
@@ -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.
index bacc013..b0c4bb3 100644 (file)
@@ -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
index b740e47..0a441c4 100644 (file)
@@ -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<FS::access_usergroup>).
 
-=cut
-
-sub access_usergroup {
-  my $self = shift;
-  qsearch( 'access_usergroup', { 'usernum' => $self->usernum } );
-}
-
-#=item access_groups
-#
-#=cut
-#
-#sub access_groups {
-#
-#}
-#
-#=item access_groupnames
-#
-#=cut
-#
-#sub access_groupnames {
-#
-#}
-
 =item agentnums 
 
 Returns a list of agentnums this user can view (via group membership).
index a445d31..954eaa7 100644 (file)
@@ -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
 
index df112f9..7845d92 100644 (file)
@@ -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<FS::access_user>) for this session.
 
-=cut
-
-sub access_user {
-  my $self = shift;
-  qsearchs('access_user', { 'usernum' => $self->usernum });
-}
-
 =item touch_last_date
 
 =cut
index 8511fe5..44ad45b 100644 (file)
@@ -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
index 9816de9..40d21d0 100644 (file)
@@ -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
index 778c124..8dd09ab 100755 (executable)
@@ -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<FS::agent>) for this address block, if one exists.
 
-=cut
-
-sub agent {
-  qsearchs('agent', { 'agentnum' => shift->agentnum } );
-}
-
 =item label
 
 Returns text including the router name, gateway ip, and netmask for this
index d70ff18..b476847 100644 (file)
@@ -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<FS::agent_type>) for this agent.
 
-=cut
-
-sub agent_type {
-  my $self = shift;
-  qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
-}
-
 =item agent_cust_main
 
 Returns the FS::cust_main object (see L<FS::cust_main>), if any, for this
@@ -181,13 +173,6 @@ sub agent_cust_main {
 Returns the FS::agent_currency objects (see L<FS::agent_currency>), if any, for
 this agent.
 
-=cut
-
-sub agent_currency {
-  my $self = shift;
-  qsearch('agent_currency', { 'agentnum' => $self->agentnum } );
-}
-
 =item agent_currency_hashref
 
 Returns a hash references of supported additional currencies for this agent.
index bd99d0c..e71ed21 100644 (file)
@@ -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
index 1a46db0..fb41e0e 100644 (file)
@@ -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<FS::agent>) for this invoice batch.
 
-=cut
-
-sub agent {
-  my $self = shift;
-  qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
-}
-
 =back
 
 =head1 SUBROUTINES
index 6ef7f2d..7de8764 100644 (file)
@@ -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<FS::cust_pkg_usage> object that this usage allocation came from.
 
 Returns the L<FS::cdr> object that the usage was applied to.
 
-=cut
-
-sub cust_pkg_usage {
-  FS::cust_pkg_usage->by_key($_[0]->pkgusagenum);
-}
-
-sub cdr {
-  FS::cdr->by_key($_[0]->acctid);
-}
-
 =back
 
 =head1 SEE ALSO
index e9c5090..1029f5a 100644 (file)
@@ -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
index f71a126..02edbda 100644 (file)
@@ -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
 
index 085e956..d9bd697 100644 (file)
@@ -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
 
index da6f2eb..b76f0d9 100644 (file)
@@ -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
index 4f78735..a0ff273 100644 (file)
@@ -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
index 610753f..46d6a9b 100644 (file)
@@ -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;
index d0e7048..cdce7be 100644 (file)
@@ -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<FS::cust_main>) for this invoice.
 
-=cut
-
-sub cust_main {
-  my $self = shift;
-  qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
 =item cust_suspend_if_balance_over AMOUNT
 
 Suspends the customer associated with this invoice if the total amount owed on
@@ -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<FS::cust_bill_pay>) for this invoice.
index 4569e6b..fcbda7f 100644 (file)
@@ -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<FS::bill_batch> object.
 
-=cut
-
-sub bill_batch { 
-  my $self = shift;
-  FS::bill_batch->by_key($self->batchnum);
-}
-
 =item cust_bill
 
 Returns the C<FS::cust_bill> object.
 
-=cut
-
-sub cust_bill {
-  my $self = shift;
-  FS::cust_bill->by_key($self->invnum);
-}
-
 =back
 
 =head1 BUGS
index 9bba830..7ca2f53 100644 (file)
@@ -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
 
index 3f787d3..25bd619 100644 (file)
@@ -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<FS::cust_pay>)
 
-=cut
-
-sub cust_pay {
-  my $self = shift;
-  qsearchs( 'cust_pay', { 'paynum' => $self->paynum } );
-}
-
 =item send_receipt HASHREF | OPTION => VALUE ...
 
 Sends a payment receipt for the associated payment, against this specific
index 30fb744..8a8bef3 100644 (file)
@@ -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
 
index eb2e80c..0a17469 100644 (file)
@@ -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
index f94bf9b..c71ebf4 100644 (file)
@@ -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<FS::cust_bill>) for this invoice line item.
 
-=cut
-
-sub cust_bill {
-  my $self = shift;
-  qsearchs( 'cust_bill', { 'invnum' => $self->invnum } );
-}
-
 =item previous_cust_bill_pkg
 
 Returns the previous cust_bill_pkg for this package, if any.
index dfa83d3..534a067 100644 (file)
@@ -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<FS::cust_bill_pkg>).
 
-=cut
-
-sub cust_bill_pkg {
-  my $self = shift;
-  qsearchs( 'cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } ) ;
-}
-
 =item cust_pkg_discount
 
 Returns the associated customer discount (see L<FS::cust_pkg_discount>).
 
-=cut
-
-sub cust_pkg_discount {
-  my $self = shift;
-  qsearchs( 'cust_pkg_discount', { 'pkgdiscountnum' => $self->pkgdiscountnum });
-}
-
-
 =back
 
 =head1 BUGS
index 859ef3c..cc28f13 100644 (file)
@@ -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
 
index d7c1472..e3afded 100644 (file)
@@ -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<FS::cust_bill_pkg>) for this
 line item display object.
 
-=cut
-
-sub cust_bill_pkg {
-  my $self = shift;
-  qsearchs( 'cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } ) ;
-}
-
 =back
 
 =head1 BUGS
 
-
 =head1 SEE ALSO
 
 L<FS::Record>, L<FS::cust_bill_pkg>, schema.html from the base documentation.
index 140982e..468e6ae 100644 (file)
@@ -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<taxable> charge.
@@ -153,13 +144,6 @@ Returns the cust_bill_pkg object for the I<taxable> charge.
 
 Returns the associated cust_location object
 
-=cut
-
-sub cust_location {
-  my $self = shift;
-  qsearchs( 'cust_location', { 'locationnum' => $self->locationnum }  );
-}
-
 =item desc
 
 Returns a description for this tax line item constituent.  Currently this
@@ -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');
index 39b2bb9..3e8098c 100644 (file)
@@ -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
index cce77b3..b829b8d 100644 (file)
@@ -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
index 7cbc9b8..2536058 100644 (file)
@@ -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
index c459d82..7845a20 100644 (file)
@@ -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<FS::cust_main>) for this credit.
 
-=cut
-
-sub cust_main {
-  my $self = shift;
-  qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
-
 =item reason
 
 Returns the text of the associated reason (see L<FS::reason>) for this credit.
index 9ecb7e0..ad5c712 100644 (file)
@@ -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<FS::cust_credit>)
 
-=cut
-
-sub cust_credit {
-  my $self = shift;
-  qsearchs( 'cust_credit', { 'crednum' => $self->crednum } );
-}
-
 =back
 
 =head1 BUGS
index 657a889..be9cd70 100644 (file)
@@ -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) {
index 9fc03f2..a0aeca7 100644 (file)
@@ -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<FS::cust_refund>)
 
-=cut
-
-sub cust_refund {
-  my $self = shift;
-  qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } );
-}
-
 =item cust_credit
 
 Returns the credit (see L<FS::cust_credit>)
 
-=cut
-
-sub cust_credit {
-  my $self = shift;
-  qsearchs( 'cust_credit', { 'crednum' => $self->crednum } );
-}
-
 =back
 
 =head1 BUGS
index ac47d95..f76f794 100644 (file)
@@ -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<FS::cust_main>).
 
-=cut
-
-sub cust_main {
-  my $self = shift;
-  qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
 =item void_access_user
 
 Returns the voiding employee object (see L<FS::access_user>).
index 30dea6e..6a67c08 100644 (file)
@@ -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<FS::part_event>) for this completed event.
 
-=cut
-
-sub part_event {
-  my $self = shift;
-  qsearchs( 'part_event', { 'eventpart' => $self->eventpart } );
-}
-
 =item cust_X
 
 Returns the customer, package, invoice or batched payment (see
index a1d7d87..0a93764 100644 (file)
@@ -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<FS::cust_location>) 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<FS::agent>) for this customer.
 
-=cut
-
-sub agent {
-  my $self = shift;
-  qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
-}
-
 =item agent_name
 
 Returns the agent name (see L<FS::agent>) for this customer.
@@ -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
index 10a007c..5c1be7b 100644 (file)
@@ -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 = ();
index c6f3d5e..6492e22 100644 (file)
@@ -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
 
index ec01842..b6ef260 100644 (file)
@@ -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<FS::cust_main>).
 
-=cut
-
-sub cust_main {
-  my $self = shift;
-  qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
 =back
 
 =head1 BUGS
index 06da096..7125807 100644 (file)
@@ -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 
index 0cb9677..e66c3a2 100644 (file)
@@ -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
 
index db53b19..d4d40b5 100644 (file)
@@ -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<FS::cust_main>) for this batched credit card
 payment.
 
-=cut
-
-sub cust_main {
-  my $self = shift;
-  qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
 =item expmmyy
 
 Returns the credit card expiration date in MMYY format.  If this is a 
@@ -236,11 +225,6 @@ Returns the payment batch this payment belongs to (L<FS::pay_batch).
 
 =cut
 
-sub pay_batch {
-  my $self = shift;
-  FS::pay_batch->by_key($self->batchnum);
-}
-
 #you know what, screw this in the new world of events.  we should be able to
 #get the event defs to retry (remove once.pm condition, add every.pm) without
 #mucking about with statuses of previous cust_event records.  right?
index 572a2ad..f5de73d 100644 (file)
@@ -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<FS::cust_main> 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)
 
index b799f69..28f757d 100644 (file)
@@ -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<FS::cust_pay>)
 
-=cut
-
-sub cust_pay {
-  my $self = shift;
-  qsearchs( 'cust_pay', { 'paynum' => $self->paynum } );
-}
-
 =item cust_refund
 
 Returns the refund (see L<FS::cust_refund>)
 
-=cut
-
-sub cust_refund {
-  my $self = shift;
-  qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } );
-}
-
 =back
 
 =head1 BUGS
index c42dc18..55b6c67 100644 (file)
@@ -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<FS::cust_main>).
 
-=cut
-
-sub cust_main {
-  my $self = shift;
-  qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
 =item void_access_user
 
 Returns the voiding employee object (see L<FS::access_user>).
index 8d12ab9..ce98690 100644 (file)
@@ -3313,13 +3313,6 @@ sub _labels_short {
 
 Returns the parent customer object (see L<FS::cust_main>).
 
-=cut
-
-sub cust_main {
-  my $self = shift;
-  qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
 =item balance
 
 Returns the balance for this specific package, when using
@@ -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:
index e2d8987..d7ac7a3 100644 (file)
@@ -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
 
index d82d949..b74a231 100644 (file)
@@ -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<FS::cust_pkg>).
 
-=cut
-
-sub cust_pkg {
-  my $self = shift;
-  qsearchs('cust_pkg', { 'pkgnum' => $self->pkgnum } );
-}
-
 =item discount
 
 Returns the discount (see L<FS::discount>).
 
-=cut
-
-sub discount {
-  my $self = shift;
-  qsearchs('discount', { 'discountnum' => $self->discountnum } );
-}
-
 =item increment_months_used MONTHS
 
 Increments months_used by the given parameter
index 43a1530..c44bfa2 100644 (file)
@@ -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
 
index c29a2f9..d11d05e 100644 (file)
@@ -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<FS::reason>) associated with this cust_pkg_reason.
 
-=cut
-
-sub reason {
-  my $self = shift;
-  qsearchs( 'reason', { 'reasonnum' => $self->reasonnum } );
-}
-
 =item reasontext
 
 Returns the text of the reason (see L<FS::reason>) associated with this
index 0eefd74..d295842 100644 (file)
@@ -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<FS::cust_pkg> linked to this record.
 
 Return the L<FS::part_pkg_usage> linked to this record.
 
-=cut
-
-sub cust_pkg {
-  my $self = shift;
-  FS::cust_pkg->by_key($self->pkgnum);
-}
-
-sub part_pkg_usage {
-  my $self = shift;
-  FS::part_pkg_usage->by_key($self->pkgusagepart);
-}
-
 =back
 
 =head1 SEE ALSO
index 9582090..7bf41ee 100644 (file)
@@ -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<FS::cust_pkg>).
 
-=cut
-
-sub cust_pkg {
-  my $self = shift;
-  qsearchs( 'cust_pkg', { 'pkgnum' => $self->pkgnum } );
-}
-
 =item pkg_svc
 
 Returns the pkg_svc record for for this service, if applicable.
index 07fec90..43006c6 100644 (file)
@@ -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
 
index 5dfd156..88cf117 100644 (file)
@@ -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
index 5891368..c09da26 100644 (file)
@@ -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
index 045421c..45eab42 100644 (file)
@@ -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
index bbabb5b..b64ef51 100644 (file)
@@ -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;
 
index d004f23..1479565 100644 (file)
@@ -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<FS::did_order_item>) associated with this bulk DID order.
 
-=cut
-
-sub did_order_item {
-  my $self = shift;
-  qsearch( 'did_order_item', { 'ordernum' => $self->ordernum } );
-}
-
 =item cust_main
 
 Returns all cust_main (see L<FS::cust_main>), if any, associated with this
index e66d78c..43ad490 100644 (file)
@@ -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
index cd881ae..e180e4b 100644 (file)
@@ -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<FS::svc_domain>) for this record.
 
-=cut
-
-sub svc_domain {
-  my $self = shift;
-  qsearchs('svc_domain', { svcnum => $self->svcnum } );
-}
-
 =item zone
 
 Returns the canonical zone name.
index 2efe1f5..39e8c34 100644 (file)
@@ -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<FS::svc_dsl>) associated with this customer
+Returns the DSL (see L<FS::svc_dsl>) associated with this customer
 device.
 
-=cut
-
-sub svc_phone {
-  my $self = shift;
-  qsearchs( 'svc_dsl', { 'svcnum' => $self->svcnum } );
-}
-
 =back
 
 =head1 BUGS
index 69e3826..d3795c6 100644 (file)
@@ -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<FS::part_export>).
 
-=cut
-
-sub part_export {
-  my $self = shift;
-  qsearchs( 'part_export', { 'exportnum' => $self->exportnum } );
-}
-
 =item part_device
 
 Returns the FS::part_device object (see L<FS::part_device>).
 
-=cut
-
-sub part_device {
-  my $self = shift;
-  qsearchs( 'part_device', { 'svcpart' => $self->devicepart } );
-}
-
 =back
 
 =head1 BUGS
index 5282503..3e5b841 100644 (file)
@@ -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
index b08f8f7..5ef50b6 100644 (file)
@@ -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<FS::part_export>).
 
-=cut
-
-sub part_export {
-  my $self = shift;
-  qsearchs( 'part_export', { 'exportnum' => $self->exportnum } );
-}
-
 =item part_svc
 
 Returns the FS::part_svc object (see L<FS::part_svc>).
 
-=cut
-
-sub part_svc {
-  my $self = shift;
-  qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } );
-}
-
 =item svc_export_machine
 
 Returns all export hostname records (L<FS::svc_export_machine>) for this
index 791653b..a76de00 100644 (file)
@@ -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
 
index f19a3f6..615c314 100644 (file)
@@ -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<FS::hardware_class> associated with this device.
 
-=cut
-
-sub hardware_class {
-  my $self = shift;
-  return qsearchs('hardware_class', { 'classnum' => $self->classnum });
-}
-
 =item description
 
 Returns the model and revision number.
index 4747241..dacbc51 100644 (file)
@@ -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
 
index 477c934..eef8880 100644 (file)
@@ -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<FS::cust_svc>).
 
-=cut
-
-sub cust_svc {
-  my $self = shift;
-  return '' unless $self->svcnum;
-  qsearchs( 'cust_svc', { 'svcnum' => $self->svcnum } );
-}
-
 =item agent 
 
 Returns the associated agent for this event, if any, as an FS::agent object.
 
-=cut
-
-sub agent {
-  my $self = shift;
-  qsearchs('agent', { 'agentnum' => $self->agentnum } );
-}
-
 =back
 
 =head1 SUBROUTINES
index b2bfeaa..6b43c2f 100644 (file)
@@ -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<FS::cust_main>) for this invoice.
 
-=cut
-
-sub cust_main {
-  my $self = shift;
-  qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
-}
-
 =back
 
 =head1 BUGS
index 1294610..22ef820 100644 (file)
@@ -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
index 49688d8..5986bba 100644 (file)
@@ -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
index 4e1f4da..5885921 100644 (file)
@@ -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<FS::agent> object for this template.
 
 =cut
 
-sub agent {
-  qsearchs('agent', { 'agentnum' => $_[0]->agentnum });
-}
-
 sub _upgrade_data {
   my ($self, %opts) = @_;
 
index af61a85..6e465f0 100644 (file)
@@ -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;
index a740bb8..9354f4d 100644 (file)
@@ -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<FS::part_event_condition>)
 
-=cut
-
-sub part_event_condition {
-  my $self = shift;
-  qsearch( 'part_event_condition', { 'eventpart' => $self->eventpart } );
-}
-
 =item new_cust_event OBJECT, [ OPTION => VALUE ]
 
 Creates a new customer event (see L<FS::cust_event>) for the provided object.
@@ -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
index 28cb141..8b16248 100644 (file)
@@ -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
index 1598e03..86dd9e7 100644 (file)
@@ -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
index e759404..17bcf00 100644 (file)
@@ -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
 
index 9ce2e96..4755528 100644 (file)
@@ -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<FS::pkg_svc>) 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<FS::part_pkg_vendor>).
 
-=cut
-
-sub part_pkg_vendor {
-  my $self = shift;
-  qsearch('part_pkg_vendor', { 'pkgpart' => $self->pkgpart } );
-}
-
 =item vendor_pkg_ids
 
 Returns a list of vendor/external package ids by exportnum
@@ -1228,13 +1195,6 @@ sub vendor_pkg_ids {
 Returns all options as FS::part_pkg_option objects (see
 L<FS::part_pkg_option>).
 
-=cut
-
-sub part_pkg_option {
-  my $self = shift;
-  qsearch('part_pkg_option', { 'pkgpart' => $self->pkgpart } );
-}
-
 =item options 
 
 Returns a list of option names and values suitable for assigning to a hash.
@@ -1553,25 +1513,11 @@ sub part_pkg_taxrate {
 Returns the package to discount m2m records (see L<FS::part_pkg_discount>)
 for this package.
 
-=cut
-
-sub part_pkg_discount {
-  my $self = shift;
-  qsearch('part_pkg_discount', { 'pkgpart' => $self->pkgpart });
-}
-
 =item part_pkg_usage
 
 Returns the voice usage pools (see L<FS::part_pkg_usage>) defined for 
 this package.
 
-=cut
-
-sub part_pkg_usage {
-  my $self = shift;
-  qsearch('part_pkg_usage', { 'pkgpart' => $self->pkgpart });
-}
-
 =item _rebless
 
 Reblesses the object into the FS::part_pkg::PLAN class (if available), where
index 246abee..71f122c 100644 (file)
@@ -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
 
index 06a0fb9..73c7c8b 100644 (file)
@@ -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
index 7c00c26..bda73bd 100644 (file)
@@ -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
 
index 142622b..2858ba7 100644 (file)
@@ -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
index 99014d3..008a2a9 100644 (file)
@@ -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') };
index 9a99783..e7bcdcc 100644 (file)
@@ -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
 
index 6b91f75..bb37f1b 100644 (file)
@@ -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<FS::part_export> associated with this vendor/external package id.
 
-=cut
-sub part_export {
-    my $self = shift;
-    qsearchs( 'part_export', { 'exportnum' => $self->exportnum } );
-}
-
 =back
 
 =head1 SEE ALSO
index 992e1c5..e4a5823 100644 (file)
@@ -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
index a116819..27f0063 100644 (file)
@@ -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
index df04cc9..1dff9c6 100755 (executable)
@@ -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;
index ed31929..b5295be 100644 (file)
@@ -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
 
index 4e6d2e4..0011ec6 100755 (executable)
@@ -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
 
index 8c6c368..9ce6a83 100644 (file)
@@ -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<FS::agent> object for this batch.
 
-=cut
-
-sub agent {
-  qsearchs('agent', { 'agentnum' => $_[0]->agentnum });
-}
-
 =item cust_pay_batch
 
 Returns all L<FS::cust_pay_batch> objects for this batch.
 
-=cut
-
-sub cust_pay_batch {
-  qsearch('cust_pay_batch', { 'batchnum' => $_[0]->batchnum });
-}
-
 =item rebalance
 
 =cut
index 68d8418..95b7c40 100644 (file)
@@ -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
index 0576022..6f4bb9d 100644 (file)
@@ -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
 
index 6d49507..52bbdeb 100644 (file)
@@ -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
index ba765e0..d5f80a2 100644 (file)
@@ -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<FS::part_device>) associated with this
 customer device.
 
-=cut
-
-sub part_device {
-  my $self = shift;
-  qsearchs( 'part_device', { 'devicepart' => $self->devicepart } );
-}
-
 =item svc_phone
 
 Returns the phone number (see L<FS::svc_phone>) associated with this customer
 device.
 
-=cut
-
-sub svc_phone {
-  my $self = shift;
-  qsearchs( 'svc_phone', { 'svcnum' => $self->svcnum } );
-}
-
 =item export HOOK [ EXPORT_ARGS ]
 
 Runs the provided export hook (i.e. "device_insert") for this service.
index d2ef465..ded6b91 100644 (file)
@@ -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
index f79bb5e..4efffd9 100644 (file)
@@ -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<FS::part_pkg>).
 
-=cut
-
-sub part_pkg {
-  my $self = shift;
-  qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
-}
-
 =item part_svc
 
 Returns the FS::part_svc object (see L<FS::part_svc>).
 
-=cut
-
-sub part_svc {
-  my $self = shift;
-  qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } );
-}
-
 =back
 
 =head1 BUGS
index c93999c..a0fd7f9 100644 (file)
@@ -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<FS::agent>) for this prepaid card, if any.
 
-=cut
-
-sub agent {
-  my $self = shift;
-  qsearchs('agent', { 'agentnum' => $self->agentnum } );
-}
-
 =back
 
 =head1 SUBROUTINES
index a18c8ff..55b12f2 100644 (file)
@@ -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<FS::contact>) associated with this prospect.
 
-=cut
-
-sub contact {
-  my $self = shift;
-  qsearch( 'contact', { 'prospectnum' => $self->prospectnum } );
-}
-
 =item cust_location
 
 Returns the locations (see L<FS::cust_location>) associated with this prospect.
@@ -298,24 +288,10 @@ sub cust_location {
 
 Returns the qualifications (see L<FS::qual>) associated with this prospect.
 
-=cut
-
-sub qual {
-  my $self = shift;
-  qsearch( 'qual', { 'prospectnum' => $self->prospectnum } );
-}
-
 =item agent
 
 Returns the agent (see L<FS::agent>) for this customer.
 
-=cut
-
-sub agent {
-  my $self = shift;
-  qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
-}
-
 =item search HASHREF
 
 (Class method)
index 07878e9..c11b460 100644 (file)
@@ -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;
     '';
 }
 
index 8ebadd4..1b52ac4 100644 (file)
@@ -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
index 8e9a10d..09c0166 100644 (file)
@@ -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
 
index 99a22c5..cd3f787 100644 (file)
@@ -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
 
index 47f13e6..cf6652f 100644 (file)
@@ -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
index efff968..c9724d1 100644 (file)
@@ -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;
index 34e13a6..19930ac 100644 (file)
@@ -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
 
index cc03b4d..16d3f62 100644 (file)
@@ -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<FS::radius_group> object to which this attribute applies.
 
-=cut
-
-sub radius_group {
-  my $self = shift;
-  qsearchs('radius_group', { 'groupnum' => $self->groupnum });
-}
-
 =back
 
 =head1 CLASS METHODS
index 8085fe8..9c78796 100644 (file)
@@ -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<FS::radius_group>).
 
 =cut
 
-sub radius_group {
-  my $self = shift;
-  qsearchs('radius_group', { 'groupnum'  => $self->groupnum } );
-}
-
 sub _upgrade_data {  #class method
   my ($class, %opts) = @_;
 
index 49ac938..4052807 100644 (file)
@@ -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<FS::rate_detail>) for this rate.
 
-=cut
-
-sub rate_detail {
-  my $self = shift;
-  qsearch( 'rate_detail', { 'ratenum' => $self->ratenum } );
-}
-
-
 =back
 
 =head1 SUBROUTINES
index f3ee84c..66c5c97 100644 (file)
@@ -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<FS::rate>) associated with this call plan
 rate.
 
-=cut
-
-sub rate {
-  my $self = shift;
-  qsearchs('rate', { 'ratenum' => $self->ratenum } );
-}
-
 =item orig_region 
 
 Returns the origination region (see L<FS::rate_region>) associated with this
index 93349f0..37c61cb 100644 (file)
@@ -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<FS::rate_region>) for this prefix.
 
-=cut
-
-sub rate_region {
-  my $self = shift;
-  qsearchs('rate_region', { 'regionnum' => $self->regionnum } );
-}
-
 =back
 
 =head1 CLASS METHODS
index d42fdb4..fec540e 100644 (file)
@@ -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
index 6a9986b..8d4e8b1 100644 (file)
@@ -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<FS::rate_time> comprising this interval.
 
-=cut
-
-sub rate_time {
-  my $self = shift;
-  FS::rate_time->by_key($self->ratetimenum);
-}
-
 =item description
 
 Returns two strings containing stime and etime, formatted 
index f48ccf0..fd944d2 100644 (file)
@@ -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
index 837b755..f438f67 100644 (file)
@@ -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<FS::part_pkg>)
 
-=cut
-
-sub part_pkg {
-  my $self = shift;
-  qsearchs('part_pkg', { 'pkgpart' => $self->pkgpart } );
-}
-
 =back
 
 =head1 BUGS
index cf5dc49..70a925a 100644 (file)
@@ -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
 
index 937dc1f..21011e7 100755 (executable)
@@ -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<provides connectivity to the router>, not any service 
 connected I<through> the router.
 
-=cut
-
-sub cust_svc {
-  my $svcnum = shift->svcnum or return undef;
-  FS::cust_svc->by_key($svcnum);
-}
-
 =back
 
 =head1 SEE ALSO
index 90867a8..b140035 100644 (file)
@@ -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;
index 659255e..4a2d617 100644 (file)
@@ -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<FS::cust_svc>).
 
-=cut
-
-sub cust_svc {
-  my $self = shift;
-  qsearchs('cust_svc', { 'svcnum' => $self->svcnum } );
-}
-
 =item suspend
 
 Runs export_suspend callbacks.
index 3da07c1..2555b9e 100644 (file)
@@ -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 
index 26d6e5b..3ca40a3 100644 (file)
@@ -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
 
index 4a355c7..fafd9e8 100644 (file)
@@ -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
index 5d28113..3a1dc5a 100644 (file)
@@ -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
index 8c47f88..5704760 100644 (file)
@@ -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;
index 7ca20cc..e22af6a 100644 (file)
@@ -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
index b28cc9e..dc9ac59 100644 (file)
@@ -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<FS::hardware_type> object associated with this installation.
 
-=cut
-
-sub hardware_type {
-  my $self = shift;
-  return qsearchs('hardware_type', { 'typenum' => $self->typenum });
-}
-
 =item status_label
 
 Returns the 'label' field of the L<FS::hardware_status> object associated 
index 8cab398..e0ff7fb 100644 (file)
@@ -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
index eb06dc1..36d57a5 100644 (file)
@@ -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
index 19f2700..ed079f8 100644 (file)
@@ -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<FS::domain_record>).
 
-=cut
-
-sub domain_record {
-  my $self = shift;
-  qsearchs('domain_record', { 'recnum' => $self->recnum } );
-}
-
 =item svc_acct
 
 Returns the FS::svc_acct record for this web virtual host's owner (see
index 095939f..27df9e7 100644 (file)
@@ -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;
index 5497c72..f371ec9 100644 (file)
@@ -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
 
index 70642fb..7e6819a 100644 (file)
@@ -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<FS::tower>).
 
-=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
index 6503755..d06050e 100644 (file)
@@ -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
index c8fcdd7..5ea91fb 100644 (file)
@@ -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
index ef79c00..2e5e150 100644 (file)
@@ -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