diff options
author | ivan <ivan> | 2011-06-20 23:50:52 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-06-20 23:50:52 +0000 |
commit | 44ce5ab2e8edd012154d3bb7e5711341e8c6cf35 (patch) | |
tree | b5d0939e04c7ff933acce6a5e950531cd9ed874f | |
parent | 1651dd5ba4114128aa0b0718c944395cdc84f274 (diff) |
some debugging for prepaid card generation, and retry more, RT#13329
-rw-r--r-- | FS/FS/prepay_credit.pm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/FS/FS/prepay_credit.pm b/FS/FS/prepay_credit.pm index e5773aebd..c93999c6d 100644 --- a/FS/FS/prepay_credit.pm +++ b/FS/FS/prepay_credit.pm @@ -1,12 +1,15 @@ package FS::prepay_credit; use strict; -use vars qw( @ISA ); +use vars qw( @ISA $DEBUG $me ); use FS::Record qw(qsearchs dbh); use FS::agent; @ISA = qw(FS::Record); +$DEBUG = 0; +$me = '[FS::prepay_credit]'; + =head1 NAME FS::prepay_credit - Object methods for prepay_credit records @@ -170,7 +173,16 @@ sub generate { my $identifier = join('', map($codeset[int(rand $#codeset)], (1..$length) ) ); - redo if qsearchs('prepay_credit',{identifier=>$identifier}) && $condup++<23; + if ( qsearchs('prepay_credit',{identifier=>$identifier}) ) { + if ( $condup++ < 54 ) { + warn "$me generate: duplicate identifier $identifier; retrying\n" + if $DEBUG; + redo; + } else { + warn "$me generate: giving up after 54 tries" + if $DEBUG; + } + } $condup = 0; my $prepay_credit = new FS::prepay_credit { |