summaryrefslogtreecommitdiff
path: root/bin/merge-referrals
blob: e39f053e817596eeb62530bb6208b27f22817251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl

use strict;
use FS::UID qw(adminsuidsetup);
use FS::Record qw(qsearch);
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;