X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay_void.pm;h=e18a4f6865d80c2ecf5fdc6c1aed42f762666e1b;hb=7a8c7b6f64ac14d555d866f93300e64c47b74a98;hp=9a0e5829352662663e78c0cf3cc1a997d73f6ade;hpb=dcdf657e77ec7b46dc69e19a849a9c133123db7c;p=freeside.git diff --git a/FS/FS/cust_pay_void.pm b/FS/FS/cust_pay_void.pm index 9a0e58293..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 @encrypted_fields ); +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,10 +11,10 @@ use FS::cust_pay; #use FS::cust_bill_pay; #use FS::cust_pay_refund; #use FS::cust_main; - -@ISA = qw( FS::Record FS::payinfo_Mixin ); +use FS::cust_pkg; @encrypted_fields = ('payinfo'); +$otaker_upgrade_kludge = 0; =head1 NAME @@ -40,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 custnum - customer (see L) +=item paid -=item paid - Amount of this payment +Amount of this payment -=item _date - specified as a UNIX timestamp; see L. Also see +=item _date + +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 @@ -135,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 @@ -156,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') ; @@ -193,7 +221,7 @@ sub check { return $error if $error; } - $self->otaker(getotaker); + $self->otaker(getotaker) unless $self->otaker; $self->SUPER::check; } @@ -209,18 +237,11 @@ sub cust_main { qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); } -=item payinfo_masked - -< DEPRICATED > Use $self->paymask - -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; - return $self->paymask; +# 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