From 36ebe36593d21235be392fa8c2732c8bd17cad96 Mon Sep 17 00:00:00 2001 From: khoff Date: Wed, 30 Mar 2005 20:55:16 +0000 Subject: [PATCH] Test script to add pre-history table history records. --- bin/add-history-records.pl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 bin/add-history-records.pl 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"; + } + +} + -- 2.11.0