X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_pay_pending.pm;h=d1083411c0031cfbcaf928beb96f647ea1c0c206;hp=3a8322e060e3d1adfe60a77baf6b66666238ca4b;hb=a36e0f8a0f69349dafaa16d1d2d57dfb6e5dbc85;hpb=cf54023e010df76e0c39ac70902877d7c4c94c6e diff --git a/FS/FS/cust_pay_pending.pm b/FS/FS/cust_pay_pending.pm index 3a8322e06..d1083411c 100644 --- a/FS/FS/cust_pay_pending.pm +++ b/FS/FS/cust_pay_pending.pm @@ -215,7 +215,7 @@ sub check { my $error = $self->ut_numbern('paypendingnum') - || $self->ut_foreign_key('custnum', 'cust_main', 'custnum') + || $self->ut_foreign_keyn('custnum', 'cust_main', 'custnum') || $self->ut_money('paid') || $self->ut_numbern('_date') || $self->ut_textn('payunique') @@ -235,6 +235,10 @@ sub check { ; return $error if $error; + if (!$self->custnum and !$self->get('custnum_pending')) { + return 'custnum required'; + } + $self->_date(time) unless $self->_date; # UNIQUE index should catch this too, without race conditions, but this