4 use vars qw( $opt_p $opt_t );
6 use FS::UID qw(adminsuidsetup);
7 use FS::Record qw(qsearchs);
13 my $user = shift or &usage;
16 $FS::cust_main::skip_fuzzyfiles = 1;
17 $FS::cust_main::skip_fuzzyfiles = 1;
18 $FS::cust_main::import = 1;
19 $FS::cust_main::import = 1;
23 unless ( /^\s*(\d+)\s*$/ ) {
24 warn "unparsable line: $_";
29 my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
30 unless ( $cust_main ) {
31 warn "unknown custnum $custnum\n";
35 my %cust_tag = ( custnum=>$custnum, tagnum=>$opt_t );
36 if ( $opt_t && ! qsearchs('cust_tag', \%cust_tag) ) {
37 my $cust_tag = new FS::cust_tag \%cust_tag;
38 my $error = $cust_tag->insert;
39 die "$error\n" if $error;
43 $cust_main->payby($opt_p);
45 my $error = $cust_main->replace;
46 die "$error\n" if $error;
52 die "usage: cust_main-bulk_change [ -p NEW_PAYBY ] [ -t tagnum ] employee_username <custnums.txt\n";
61 cust_main-bulk_change [ -p NEW_PAYBY ] [ -t tagnum ] username <custnums.txt
65 Command-line tool to make bulk changes to a group of customers.
67 -p: new payby, for example, I<CARD> or I<DCRD>
69 -t: tagnum to add if not present
71 user: Employee username
77 L<FS::payinfo_Mixin>, L<FS::cust_main>, L<FS::payby>