[freeside-commits] freeside/FS/FS Schema.pm, 1.238, 1.239 cust_pay_void.pm, 1.11, 1.12
Ivan,,,
ivan at wavetail.420.am
Thu Oct 21 23:14:26 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv3866/FS/FS
Modified Files:
Schema.pm cust_pay_void.pm
Log Message:
display both original usernum and void usernum vfor voided payments, RT#10280
Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -w -d -r1.238 -r1.239
--- Schema.pm 14 Oct 2010 01:14:27 -0000 1.238
+++ Schema.pm 22 Oct 2010 06:14:24 -0000 1.239
@@ -1194,10 +1194,11 @@
'reason', 'varchar', 'NULL', $char_d, '', '',
'otaker', 'varchar', 'NULL', 32, '', '',
'usernum', 'int', 'NULL', '', '', '',
+ 'void_usernum', 'int', 'NULL', '', '', '',
],
'primary_key' => 'paynum',
'unique' => [],
- 'index' => [ [ 'custnum' ], [ 'usernum' ], ],
+ 'index' => [ [ 'custnum' ], [ 'usernum' ], [ 'void_usernum' ] ],
},
'cust_bill_pay' => {
@@ -2969,6 +2970,17 @@
'index' => [ ['agentnum'], ]
},
+ 'svc_cert' => {
+ 'columns' => [
+ 'svcnum', 'int', '', '', '', '',
+ 'recnum', 'int', '', '', '', '',
+ 'something', 'text', '', '', '', '',
+ #XXX more fields
+ ],
+ 'primary_key' => 'svcnum',
+ 'unique' => [],
+ 'index' => [], #recnum
+ },
# name type nullability length default local
Index: cust_pay_void.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay_void.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -d -r1.11 -r1.12
--- cust_pay_void.pm 20 Oct 2010 02:07:01 -0000 1.11
+++ cust_pay_void.pm 22 Oct 2010 06:14:24 -0000 1.12
@@ -1,12 +1,14 @@
package FS::cust_pay_void;
use strict;
-use base qw( FS::otaker_Mixin FS::payinfo_Mixin FS::Record );
+use base qw( FS::otaker_Mixin FS::payinfo_Mixin FS::cust_main_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 );
+use FS::Record qw(qsearch qsearchs dbh fields);
use FS::CurrentUser;
+use FS::access_user;
use FS::cust_pay;
#use FS::cust_bill;
#use FS::cust_bill_pay;
@@ -219,7 +221,8 @@
return $error if $error;
}
- $self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
+ $self->void_usernum($FS::CurrentUser::CurrentUser->usernum)
+ unless $self->void_usernum;
$self->SUPER::check;
}
@@ -235,11 +238,41 @@
qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
}
+=item void_access_user
+
+Returns the voiding employee object (see L<FS::access_user>).
+
+=cut
+
+sub void_access_user {
+ my $self = shift;
+ qsearchs('access_user', { 'usernum' => $self->void_usernum } );
+}
+
# Used by FS::Upgrade to migrate to a new database.
sub _upgrade_data { # class method
my ($class, %opts) = @_;
+
+ my $sql = "SELECT usernum FROM access_user WHERE username = ( SELECT history_user FROM h_cust_pay_void WHERE paynum = ? AND history_action = 'insert' ) ";
+ my $sth = dbh->prepare($sql) or die dbh->errstr;
+
+ foreach my $cust_pay_void (qsearch('cust_pay_void', {'void_usernum' => ''})) {
+ $sth->execute($cust_pay_void->paynum) or die $sth->errstr;
+ my $usernum = $sth->fetchrow_arrayref->[0] or next;
+ if ( $usernum ) {
+ $cust_pay_void->void_usernum($usernum);
+ my $error = $cust_pay_void->replace;
+ die $error if $error;
+ } else {
+ warn "cust_pay_void upgrade: can't find access_user record for ". $cust_pay_void->paynum. "\n";
+ }
+ }
+
local($otaker_upgrade_kludge) = 1;
$class->_upgrade_otaker(%opts);
+
+ #XXX look for the h_cust_pay delete records and when that's a different
+ # usernum, set usernum
}
=back
More information about the freeside-commits
mailing list