X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Faccess_right.pm;h=ef8cc6cd800400e52e5a3489e103498a7b7e48c9;hb=f9a181e4c2e505df84de16190ee3b75011326f3f;hp=bc6dd5d841aa6f44f3ffb04f4871e12847efd7d5;hpb=428e8460af396a7fe6d7ae7d3d778fe4ad313118;p=freeside.git diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm index bc6dd5d84..ef8cc6cd8 100644 --- a/FS/FS/access_right.pm +++ b/FS/FS/access_right.pm @@ -145,6 +145,41 @@ sub _upgrade_data { # class method if $error; } + my %migrate = ( + 'Post payment' => [ 'Post check payment', 'Post cash payment' ], + 'Process payment' => [ 'Process credit card payment', 'Process Echeck payment' ], + 'Post refund' => [ 'Post check refund', 'Post cash refund' ], + 'Refund payment' => [ 'Refund credit card payment', 'Refund Echeck payment' ], + ); + + foreach my $oldright (keys %migrate) { + my @old = qsearch('access_right', { 'righttype'=>'FS::access_group', + 'rightname'=>$oldright, + } + ); + + foreach my $old ( @old ) { + + foreach my $newright ( @{ $migrate{$oldright} } ) { + my %hash = ( + 'righttype' => 'FS::access_group', + 'rightobjnum' => $old->rightobjnum, + 'rightname' => $newright, + ); + next if qsearchs('access_right', \%hash); + my $access_right = new FS::access_right \%hash; + my $error = $access_right->insert; + die $error if $error; + } + + #after the WEST stuff is sorted, etc. + #my $error = $old->delete; + #die $error if $error; + + } + + } + ''; }