summaryrefslogtreecommitdiff
path: root/bin/merge-referrals
diff options
context:
space:
mode:
Diffstat (limited to 'bin/merge-referrals')
-rw-r--r--bin/merge-referrals20
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/merge-referrals b/bin/merge-referrals
new file mode 100644
index 000000000..ba07a81c6
--- /dev/null
+++ b/bin/merge-referrals
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use FS::UID qw(adminsuidsetup);
+use FS::Record qw(qsearchs);
+use FS::cust_main;
+
+my $user = shift or die "usage: merge-customers username custnum\n";
+adminsuidsetup $user;
+
+my $custnum = shift or die "usage: merge-customers username custnum\n";
+
+foreach my $cust_main (
+ qsearch('cust_main', { 'referral_custnum' => $custnum })
+) {
+ my $error = $cust_main->merge($custnum);
+ die $error if $error;
+}
+
+1;