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;
21 unless ( /^\s*(\d+)\s*$/ ) {
22 warn "unparsable line: $_";
27 my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
28 unless ( $cust_main ) {
29 warn "unknown custnum $custnum\n";
33 my %cust_tag = ( custnum=>$custnum, tagnum=>$opt_t );
34 if ( $opt_t && ! qsearchs('cust_tag', \%cust_tag) ) {
35 my $cust_tag = new FS::cust_tag \%cust_tag;
36 my $error = $cust_tag->insert;
37 die "$error\n" if $error;
41 $cust_main->payby($opt_p);
43 my $error = $cust_main->replace;
44 die "$error\n" if $error;
50 die "usage: cust_main-bulk_change [ -p NEW_PAYBY ] [ -t tagnum ] employee_username <custnums.txt\n";
59 cust_main-bulk_change [ -p NEW_PAYBY ] [ -t tagnum ] username <custnums.txt
63 Command-line tool to make bulk changes to a group of customers.
65 -p: new payby, for example, I<CARD> or I<DCRD>
67 -t: tagnum to add if not present
69 user: Employee username
75 L<FS::payinfo_Mixin>, L<FS::cust_main>, L<FS::payby>