From 0f10241a8a2e3d5978b17f7b3b0c579902ae2250 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 7 Apr 2004 11:04:06 +0000 Subject: javascript confirm when slaving a domain --- httemplate/view/svc_domain.cgi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 1dbe16d23..cd9f79d36 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -54,6 +54,9 @@ Service #<%= $svcnum %> if ( confirm("Remove this record?") == true ) window.location.href = href; } + function slave_areyousure() { + return confirm("Remove all records and slave from " + document.SlaveForm.recdata.value + "?"); + } <% my @records; if ( @records = $svc_domain->domain_record ) { %> @@ -90,7 +93,7 @@ Service #<%= $svcnum %>

or

-
+ <% if ( @records ) { %> Delete all records and <% } %> @@ -99,7 +102,7 @@ Slave from nameserver IP - +


<%= joblisting({'svcnum'=>$svcnum}, 1) %> -- cgit v1.2.1 From ca19c9b9d3f40739a201e8100c22f5cba3730b9e Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 7 Apr 2004 11:39:15 +0000 Subject: automatically update reverse-ARPA records (Bug#462) / recognize SOA records with the fqdn as well as @ --- FS/FS/Conf.pm | 7 +++++ FS/FS/domain_record.pm | 78 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index d8191c278..905c60d2b 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1199,6 +1199,13 @@ httemplate/docs/config.html 'type' => 'checkbox', }, + { + 'key' => 'disable_autoreverse', + 'section' => 'BIND', + 'description' => 'Disable automatic synchronization of reverse-ARPA entries.', + 'type' => 'checkbox', + }, + ); 1; diff --git a/FS/FS/domain_record.pm b/FS/FS/domain_record.pm index ea0c48d4f..2a30594da 100644 --- a/FS/FS/domain_record.pm +++ b/FS/FS/domain_record.pm @@ -1,7 +1,8 @@ package FS::domain_record; use strict; -use vars qw( @ISA $noserial_hack ); +use vars qw( @ISA $noserial_hack $DEBUG ); +use FS::Conf; #use FS::Record qw( qsearch qsearchs ); use FS::Record qw( qsearchs dbh ); use FS::svc_domain; @@ -9,6 +10,8 @@ use FS::svc_www; @ISA = qw(FS::Record); +$DEBUG = 1; + =head1 NAME FS::domain_record - Object methods for domain_record records @@ -110,6 +113,18 @@ sub insert { } } + my $conf = new FS::Conf; + if ( $self->rectype =~ /^A$/ && ! $conf->exists('disable_autoreverse') ) { + my $reverse = $self->reverse_record; + if ( $reverse && ! $reverse->recnum ) { + my $error = $reverse->insert; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "error adding corresponding reverse-ARPA record: $error"; + } + } + } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; @@ -153,6 +168,18 @@ sub delete { } } + my $conf = new FS::Conf; + if ( $self->rectype =~ /^A$/ && ! $conf->exists('disable_autoreverse') ) { + my $reverse = $self->reverse_record; + if ( $reverse && $reverse->recnum && $reverse->recdata eq $self->zone.'.' ){ + my $error = $reverse->delete; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "error removing corresponding reverse-ARPA record: $error"; + } + } + } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; @@ -284,10 +311,16 @@ sub increment_serial { my $soa = qsearchs('domain_record', { svcnum => $self->svcnum, - reczone => '@', #or full domain ? + reczone => '@', + recaf => 'IN', + rectype => 'SOA', } ) + || qsearchs('domain_record', { + svcnum => $self->svcnum, + reczone => $self->svc_domain->domain.'.', recaf => 'IN', rectype => 'SOA', - } ) or return "soa record not found; can't increment serial"; + } ) + or return "soa record not found; can't increment serial"; my $data = $soa->recdata; $data =~ s/(\(\D*)(\d+)/$1.($2+1)/e; #well, it works. @@ -328,11 +361,44 @@ sub zone { $zone; } -=back +=item reverse_record + +Returns the corresponding reverse-ARPA record as another FS::domain_record +object. If the specific record does not exist in the database but the +reverse-ARPA zone itself does, an appropriate new record is created. If no +reverse-ARPA zone is available at all, returns false. + +(You can test whether or not record itself exists in the database or is a new +object that might need to be inserted by checking the recnum field) -=head1 VERSION +Mostly used by the insert and delete methods - probably should see them for +examples. -$Id: domain_record.pm,v 1.16 2003-08-05 00:20:43 khoff Exp $ +=cut + +sub reverse_record { + my $self = shift; + warn "reverse_record called\n" if $DEBUG; + #should support classless reverse-ARPA ala rfc2317 too + $self->recdata =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ + or return ''; + my $domain = "$3.$2.$1.in-addr.arpa"; + my $ptr_reczone = $4; + warn "reverse_record: searching for domain: $domain\n" if $DEBUG; + my $svc_domain = qsearchs('svc_domain', { 'domain' => $domain } ) + or return ''; + warn "reverse_record: found domain: $domain\n" if $DEBUG; + my %hash = ( + 'svcnum' => $svc_domain->svcnum, + 'reczone' => $ptr_reczone, + 'recaf' => 'IN', + 'rectype' => 'PTR', + ); + qsearchs('domain_record', \%hash ) + or new FS::domain_record { %hash, 'recdata' => $self->zone.'.' }; +} + +=back =head1 BUGS -- cgit v1.2.1 From 3d7ce17fee0a42b8d476ae7e7eaeef5fc24043d0 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 7 Apr 2004 13:11:20 +0000 Subject: added options to select username, svcnum, svcpart --- FS/bin/freeside-reexport | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/FS/bin/freeside-reexport b/FS/bin/freeside-reexport index b5c50a422..34ccbc715 100644 --- a/FS/bin/freeside-reexport +++ b/FS/bin/freeside-reexport @@ -1,6 +1,8 @@ -#!/usr/bin/perl -Tw +#!/usr/bin/perl -w use strict; +use vars qw($opt_s $opt_u $opt_p); +use Getopt::Std; use FS::UID qw(adminsuidsetup); use FS::Record qw(qsearch qsearchs); use FS::part_export; @@ -20,20 +22,27 @@ if ( $export_x =~ /^(\d+)$/ ) { or die "no exports of type $export_x found\n"; } -my $svc_something = shift or die &usage; -my $svc_x; -if ( $svc_something =~ /^(\d+)$/ ) { - my $cust_svc = qsearchs('cust_svc', { svcnum=>$1 } ) - or die "svcnum $svc_something not found\n"; - $svc_x = $cust_svc->svc_x; -} else { - $svc_x = qsearchs('svc_acct', { username=>$svc_something } ) - or die "username $svc_something not found\n"; +getopts('s:u:p:'); + +my @svc_x = (); +if ( $opt_s ) { + my $cust_svc = qsearchs('cust_svc', { svcnum=>$opt_s } ) + or die "svcnum $opt_s not found\n"; + push @svc_x, $cust_svc->svc_x; +} elsif ( $opt_u ) { + my $svc_x = qsearchs('svc_acct', { username=>$opt_u } ) + or die "username $opt_u not found\n"; + push @svc_x, $svc_x; +} elsif ( $opt_p ) { + push @svc_x, map { $_->svc_x } qsearch('cust_svc', { svcpart=>$opt_p } ); + die "no services with svcpart $opt_p found\n" unless @svc_x; } foreach my $part_export ( @part_export ) { - my $error = $part_export->export_insert($svc_x); - die $error if $error; + foreach my $svc_x ( @svc_x ) { + my $error = $part_export->export_insert($svc_x); + die $error if $error; + } } @@ -47,7 +56,7 @@ freeside-reexport - Command line tool to re-trigger export jobs for existing ser =head1 SYNOPSIS - freeside-reexport user exportnum|exporttype svcnum|username + freeside-reexport user exportnum|exporttype [ -s svcnum | -u username | -p svcpart ] =head1 DESCRIPTION -- cgit v1.2.1 From fad8705f1dacd35d394c8a0290fdd0a372400bc1 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 7 Apr 2004 13:12:17 +0000 Subject: oops, update the usage too --- FS/bin/freeside-reexport | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FS/bin/freeside-reexport b/FS/bin/freeside-reexport index 34ccbc715..54af9dd80 100644 --- a/FS/bin/freeside-reexport +++ b/FS/bin/freeside-reexport @@ -47,7 +47,7 @@ foreach my $part_export ( @part_export ) { sub usage { - die "Usage:\n\n freeside-reexport user exportnum|exporttype svcnum|username\n"; + die "Usage:\n\n freeside-reexport user exportnum|exporttype [ -s svcnum | -u username | -p svcpart ]\n"; } =head1 NAME -- cgit v1.2.1 From 60083c565ce36609c46bbe935ecc31ca97a59210 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 8 Apr 2004 05:53:06 +0000 Subject: comment out xmlrpc server until it is ready --- fs_selfservice/FS-SelfService/Makefile.PL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs_selfservice/FS-SelfService/Makefile.PL b/fs_selfservice/FS-SelfService/Makefile.PL index a14580eb2..0b7fc4606 100644 --- a/fs_selfservice/FS-SelfService/Makefile.PL +++ b/fs_selfservice/FS-SelfService/Makefile.PL @@ -5,7 +5,7 @@ WriteMakefile( 'NAME' => 'FS::SelfService', 'VERSION_FROM' => 'SelfService.pm', # finds $VERSION 'EXE_FILES' => [ 'freeside-selfservice-clientd', - 'freeside-selfservice-xmlrpc-server', + #'freeside-selfservice-xmlrpc-server', ], 'INSTALLSCRIPT' => '/usr/local/sbin', 'INSTALLSITEBIN' => '/usr/local/sbin', -- cgit v1.2.1 From ce41102169513f44c89a1e9bddfb250b29f239bb Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 8 Apr 2004 12:00:05 +0000 Subject: beginning of RT integration --- Makefile | 36 ++++++++++++++--- htetc/handler.pl | 96 ++++++++++++++++++++++++++++++++++++++++++-- rt/FREESIDE_MODIFIED | 2 + rt/etc/RT_SiteConfig.pm | 12 ++++++ rt/sbin/rt-setup-database | 4 ++ rt/sbin/rt-setup-database.in | 7 ++++ 6 files changed, 147 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index e5ef70d6c..70e588218 100644 --- a/Makefile +++ b/Makefile @@ -56,10 +56,18 @@ SELFSERVICE_USER = fs_selfservice SELFSERVICE_MACHINES = localhost # SELFSERVICE_MACHINES = web1.example.com web2.example.com +#RT_ENABLED = 0 +RT_ENABLED = 1 +RT_DOMAIN = example.com +RT_TIMEZONE = 'US/Pacific'; +#RT_TIMEZONE = 'US/Eastern'; + #--- #not changable yet FREESIDE_CONF = /usr/local/etc/freeside +#rt/config.layout.in +RT_PATH = /opt/rt3 VERSION=1.5.0pre4 TAG=freeside_1_5_0pre4 @@ -125,6 +133,7 @@ install-docs: docs [ "${TEMPLATE}" = "mason" ] && \ perl -p -i -e "\ s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g; \ + s'%%%RT_ENABLED%%%'${RT_ENABLED}'g; \ " ${MASON_HANDLER} || true [ "${TEMPLATE}" = "mason" -a ! -e ${MASONDATA} ] && mkdir ${MASONDATA} || true [ "${TEMPLATE}" = "mason" ] && chown -R freeside ${MASONDATA} || true @@ -148,7 +157,7 @@ install-init: s/%%%SELFSERVICE_MACHINES%%%/${SELFSERVICE_MACHINES}/g;\ " ${INIT_FILE} -install: install-perl-modules install-docs install-init +install: install-perl-modules install-docs install-init install-rt deploy: install ${HTTPD_RESTART} @@ -191,20 +200,35 @@ configure-rt: s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g;\ s'%%%MASONDATA%%%'${MASONDATA}'g;\ " config.layout; \ - ./configure --with-layout=Freeside\ + ./configure --enable-layout=Freeside\ --with-db-type=Pg \ + --with-db-dba=${DB_USER} \ --with-db-database=freeside \ --with-db-rt-user=${DB_USER} \ --with-db-rt-pass=${DB_PASSWORD} \ --with-web-user=freeside \ - --with-web-group=www + --with-web-group=freeside \ + --with-rt-group=freeside create-rt: configure-rt cd rt; make install - rt/sbin/rt-setup-database --action schema - rt/sbin/rt-setup-database --action insert_initial - rt/sbin/rt-setup-database --action insert --datafile rt/etc/initialdata + echo -e "${DB_PASSWORD}\n\\d sessions"\ + | psql -UW ${DB_USER} freeside 2>&1\ + | grep '^Did not find'\ + && rt/sbin/rt-setup-database --dba '${DB_USER}' \ + --dba-password '${DB_PASSWORD}' \ + --action schema \ + || true + rt/sbin/rt-setup-database --action insert_initial \ + && rt/sbin/rt-setup-database --action insert --datafile ${RT_PATH}/etc/initialdata \ + || true + perl -p -i -e "\ + s'%%%RT_DOMAIN%%%'${RT_DOMAIN}'g;\ + s'%%%RT_TIMEZONE%%%'${RT_TIMEZONE}'g;\ + " ${RT_PATH}/etc/RT_SiteConfig.pm +install-rt: + [ ${RT_ENABLED} ] && cd rt; make install clean: rm -rf aspdocs masondocs diff --git a/htetc/handler.pl b/htetc/handler.pl index b81606a0a..d425c2270 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -35,12 +35,37 @@ use strict; # data_dir=>'/usr/local/etc/freeside/masondata', # out_mode=>'stream', # ); + +use vars qw($r); + +if ( %%%RT_ENABLED%%% ) { + eval ' + use lib ("/opt/rt3/local/lib", "/opt/rt3/lib"); + use RT; + use vars qw($Nobody $SystemUser); + RT::LoadConfig(); + '; + die $@ if $@; + + +} + + my $ah = new HTML::Mason::ApacheHandler ( #interp => $interp, #auto_send_headers => 0, - comp_root=>'%%%FREESIDE_DOCUMENT_ROOT%%%', + comp_root=> [ + [ 'freeside' => '%%%FREESIDE_DOCUMENT_ROOT%%%' ], + [ 'rt' => '%%%FREESIDE_DOCUMENT_ROOT%%%/rt' ], + ], data_dir=>'/usr/local/etc/freeside/masondata', #out_mode=>'stream', + + #RT + args_method => 'CGI', + default_escape_flags => 'h', + allow_globals => [qw(%session)], + #autoflush => 1, ); # Activate the following if running httpd as root (the normal case). @@ -50,7 +75,7 @@ my $ah = new HTML::Mason::ApacheHandler ( sub handler { - my ($r) = @_; + ($r) = @_; # If you plan to intermix images in the same directory as # components, activate the following to prevent Mason from @@ -62,7 +87,8 @@ sub handler { package HTML::Mason::Commands; use strict; use vars qw( $cgi $p ); - use CGI 2.47; + use vars qw( %session ); + use CGI 2.47 qw(-private_tempfiles); #use CGI::Carp qw(fatalsToBrowser); use Date::Format; use Date::Parse; @@ -125,6 +151,32 @@ sub handler use FS::export_svc; use FS::msgcat; + if ( %%%RT_ENABLED%%% ) { + eval ' + use RT::Tickets; + use RT::Transactions; + use RT::Users; + use RT::CurrentUser; + use RT::Templates; + use RT::Queues; + use RT::ScripActions; + use RT::ScripConditions; + use RT::Scrips; + use RT::Groups; + use RT::GroupMembers; + use RT::CustomFields; + use RT::CustomFieldValues; + use RT::TicketCustomFieldValues; + + use RT::Interface::Web; + use MIME::Entity; + use Text::Wrapper; + use CGI::Cookie; + use Time::ParseDate; + '; + die $@ if $@; + } + *CGI::redirect = sub { my( $self, $location ) = @_; use vars qw($m); @@ -205,7 +257,43 @@ sub handler # $r->send_http_header; - my $status = $ah->handle_request($r); + #$ah->interp->remove_escape('h'); + + if ( $r->filename =~ /\/rt\// ) { #RT + #warn "processing RT file". $r->filename. "; escaping for RT\n"; + + # MasonX::Request::ExtendedCompRoot + #$ah->interp->comp_root( '/rt'. $ah->interp->comp_root() ); + + $ah->interp->set_escape( h => \&RT::Interface::Web::EscapeUTF8 ); + + local $SIG{__WARN__}; + local $SIG{__DIE__}; + + RT::Init(); + + # We don't need to handle non-text items + return -1 if defined( $r->content_type ) && $r->content_type !~ m|^text/|io; + + } else { + $ah->interp->set_escape( 'h' => sub { ${$_[0]}; } ); + } + + my %session; + my $status; + eval { $status = $ah->handle_request($r); }; +#!! +# if ( $@ ) { +# $RT::Logger->crit($@); +# } + + undef %session; + +#!! +# if ($RT::Handle->TransactionDepth) { +# $RT::Handle->ForceRollback; +# $RT::Logger->crit("Transaction not committed. Usually indicates a software fault. Data loss may have occurred") ; +# } $status; } diff --git a/rt/FREESIDE_MODIFIED b/rt/FREESIDE_MODIFIED index cab7db3cf..84a9f5ea9 100644 --- a/rt/FREESIDE_MODIFIED +++ b/rt/FREESIDE_MODIFIED @@ -1,3 +1,5 @@ sbin/rt-setup-database +sbin/rt-setup-database.in config.layout config.layout.in +etc/RT_SiteConfig.pm diff --git a/rt/etc/RT_SiteConfig.pm b/rt/etc/RT_SiteConfig.pm index 0afc6045c..572a2baf6 100644 --- a/rt/etc/RT_SiteConfig.pm +++ b/rt/etc/RT_SiteConfig.pm @@ -1 +1,13 @@ +$RT::rtname = '%%%RT_DOMAIN%%%'; +$RT::Organization = '%%%RT_DOMAIN%%%'; + +$RT::Timezone = '%%%RT_TIMEZONE%%%'; + +$RT::WebBaseURL = ''; +$RT::WebPath = '/freeside/rt'; + +$RT::WebExternalAuth = 1; +$RT::WebFallbackToInternal = 1; #no +$RT::WebExternalAuto = 1; + 1; diff --git a/rt/sbin/rt-setup-database b/rt/sbin/rt-setup-database index 83e08270a..434e68671 100644 --- a/rt/sbin/rt-setup-database +++ b/rt/sbin/rt-setup-database @@ -592,6 +592,10 @@ $0: Set up RT's database --action init Initialize the database drop Drop the database. This will ERASE ALL YOUR DATA + insert_initial + Insert RT's core system objects + insert_initial + Insert RT's core system objects insert Insert data into RT's database. By default, will use RT's installation data. To use a local or supplementary datafile, specify it diff --git a/rt/sbin/rt-setup-database.in b/rt/sbin/rt-setup-database.in index 9e990e5b8..f37c69dc7 100644 --- a/rt/sbin/rt-setup-database.in +++ b/rt/sbin/rt-setup-database.in @@ -110,6 +110,9 @@ elsif ( $args{'action'} eq 'drop' ) { } drop_db(); } +elsif ( $args{'action'} eq 'insert_initial' ) { + insert_initial_data(); +} elsif ( $args{'action'} eq 'insert' ) { insert_data( $args{'datafile'} ); } @@ -589,6 +592,10 @@ $0: Set up RT's database --action init Initialize the database drop Drop the database. This will ERASE ALL YOUR DATA + insert_initial + Insert RT's core system objects + insert_initial + Insert RT's core system objects insert Insert data into RT's database. By default, will use RT's installation data. To use a local or supplementary datafile, specify it -- cgit v1.2.1 From b57bf99761751466c5b9a5d35df9e00b407c6f64 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 8 Apr 2004 12:05:04 +0000 Subject: remove accidentally doubled lines in usage inst --- rt/sbin/rt-setup-database | 2 -- rt/sbin/rt-setup-database.in | 2 -- 2 files changed, 4 deletions(-) diff --git a/rt/sbin/rt-setup-database b/rt/sbin/rt-setup-database index 434e68671..17819886c 100644 --- a/rt/sbin/rt-setup-database +++ b/rt/sbin/rt-setup-database @@ -594,8 +594,6 @@ $0: Set up RT's database This will ERASE ALL YOUR DATA insert_initial Insert RT's core system objects - insert_initial - Insert RT's core system objects insert Insert data into RT's database. By default, will use RT's installation data. To use a local or supplementary datafile, specify it diff --git a/rt/sbin/rt-setup-database.in b/rt/sbin/rt-setup-database.in index f37c69dc7..56f4e8763 100644 --- a/rt/sbin/rt-setup-database.in +++ b/rt/sbin/rt-setup-database.in @@ -594,8 +594,6 @@ $0: Set up RT's database This will ERASE ALL YOUR DATA insert_initial Insert RT's core system objects - insert_initial - Insert RT's core system objects insert Insert data into RT's database. By default, will use RT's installation data. To use a local or supplementary datafile, specify it -- cgit v1.2.1 From 4c4b4f8d7548e10b98a173de30e25174f7cd305a Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 8 Apr 2004 12:07:36 +0000 Subject: don't enable by default --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 70e588218..8a9921040 100644 --- a/Makefile +++ b/Makefile @@ -56,8 +56,8 @@ SELFSERVICE_USER = fs_selfservice SELFSERVICE_MACHINES = localhost # SELFSERVICE_MACHINES = web1.example.com web2.example.com -#RT_ENABLED = 0 -RT_ENABLED = 1 +RT_ENABLED = 0 +#RT_ENABLED = 1 RT_DOMAIN = example.com RT_TIMEZONE = 'US/Pacific'; #RT_TIMEZONE = 'US/Eastern'; -- cgit v1.2.1 From 9253dd9fd2a67d99b0de171eda9f614ec6815639 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 8 Apr 2004 12:23:00 +0000 Subject: fix quotes --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8a9921040..f631bf1b7 100644 --- a/Makefile +++ b/Makefile @@ -59,8 +59,8 @@ SELFSERVICE_MACHINES = localhost RT_ENABLED = 0 #RT_ENABLED = 1 RT_DOMAIN = example.com -RT_TIMEZONE = 'US/Pacific'; -#RT_TIMEZONE = 'US/Eastern'; +RT_TIMEZONE = US/Pacific; +#RT_TIMEZONE = US/Eastern; #--- -- cgit v1.2.1 From 179de7c7734515475859823659b0ffb1ddc59635 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 8 Apr 2004 12:37:17 +0000 Subject: fix psql command line options for older pg --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f631bf1b7..b99206c27 100644 --- a/Makefile +++ b/Makefile @@ -213,7 +213,7 @@ configure-rt: create-rt: configure-rt cd rt; make install echo -e "${DB_PASSWORD}\n\\d sessions"\ - | psql -UW ${DB_USER} freeside 2>&1\ + | psql -U ${DB_USER} -W freeside 2>&1\ | grep '^Did not find'\ && rt/sbin/rt-setup-database --dba '${DB_USER}' \ --dba-password '${DB_PASSWORD}' \ -- cgit v1.2.1 From 42b77edd5f8c054b1a05511d09563b9a663cfc14 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 9 Apr 2004 22:28:06 +0000 Subject: fs_passwd.cgi --- fs_passwd/fs_passwd.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs_passwd/fs_passwd.html b/fs_passwd/fs_passwd.html index fadc4df8b..7e06ecff1 100644 --- a/fs_passwd/fs_passwd.html +++ b/fs_passwd/fs_passwd.html @@ -9,6 +9,9 @@ Username + Domain + + Current password -- cgit v1.2.1 From 7db53b9364a0f78620f156d7c511facf57343e3d Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 9 Apr 2004 22:29:33 +0000 Subject: oops, this one too --- fs_passwd/fs_passwd.cgi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs_passwd/fs_passwd.cgi b/fs_passwd/fs_passwd.cgi index 34a33c7f5..38b70d0cf 100755 --- a/fs_passwd/fs_passwd.cgi +++ b/fs_passwd/fs_passwd.cgi @@ -22,6 +22,9 @@ my $cgi = new CGI; $cgi->param('username') =~ /^([^\n]{0,255}$)/ or die "Illegal username"; my $me = $1; +$cgi->param('domain') =~ /^([^\n]{0,255}$)/ or die "Illegal domain"; +my $domain = $1; + $cgi->param('old_password') =~ /^([^\n]{0,255}$)/ or die "Illegal old_password"; my $old_password = $1; @@ -33,6 +36,7 @@ die "New passwords don't match" my $rv = passwd( 'username' => $me, + 'domain' => $domain, 'old_password' => $old_password, 'new_password' => $new_password, ); -- cgit v1.2.1 From ed8a6d06b1ed8b13132898d3b05c8b81d63d1038 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 9 Apr 2004 22:33:19 +0000 Subject: properly disable RT where not using --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b99206c27..5c7f15537 100644 --- a/Makefile +++ b/Makefile @@ -228,7 +228,7 @@ create-rt: configure-rt " ${RT_PATH}/etc/RT_SiteConfig.pm install-rt: - [ ${RT_ENABLED} ] && cd rt; make install + [ ${RT_ENABLED} -eq 1 ] && cd rt; make install clean: rm -rf aspdocs masondocs -- cgit v1.2.1 From e28f678a7dff5f66b8efbdf7c2eb2b8f321c6ee0 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 9 Apr 2004 22:34:45 +0000 Subject: really properly disable RT where not using --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5c7f15537..34e06db78 100644 --- a/Makefile +++ b/Makefile @@ -228,7 +228,7 @@ create-rt: configure-rt " ${RT_PATH}/etc/RT_SiteConfig.pm install-rt: - [ ${RT_ENABLED} -eq 1 ] && cd rt; make install + [ ${RT_ENABLED} -eq 1 ] && cd rt; make install || true clean: rm -rf aspdocs masondocs -- cgit v1.2.1 From 71cdb6ad901465cdc9326cfc3d3650f3aabda5aa Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 9 Apr 2004 22:35:45 +0000 Subject: thank goodness its friday --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 34e06db78..3b3a4d003 100644 --- a/Makefile +++ b/Makefile @@ -228,7 +228,7 @@ create-rt: configure-rt " ${RT_PATH}/etc/RT_SiteConfig.pm install-rt: - [ ${RT_ENABLED} -eq 1 ] && cd rt; make install || true + [ ${RT_ENABLED} -eq 1 ] && ( cd rt; make install ) || true clean: rm -rf aspdocs masondocs -- cgit v1.2.1 From 76e907f24d984319b7c1e0e9374b99535a99ab43 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 Apr 2004 01:50:47 +0000 Subject: update unearned revenue report based on feedback from kevin --- httemplate/search/report_prepaid_income.cgi | 91 ++++++++++++++++------------ httemplate/search/report_prepaid_income.html | 24 +++++++- 2 files changed, 74 insertions(+), 41 deletions(-) diff --git a/httemplate/search/report_prepaid_income.cgi b/httemplate/search/report_prepaid_income.cgi index eb8bbb55e..1677591a3 100644 --- a/httemplate/search/report_prepaid_income.cgi +++ b/httemplate/search/report_prepaid_income.cgi @@ -5,11 +5,13 @@ #needs to be re-written in sql for efficiency - my $now = $cgi->param('date') && str2time($cgi->param('date')) || time; + my $time = time; + + my $now = $cgi->param('date') && str2time($cgi->param('date')) || $time; $now =~ /^(\d+)$/ or die "unparsable date?"; $now = $1; - my %prepaid; + my( $total, $total_legacy ) = ( 0, 0 ); my @cust_bill_pkg = grep { $_->cust_pkg && $_->cust_pkg->part_pkg->freq !~ /^([01]|\d+[dw])$/ } @@ -18,58 +20,67 @@ 'edate' => { op=>'>', value=>$now }, }, ); - foreach my $cust_bill_pkg ( @cust_bill_pkg ) { + my @cust_pkg = + grep { $_->part_pkg->recur != 0 + && $_->part_pkg->freq !~ /^([01]|\d+[dw])$/ + } + qsearch ( 'cust_pkg', { + 'bill' => { op=>'>', value=>$now } + } ); - #conceptual false laziness w/texas tax exempt_amount stuff in - #FS::cust_main::bill + foreach my $cust_bill_pkg ( @cust_bill_pkg) { + my $period = $cust_bill_pkg->edate - $cust_bill_pkg->sdate; - my $freq = $cust_bill_pkg->cust_pkg->part_pkg->freq; - my $per_month = sprintf("%.2f", $cust_bill_pkg->recur / $freq); + my $elapsed = $now - $cust_bill_pkg->sdate; + $elapsed = 0 if $elapsed < 0; - my($mon, $year) = (localtime($cust_bill_pkg->sdate) )[4,5]; - $mon+=2; $year+=1900; + my $remaining = 1 - $elapsed/$period; - foreach my $which_month ( 2 .. $freq ) { - until ( $mon < 13 ) { $mon -= 12; $year++; } - $prepaid{"$year-$mon"} += $per_month; - $mon++; - } + my $unearned = $remaining * $cust_bill_pkg->recur; + $total += $unearned; } - my @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); + foreach my $cust_pkg ( @cust_pkg ) { + my $period = $cust_pkg->bill - $cust_pkg->last_bill; -%> + my $elapsed = $now - $cust_pkg->last_bill; + $elapsed = 0 if $elapsed < 0; -<%= header( 'Prepaid Income (Unearned Revenue) Report', - menubar( 'Main Menu'=>$p, ) ) %> -<%= table() %> -<% + my $remaining = 1 - $elapsed/$period; - my $total = 0; - - my ($now_mon, $now_year) = (localtime($now))[4,5]; - $now_mon+=2; $now_year+=1900; - until ( $now_mon < 13 ) { $now_mon -= 12; $now_year++; } - - my $subseq = 0; - for my $year ( $now_year .. 2037 ) { - for my $mon ( ( $subseq++ ? 1 : $now_mon ) .. 12 ) { - if ( $prepaid{"$year-$mon"} ) { - $total += $prepaid{"$year-$mon"}; - %> <%= $mon[$mon-1]. ' '. $year %> - - <%= sprintf("%.2f", $prepaid{"$year-$mon"} ) %> - - - <% - } - } + my $unearned = $remaining * $cust_pkg->part_pkg->recur; #!! only works for flat/legacy + $total_legacy += $unearned; } + $total = sprintf('%.2f', $total); + $total_legacy = sprintf('%.2f', $total_legacy); + %> -Total<%= sprintf("%.2f", $total) %> + +<%= header( 'Prepaid Income (Unearned Revenue) Report', + menubar( 'Main Menu'=>$p, ) ) %> +<%= table() %> + + Actual Unearned Revenue + Legacy Unearned Revenue + + + $<%= $total %> + + <%= $now == $time ? "\$$total_legacy" : 'N/A'%> + + + +
+Actual unearned revenue is the amount of unearned revenue Freeside has +actually invoiced for packages with longer-than monthly terms. +

+Legacy unearned revenue is the amount of unearned revenue represented by +customer packages. This number may be larger than actual unearned +revenue if you have imported longer-than monthly customer packages from +a previous billing system. diff --git a/httemplate/search/report_prepaid_income.html b/httemplate/search/report_prepaid_income.html index b85a481be..e8b6ac4b1 100644 --- a/httemplate/search/report_prepaid_income.html +++ b/httemplate/search/report_prepaid_income.html @@ -9,7 +9,29 @@

Prepaid Income (Unearned Revenue) Report

- Prepaid income (unearned revenue) as of + + + + + + + + + +
Prepaid income (unearned revenue) as of + + +
+ m/d/y
+ + -- cgit v1.2.1 From 625a49b4b28777e550a321f52f9cc5157a2b580b Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 13 Apr 2004 18:27:20 +0000 Subject: adding comments for fedora --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3b3a4d003..bf73202f6 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ MASONDATA = /usr/local/etc/freeside/masondata #deb FREESIDE_DOCUMENT_ROOT = /var/www/freeside -#redhat, mandrake +#redhat, fedora, mandrake #FREESIDE_DOCUMENT_ROOT = /var/www/html/freeside #freebsd #FREESIDE_DOCUMENT_ROOT = /usr/local/www/data/freeside @@ -24,14 +24,14 @@ FREESIDE_DOCUMENT_ROOT = /var/www/freeside #suse #FREESIDE_DOCUMENT_ROOT = /srv/www/htdocs/freeside -#deb, redhat, mandrake, suse, others? +#deb, redhat, fedora, mandrake, suse, others? INIT_FILE = /etc/init.d/freeside #freebsd #INIT_FILE = /usr/local/etc/rc.d/011.freeside.sh #deb, suse HTTPD_RESTART = /etc/init.d/apache restart -#redhat, mandrake +#redhat, fedora, mandrake #HTTPD_RESTART = /etc/init.d/httpd restart #freebsd #HTTPD_RESTART = /usr/local/etc/rc.d/apache.sh stop; sleep 1; /usr/local/etc/rc.d/apache.sh start @@ -40,7 +40,7 @@ HTTPD_RESTART = /etc/init.d/apache restart FREESIDE_RESTART = ${INIT_FILE} restart -#deb, redhat, mandrake, suse, others? +#deb, redhat, fedora, mandrake, suse, others? INSTALLGROUP = root #freebsd, openbsd #INSTALLGROUP = wheel -- cgit v1.2.1 From df33a04853368c1ccb95ea1718b1ebad93b78672 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 13 Apr 2004 20:01:57 +0000 Subject: adding forgotten test --- FS/t/part_export-communigate_pro.t | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 FS/t/part_export-communigate_pro.t diff --git a/FS/t/part_export-communigate_pro.t b/FS/t/part_export-communigate_pro.t new file mode 100644 index 000000000..88b8b64e0 --- /dev/null +++ b/FS/t/part_export-communigate_pro.t @@ -0,0 +1,5 @@ +BEGIN { $| = 1; print "1..1\n" } +END {print "not ok 1\n" unless $loaded;} +use FS::part_export::communigate_pro; +$loaded=1; +print "ok 1\n"; -- cgit v1.2.1