[freeside-commits] freeside/FS/FS cust_credit.pm,1.44,1.45
Ivan,,,
ivan at wavetail.420.am
Sat Sep 18 00:53:13 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv22720
Modified Files:
cust_credit.pm
Log Message:
YA otaker upgrade kludge for old datasets: empty cust_credit.creasonnum
Index: cust_credit.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_credit.pm,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -w -d -r1.44 -r1.45
--- cust_credit.pm 24 Aug 2010 02:27:46 -0000 1.44
+++ cust_credit.pm 18 Sep 2010 07:53:11 -0000 1.45
@@ -2,7 +2,9 @@
use strict;
use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Record );
-use vars qw( $conf $unsuspendauto $me $DEBUG $otaker_upgrade_kludge );
+use vars qw( $conf $unsuspendauto $me $DEBUG
+ $otaker_upgrade_kludge $ignore_empty_reasonnum
+ );
use Date::Format;
use FS::UID qw( dbh getotaker );
use FS::Misc qw(send_email);
@@ -21,6 +23,7 @@
$DEBUG = 0;
$otaker_upgrade_kludge = 0;
+$ignore_empty_reasonnum = 0;
#ask FS::UID to run this stuff for us later
$FS::UID::callback{'FS::cust_credit'} = sub {
@@ -300,7 +303,6 @@
|| $self->ut_money('amount')
|| $self->ut_alphan('otaker')
|| $self->ut_textn('reason')
- || $self->ut_foreign_key('reasonnum', 'reason', 'reasonnum')
|| $self->ut_textn('addlinfo')
|| $self->ut_enum('closed', [ '', 'Y' ])
|| $self->ut_foreign_keyn('pkgnum', 'cust_pkg', 'pkgnum')
@@ -308,6 +310,10 @@
;
return $error if $error;
+ my $method = $ignore_empty_reasonnum ? 'ut_foreign_keyn' : 'ut_foreign_key';
+ $error = $self->$method('reasonnum', 'reason', 'reasonnum');
+ return $error if $error;
+
return "amount must be > 0 " if $self->amount <= 0;
return "amount must be greater or equal to amount applied"
@@ -552,6 +558,7 @@
}
local($otaker_upgrade_kludge) = 1;
+ local($ignore_empty_reasonnum) = 1;
$class->_upgrade_otaker(%opts);
}
More information about the freeside-commits
mailing list