X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;h=0ead2265860513b0b26883a3722b226d7a17a333;hb=f0547b5c6821995268ae3a68dbc80eef08885b77;hp=30333e0c4e27d593355c847374db0c5a78eb44da;hpb=10fdcf4c76e4dd14f7fb738665e3fb401af3c28a;p=freeside.git diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 30333e0c4..0ead22658 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -403,6 +403,7 @@ sub check { || $self->ut_money('paid') || $self->ut_numbern('_date') || $self->ut_textn('paybatch') + || $self->ut_textn('payunique') || $self->ut_enum('closed', [ '', 'Y' ]) || $self->payinfo_check() ; @@ -416,6 +417,13 @@ sub check { $self->_date(time) unless $self->_date; + # UNIQUE index should catch this too, without race conditions, but this + # should give a better error message the other 99.9% of the time... + if ( length($self->payunique) + && qsearchs('cust_pay', { 'payunique' => $self->payunique } ) ) { + return "duplicate transaction"; #well, it *could* be a better error message + } + $self->SUPER::check; }