X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay_void.pm;h=e18a4f6865d80c2ecf5fdc6c1aed42f762666e1b;hb=1d63fa587dad1f8dbd54ef576a10e5a209a6fa91;hp=946d69fe1803ae109440b59d661a81e99e0d5931;hpb=0f37b9c32e41fd94a0d5ea2f895a737cf674f310;p=freeside.git diff --git a/FS/FS/cust_pay_void.pm b/FS/FS/cust_pay_void.pm index 946d69fe1..e18a4f686 100644 --- a/FS/FS/cust_pay_void.pm +++ b/FS/FS/cust_pay_void.pm @@ -1,6 +1,8 @@ package FS::cust_pay_void; + use strict; -use vars qw( @ISA ); +use base qw( FS::otaker_Mixin FS::payinfo_Mixin FS::Record ); +use vars qw( @encrypted_fields $otaker_upgrade_kludge ); use Business::CreditCard; use FS::UID qw(getotaker); use FS::Record qw(qsearchs dbh fields); # qsearch ); @@ -9,8 +11,10 @@ use FS::cust_pay; #use FS::cust_bill_pay; #use FS::cust_pay_refund; #use FS::cust_main; +use FS::cust_pkg; -@ISA = qw( FS::Record ); +@encrypted_fields = ('payinfo'); +$otaker_upgrade_kludge = 0; =head1 NAME @@ -38,24 +42,48 @@ are currently supported: =over 4 -=item paynum - primary key (assigned automatically for new payments) +=item paynum + +primary key (assigned automatically for new payments) + +=item custnum + +customer (see L) + +=item paid -=item custnum - customer (see L) +Amount of this payment -=item paid - Amount of this payment +=item _date -=item _date - specified as a UNIX timestamp; see L. Also see +specified as a UNIX timestamp; see L. Also see L and L for conversion functions. -=item payby - `CARD' (credit cards), `CHEK' (electronic check/ACH), +=item otaker + +order taker (see L) + +=item payby + +`CARD' (credit cards), `CHEK' (electronic check/ACH), `LECB' (phone bill billing), `BILL' (billing), `CASH' (cash), `WEST' (Western Union), `MCRD' (Manual credit card), or `COMP' (free) -=item payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively +=item payinfo + +card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively -=item paybatch - text field for tracking card processing +=item paybatch -=item closed - books closed flag, empty or `Y' +text field for tracking card processing + +=item closed + +books closed flag, empty or `Y' + +=item pkgnum + +Desired pkgnum when using experimental package balances. =item void_date @@ -133,7 +161,8 @@ Currently unimplemented. =cut sub replace { - return "Can't modify voided payments!"; + return "Can't modify voided payments!" unless $otaker_upgrade_kludge; + shift->SUPER::replace(@_); } =item check @@ -154,6 +183,7 @@ sub check { || $self->ut_number('_date') || $self->ut_textn('paybatch') || $self->ut_enum('closed', [ '', 'Y' ]) + || $self->ut_foreign_keyn('pkgnum', 'cust_pkg', 'pkgnum') || $self->ut_numbern('void_date') || $self->ut_textn('reason') ; @@ -191,7 +221,7 @@ sub check { return $error if $error; } - $self->otaker(getotaker); + $self->otaker(getotaker) unless $self->otaker; $self->SUPER::check; } @@ -207,17 +237,11 @@ sub cust_main { qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); } -=item payinfo_masked - -Returns a "masked" payinfo field with all but the last four characters replaced -by 'x'es. Useful for displaying credit cards. - -=cut - -sub payinfo_masked { - my $self = shift; - my $payinfo = $self->payinfo; - 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); +# Used by FS::Upgrade to migrate to a new database. +sub _upgrade_data { # class method + my ($class, %opts) = @_; + local($otaker_upgrade_kludge) = 1; + $class->_upgrade_otaker(%opts); } =back