From 4f8a0bb6d0c789c7e156a446dc61dbe27938a372 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 2 Sep 2001 05:38:13 +0000 Subject: migration. ugh. --- bin/fs-migrate-payref | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 bin/fs-migrate-payref (limited to 'bin/fs-migrate-payref') diff --git a/bin/fs-migrate-payref b/bin/fs-migrate-payref new file mode 100755 index 000000000..f1513112b --- /dev/null +++ b/bin/fs-migrate-payref @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use strict; +use FS::UID qw(adminsuidsetup); +use FS::Record qw(qsearch); +use FS::cust_pay; +use FS::cust_refund; + +my $user = shift or die &usage; +my $dbh = adminsuidsetup $user; + +#local $FS::UID::AutoCommit = 0; #quelle hack, in this case +# $FS::UID::AutoCommit = 0; #quelle hack, in this case + +# apply payments to invoices + +foreach my $cust_pay ( qsearch('cust_pay', {} ) ) { + my $error = $cust_pay->upgrade_replace; + warn $error if $error; +} + +# apply refunds to credits + +foreach my $cust_refund ( qsearch('cust_refund') ) { + my $error = $cust_refund->upgrade_replace; + warn $error if $error; +} + +# ? apply credits to invoices + -- cgit v1.2.1