From 32072dbf59a054529f5304574c0f56f9567d14d0 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sat, 28 Dec 2013 16:11:46 -0800 Subject: autoload methods returning foreign records, RT#13971 --- FS/FS/cust_credit_refund.pm | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'FS/FS/cust_credit_refund.pm') diff --git a/FS/FS/cust_credit_refund.pm b/FS/FS/cust_credit_refund.pm index 9fc03f2..a0aeca7 100644 --- a/FS/FS/cust_credit_refund.pm +++ b/FS/FS/cust_credit_refund.pm @@ -1,13 +1,7 @@ package FS::cust_credit_refund; +use base qw( FS::cust_main_Mixin FS::Record ); use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearch qsearchs dbh ); -use FS::cust_main_Mixin; -use FS::cust_credit; -use FS::cust_refund; - -@ISA = qw( FS::cust_main_Mixin FS::Record ); =head1 NAME @@ -126,12 +120,10 @@ sub check { return "amount must be > 0" if $self->amount <= 0; return "unknown cust_credit.crednum: ". $self->crednum - unless my $cust_credit = - qsearchs( 'cust_credit', { 'crednum' => $self->crednum } ); + unless my $cust_credit = $self->cust_credit; return "Unknown refund" - unless my $cust_refund = - qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } ); + unless my $cust_refund = $self->cust_refund; $self->_date(time) unless $self->_date; @@ -148,24 +140,10 @@ sub check { Returns the refund (see L) -=cut - -sub cust_refund { - my $self = shift; - qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } ); -} - =item cust_credit Returns the credit (see L) -=cut - -sub cust_credit { - my $self = shift; - qsearchs( 'cust_credit', { 'crednum' => $self->crednum } ); -} - =back =head1 BUGS -- cgit v1.1