From c82d349f864e6bd9f96fd1156903bc1f7193a203 Mon Sep 17 00:00:00 2001 From: cvs2git Date: Mon, 27 Dec 2010 00:04:45 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'TORRUS_1_0_9'. --- bin/19add | 20 - bin/19commit | 26 - bin/19diff | 12 - bin/21add | 20 - bin/21commit | 26 - bin/21diff | 12 - bin/add-history-records.pl | 139 ----- bin/all-postal-no-email | 22 - bin/apache.export | 94 --- bin/artera.import | 75 --- bin/backup-dvd | 45 -- bin/bill-as-nextmonth | 5 - bin/bill-as-nextmonth-BILL | 5 - bin/bill-as-nextyear | 5 - bin/bill-as-nextyear-BILL | 5 - bin/bill-for-nextmonth | 5 - bin/bill-for-nextyear | 5 - bin/bill-nextmonth | 5 - bin/bill-nextyear | 5 - bin/bind.export | 195 ------ bin/bind.import | 235 ------- bin/breakdown-bill-applications | 25 - bin/bsdshell.export | 114 ---- bin/build_exten.php | 790 ------------------------ bin/cch_tax_tool | 59 -- bin/cdr-mysql.import | 88 --- bin/cdr-netsapiens.import | 237 -------- bin/cdr-transnexus.import | 143 ----- bin/cdr.http_and_import | 108 ---- bin/cdr.import | 28 - bin/cdr_calltype.import | 41 -- bin/cdr_upstream_rate.import | 142 ----- bin/confdiff | 27 - bin/countdeclines | 22 - bin/create-fetchmailrc | 47 -- bin/cust_main-find_bogus_geocode | 36 -- bin/cust_main_special.pm | 608 ------------------- bin/cust_pay_histogram | 115 ---- bin/customer-faker | 124 ---- bin/cvs2cl | 2 - bin/del-old-history | 30 - bin/drop_slony.slonik | 9 - bin/expand-country | 29 - bin/explain-ar-total.sql | 976 ----------------------------- bin/explain-bill-query | 34 -- bin/fetch_and_expand_taxes | 55 -- bin/find-overapplied | 27 - bin/fix-sequences | 69 --- bin/follow-tax-rename | 52 -- bin/freeside-backup | 42 -- bin/freeside-create-initial-data | 31 - bin/freeside-init | 60 -- bin/freeside-migrate-events | 266 -------- bin/freeside-session-kill | 103 ---- bin/freeside-upgrade-unicode | 72 --- bin/freeside.import | 146 ----- bin/fs-migrate-cust_tax_exempt | 323 ---------- bin/fs-migrate-part_svc | 41 -- bin/fs-migrate-payref | 31 - bin/fs-migrate-svc_acct_sm | 227 ------- bin/fs-radius-add-check | 68 --- bin/fs-radius-add-reply | 69 --- bin/generate-prepay | 35 -- bin/generate-raddb | 53 -- bin/generate-table-module | 104 ---- bin/generate-tests | 21 - bin/h_cust_main-wipe_paycvv | 30 - bin/import-county-tax-rates | 30 - bin/import-optigold.pl | 1077 --------------------------------- bin/import-tax-rates | 56 -- bin/ispman.ldap.import | 114 ---- bin/japan.pl | 32 - bin/make-pkg-fruit | 172 ------ bin/mapsecrets2access_user | 87 --- bin/masonize | 80 --- bin/merge-referrals | 20 - bin/merge-user | 71 --- bin/monitor | 127 ---- bin/move-customers | 678 --------------------- bin/move-unlinked | 99 --- bin/opensrs_domain_pkgs | 142 ----- bin/passwd.import | 121 ---- bin/payment-faker | 54 -- bin/pg-readonly | 24 - bin/pg-sizer | 36 -- bin/pg-version | 13 - bin/ping | 58 -- bin/pod2x | 145 ----- bin/postfix.export | 122 ---- bin/postfix_courierimap.import | 137 ----- bin/print-directory_assist | 12 - bin/print-schema | 7 - bin/rate-us.import | 109 ---- bin/rate.delete | 3 - bin/rate.import | 95 --- bin/reassemble_taxes | 35 -- bin/rebill | 132 ---- bin/reset-cust_credit-otaker | 88 --- bin/rollback | 38 -- bin/rotate-cdrs | 38 -- bin/rt-drop-tables | 29 - bin/rt-trim-whitespace | 38 -- bin/rt-update-customfield-dates | 73 --- bin/rt-update-links | 36 -- bin/select-cust-desync_bill_dates.sql | 9 - bin/sendmail.import | 178 ------ bin/sequences.reset | 32 - bin/shadow.reimport | 125 ---- bin/slony-setup | 109 ---- bin/sqlradius-norealm.reimport | 113 ---- bin/sqlradius.import | 152 ----- bin/sqlradius.reimport | 160 ----- bin/strip-eps | 20 - bin/svc_acct-recalculate_usage | 110 ---- bin/svc_acct.import | 237 -------- bin/svc_acct_pop.import | 59 -- bin/svc_broadband.renumber | 84 --- bin/svc_domain.erase | 15 - bin/sysvshell.export | 112 ---- bin/tax_rate_location.import | 48 -- bin/test_scrub | 60 -- bin/test_scrub_sql | 58 -- bin/tron-scan | 24 - bin/wipe-agent | 39 -- bin/wipe-customers | 30 - bin/xmlrpc-agent_new_customer.pl | 80 --- bin/xmlrpc-customer_status.pl | 23 - bin/xmlrpc-order_pkg.pl | 31 - 128 files changed, 12856 deletions(-) delete mode 100755 bin/19add delete mode 100755 bin/19commit delete mode 100755 bin/19diff delete mode 100755 bin/21add delete mode 100755 bin/21commit delete mode 100755 bin/21diff delete mode 100755 bin/add-history-records.pl delete mode 100755 bin/all-postal-no-email delete mode 100755 bin/apache.export delete mode 100644 bin/artera.import delete mode 100644 bin/backup-dvd delete mode 100755 bin/bill-as-nextmonth delete mode 100755 bin/bill-as-nextmonth-BILL delete mode 100755 bin/bill-as-nextyear delete mode 100755 bin/bill-as-nextyear-BILL delete mode 100755 bin/bill-for-nextmonth delete mode 100755 bin/bill-for-nextyear delete mode 100755 bin/bill-nextmonth delete mode 100755 bin/bill-nextyear delete mode 100755 bin/bind.export delete mode 100755 bin/bind.import delete mode 100644 bin/breakdown-bill-applications delete mode 100755 bin/bsdshell.export delete mode 100755 bin/build_exten.php delete mode 100755 bin/cch_tax_tool delete mode 100755 bin/cdr-mysql.import delete mode 100755 bin/cdr-netsapiens.import delete mode 100755 bin/cdr-transnexus.import delete mode 100755 bin/cdr.http_and_import delete mode 100644 bin/cdr.import delete mode 100755 bin/cdr_calltype.import delete mode 100755 bin/cdr_upstream_rate.import delete mode 100755 bin/confdiff delete mode 100755 bin/countdeclines delete mode 100644 bin/create-fetchmailrc delete mode 100755 bin/cust_main-find_bogus_geocode delete mode 100644 bin/cust_main_special.pm delete mode 100755 bin/cust_pay_histogram delete mode 100755 bin/customer-faker delete mode 100755 bin/cvs2cl delete mode 100755 bin/del-old-history delete mode 100644 bin/drop_slony.slonik delete mode 100755 bin/expand-country delete mode 100644 bin/explain-ar-total.sql delete mode 100644 bin/explain-bill-query delete mode 100755 bin/fetch_and_expand_taxes delete mode 100644 bin/find-overapplied delete mode 100755 bin/fix-sequences delete mode 100644 bin/follow-tax-rename delete mode 100644 bin/freeside-backup delete mode 100755 bin/freeside-create-initial-data delete mode 100755 bin/freeside-init delete mode 100644 bin/freeside-migrate-events delete mode 100755 bin/freeside-session-kill delete mode 100755 bin/freeside-upgrade-unicode delete mode 100644 bin/freeside.import delete mode 100755 bin/fs-migrate-cust_tax_exempt delete mode 100755 bin/fs-migrate-part_svc delete mode 100755 bin/fs-migrate-payref delete mode 100755 bin/fs-migrate-svc_acct_sm delete mode 100755 bin/fs-radius-add-check delete mode 100755 bin/fs-radius-add-reply delete mode 100755 bin/generate-prepay delete mode 100755 bin/generate-raddb delete mode 100755 bin/generate-table-module delete mode 100755 bin/generate-tests delete mode 100755 bin/h_cust_main-wipe_paycvv delete mode 100755 bin/import-county-tax-rates delete mode 100755 bin/import-optigold.pl delete mode 100755 bin/import-tax-rates delete mode 100755 bin/ispman.ldap.import delete mode 100755 bin/japan.pl delete mode 100755 bin/make-pkg-fruit delete mode 100755 bin/mapsecrets2access_user delete mode 100755 bin/masonize delete mode 100644 bin/merge-referrals delete mode 100755 bin/merge-user delete mode 100755 bin/monitor delete mode 100755 bin/move-customers delete mode 100755 bin/move-unlinked delete mode 100755 bin/opensrs_domain_pkgs delete mode 100755 bin/passwd.import delete mode 100755 bin/payment-faker delete mode 100644 bin/pg-readonly delete mode 100755 bin/pg-sizer delete mode 100755 bin/pg-version delete mode 100755 bin/ping delete mode 100755 bin/pod2x delete mode 100755 bin/postfix.export delete mode 100755 bin/postfix_courierimap.import delete mode 100755 bin/print-directory_assist delete mode 100755 bin/print-schema delete mode 100755 bin/rate-us.import delete mode 100644 bin/rate.delete delete mode 100755 bin/rate.import delete mode 100755 bin/reassemble_taxes delete mode 100755 bin/rebill delete mode 100755 bin/reset-cust_credit-otaker delete mode 100755 bin/rollback delete mode 100755 bin/rotate-cdrs delete mode 100755 bin/rt-drop-tables delete mode 100755 bin/rt-trim-whitespace delete mode 100755 bin/rt-update-customfield-dates delete mode 100644 bin/rt-update-links delete mode 100644 bin/select-cust-desync_bill_dates.sql delete mode 100644 bin/sendmail.import delete mode 100644 bin/sequences.reset delete mode 100755 bin/shadow.reimport delete mode 100755 bin/slony-setup delete mode 100755 bin/sqlradius-norealm.reimport delete mode 100644 bin/sqlradius.import delete mode 100755 bin/sqlradius.reimport delete mode 100755 bin/strip-eps delete mode 100644 bin/svc_acct-recalculate_usage delete mode 100755 bin/svc_acct.import delete mode 100755 bin/svc_acct_pop.import delete mode 100755 bin/svc_broadband.renumber delete mode 100755 bin/svc_domain.erase delete mode 100755 bin/sysvshell.export delete mode 100755 bin/tax_rate_location.import delete mode 100644 bin/test_scrub delete mode 100755 bin/test_scrub_sql delete mode 100755 bin/tron-scan delete mode 100644 bin/wipe-agent delete mode 100644 bin/wipe-customers delete mode 100755 bin/xmlrpc-agent_new_customer.pl delete mode 100755 bin/xmlrpc-customer_status.pl delete mode 100755 bin/xmlrpc-order_pkg.pl (limited to 'bin') diff --git a/bin/19add b/bin/19add deleted file mode 100755 index 726cd66..0000000 --- a/bin/19add +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/perl - -use Cwd; -use String::ShellQuote; - -my $USER = $ENV{USER}; - -my $dir = getcwd; -( my $prefix = $dir ) =~ s(^/home/$USER/freeside/?)() or die $dir; #eventually from anywhere - -system join('', - #"cvs add @ARGV && ", - "cvs add @ARGV ; ", - "( for file in @ARGV; do ", - "cp -i \$file /home/$USER/freeside1.9/$prefix/`dirname \$file`;", - "done ) && ", - "cd /home/$USER/freeside1.9/$prefix/ && ", - "cvs add @ARGV" -); - diff --git a/bin/19commit b/bin/19commit deleted file mode 100755 index 0b4cd05..0000000 --- a/bin/19commit +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl - -# usage: 19commit 'log message' filename filename ... - -use Cwd; -use String::ShellQuote; - -my $USER = $ENV{USER}; - -my $dir = getcwd; -( my $prefix = $dir ) =~ s(^/home/$USER/freeside/?)() or die $dir; #eventually from anywhere - -my $desc = shell_quote(shift @ARGV); # -m - -die "no files!" unless @ARGV; - -#warn "$prefix"; - -#print <table($table); - my $pkey = $dbdef_table->primary_key; - - foreach my $rec (qsearch($table, {})) { - - #my $h_rec = qsearchs( - # $h_table, - # { $pkey => $rec->getfield($pkey) }, - # eval "FS::${h_table}->sql_h_searchs(time)", - #); - - my $h_rec = qsearchs( - $h_table, - { $pkey => $rec->getfield($pkey) }, - "DISTINCT ON ( $pkey ) *", - "AND history_action = 'insert' ORDER BY $pkey ASC, history_date DESC", - '', - 'AS maintable', - ); - - unless ($h_rec) { - my $h_insert_rec = $rec->_h_statement('insert', 1); - #print $h_insert_rec . "\n"; - $dbh->do($h_insert_rec); - die $dbh->errstr if $dbh->err; - $dbh->commit or die $dbh->errstr; - $cnt++; - } - - - $t_cnt++; - - } - - print "History records inserted into $h_table: $cnt\n"; - print " Total records in $table: $t_cnt\n"; - - print "\n"; - -} - -foreach my $table (@tables) { - - my $h_table = 'h_' . $table; - my $cnt = 0; - - eval "use FS::${table}"; - die $@ if $@; - eval "use FS::${h_table}"; - die $@ if $@; - - print "Adding insert records for unmatched delete records on ${table}...\n"; - - my $dbdef_table = $dbdef->table($table); - my $pkey = $dbdef_table->primary_key; - - #SELECT * FROM h_svc_www - #DISTINCT ON ( $pkey ) ? - my $where = " - WHERE ${pkey} in ( - SELECT ${h_table}1.${pkey} - FROM ${h_table} as ${h_table}1 - WHERE ( - SELECT count(${h_table}2.${pkey}) - FROM ${h_table} as ${h_table}2 - WHERE ${h_table}2.${pkey} = ${h_table}1.${pkey} - AND ${h_table}2.history_action = 'delete' - ) > 0 - AND ( - SELECT count(${h_table}3.${pkey}) - FROM ${h_table} as ${h_table}3 - WHERE ${h_table}3.${pkey} = ${h_table}1.${pkey} - AND ( ${h_table}3.history_action = 'insert' - OR ${h_table}3.history_action = 'replace_new' ) - ) = 0 - GROUP BY ${h_table}1.${pkey})"; - - - my @h_recs = qsearch( - $h_table, { }, - "DISTINCT ON ( $pkey ) *", - $where, - '', - '' - ); - - foreach my $h_rec (@h_recs) { - #print "Adding insert record for deleted record with pkey='" . $h_rec->getfield($pkey) . "'...\n"; - my $class = 'FS::' . $table; - my $rec = $class->new({ $h_rec->hash }); - my $h_insert_rec = $rec->_h_statement('insert', 1); - #print $h_insert_rec . "\n"; - $dbh->do($h_insert_rec); - die $dbh->errstr if $dbh->err; - $dbh->commit or die $dbh->errstr; - $cnt++; - } - - print "History records inserted into $h_table: $cnt\n"; - -} - - - -sub usage { - die "Usage:\n add-history-records.pl user\n"; -} - diff --git a/bin/all-postal-no-email b/bin/all-postal-no-email deleted file mode 100755 index ef5dff6..0000000 --- a/bin/all-postal-no-email +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use FS::UID qw(adminsuidsetup); -use FS::Record qw(qsearch); -use FS::cust_main; - -my $user = shift or die &usage; -adminsuidsetup $user; - -foreach my $cust_main ( qsearch( 'cust_main', {} ) ) { - - print $cust_main->custnum. "\n"; - - $cust_main->invoicing_list( [ 'POST' ] ); - -} - -sub usage { - die "Usage:\n\n all-postal-no-email user\n"; -} - diff --git a/bin/apache.export b/bin/apache.export deleted file mode 100755 index 82eb6d6..0000000 --- a/bin/apache.export +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use Getopt::Std; -#use File::Path; -use File::Rsync; -use Net::SSH qw(ssh); -use FS::UID qw(adminsuidsetup datasrc); -use FS::Record qw(qsearch qsearchs); -use FS::part_export; -use FS::cust_svc; -use FS::svc_www; - -use vars qw(%opt); -getopts("d", \%opt); - -my $user = shift or die &usage; -adminsuidsetup $user; - -#needs the export number in there somewhere too...? -my $spooldir = "/usr/local/etc/freeside/export.". datasrc. "/apache"; -mkdir $spooldir, 0700 unless -d $spooldir; - -my @exports = qsearch('part_export', { 'exporttype' => 'apache' } ); - -my $rsync = File::Rsync->new({ - rsh => 'ssh', -# dry_run => 1, -}); - -foreach my $export ( @exports ) { - - my $machine = $export->machine; - my $exportnum = $export->exportnum; - my $file = "$spooldir/$machine.exportnum$exportnum.conf"; - - warn "exporting apache configuration for $machine to $file\n" - if $opt{d}; - - open(HTTPD_CONF,">$file") or die "can't open $file: $!"; - - my $template = $export->option('template'); - - my @svc_www = $export->svc_x; - - foreach my $svc_www ( @svc_www ) { - use vars qw($zone $username $dir $email $config); - $zone = $svc_www->domain_record->zone; - $config = $svc_www->config; - if ( $svc_www->svc_acct ) { - $username = $svc_www->svc_acct->username; - $dir = $svc_www->svc_acct->dir; - $email = $svc_www->svc_acct->email; - } else { - $username = ''; - $dir = ''; - $email = ''; - } - - warn " adding configuration section for $zone\n" - if $opt{d}; - - print HTTPD_CONF eval(qq("$template")). "\n\n"; - } - - my $user = $export->option('user'); - my $httpd_conf = $export->option('httpd_conf'); - - warn "syncing $file to $httpd_conf on $machine\n" - if $opt{d}; - - $rsync->exec( { - src => $file, - dest => "$user\@$machine:$httpd_conf", - } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err); - # warn $rsync->out; - - my $restart = $export->option('restart') || 'apachectl graceful'; - - warn "running restart command $restart on $machine\n" - if $opt{d}; - - ssh("root\@$machine", $restart); - -} - -close HTTPD_CONF; - -# ----- - -sub usage { - die "Usage:\n apache.export [ -d ] user\n"; -} - diff --git a/bin/artera.import b/bin/artera.import deleted file mode 100644 index 716ddda..0000000 --- a/bin/artera.import +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -use Text::CSV_XS; -use FS::UID qw(adminsuidsetup); -use FS::Record qw(qsearchs); -use FS::svc_external; -use FS::svc_domain; -use FS::svc_acct; - -$FS::svc_Common::noexport_hack = 1; - -my $svcpart = 30; - -my $user = shift - or die 'Usage:\n\n artera.import user ); - -my( $num, $linked ) = ( 0, 0 ); - -while (<>) { - my $status = $csv->parse($_) - or die $csv->error_input; - my($serial, $keycode, $name, $ordernum, $email) = $csv->fields(); - #warn join(" - ", $serial, $keycode, $name, $ordernum, $email ). "\n"; - - $email =~ /^([^@]+)\@([^@]+)$/ - or die $email; - my($username, $domain) = ( $1, $2 ); - my $svc_domain = qsearchs('svc_domain', { 'domain' => $domain } ); - my $cust_svc = ''; - if ( $svc_domain ) { - my $svc_acct = qsearchs('svc_acct', { - 'username' => $username, - 'domsvc' => $svc_domain->svcnum, - } ); - $cust_svc = $svc_acct->cust_svc - if $svc_acct; - #} else { - # warn "can't find domain $domain\n"; - } - - my $exist = qsearchs('svc_external', { 'id' => $serial } ); - next if $exist; - - my $svc_external = new FS::svc_external { - 'svcpart' => $svcpart, - 'pkgnum' => ( $cust_svc ? $cust_svc->pkgnum : '' ), - 'id' => $serial, - 'title' => $keycode, - }; - #my $error = $svc_external->check; - my $error = $svc_external->insert; - if ( $cust_svc && $error =~ /^Already/ ) { - warn $error; - $svc_external->pkgnum(''); - $error = $svc_external->insert; - } - warn $error if $error; - - $num++; - $linked++ if $cust_svc; - #print "$num imported, $linked linked\n"; - -} - -print "$num imported, $linked linked\n"; - diff --git a/bin/backup-dvd b/bin/backup-dvd deleted file mode 100644 index d0314b4..0000000 --- a/bin/backup-dvd +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -database="freeside" -DEVICE="/dev/hda" - -su freeside -c "pg_dump $database" >/var/backups/$database.sql - -DATE=$(date +%Y-%m-%d) - -#NOTE: These two paths must end in a / in -#order to correctly build up the other paths -#BACKUP_DIR="/backup/directory/" -BACKUP_DIR="/backup/" - #TEMP_BACKUP_FILES_DIR="/backup/temp/" - -BACKUP_FILE=$BACKUP_DIR"backup-"$DATE".tar.bz2" - #DATABASE_FILE=$TEMP_BACKUP_FILES_DIR"foo-"$DATE".sql" - - #These directories shouldn't end in a / although - #I don't think it will cause any problems if - #they do. There should be a space at the end though - #to ensure the database file gets concatenated correctly. - #SOURCE="/a/location /other/locations " $DATABASE_FILE - -#echo Removing old backup directories -rm -rf $BACKUP_DIR - #rm -rf $TEMP_BACKUP_FILES_DIR - -#echo Creating new backup directories -mkdir $BACKUP_DIR - #mkdir $TEMP_BACKUP_FILES_DIR - - #echo Creating database backup - #pg_dump -U username -f $DATABASE_FILE databaseName - -#echo Backing up $SOURCE to file $BACKUP_FILE -#tar -cvpl -f $BACKUP_FILE --anchored --exclude /backup / -tar -cjpl -f $BACKUP_FILE --anchored --exclude /backup / - - ##This is not necessary and possibly harmful for DVD+RW media - #echo Quick blanking media - #dvd+rw-format -blank /dev/hdc - -#echo Burning backup -growisofs -dvd-compat -Z $DEVICE -quiet -r -J $BACKUP_FILE diff --git a/bin/bill-as-nextmonth b/bin/bill-as-nextmonth deleted file mode 100755 index 813e841..0000000 --- a/bin/bill-as-nextmonth +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -month=`date +%m` -nextmonth=`expr $month + 1` -/usr/local/bin/freeside-daily -d $nextmonth/1/`date +%Y` fs_daily diff --git a/bin/bill-as-nextmonth-BILL b/bin/bill-as-nextmonth-BILL deleted file mode 100755 index 91e9431..0000000 --- a/bin/bill-as-nextmonth-BILL +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -month=`date +%m` -nextmonth=`expr $month + 1` -/usr/local/bin/freeside-daily -d $nextmonth/1/`date +%Y` -p BILL fs_daily diff --git a/bin/bill-as-nextyear b/bin/bill-as-nextyear deleted file mode 100755 index 63c4ad2..0000000 --- a/bin/bill-as-nextyear +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -year=`date +%Y` -nextyear=`expr $year + 1` -/usr/local/bin/freeside-daily -d 1/1/$nextyear fs_daily diff --git a/bin/bill-as-nextyear-BILL b/bin/bill-as-nextyear-BILL deleted file mode 100755 index 0d77dd0..0000000 --- a/bin/bill-as-nextyear-BILL +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -year=`date +%Y` -nextyear=`expr $year + 1` -/usr/local/bin/freeside-daily -d 1/1/$nextyear -p BILL fs_daily diff --git a/bin/bill-for-nextmonth b/bin/bill-for-nextmonth deleted file mode 100755 index e1a3376..0000000 --- a/bin/bill-for-nextmonth +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -month=`date +%m` -nextmonth=`expr $month + 1` -/usr/local/bin/freeside-daily -d $nextmonth/1/`date +%Y` -n fs_daily diff --git a/bin/bill-for-nextyear b/bin/bill-for-nextyear deleted file mode 100755 index 1430a58..0000000 --- a/bin/bill-for-nextyear +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -year=`date +%Y` -nextyear=`expr $year + 1` -/usr/local/bin/freeside-daily -d 1/1/$nextyear -n fs_daily diff --git a/bin/bill-nextmonth b/bin/bill-nextmonth deleted file mode 100755 index 813e841..0000000 --- a/bin/bill-nextmonth +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -month=`date +%m` -nextmonth=`expr $month + 1` -/usr/local/bin/freeside-daily -d $nextmonth/1/`date +%Y` fs_daily diff --git a/bin/bill-nextyear b/bin/bill-nextyear deleted file mode 100755 index 63c4ad2..0000000 --- a/bin/bill-nextyear +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -year=`date +%Y` -nextyear=`expr $year + 1` -/usr/local/bin/freeside-daily -d 1/1/$nextyear fs_daily diff --git a/bin/bind.export b/bin/bind.export deleted file mode 100755 index 286e43a..0000000 --- a/bin/bind.export +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use File::Path; -use File::Rsync; -use Net::SSH qw(ssh); -use FS::UID qw(adminsuidsetup datasrc); -use FS::Record qw(qsearch qsearchs); -use FS::part_export; -use FS::cust_pkg; -use FS::cust_svc; -use FS::svc_domain; - -my $user = shift or die &usage; -adminsuidsetup $user; - -my $spooldir = "/usr/local/etc/freeside/export.". datasrc. "/bind"; -mkdir $spooldir, 0700 unless -d $spooldir; - -my @exports = qsearch('part_export', { 'exporttype' => 'bind' } ); -my @sexports = qsearch('part_export', { 'exporttype' => 'bind_slave' } ); - -my $rsync = File::Rsync->new({ - rsh => 'ssh', -# dry_run => 1, -}); - -foreach my $export ( @exports ) { - - my $machine = $export->machine; - my $prefix = "$spooldir/$machine"; - - my $bind_rel = $export->option('bind_release'); - my $ndc_cmd = $export->option('reload') - || ( ($bind_rel eq 'BIND9') ? 'rndc' : 'ndc' ); - my $minttl = $export->option('bind9_minttl'); - - #prevent old domain files from piling up - #rmtree "$prefix" or die "can't rmtree $prefix.db: $!"; - - mkdir $prefix, 0700 unless -d $prefix; - - open(NAMED_CONF,">$prefix/named.conf") - or die "can't open $prefix/named.conf: $!"; - - if ( -e "$prefix/named.conf.HEADER" ) { - open(CONF_HEADER,"<$prefix/named.conf.HEADER") - or die "can't open $prefix/named.conf.HEADER: $!"; - while () { print NAMED_CONF $_; } - close CONF_HEADER; - } - - my $zonepath = $export->option('zonepath'); - $zonepath =~ s/\/$//; - - my @svc_domain = $export->svc_x; - - foreach my $svc_domain ( @svc_domain ) { - my $domain = $svc_domain->domain; - my @masters = qsearch('domain_record', { - 'svcnum' => $svc_domain->svcnum, - 'rectype' => '_mstr', - } ); - if ( @masters ) { - my $masters = join('; ', map { $_->recdata } @masters ); - - print NAMED_CONF <$prefix/db.$domain") - or die "can't open $prefix/db.$domain: $!"; - - if ($bind_rel eq 'BIND9') { - print DB_MASTER "\$TTL $minttl\n\$ORIGIN $domain.\n"; - } - - my @domain_records = - qsearch('domain_record', { 'svcnum' => $svc_domain->svcnum } ); - foreach my $domain_record ( - sort { $b->rectype cmp $a->rectype } @domain_records - ) { - #if ( $domain_record->rectype eq 'SOA' ) { - # print DB_MASTER join("\t", $domain_record-> reczone - #} else { - print DB_MASTER join("\t", - map { $domain_record->getfield($_) } - qw( reczone recaf rectype recdata ) - ), "\n"; - #} - } - - close DB_MASTER; - - } - - } - - $rsync->exec( { - src => "$prefix/", - recursive => 1, - dest => "root\@$machine:$zonepath/", - exclude => [qw( *.import named.conf.HEADER named.conf )], - } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err); - # warn $rsync->out; - - $rsync->exec( { - src => "$prefix/named.conf", - dest => "root\@$machine:". $export->option('named_conf'), - } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err); -# warn $rsync->out; - - ssh("root\@$machine", "$ndc_cmd reload"); - -} - -close NAMED_CONF; - -foreach my $sexport ( @sexports ) { #false laziness with above - - my $machine = $sexport->machine; - my $prefix = "$spooldir/$machine"; - - my $bind_rel = $sexport->option('bind_release'); - my $ndc_cmd = ($bind_rel eq 'BIND9') ? 'rndc' : 'ndc'; - - #prevent old domain files from piling up - #rmtree "$prefix" or die "can't rmtree $prefix.db: $!"; - - mkdir $prefix, 0700 unless -d $prefix; - - open(NAMED_CONF,">$prefix/named.conf") - or die "can't open $prefix/named.conf: $!"; - - if ( -e "$prefix/named.conf.HEADER" ) { - open(CONF_HEADER,"<$prefix/named.conf.HEADER") - or die "can't open $prefix/named.conf.HEADER: $!"; - while () { print NAMED_CONF $_; } - close CONF_HEADER; - } - - my $masters = $sexport->option('master'); - - #false laziness with freeside-sqlradius-reset - my @svc_domain = - map { qsearchs('svc_domain', { 'svcnum' => $_->svcnum } ) } - map { qsearch('cust_svc', { 'svcpart' => $_->svcpart } ) } - grep { qsearch('cust_svc', { 'svcpart' => $_->svcpart } ) } - $sexport->export_svc; - - foreach my $svc_domain ( @svc_domain ) { - my $domain = $svc_domain->domain; - print NAMED_CONF <exec( { - src => "$prefix/named.conf", - dest => "root\@$machine:". $sexport->option('named_conf'), - } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err); -# warn $rsync->out; - - ssh("root\@$machine", "$ndc_cmd reload"); - -} -close NAMED_CONF; - -# ----- - -sub usage { - die "Usage:\n bind.export user\n"; -} - diff --git a/bin/bind.import b/bin/bind.import deleted file mode 100755 index 45db2e2..0000000 --- a/bin/bind.import +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/perl -w -# -# REQUIRED: -# -p: part number for domains -# -# -n: named.conf file (or an include file with zones you want to import), -# for example root@ns.isp.com:/var/named/named.conf -# -# OPTIONAL: -# -d: dry-run, debug: don't insert any records, just dump debugging output -# -e: use existing domains records in Freeside -# -s: import slave zones as master. useful if you need to recreate your -# primary nameserver from a secondary -# -c dir: override patch for downloading zone files (for example, when -# downloading zone files from chrooted bind) -# -# need to manually put header in -# /usr/local/etc/freeside/export./named.conf.HEADER -# (or, nowadays, better just to include the file freeside exports) - -use strict; - -use vars qw($domain_svcpart); - -use Getopt::Std; -use Data::Dumper; -#use BIND::Conf_Parser; -#use DNS::ZoneParse 0.81; - -use Net::SCP qw(scp iscp); - -use FS::UID qw(adminsuidsetup datasrc); -use FS::Record qw(qsearch); #qsearchs); -#use FS::svc_acct_sm; -use FS::svc_domain; -use FS::domain_record; -#use FS::svc_acct; -#use FS::part_svc; - -use vars qw($opt_p $opt_n $opt_s $opt_c $opt_d $opt_e); -getopts("p:n:sc:de"); - -my $user = shift or die &usage; -adminsuidsetup $user; - -$FS::svc_Common::noexport_hack = 1; -$FS::domain_record::noserial_hack = 1; - -use vars qw($spooldir); -$spooldir = "/usr/local/etc/freeside/export.". datasrc. "/bind"; -mkdir $spooldir unless -d $spooldir; - -$domain_svcpart = $opt_p; - -my $named_conf = $opt_n; - -use vars qw($named_machine $prefix); -$named_machine = (split(/:/, $named_conf))[0]; -my $pnamed_machine = $named_machine; -$pnamed_machine =~ s/^[\w\-]+\@//; -$prefix = "$spooldir/$pnamed_machine"; -mkdir $prefix unless -d $prefix; - -#iscp("$named_conf","$prefix/named.conf.import"); -scp("$named_conf","$prefix/named.conf.import"); - -## - -$FS::svc_domain::whois_hack=1; - -my $p = Parser->new; -$p->parse_file("$prefix/named.conf.import"); - -print "\nBIND import completed.\n"; - -## - -sub usage { - die "Usage:\n\n bind.import -p partnum -n \"user\@machine:/path/to/named.conf\" [ -s ] [ -c chroot_dir ] [ -d ] [ -e ] user\n"; -} - -######## -BEGIN { - - package Parser; - use BIND::Conf_Parser; - use vars qw(@ISA $named_dir); - @ISA = qw(BIND::Conf_Parser); - - $named_dir = 'COULD_NOT_FIND_NAMED_DIRECTORY_TRY_SETTING_-C_OPTION'; - sub handle_option { - my($self, $option, $argument) = @_; - return unless $option eq "directory"; - $named_dir = $argument; - #warn "found named dir: $named_dir\n"; - } - - sub handle_zone { - my($self, $name, $class, $type, $options) = @_; - return unless $class eq 'in'; - return if grep { $name eq $_ } (qw( - . localhost 127.in-addr.arpa 0.in-addr.arpa 255.in-addr.arpa - 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa - 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.int - )); - - use FS::Record qw(qsearchs); - use FS::svc_domain; - - my $domain = - qsearchs('svc_domain', { 'domain' => $name } ) - || new FS::svc_domain( { - svcpart => $main::domain_svcpart, - domain => $name, - action => 'N', - } ); - unless ( $domain->svcnum ) { - my $error = $domain->insert; - die $error if $error; - } - - if ( $type eq 'slave' && !$main::opt_s ) { - - if ( $main::opt_d ) { - - use Data::Dumper; - print "$name: ". Dumper($options); - - } else { - - foreach my $master ( @{ $options->{masters} } ) { - my $domain_record = new FS::domain_record( { - 'svcnum' => $domain->svcnum, - 'reczone' => '@', - 'recaf' => 'IN', - 'rectype' => '_mstr', - 'recdata' => $master, - } ); - my $error = $domain_record->insert; - die $error if $error; - } - - } - - } elsif ( $type eq 'master' || ( $type eq 'slave' && $main::opt_s ) ) { - - my $file = $options->{file}; - - use File::Basename; - my $basefile = basename($file); - my $sourcefile = $file; - if ( $main::opt_c ) { - $sourcefile = "$main::opt_c/$sourcefile" if $main::opt_c; - } else { - $sourcefile = "$named_dir/$sourcefile" unless $file =~ /^\//; - } - - use Net::SCP qw(iscp scp); - #iscp("$main::named_machine:$sourcefile", - # "$main::prefix/$basefile.import"); - scp("$main::named_machine:$sourcefile", - "$main::prefix/$basefile.import"); - - use DNS::ZoneParse 0.84; - my $zone = DNS::ZoneParse->new("$main::prefix/$basefile.import"); - - my $dump = $zone->dump; - - if ( $main::opt_d ) { - - use Data::Dumper; - print "$name: ". Dumper($dump); - - } else { - - foreach my $rectype ( keys %$dump ) { - if ( $rectype =~ /^SOA$/i ) { - my $rec = $dump->{$rectype}; - $rec->{email} =~ s/\@/\./; - my $domain_record = new FS::domain_record( { - 'svcnum' => $domain->svcnum, - 'reczone' => $rec->{origin}, - 'recaf' => 'IN', - 'rectype' => $rectype, - 'recdata' => - $rec->{primary}. ' '. $rec->{email}. ' ( '. - join(' ', map $rec->{$_}, - qw( serial refresh retry expire minimumTTL ) ). - ' )', - } ); - my $error = $domain_record->insert; - die $error if $error; - } else { - #die $dump->{$rectype}; - - my $datasub; - if ( $rectype =~ /^MX$/i ) { - $datasub = sub { $_[0]->{priority}. ' '. $_[0]->{host}; }; - } elsif ( $rectype =~ /^TXT$/i ) { - $datasub = sub { $_[0]->{text}; }; - } else { - $datasub = sub { $_[0]->{host}; }; - } - - foreach my $rec ( @{ $dump->{$rectype} } ) { - my $domain_record = new FS::domain_record( { - 'svcnum' => $domain->svcnum, - 'reczone' => $rec->{name}, - 'recaf' => $rec->{class} || 'IN', - 'rectype' => $rectype, - 'recdata' => &{$datasub}($rec), - } ); - my $error = $domain_record->insert; - if ( $error ) { - warn "$error inserting ". - $rec->{name}. ' . '. $domain->domain. "\n"; - warn Dumper($rec); - #system('cat',"$main::prefix/$basefile.import"); - die; - } - } - } - } - - } - - #} else { - # die "unrecognized type $type\n"; - } - - } - -} -######### - diff --git a/bin/breakdown-bill-applications b/bin/breakdown-bill-applications deleted file mode 100644 index 44c3e36..0000000 --- a/bin/breakdown-bill-applications +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use FS::UID qw(adminsuidsetup dbh); -use FS::Record qw( qsearch ); -use FS::cust_bill_pay; -use FS::cust_credit_bill; - -$FS::CurrentUser::upgrade_hack = 1; -adminsuidsetup(shift) or die "Usage: breakdown-bill-applications username\n"; - -#quick and dirty conversion script if you have enough memory to throw at it - -my @tables = qw( cust_bill_pay cust_credit_bill ); - -my @apps = (); -foreach my $table { - push @apps, qsearch($table, - - -) { - -} - -foreach my $cust_bill_ diff --git a/bin/bsdshell.export b/bin/bsdshell.export deleted file mode 100755 index 6e0d103..0000000 --- a/bin/bsdshell.export +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/perl -w - -# bsdshell export - -use strict; -use File::Rsync; -use Net::SSH qw(ssh); -use FS::UID qw(adminsuidsetup datasrc); -use FS::Record qw(qsearch qsearchs); -use FS::part_export; -use FS::cust_svc; -use FS::svc_acct; - -my @saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' ); - -my $user = shift or die &usage; -adminsuidsetup $user; - -my $spooldir = "/usr/local/etc/freeside/export.". datasrc; -#my $spooldir = "/usr/local/etc/freeside/export.". datasrc. "/shell"; - -my @bsd_exports = qsearch('part_export', { 'exporttype' => 'bsdshell' } ); - -my $rsync = File::Rsync->new({ - rsh => 'ssh', -# dry_run => 1, -}); - -foreach my $export ( @bsd_exports ) { - my $machine = $export->machine; - my $prefix = "$spooldir/$machine"; - mkdir $prefix, 0700 unless -d $prefix; - - #LOCKING!!! - - ( open(MASTER,">$prefix/master.passwd") - #!!! and flock(MASTER,LOCK_EX|LOCK_NB) - ) or die "Can't open $prefix/master.passwd: $!"; - ( open(PASSWD,">$prefix/passwd") - #!!! and flock(PASSWD,LOCK_EX|LOCK_NB) - ) or die "Can't open $prefix/passwd: $!"; - - chmod 0644, "$prefix/passwd"; - chmod 0600, "$prefix/master.passwd"; - - my @svc_acct = $export->svc_x; - - next unless @svc_acct; - - foreach my $svc_acct ( sort { $a->uid <=> $b->uid } @svc_acct ) { - - my $password = $svc_acct->_password; - my $cpassword; - #if ( ( length($password) <= 8 ) - if ( ( length($password) <= 12 ) - && ( $password ne '*' ) - && ( $password ne '!!' ) - && ( $password ne '' ) - ) { - $cpassword=crypt($password, - $saltset[int(rand(64))].$saltset[int(rand(64))] - ); - # MD5 !!!! - } else { - $cpassword=$password; - } - - ### - # FORMAT OF THE PASSWD FILE HERE - print PASSWD join(":", - $svc_acct->username, - 'x', # "##". $username, - $svc_acct->uid, - $svc_acct->gid, - $svc_acct->finger, - $svc_acct->dir, - $svc_acct->shell, - ), "\n"; - - ### - # FORMAT OF FreeBSD MASTER PASSWD FILE HERE - print MASTER join(":", - $svc_acct->username, # User name - $cpassword, # Encrypted password - $svc_acct->uid, # User ID - $svc_acct->gid, # Group ID - "", # Login Class - "0", # Password Change Time - "0", # Password Expiration Time - $svc_acct->finger, # Users name - $svc_acct->dir, # Users home directory - $svc_acct->shell, # shell - ), "\n" ; - - } - - #!!! flock(MASTER,LOCK_UN); - #!!! flock(PASSWD,LOCK_UN); - close MASTER; - close PASSWD; - - $rsync->exec( { - src => "$prefix/passwd", - dest => "root\@$machine:/etc/passwd" - } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err); - - $rsync->exec( { - src => "$prefix/master.passwd", - dest => "root\@$machine:/etc/master.passwd.new" - } ) or die "rsync to $machine failed: ". join(" / ", $rsync->err); - ssh("root\@$machine", "pwd_mkdb /etc/master.passwd.new"); - - # UNLOCK!! -} diff --git a/bin/build_exten.php b/bin/build_exten.php deleted file mode 100755 index e55df4b..0000000 --- a/bin/build_exten.php +++ /dev/null @@ -1,790 +0,0 @@ -#!/usr/bin/php -q - [optional parameters]"); - out(""); - - out("OPERATIONS (exactly one must be specified):"); - out(" --create, -c"); - out(" Create a new extension"); - out(" --modify, -m"); - out(" Modify an existing extension, the extension must exist and all values execept"); - out(" those specified will remain the same"); - out(" --delete, -d"); - out(" Delete an extension"); - - out("PARAMETERS:"); - out(" --exten extension_number"); - out(" Extension number to create or delete. Must be specified."); - - out("OPTIONAL PARAMETERS:"); - out(" --name name"); - out(" Display Name, defaults to specified extension number."); - out(" --outboundcid cid_number"); - out(" Outbound CID Number, defaults to specified extension number."); - out(" --directdid did_number"); - out(" Direct DID Number, defaults to extension number."); - out(" --vm-password password"); - out(" Voicemail Password, defaults to specified extension number."); - out(" --sip-secret secret"); - out(" SIP Secret, defaults to md5 hash of specified extension number."); - out(" --debug"); - out(" Display debug messages."); - out(" --no-warnings"); - out(" Do Not display warning messages."); - - out(" --help, -h, -? Show this help"); -} - -// **** Parse out command-line options -$shortopts = "cmdh?"; -$longopts = array( - "help", - "debug", - "no-warnings", - "create", - "modify", - "delete", - "exten=", - "outboundcid=", - "directdid=", - "name=", - "sip-secret=", - "vm-password=", -); - -$args = Console_Getopt::getopt(Console_Getopt::readPHPArgv(), $shortopts, $longopts); -if (is_object($args)) { - // assume it's PEAR_ERROR - fatal($args->message); - exit(255); -} - -$no_params = true; - -$param_debug = false; -$param_warnings = true; -$param_create = false; -$param_modify = false; -$param_delete = false; -$param_exten = false; -$param_name = false; -$param_outboundcid = false; -$param_directdid = false; -$param_sip_secret = false; -$param_vm_password = false; - -foreach ($args[0] as $arg) { - $no_params = false; - switch ($arg[0]) { - - case "--help": - case "h": - case "?": - showHelp(); - exit(10); - break; - - case "--debug": - $param_debug = true; - debug("debug mode is enabled"); - break; - - case "--no-warnings": - $param_warnings = false; - break; - - case "--create": - case "c": - $param_create = true; - break; - - case "--modify": - case "m": - $param_modify = true; - break; - - case "--delete": - case "d": - $param_delete = true; - break; - - case "--exten": - $param_exten = true; - $new_exten = $arg[1]; - break; - - case "--outboundcid": - $param_outboundcid = true; - $new_outboundcid = $arg[1]; - break; - - case "--directdid": - $param_directdid = true; - $new_directdid = $arg[1]; - break; - - case "--name": - $param_name = true; - $new_name = $arg[1]; - break; - - case "--sip-secret": - $param_sip_secret = true; - $new_sip_secret = $arg[1]; - break; - - case "--vm-password": - $param_vm_password = true; - $new_vm_password = $arg[1]; - break; - - default: - error("unhandled argument supplied: ".$arg[0].", aborting"); - exit (1); - } -} - -if ($no_params) { - showHelp(); - exit(10); -} -if ($param_create && $param_modify) { - error("Incompatible combination of options, create and modify"); - exit (1); -} -if (!(($param_create || $param_modify) XOR $param_delete)) { - error("Invalid Parameter combination, you must include create or delete and can not do both in one call"); - exit (1); -} -if (!$param_exten) { - error("You must provide an extension number to create or delete an extension"); - exit (1); -} - -if ($param_warnings && $param_create) { - if (!$param_outboundcid) { - $new_outboundcid = $new_exten; - warning("WARNING: No outboundcid specified for extenion, using $new_outboundcid as outboundcid"); - } - if (!$param_directdid) { - $new_directdid = $new_exten; - warning("WARNING: No outboundcid specified for extenion, using $new_outboundcid as outboundcid"); - } - if (!$param_name) { - $new_name = $new_exten; - warning("WARNING: No name specified for extenion, using $new_name as name"); - } - if (!$param_sip_secret) { - $new_sip_secret = md5($new_exten); - warning("WARNING: No sip-secret specified for extenion, using $new_sip_secret as secret"); - } - if (!$param_vm_password) { - $new_vm_password = $new_exten; - warning("WARNING: No vm-password specified for extenion, using $new_vm_password as password"); - } -} - -// Now setup actions and exten how leveraged code expected it -// -$exten = $new_exten; -if ($param_create) { - $actions = "addext/addvm"; -} else if ($param_modify) { - $actions = "modext"; -} else if ($param_delete) { - $actions = "remext"; -} - -/* I don't think I need these but ??? -*/ -$type = 'setup'; -$display = ''; -$extdisplay = null; - -// determine module type to show, default to 'setup' -$type_names = array( - 'tool'=>'Tools', - 'setup'=>'Setup', - 'cdrcost'=>'Call Cost', -); - -define("AMP_CONF", "/etc/amportal.conf"); -$amportalconf = AMP_CONF; - -// bootstrap retrieve_conf by getting the AMPWEBROOT since that is currently where the necessary -// functions.inc.php resides, and then use that parser to properly parse the file and get all -// the defaults as needed. -// -function parse_amportal_conf_bootstrap($filename) { - $file = file($filename); - foreach ($file as $line) { - if (preg_match("/^\s*([\w]+)\s*=\s*\"?([\w\/\:\.\*\%-]*)\"?\s*([;#].*)?/",$line,$matches)) { - $conf[ $matches[1] ] = $matches[2]; - } - } - if ( !isset($conf["AMPWEBROOT"]) || ($conf["AMPWEBROOT"] == "")) { - $conf["AMPWEBROOT"] = "/var/www/html"; - } else { - $conf["AMPWEBROOT"] = rtrim($conf["AMPWEBROOT"],'/'); - } - - return $conf; -} - -$amp_conf = parse_amportal_conf_bootstrap($amportalconf); -if (count($amp_conf) == 0) { - exit (1); -} - - -// Emulate gettext extension functions if gettext is not available -if (!function_exists('_')) { - function _($str) { - return $str; - } -} -if (!function_exists('gettext')) { - function gettext($message) { - return $message; - } -} -if (!function_exists('dgettext')) { - function dgettext($domain, $message) { - return $message; - } -} - -// setup locale -function set_language() { - if (extension_loaded('gettext')) { - if (isset($_COOKIE['lang'])) { - setlocale(LC_ALL, $_COOKIE['lang']); - putenv("LANGUAGE=".$_COOKIE['lang']); - } else { - setlocale(LC_ALL, 'en_US'); - } - bindtextdomain('amp','./i18n'); - bind_textdomain_codeset('amp', 'utf8'); - textdomain('amp'); - } -} -set_language(); - -// systems running on sqlite3 (or pgsql) this function is not available -// instead of changing the whole code, lets hack our own version of this function. -// according to the documentation found here: http://il2.php.net/mysql_real_escape_string -// this shold be enough. -// Fixes ticket: http://freepbx.org/trac/ticket/1963 -if (!function_exists('mysql_real_escape_string')) { - function mysql_real_escape_string($str) { - $str = str_replace( "\x00", "\\" . "\x00", $str ); - $str = str_replace( "\x1a", "\\" . "\x1a", $str ); - $str = str_replace( "\n" , "\\". "\n" , $str ); - $str = str_replace( "\r" , "\\". "\r" , $str ); - $str = str_replace( "\\" , "\\". "\\" , $str ); - $str = str_replace( "'" , "''" , $str ); - $str = str_replace( '"' , '""' , $str ); - return $str; - } -} - -// include base functions - -require_once($amp_conf['AMPWEBROOT']."/admin/functions.inc.php"); -require_once($amp_conf['AMPWEBROOT']."/admin/common/php-asmanager.php"); -$amp_conf = parse_amportal_conf($amportalconf); -if (count($amp_conf) == 0) { - exit (1); -} -$asterisk_conf_file = $amp_conf["ASTETCDIR"]."/asterisk.conf"; -$asterisk_conf = parse_asterisk_conf($asterisk_conf_file); - -ini_set('include_path',ini_get('include_path').':'.$amp_conf['AMPWEBROOT'].'/admin/:'); - -$astman = new AGI_AsteriskManager(); - -// attempt to connect to asterisk manager proxy -if (!isset($amp_conf["ASTMANAGERPROXYPORT"]) || !$res = $astman->connect("127.0.0.1:".$amp_conf["ASTMANAGERPROXYPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { - // attempt to connect directly to asterisk, if no proxy or if proxy failed - if (!$res = $astman->connect("127.0.0.1:".$amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { - // couldn't connect at all - unset( $astman ); - } -} -// connect to database -require_once($amp_conf['AMPWEBROOT']."/admin/common/db_connect.php"); - -$nt = notifications::create($db); - -$framework_asterisk_running = checkAstMan(); - -// get all enabled modules -// active_modules array used below and in drawselects function and genConf function -$active_modules = module_getinfo(false, MODULE_STATUS_ENABLED); - -$fpbx_menu = array(); - -// pointer to current item in $fpbx_menu, if applicable -$cur_menuitem = null; - -// add module sections to $fpbx_menu -$types = array(); -if(is_array($active_modules)){ - foreach($active_modules as $key => $module) { - //include module functions - if (is_file($amp_conf['AMPWEBROOT']."/admin/modules/{$key}/functions.inc.php")) { - require_once($amp_conf['AMPWEBROOT']."/admin/modules/{$key}/functions.inc.php"); - } - - // create an array of module sections to display - // stored as [items][$type][$category][$name] = $displayvalue - if (isset($module['items']) && is_array($module['items'])) { - // loop through the types - foreach($module['items'] as $itemKey => $item) { - - if (!$framework_asterisk_running && - ((isset($item['needsenginedb']) && strtolower($item['needsenginedb'] == 'yes')) || - (isset($item['needsenginerunning']) && strtolower($item['needsenginerunning'] == 'yes'))) - ) - { - $item['disabled'] = true; - } else { - $item['disabled'] = false; - } - - if (!in_array($item['type'], $types)) { - $types[] = $item['type']; - } - - if (!isset($item['display'])) { - $item['display'] = $itemKey; - } - - // reference to the actual module - $item['module'] =& $active_modules[$key]; - - // item is an assoc array, with at least array(module=> name=>, category=>, type=>, display=>) - $fpbx_menu[$itemKey] = $item; - - // allow a module to replace our main index page - if (($item['display'] == 'index') && ($display == '')) { - $display = 'index'; - } - - // check current item - if ($display == $item['display']) { - // found current menuitem, make a reference to it - $cur_menuitem =& $fpbx_menu[$itemKey]; - } - } - } - } -} -sort($types); - -// new gui hooks -if(is_array($active_modules)){ - foreach($active_modules as $key => $module) { - if (isset($module['items']) && is_array($module['items'])) { - foreach($module['items'] as $itemKey => $itemName) { - //list of potential _configpageinit functions - $initfuncname = $key . '_' . $itemKey . '_configpageinit'; - if ( function_exists($initfuncname) ) { - $configpageinits[] = $initfuncname; - } - } - } - //check for module level (rather than item as above) _configpageinit function - $initfuncname = $key . '_configpageinit'; - if ( function_exists($initfuncname) ) { - $configpageinits[] = $initfuncname; - } - } -} - -// extensions vs device/users ... this is a bad design, but hey, it works -if (isset($amp_conf["AMPEXTENSIONS"]) && ($amp_conf["AMPEXTENSIONS"] == "deviceanduser")) { - unset($fpbx_menu["extensions"]); -} else { - unset($fpbx_menu["devices"]); - unset($fpbx_menu["users"]); -} - - -// Here we process the action and create the exten, mailbox or delete it. -// - -$EXTEN_REQUEST = array ( - 'actions' => $actions, - 'ext' => $exten, - 'displayname' => $new_name, - 'emergencycid' => '', - 'outboundcid' => $new_outboundcid, - 'accountcode' => '', - 'dtmfmode' => 'auto', - 'devicesecret' => $new_sip_secret, - 'directdid' => $new_directdid, - ); - -$actions = explode('/',$EXTEN_REQUEST['actions']); - - $actions_taken = false; - - $ext = ''; - $pass = ''; - $displayname = ''; - $emergencycid = ''; - $outboundcid = ''; - $directdid = ''; - $mailbox = ''; - $tech = 'sip'; - $dcontext = 'from-internal'; - $dtmfmode = 'auto'; - - foreach ($EXTEN_REQUEST as $key => $value) { - switch ($key) { - case 'ext': - case 'displayname': - case 'emergencycid': - case 'outboundcid': - case 'accountcode': - case 'dtmfmode': - case 'devicesecret': - case 'directdid': - case 'mailbox': - case 'dcontext': - $$key = $value; - break; - - default: - break; - } - } - - /* - echo "\nDumping core_users_get:"; - $user_list = core_users_get($ext); - var_dump($user_list); - - echo "\nDumping core_devices_get:"; - $device_list = core_devices_get($ext); - var_dump($device_list); - - echo "\nDumping voicemail_mailbox_get:"; - $vm_list = voicemail_mailbox_get($ext); - var_dump($vm_list); - - exit; - */ - - if ($ext == '') { - fatal("No Extension provided (this should have been caught above, may be a bug"); - exit (10); - } - - /* DEFAULTS: - displayname: ext - devicesecret: ext - */ - - if (in_array('addext', $actions) || in_array('addvm',$actions)) { - if ($displayname == '') { - $displayname = $ext; - } - if (isset($accountcode)) { - $_REQUEST['devinfo_accountcode'] = $accountcode; - } - if (!isset($devicesecret)) { - $devicesecret = $ext; - } - if ($mailbox == '') { - $mailbox = $ext.'@default'; - } - $user_add_arr = array( - 'extension' => $ext, - 'device' => $ext, - 'name' => $displayname, - 'directdid' => $directdid, - 'outboundcid' => $outboundcid, - 'sipname' => '', - 'record_out' => 'Never', - 'record_in' => 'Never', - 'callwaiting' => 'enabled', - - 'vm' => 'enabled', - 'vmcontext' => 'default', - 'options' => '', - 'vmpwd' => $new_vm_password, - 'email' => '', - 'pager' => '', - 'attach' => 'attach=no', - 'saycid' => 'saycid=no', - 'envelope' => 'envelope=no', - 'delete' => 'delete=no', - ); - - // archaic code expects these in the REQUEST array ... - // - $_REQUEST['devinfo_secret'] = $devicesecret; - $_REQUEST['devinfo_dtmfmode'] = $dtmfmode; - $_REQUEST['devinfo_canreinvite'] = 'no'; - $_REQUEST['devinfo_context'] = $dcontext; - $_REQUEST['devinfo_host'] = 'dynamic'; - $_REQUEST['devinfo_type'] = 'friend'; - $_REQUEST['devinfo_nat'] = 'yes'; - $_REQUEST['devinfo_port'] = '5060'; - $_REQUEST['devinfo_dial'] = 'SIP/'.$ext; - $_REQUEST['devinfo_mailbox'] = $mailbox; - - } else if (in_array('modext', $actions)) { - $user_list = core_users_get($ext); - //var_dump($user_list); - if (!isset($user_list['extension'])) { - error("No such extension found: $ext"); - exit (10); - } - $device_list = core_devices_get($ext); - //var_dump($device_list); - if (count($device_list) == 0) { - error("No such device found: $ext"); - exit (10); - } - $vm_list = voicemail_mailbox_get($ext); - //var_dump($vm_list); - if (count($vm_list) == 0) { - error("No voicemail found for: $ext"); - exit (10); - } - - if ($param_name) { - $user_list['name'] = $new_name; - $device_list['description'] = $new_name; - $vm_list['name'] = $new_name; - } - if ($param_sip_secret) { - $device_list['secret'] = $new_sip_secret; - } - if ($param_vm_password) { - $vm_list['pwd'] = $new_vm_password; - } - if ($param_directdid) { - $user_list['directdid'] = $new_directdid; - } - if ($param_outboundcid) { - $user_list['outboundcid'] = $new_outboundcid; - } - $user_mod_arr = array( - 'extension' => $ext, - 'device' => $ext, - 'name' => $user_list['name'], - 'directdid' => $user_list['directdid'], - 'outboundcid' => $user_list['outboundcid'], - 'sipname' => $user_list['sipname'], - 'record_out' => $user_list['record_out'], - 'record_in' => $user_list['record_in'], - 'callwaiting' => $user_list['callwaiting'], - - 'vm' => 'enabled', - 'vmcontext' => $vm_list['vmcontext'], - 'vmpwd' => $vm_list['pwd'], - 'email' => $vm_list['email'], - 'pager' => $vm_list['pager'], - 'options' => '', - 'attach' => $vm_list['options']['attach'], - 'saycid' => $vm_list['options']['saycid'], - 'envelope' => $vm_list['options']['envelope'], - 'delete' => $vm_list['options']['delete'], - ); - - // archaic code expects these in the REQUEST array ... - // - $_REQUEST['devinfo_secret'] = $device_list['secret']; - $_REQUEST['devinfo_dtmfmode'] = $device_list['dtmfmode']; - $_REQUEST['devinfo_canreinvite'] = $device_list['canreinvite']; - $_REQUEST['devinfo_context'] = $device_list['context']; - $_REQUEST['devinfo_host'] = $device_list['host']; - $_REQUEST['devinfo_type'] = $device_list['type']; - $_REQUEST['devinfo_nat'] = $device_list['nat']; - $_REQUEST['devinfo_port'] = $device_list['port']; - $_REQUEST['devinfo_dial'] = $device_list['dial']; - $_REQUEST['devinfo_mailbox'] = $device_list['mailbox']; - $_REQUEST['devinfo_accountcode'] = $device_list['accountcode']; - $_REQUEST['devinfo_username'] = $ext; - //$_REQUEST['devinfo_callerid'] = $device_list['callerid']; - //$_REQUEST['devinfo_record_in'] = $device_list['record_in']; - //$_REQUEST['devinfo_record_out'] = $device_list['record_out']; - - if (isset($device_list['qualify'])) { - $_REQUEST['devinfo_qualify'] = $device_list['qualify']; - } - if (isset($device_list['callgroup'])) { - $_REQUEST['devinfo_callgroup'] = $device_list['callgroup']; - } - if (isset($device_list['pickupgroup'])) { - $_REQUEST['devinfo_pickupgroup'] = $device_list['pickupgroup']; - } - if (isset($device_list['allow'])) { - $_REQUEST['devinfo_allow'] = $device_list['allow']; - } - if (isset($device_list['disallow'])) { - $_REQUEST['devinfo_disallow'] = $device_list['disallow']; - } - - $actions_taken = true; - debug("core_users_edit($ext, $user_add_arr)"); - core_users_edit($ext, $user_mod_arr); - // doesn't return a return code, so hope it worked:-) - - debug("core_devices_del($ext, true)"); - debug("core_devices_add($ext,'sip',".$device_list['dial'].",'fixed',$ext,".$device_list['description'].",".$device_list['emergency_cid'].",true)"); - core_devices_del($ext,true); - core_devices_add($ext,'sip',$device_list['dial'],'fixed',$ext,$device_list['description'],$device_list['emergency_cid'],true); - // doesn't return a return code, so hope it worked:-) - - debug("voicemail_mailbox_del($ext)"); - debug("voicemail_mailbox_add($ext, $user_mod_arr)"); - voicemail_mailbox_del($ext); - voicemail_mailbox_add($ext, $user_mod_arr); - } - - if (in_array('addvm', $actions)) { - $actions_taken = true; - if (($existing_vmbox = voicemail_mailbox_get($ext)) == null ) { - debug("voicemail_mailbox_add($ext, $user_add_arr)"); - voicemail_mailbox_add($ext, $user_add_arr); - } else { - debug(print_r($existing_vmbox,true)); - fatal("voicemail_mailbox_get($ext) indicates the box already exists, aborting"); - exit (1); - } - - // check if we need to create symlink if if addext is not being called - if (!in_array('addext', $actions)) { - - $thisUser = core_users_get($ext); - - // This is a bit kludgey, the other way is to reformat the core_users_get() info and do a core_users_add() in edit mode - // - if (!empty($thisUser)) { - $this_vmcontext = $user_add_arr['vmcontext']; - sql("UPDATE `users` SET `voicemail` = '$this_vmcontext' WHERE `extension` = '$ext'"); - - if ($astman) { - $astman->database_put("AMPUSER",$ext."/voicemail","\"".isset($this_vmcontext)?$this_vmcontext:''."\""); - } - } - - if(isset($this_vmcontext) && $this_vmcontext != "novm") { - if(empty($this_vmcontext)) { - $vmcontext = "default"; - } else { - $vmcontext = $this_vmcontext; - } - //voicemail symlink - // - exec("rm -f /var/spool/asterisk/voicemail/device/".$ext,$output,$return_val); - exec("/bin/ln -s /var/spool/asterisk/voicemail/".$vmcontext."/".$ext."/ /var/spool/asterisk/voicemail/device/".$ext,$output,$return_val); - if ($return_val != 0) { - error("Error code $return_val when sym-linking vmail context $vmcontext to device directory for $ext. Trying to carry on but you should investigate."); - } - } - } - } - - if (in_array('addext', $actions)) { - $actions_taken = true; - $any_users = core_users_get($ext); - debug("core_users_add($user_add_arr)"); - if (isset($any_users['extension']) || !core_users_add($user_add_arr)) { - var_dump($any_users); - fatal("Attempt to add user failed, aborting"); - exit (1); - } - } - - if (in_array('addext', $actions)) { - $actions_taken = true; - debug("core_devices_add($ext, $tech, '', 'fixed', $ext, $displayname, $emergencycid)"); - $any_devices = core_devices_get($ext); - if (count($any_devices) > 0 || !core_devices_add($ext, $tech, '', 'fixed', $ext, $displayname, $emergencycid)) { - var_dump($any_devices); - fatal("Attempt to add device failed, aborting"); - exit (1); - } - } - - if (in_array('remext', $actions)) { - $actions_taken = true; - if (core_users_get($ext) != null) { - debug("removing user $ext"); - core_users_del($ext); - core_devices_del($ext); - } else { - debug("not removing user $ext"); - } - if (voicemail_mailbox_get($ext) != null) { - debug("removing vm $ext"); - voicemail_mailbox_del($ext); - } else { - debug("not removing vm $ext"); - } - } - - if ($actions_taken) { - debug("Request completed successfully"); - exit (0); - } else { - warning("No actions were performed"); - exit (10); - } - exit; -?> diff --git a/bin/cch_tax_tool b/bin/cch_tax_tool deleted file mode 100755 index 6261363..0000000 --- a/bin/cch_tax_tool +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -# this tool manipulates fixed length cch tax files by comparing the -# update files in the $update_dir to the initial install files -# in the $init_dir -# -# it produces .DOIT files in $update_dir which are suitable for -# syncing a database initialzed with the files in $init_dir to -# the state represented by the files in $update_dir -# -# how one acquires update files from cch that overlap with initial -# full install remains a mystery - -my $init_dir = "cchinit/"; -my $update_dir = "cchupdate/"; - -foreach my $file (qw (CODE DETAIL PLUS4 GEOCODE TXMATRIX ZIP)) { - my $tfile = $update_dir. $file. "T"; - $tfile = $update_dir. "TXMATRIT" if $tfile =~ /TXMATRIXT$/; - open FILE, "$tfile.TXT" or die "Can't open $tfile.TXT\n"; - open INSERT, ">$tfile.INS" or die "Can't open $tfile.INS\n"; - open DELETE, ">$tfile.DEL" or die "Can't open $tfile.DEL\n"; - while(){ - chomp; - print INSERT "$_\n" if s/I$//; - print DELETE "$_\n" if s/D$//; - } - close FILE; - close INSERT; - close DELETE; - system "sort $tfile.INS > $tfile.INSSORT"; - system "sort $tfile.DEL > $tfile.DELSORT"; - system "sort $init_dir$file.txt > $tfile.ORGINSSORT"; - system "comm -12 $tfile.INSSORT $tfile.ORGINSSORT > $tfile.PREINS"; - system "comm -23 $tfile.INSSORT $tfile.ORGINSSORT > $tfile.2BEINS"; - system "comm -23 $tfile.DELSORT $tfile.ORGINSSORT > $tfile.PREDEL"; - system "comm -12 $tfile.DELSORT $tfile.ORGINSSORT > $tfile.2BEDEL"; -} - -foreach my $file (qw (CODET DETAILT PLUS4T GEOCODET TXMATRIT ZIPT)) { - my $tfile = $update_dir. $file; - $tfile = "TXMATRIT" if $tfile eq "TXMATRIXT"; - open INSERT, "$tfile.2BEINS" or die "Can't open $tfile.2BEINS\n"; - open DELETE, "$tfile.2BEDEL" or die "Can't open $tfile.2BEDEL\n"; - open FILE, ">$tfile.DOIT" or die "Can't open $tfile.DOIT\n"; - while(){ - chomp; - print FILE $_, "I\n"; - } - while(){ - chomp; - print FILE $_, "D\n"; - } - close FILE; - close INSERT; - close DELETE; -} diff --git a/bin/cdr-mysql.import b/bin/cdr-mysql.import deleted file mode 100755 index 608a8dc..0000000 --- a/bin/cdr-mysql.import +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/perl - -use strict; -use vars qw( $DEBUG ); -use Date::Parse 'str2time'; -use Date::Format 'time2str'; -use FS::UID qw(adminsuidsetup dbh); -use FS::cdr; -use DBI; -use Getopt::Std; - -my %opt; -getopts('H:U:P:D:T:', \%opt); -my $user = shift or die &usage; - -my $dsn = 'dbi:mysql'; -$dsn .= ":database=$opt{D}" if $opt{D}; -$dsn .= ":host=$opt{H}" if $opt{H}; - -my $mysql = DBI->connect($dsn, $opt{U}, $opt{P}) - or die $DBI::errstr; - -adminsuidsetup $user; - -my $fsdbh = FS::UID::dbh; - -# check for existence of freesidestatus -my $table = $opt{T} || 'cdr'; -my $status = $mysql->selectall_arrayref("SHOW COLUMNS FROM $table WHERE Field = 'freesidestatus'"); -if( ! @$status ) { - print "Adding freesidestatus column...\n"; - $mysql->do("ALTER TABLE $table ADD COLUMN freesidestatus varchar(32)") - or die $mysql->errstr; -} -else { - print "freesidestatus column present\n"; -} - -my @cols = ( qw( -calldate clid src dst dcontext channel lastapp lastdata duration - billsec disposition amaflags accountcode uniqueid userfield) ); -my $sql = 'SELECT '.join(',', @cols). " FROM $table WHERE freesidestatus IS NULL"; -my $sth = $mysql->prepare($sql); -$sth->execute; -print "Importing ".$sth->rows." records...\n"; - -my $cdr_batch = new FS::cdr_batch({ - 'cdrbatch' => 'mysql-import-'. time2str('%Y/%m/%d-%T',time), - }); -my $error = $cdr_batch->insert; -die $error if $error; -my $cdrbatchnum = $cdr_batch->cdrbatchnum; -my $imports = 0; -my $updates = 0; - -my $row; -while ( $row = $sth->fetchrow_hashref ) { - my $cdr = FS::cdr->new($row); - $cdr->startdate(str2time($cdr->calldate)); - $cdr->cdrbatchnum($cdrbatchnum); - my $error = $cdr->insert; - if($error) { - print "failed import: $error\n"; - } - else { - $imports++; - if( $mysql->do("UPDATE cdr SET freesidestatus = 'done' - WHERE calldate = ? AND src = ? AND dst = ?", - undef, - $row->{'calldate'}, - $row->{'src'}, - $row->{'dst'}, - - ) ) { - $updates++; - } - else { - print "failed to set status: ".$mysql->errstr."\n"; - } - } -} -print "Done.\nImported $imports CDRs, marked $updates CDRs as done.\n"; -$mysql->disconnect; - -sub usage { - "Usage: \n cdr-mysql.import\n\t[ -H host ]\n\t-D database\n\t-U user\n\t-P password\n\tfreesideuser\n"; -} - diff --git a/bin/cdr-netsapiens.import b/bin/cdr-netsapiens.import deleted file mode 100755 index 8aa4ac0..0000000 --- a/bin/cdr-netsapiens.import +++ /dev/null @@ -1,237 +0,0 @@ -#!/usr/bin/perl -# -# */5 * * * /home/ivan/freeside/bin/cdr-netsapiens.import ivan exportnum - -use strict; -use vars qw( $DEBUG ); -use Date::Format; -use REST::Client; -use FS::UID qw(adminsuidsetup dbh); -use FS::Record qw(qsearchs); -use FS::part_export; -use FS::cdr; - -$DEBUG = 1; - -my $user = shift or die &usage; -adminsuidsetup $user; - -my $exportnum = shift or die &usage; -my $part_export = qsearchs('part_export', { 'exportnum' => $exportnum } ) - or die "unknown exportnum $exportnum\n"; - -my $cdrbatch = 'NetSapiens import '. time2str('%Y-%m-%d %x', $^T); - -my $cdrs = 0; - -do { - - #find max time_release - my $sth = dbh->prepare('SELECT MAX(enddate) FROM cdr') #XXX and imported from this netsapens switch - or die dbh->errstr; - - $sth->execute or die $sth->errstr; - my $time_release = time2str('%Y-%m-%d %X', $sth->fetchrow_arrayref->[0]); - #retreive CDRs >= this time - - my $ns = $part_export->ns_command( 'GET', '/cdr/', - 'time_release' => "$time_release,", - '_sort' => '+time_release', - ); - - #loop over them, double check duplicates, insert the rest - - my $content = $ns->responseContent; - - $cdrs = 0; - - #20090219201719000016@SkyNet360.Com - #
- while ( $content =~ - s/^.*?//is ) - { - - my $cdrid = ($1-1900). $2; #2009 -> 109 so we fit in a bigint - - unless ( $cdrs ) { #inefficient - my $dsth = dbh->prepare( - 'SELECT cdrid FROM cdr WHERE cdrid IS NOT NULL AND cdrid = ?' - ) or die dbh->errstr; - $dsth->execute($cdrid) or die $dsth->errstr; - my $row = $dsth->fetchrow_arrayref; - if ( $row && $row->[0] eq $cdrid ) { # == w/ 8 byte int? - warn "$cdrid (dup)\n" if $DEBUG > 1; - next; - } - } - warn "$cdrid\n" if $DEBUG > 1; - - $content =~ s/(.*?)<\/form>//is; - my $cdr_content = $1; - - my %cdr = (); - while ( $cdr_content =~ - s/.*?//is ) - { - warn " $1 => $2\n" if $DEBUG > 2; - $cdr{$1} = $2; - } - - $cdrs++; - - my $cdr = new FS::cdr { - 'src' => $cdr{'orig_from_user'}, #orig_sub - 'dst' => $cdr{'orig_to_user'}, #term_sub? - 'startdate' => FS::cdr::_cdr_date_parse($cdr{'time_start'}), - 'enddate' => FS::cdr::_cdr_date_parse($cdr{'time_release'}), - 'duration' => $cdr{'duration'}, - 'billsec' => $cdr{'time_talking'}, - #'disposition' => - #'accountcode' => - #'charged_party' - 'cdrid' => $cdrid, - 'cdrbatch' => $cdrbatch, - }; - - my $error = $cdr->insert; - die $error if $error; - - } - -} while $cdrs; - -sub usage { - "Usage: \n cdr-netsapiens.import user exportnum\n"; -} - -__END__ - - rly_prt_0 => 23946 - orig_req_host => residential.skynet360.com - batch_dura => 0 - orig_from_host => 63.251.149.5 - batch_tim_beg => 2009-02-19 20:17:19 - term_match => sip:7865457300@residential.skynet360.com - term_domain => residential.skynet360.com - term_sub => 7865457300 - orig_req_user => 7865457300 - orig_callid => 5D1164E6-44E011D6-8C84C368-EA5A0BC4@63.251.149.5 - term_ip => 63.251.148.137:1453 - term_to_uri => sip:7865457300@residential.skynet360.com - release_code => end - time_start => 2009-02-19 20:17:19.0 - batch_hold => 0 - orig_from_user => 9046384544 - time_holding => 0 - term_logi_uri => sip:7865457300@residential.skynet360.com - time_talking => 0 - orig_from_uri => sip:9046384544@63.251.149.5 - duration => 0 - orig_logi_uri => sip:9046384544@63.251.149.5 - rly_cnt_b => 0 - time_insert => 2009-02-19 15:17:38.0 - orig_to_user => 7865457300 - rly_prt_a => 63.251.149.18:21972 - cdr_index => 0 - orig_to_host => 63.251.149.18 - orig_match => sip:*@63.251.149.5 - time_release => 2009-02-19 20:17:37 - codec => G.711 u-law - orig_req_uri => sip:7865457300@residential.skynet360.com - orig_to_uri => sip:7865457300@63.251.149.18 - rly_cnt_a => 13 - orig_ip => 63.251.149.5:57326 - release_text => Orig: Cancel - time_disp => 0 - time_ringing => 2009-02-19 20:17:19 - _method => put -prt_0 => 23946 - orig_req_host => residential.skynet360.com - batch_dura => 0 - orig_from_host => 63.251.149.5 - batch_tim_beg => 2009-02-19 20:17:19 - term_match => sip:7865457300@residential.skynet360.com - term_domain => residential.skynet360.com - time_start => 2009-02-19 20:17:19.0 - term_sub => 7865457300 - orig_req_user => 7865457300 - orig_callid => 5D1164E6-44E011D6-8C84C368-EA5A0BC4@63.251.149.5 - term_ip => 63.251.148.137:1453 - term_to_uri => sip:7865457300@residential.skynet360.com - release_code => end - time_start => 2009-02-19 20:17:19.0 - batch_hold => 0 - orig_from_user => 9046384544 - time_holding => 0 - term_logi_uri => sip:7865457300@residential.skynet360.com - time_talking => 0 - orig_from_uri => sip:9046384544@63.251.149.5 - duration => 0 - orig_logi_uri => sip:9046384544@63.251.149.5 - rly_cnt_b => 0 - time_insert => 2009-02-19 15:17:38.0 - orig_to_user => 7865457300 - rly_prt_a => 63.251.149.18:21972 - cdr_index => 0 - orig_to_host => 63.251.149.18 - orig_match => sip:*@63.251.149.5 - time_release => 2009-02-19 20:17:37 - codec => G.711 u-law - orig_req_uri => sip:7865457300@residential.skynet360.com - orig_to_uri => sip:7865457300@63.251.149.18 - rly_cnt_a => 13 - orig_ip => 63.251.149.5:57326 - release_text => Orig: Cancel - time_disp => 0 - time_ringing => 2009-02-19 20:17:19 - _method => put - -list of freeside CDR fields, useful ones marked with * - - acctid - primary key -*[1] calldate - Call timestamp (SQL timestamp) - clid - Caller*ID with text -* src - Caller*ID number / Source number -* dst - Destination extension - dcontext - Destination context - channel - Channel used - dstchannel - Destination channel if appropriate - lastapp - Last application if appropriate - lastdata - Last application data -* startdate - Start of call (UNIX-style integer timestamp) - answerdate - Answer time of call (UNIX-style integer timestamp) -* enddate - End time of call (UNIX-style integer timestamp) -* duration - Total time in system, in seconds -* billsec - Total time call is up, in seconds -*[2] disposition - What happened to the call: ANSWERED, NO ANSWER, BUSY - amaflags - What flags to use: BILL, IGNORE etc, specified on a per - channel basis like accountcode. -*[3] accountcode - CDR account number to use: account - uniqueid - Unique channel identifier (Unitel/RSLCOM Event ID) - userfield - CDR user-defined field - cdr_type - CDR type - see FS::cdr_type (Usage = 1, S&E = 7, OC&C = 8) -*[4] charged_party - Service number to be billed - upstream_currency - Wholesale currency from upstream -*[5] upstream_price - Wholesale price from upstream - upstream_rateplanid - Upstream rate plan ID - rated_price - Rated (or re-rated) price - distance - km (need units field?) - islocal - Local - 1, Non Local = 0 -*[6] calltypenum - Type of call - see FS::cdr_calltype - description - Description (cdr_type 7&8 only) (used for - cust_bill_pkg.itemdesc) - quantity - Number of items (cdr_type 7&8 only) - carrierid - Upstream Carrier ID (see FS::cdr_carrier) - upstream_rateid - Upstream Rate ID - svcnum - Link to customer service (see FS::cust_svc) - freesidestatus - NULL, done (or something) - -[1] Auto-populated from startdate if not present -[2] Package options available to ignore calls without a specific disposition -[3] When using 'cdr-charged_party-accountcode' config -[4] Auto-populated from src (normal calls) or dst (toll free calls) if not present -[5] When using 'upstream_simple' rating method. -[6] Set to usage class classnum when using pre-rated CDRs and usage class-based - taxation (local/intrastate/interstate/international) - - diff --git a/bin/cdr-transnexus.import b/bin/cdr-transnexus.import deleted file mode 100755 index b9fe41a..0000000 --- a/bin/cdr-transnexus.import +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Getopt::Std; -use Net::SFTP::Foreign; -use FS::UID qw(adminsuidsetup datasrc); -use FS::cdr; - -### -# parse command line -### - -use vars qw( $opt_p $opt_d $opt_v ); -getopts('v'); - -$opt_p = 'last'; -$opt_d = 'done'; - -my $user = shift or die &usage; -adminsuidsetup $user; - -# %%%FREESIDE_CACHE%%% -my $cachedir = '/usr/local/etc/freeside/cache.'. datasrc. '/cdrs'; -mkdir $cachedir unless -d $cachedir; - -#my $format = shift or die &usage; -my $format = 'transnexus'; - -use vars qw( $servername ); -$servername = shift or die &usage; - -my $DIR = '/home/ossadmin/OSS/nexoss/CDR_ARCHIVE_BY_ACCOUNT'; - -### -# get the file list -### - -warn "Retreiving directory listing\n" if $opt_v; - -my $ls_sftp = sftp(); - -my $lsdir = $ls_sftp->ls($DIR); - -### -# import each file in each dir -### - -foreach my $dir ( @$lsdir ) { - - my $dirname = $dir->{filename}; - warn "Scanning dir $dirname\n" if $opt_v; - - #my $ls = $ls_sftp->ls("$DIR/$dirname", wanted => qr/^$opt_p.*-CDRs$/i ); - my $ls = $ls_sftp->ls("$DIR/$dirname", wanted => qr/^$opt_p.*Customer-CDRs$/i ); - - foreach my $file ( @$ls ) { - - my $filename = $file->{filename}; - warn "Downloading $filename\n" if $opt_v; - - #get the file - my $get_sftp = sftp(); - $get_sftp->get("$DIR/$dirname/$filename", "$cachedir/$filename") - or die "Can't get $filename: ". $get_sftp->error; - - warn "Processing $filename\n" if $opt_v; - - my $error = FS::cdr::batch_import( { - 'file' => "$cachedir/$filename", - 'format' => $format, - 'batch_namevalue' => $filename, - 'empty_ok' => 1, - } ); - die $error if $error; - - if ( $opt_d ) { - my $mv_sftp = sftp(); - $mv_sftp->mkdir("$DIR/$dirname/$opt_d"); - $mv_sftp->rename( "$DIR/$dirname/$filename", - "$DIR/$dirname/$opt_d/$filename" ) - or die "can't move $filename to $opt_d: ". $mv_sftp->error; - } - - unlink "$cachedir/$filename"; - - } - -} - -### -# subs -### - -sub usage { - "Usage: \n cdr-transnexus.import [ -v ] user [sftpuser@]servername\n"; -} - -use vars qw( $sftp ); - -sub sftp { - - #reuse connections - return $sftp if $sftp && $sftp->cwd; - - my %sftp = ( host => $servername ); - - $sftp = Net::SFTP::Foreign->new(%sftp); - $sftp->error and die "SFTP connection failed: ". $sftp->error; - - $sftp; -} - -=head1 NAME - -cdr.sftp_and_import - Download CDR files from a remote server via SFTP - -=head1 SYNOPSIS - - cdr-transnexus.import [ -v ] user [sftpuser@]servername - -=head1 DESCRIPTION - -Command line tool to download CDR files from a remote server via SFTP and then -import them into the database. - --v: verbose - -user: freeside username - -[sftpuser@]servername: remote server - -=head1 BUGS - -Hacked up copy of freeside-cdr-sftp_and_import - -=head1 SEE ALSO - -L - -=cut - -1; - diff --git a/bin/cdr.http_and_import b/bin/cdr.http_and_import deleted file mode 100755 index 8910eec..0000000 --- a/bin/cdr.http_and_import +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/perl -# -# Usage: -# cdr.http_and_import [ -p prefix ] [ -e extension ] [ -v ] user format URL -# -# -e: file extension, defaults to .csv -# -d: if specified, moves files to the specified folder when done - -use strict; -use Getopt::Std; -use WWW::IndexParser; -#use LWP::UserAgent; -use FS::UID qw(adminsuidsetup datasrc dbh); -use FS::cdr; - -### -# parse command line -### - -use vars qw( $opt_p $opt_e $opt_v ); -getopts('p:e:v'); - -$opt_e ||= 'csv'; -#$opt_e = ".$opt_e" unless $opt_e =~ /^\./; -$opt_e =~ s/^\.//; - -my $user = shift or die &usage; -adminsuidsetup $user; - -# %%%FREESIDE_CACHE%%% -my $cachedir = '/usr/local/etc/freeside/cache.'. datasrc. '/cdrs'; -mkdir $cachedir unless -d $cachedir; - -my $format = shift or die &usage; - -use vars qw( $URL ); -$URL = shift or die &usage; - -### -# get the file list -### - -warn "Retreiving directory listing\n" if $opt_v; - -my @files = WWW::IndexParser->new(url => $URL); - -### -# import each file -### - -foreach my $file ( @files ) { - - my $filename = $file->{filename}; - - if ( $opt_p ) { next unless $filename =~ /^$opt_p/ }; - if ( $opt_e ) { next unless $filename =~ /\.$opt_e$/i }; - - #check and see if we've gotten this file already!!! - #just going to cheat with filenames in the cache for now - if ( -e "$cachedir/$filename" ) { - warn "Already have unprocessed $cachedir/$filename; skipping\n"; # if $opt_v; - next; - } - if ( -e "$cachedir/$filename.DONE" ) { - warn "Already processed $cachedir/$filename; skipping\n" if $opt_v; - next; - } - - warn "Downloading $filename\n" if $opt_v; - - #get the file - - my $ua = LWP::UserAgent->new; - my $response = $ua->get("$URL/$filename"); - - unless ( $response->is_success ) { - die "Error retreiving $URL/$filename: ". $response->status_line; - } - - open(FILE, ">$cachedir/$filename") - or die "can't open $cachedir/$filename: $!"; - print FILE $response->content; - close FILE or die "can't close $cachedir/$filename: $!"; - - warn "Processing $filename\n" if $opt_v; - - my $error = FS::cdr::batch_import( { - 'file' => "$cachedir/$filename", - 'format' => $format, - 'batch_namevalue' => $filename, - 'empty_ok' => 1, - } ); - die $error if $error; - - close FILE; - - rename("$cachedir/$filename", "$cachedir/$filename.DONE"); - -} - -### -# sub -### - -sub usage { - "Usage: \n cdr.http_and_import [ -p prefix ] [ -e extension ] [ -v ] user format URL\n"; -} - diff --git a/bin/cdr.import b/bin/cdr.import deleted file mode 100644 index 36266ef..0000000 --- a/bin/cdr.import +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl -# -# Usage: -# cdr.import user format filename -# - -use strict; -use FS::UID qw(adminsuidsetup); -use FS::cdr; - -my $user = shift or die &usage; -adminsuidsetup $user; - -my $format = shift or die &usage; - -my $file = shift; - -my $error = FS::cdr::batch_import( { - 'file' => $file, - 'format' => $format, - 'batch_namevalue' => $file, -} ); -die $error if $error; - -sub usage { - "Usage: \n cdr.import user format filename\n"; -} - diff --git a/bin/cdr_calltype.import b/bin/cdr_calltype.import deleted file mode 100755 index a998284..0000000 --- a/bin/cdr_calltype.import +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl -w -# -# bin/cdr_calltype.import ivan ~ivan/convergent/newspecs/fixed_inbound/calltypes.csv - -use strict; -use FS::UID qw(dbh adminsuidsetup); -use FS::cdr_calltype; - -my $user = shift or die &usage; -adminsuidsetup $user; - -while (<>) { - - chomp; - my $line = $_; - - #$line =~ /^(\d+),"([^"]+)"$/ or do { - $line =~ /^(\d+),"([^"]+)"/ or do { - warn "unparsable line: $line\n"; - next; - }; - - my $cdr_calltype = new FS::cdr_calltype { - 'calltypenum' => $1, - 'calltypename' => $2, - }; - - #my $error = $cdr_calltype->check; - my $error = $cdr_calltype->insert; - if ( $error ) { - warn "********** $error FOR LINE: $line\n"; - dbh->commit; - #my $wait = scalar(); - } - -} - -sub usage { - "Usage:\n\ncdr_calltype.import username filename ...\n"; -} - diff --git a/bin/cdr_upstream_rate.import b/bin/cdr_upstream_rate.import deleted file mode 100755 index fda3883..0000000 --- a/bin/cdr_upstream_rate.import +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/perl -w -# -# Usage: bin/cdr_upstream_rate.import username ratenum filename -# -# records will be imported into cdr_upstream_rate, rate_detail and rate_region -# -# Example: bin/cdr_upstream_rate.import ivan 1 ~ivan/convergent/sample_rate_table.csv -# -# username: a freeside login (from /usr/local/etc/freeside/mapsecrets) -# ratenum: rate plan (FS::rate) created with the web UI -# filename: CSV file -# -# the following fields are currently used: -# - Class Code => cdr_upstream_rate.rateid -# - Description => rate_region.regionname -# (rate_detail->dest_region) -# - 1_rate => ( * 60 / 1_rate_seconds ) => rate_detail.min_charge -# - 1_rate_seconds => (used above) -# - 1_second_increment => rate_detail.sec_granularity -# -# the following fields are not (yet) used: -# - Flagfall => what's this for? -# -# - 1_cap_time => freeside doesn't have voip time caps yet... -# - 1_cap_cost => freeside doesn't have voip cost caps yet... -# - 1_repeat => not sure what this is for, sample data is all 0 -# -# - 2_rate => \ -# - 2_rate_seconds => | -# - 2_second_increment => | not sure what the second set of rate data -# - 2_cap_time => | is supposed to be for... -# - 2_cap_cost => | -# - 2_repeat => / -# -# - Carrier => probably not needed? -# - Start Date => not necessary? - -use strict; -use vars qw( $DEBUG ); -use Text::CSV_XS; -use FS::UID qw(dbh adminsuidsetup); -use FS::Record qw(qsearchs); -use FS::rate; -use FS::cdr_upstream_rate; -use FS::rate_detail; -use FS::rate_region; - -$DEBUG = 1; - -my $user = shift or die &usage; -adminsuidsetup $user; - -my $ratenum = shift or die &usage; - -my $rate = qsearchs( 'rate', { 'ratenum' => $ratenum } ); -die "rate plan $ratenum not found in rate table\n" - unless $rate; - -my $csv = new Text::CSV_XS; -my $hline = scalar(<>); -chomp($hline); -$csv->parse($hline) or die "can't parse header: $hline\n"; -my @header = $csv->fields(); - -$FS::UID::AutoCommit = 0; - -while (<>) { - - chomp; - my $line = $_; - -# #$line =~ /^(\d+),"([^"]+)"$/ or do { -# #} -# $line =~ /^(\d+),"([^"]+)"/ or do { -# warn "unparsable line: $line\n"; -# next; -# }; - - $csv->parse($line) or die "can't parse line: $line\n"; - my @line = $csv->fields(); - - my %hash = map { $_ => shift(@line) } @header; - - warn join('', map { "$_ => $hash{$_}\n" } keys %hash ) - if $DEBUG > 1; - - my $rate_region = new FS::rate_region { - 'regionname' => $hash{'Description'} - }; - - my $error = $rate_region->insert; - if ( $error ) { - dbh->rollback; - die "error inserting into rate_region: $error\n"; - } - my $dest_regionnum = $rate_region->regionnum; - warn "rate_region $dest_regionnum inserted\n" - if $DEBUG; - - my $rate_detail = new FS::rate_detail { - 'ratenum' => $ratenum, - 'dest_regionnum' => $dest_regionnum, - 'min_included' => 0, - #'min_charge', => sprintf('%.5f', 60 * $hash{'1_rate'} / $hash{'1_rate_seconds'} ), - 'min_charge', => sprintf('%.5f', $hash{'1_rate'} / - ( $hash{'1_rate_seconds'} / 60 ) - ), - 'sec_granularity' => $hash{'1_second_increment'}, - }; - $error = $rate_detail->insert; - if ( $error ) { - dbh->rollback; - die "error inserting into rate_detail: $error\n"; - } - my $ratedetailnum = $rate_detail->ratedetailnum; - warn "rate_detail $ratedetailnum inserted\n" - if $DEBUG; - - my $cdr_upstream_rate = new FS::cdr_upstream_rate { - 'upstream_rateid' => $hash{'Class Code'}, - 'ratedetailnum' => $rate_detail->ratedetailnum, - }; - $error = $cdr_upstream_rate->insert; - if ( $error ) { - dbh->rollback; - die "error inserting into cdr_upstream_rate: $error\n"; - } - warn "cdr_upstream_rate ". $cdr_upstream_rate->upstreamratenum. " inserted\n" - if $DEBUG; - - dbh->commit or die "can't commit: ". dbh->errstr; - - warn "\n" if $DEBUG; - -} - -dbh->commit or die "can't commit: ". dbh->errstr; - -sub usage { - "Usage:\n\ncdr_upstream_rate.import username ratenum filename\n"; -} - diff --git a/bin/confdiff b/bin/confdiff deleted file mode 100755 index 5b6af85..0000000 --- a/bin/confdiff +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/perl - -use FS::UID qw(adminsuidsetup); -use FS::Conf; - -adminsuidsetup('ivan'); - -my $conf = new FS::Conf; - -my $file2 = pop @ARGV; -my $file1 = pop @ARGV; - -open(FILE1, ">/tmp/$file1") or die "can't open /tmp/$file1: $!"; -print FILE1 $conf->config($file1); -print FILE1 "\n"; -close FILE1 or die $!; - -open(FILE2, ">/tmp/$file2") or die "can't open /tmp/$file2: $!"; -print FILE2 $conf->config($file2); -print FILE2 "\n"; -close FILE2 or die $!; - -my @opt = @ARGV; - -system('diff', @opt, "/tmp/$file1", "/tmp/$file2"); - -#unlink("/tmp/$file1', "/tmp/$file2"); diff --git a/bin/countdeclines b/bin/countdeclines deleted file mode 100755 index bbc3925..0000000 --- a/bin/countdeclines +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/perl - -use Date::Parse; - -my $e = 'PlugnPay error: 97: Declined for CVV failure'; -my @y = (2008,2009); - -my $p = 0; - -foreach my $y (@y) { - foreach my $m (1..12) { - my $d = "$m/1/$y"; - my $t = str2time($d); - - #print "$pd-$d: SELECT count(*) from cust_bill_event where statustext = '$e' and _date >= $p and _date < $t;\n" - print "SELECT count(*) from cust_bill_event where statustext = '$e' and _date >= $p and _date < $t;\n" - if $p; - - $p = $t; - $pd = $d; - } -} diff --git a/bin/create-fetchmailrc b/bin/create-fetchmailrc deleted file mode 100644 index 11bde0c..0000000 --- a/bin/create-fetchmailrc +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/perl -w -# this quick hack helps you generate/maintain .fetchmailrc files from -# FS::acct_snarf data. it is run from a shellcommands export as: -# create-fetchmailrc $username $dir $snarf_machine1 $snarf_username1 $snarf__password1 $snarf_machine2 $snarf_username2 $snarf__password2 ... - -use strict; -use POSIX qw( setuid setgid ); - -my $header = <$filename") or die "can't open $filename: $!\n"; -chown $uid, $gid, $filename or die "can't chown $uid.$gid $filename: $!\n"; -chmod 0600, $filename or die "can't chmod 600 $filename: $!\n"; -print FETCHMAILRC $header; - -while ($ARGV[0]) { - my( $s_machine, $s_username, $s_password ) = splice( @ARGV, 0, 3 ); - print FETCHMAILRC < 'cust_main', - 'extra_sql' => 'WHERE geocode IS NOT NULL', -}); - -foreach my $cust_main ( @cust_main ) { - - my $db_geocode = $cust_main->geocode; - - $cust_main->set('geocode', ''); - - my $calc_geocode = $cust_main->geocode('cch'); - - next unless $calc_geocode; - - my $cust = $cust_main->custnum.': '. $cust_main->name. "\n"; - - if ( $db_geocode eq $calc_geocode ) { - warn "unnecessary geocode override for $cust"; - } else { - warn "bogus geocode override $db_geocode overrides $calc_geocode for $cust"; - } - -} - -1; diff --git a/bin/cust_main_special.pm b/bin/cust_main_special.pm deleted file mode 100644 index 967b6be..0000000 --- a/bin/cust_main_special.pm +++ /dev/null @@ -1,608 +0,0 @@ -package cust_main_special; - -require 5.006; -use strict; -use vars qw( @ISA $DEBUG $me $conf ); -use Safe; -use Carp; -use Data::Dumper; -use Date::Format; -use FS::UID qw( dbh ); -use FS::Record qw( qsearchs qsearch ); -use FS::payby; -use FS::cust_pkg; -use FS::cust_bill; -use FS::cust_bill_pkg; -use FS::cust_bill_pkg_display; -use FS::cust_bill_pkg_tax_location; -use FS::cust_main_county; -use FS::cust_location; -use FS::tax_rate; -use FS::cust_tax_location; -use FS::part_pkg_taxrate; -use FS::queue; -use FS::part_pkg; - -@ISA = qw ( FS::cust_main ); - -$DEBUG = 0; -$me = '[emergency billing program]'; - -$conf = new FS::Conf; - -=head1 METHODS - -=over 4 - -=item bill OPTIONS - -Generates invoices (see L) for this customer. Usually used in -conjunction with the collect method by calling B. - -If there is an error, returns the error, otherwise returns false. - -Options are passed as name-value pairs. Currently available options are: - -=over 4 - -=item resetup - -If set true, re-charges setup fees. - -=item time - -Bills the customer as if it were that time. Specified as a UNIX timestamp; see L). Also see L and L for conversion functions. For example: - - use Date::Parse; - ... - $cust_main->bill( 'time' => str2time('April 20th, 2001') ); - -=item pkg_list - -An array ref of specific packages (objects) to attempt billing, instead trying all of them. - - $cust_main->bill( pkg_list => [$pkg1, $pkg2] ); - -=item invoice_time - -Used in conjunction with the I