3 use FS::UID qw( adminsuidsetup );
4 use FS::Record qw( qsearch qsearchs );
7 $FS::Record::nowarn_classload = 1;
8 $FS::Record::nowarn_classload = 1;
12 my $begin = 1231876106;
14 my @old = qsearch('h_cust_main_county', {
15 'history_action' => 'replace_old',
16 'history_date' => { op=>'>=', value=>$begin, },
19 foreach my $old (@old) {
21 my $new = qsearchs('h_cust_main_county', {
22 'history_action' => 'replace_new',
23 'history_date' => $old->history_date,
27 warn "huh? no corresponding new record found?";
31 my $old_taxname = $old->taxname;
32 my $new_taxname = $new->taxname;
34 my @cust_bill_pkg = qsearch('cust_bill_pkg', {
36 'itemdesc' => $old->taxname,
39 next unless @cust_bill_pkg;
41 warn 'fixing '. scalar(@cust_bill_pkg).
42 " dangling line items for rename $old_taxname -> $new_taxname\n";
44 foreach my $cust_bill_pkg ( @cust_bill_pkg ) {
46 $cust_bill_pkg->itemdesc( $new->taxname );
47 my $error = $cust_bill_pkg->replace;