diff options
author | khoff <khoff> | 2005-03-30 20:55:16 +0000 |
---|---|---|
committer | khoff <khoff> | 2005-03-30 20:55:16 +0000 |
commit | 36ebe36593d21235be392fa8c2732c8bd17cad96 (patch) | |
tree | 63ce873bfad3ae8055939cf49387d93081055783 /bin | |
parent | 2a5619a7ea675206db2ede6d9bf767c06e4605ea (diff) |
Test script to add pre-history table history records.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/add-history-records.pl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/bin/add-history-records.pl b/bin/add-history-records.pl new file mode 100755 index 000000000..16f91a18f --- /dev/null +++ b/bin/add-history-records.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl + + +use strict; +use FS::UID qw(adminsuidsetup); +use FS::Record qw(qsearchs qsearch); +use FS::svc_domain; +use FS::h_svc_domain; +use FS::domain_record; +use FS::h_domain_record; + +use Data::Dumper; + +adminsuidsetup(shift); + + +my $svcnum = shift; + +my $svc_domain = qsearchs('svc_domain', { svcnum => $svcnum }) or die "no svcnum '$svcnum'"; + +my $h_svc_domain = qsearchs( + 'h_svc_domain', + { 'svcnum' => $svc_domain->svcnum }, + FS::h_svc_domain->sql_h_searchs(time), +); + +unless ($h_svc_domain) { + print $svc_domain->_h_statement('insert', 1) . "\n"; +} + +foreach my $rec ($svc_domain->domain_record) { + my $h_rec = qsearchs( + 'h_domain_record', + { 'svcnum' => $svc_domain->svcnum }, + FS::h_domain_record->sql_h_searchs(time), + ); + + #print Dumper($h_rec); + + unless ($h_rec) { + print $rec->_h_statement('insert', 1) . "\n"; + } + +} + |