From a44fcf8b6fb405c09a47de27b32fcb19f121dcae Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Mar 2004 15:38:48 +0000 Subject: catch misconfigured exports --- httemplate/edit/part_export.cgi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 4d0c7391f..b3d42bd96 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -46,6 +46,8 @@ my $widget = new HTML::Widgets::SelectLayers( foreach my $option ( keys %{$exports->{$layer}{options}} ) { my $optinfo = $exports->{$layer}{options}{$option}; + die "Retreived non-ref export info option from $layer export: $optinfo" + unless ref($optinfo); my $label = $optinfo->{label}; my $type = defined($optinfo->{type}) ? $optinfo->{type} : 'text'; my $value = $cgi->param($option) -- cgit v1.2.1 From 4b157c989b4089b49f42fa5c5bbb9969f2064caa Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 30 Mar 2004 17:13:01 +0000 Subject: little more explanation about editing Pg dumps --- httemplate/docs/upgrade10.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/upgrade10.html b/httemplate/docs/upgrade10.html index 14e308544..205866e73 100644 --- a/httemplate/docs/upgrade10.html +++ b/httemplate/docs/upgrade10.html @@ -188,12 +188,12 @@ UPDATE pg_attribute SET attnotnull = FALSE WHERE ( attname = 'srcsvc' OR attname If you created your database with a version before 1.4.2, dump database, edit: - cust_main and h_cust_main: increase otaker from 8 to 32 -- cust_main and h_cust_main: change ss from char(11) to varchar(11) +- cust_main and h_cust_main: change ss from char(11) to varchar(11) ( "character(11)" to "character varying(11)" ) - cust_credit and h_cust_credit: increase otaker from 8 to 32 - cust_pkg and h_cust_pkg: increase otaker from 8 to 32 - cust_refund and h_cust_refund: increase otaker from 8 to 32 - domain_record and h_domain_record: increase reczone from 80 to 255 -- domain_record and h_domain_record: change rectype from char to varchar +- domain_record and h_domain_record: change rectype from char to varchar ( "character(5)" to "character varying(5)" ) - domain_record and h_domain_record: increase recdata from 80 to 255 then reload -- cgit v1.2.1 From 68d86148eadaadb6706b91df58d7b505269b1cdf Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 1 Apr 2004 10:56:31 +0000 Subject: add a yesterday column and a total row, closes: Bug#797 --- httemplate/browse/part_referral.cgi | 60 +++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 13 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index 3f59abcf5..a326bd231 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -10,31 +10,46 @@ Where a customer heard about your service. Tracked for informational purposes. <% my $today = timelocal(0, 0, 0, (localtime(time))[3..5] ); - my %past; - tie %past, 'Tie::IxHash', + my %after; + tie %after, 'Tie::IxHash', 'Today' => 0, + 'Yesterday' => 86400, # 60sec * 60min * 24hrs 'Past week' => 518400, # 60sec * 60min * 24hrs * 6days 'Past 30 days' => 2505600, # 60sec * 60min * 24hrs * 29days - 'Past 60 days' => 5097600, # 60sec * 60min * 24hrs * 29days - 'Past 90 days' => 7689600, # 60sec * 60min * 24hrs * 29days + 'Past 60 days' => 5097600, # 60sec * 60min * 24hrs * 59days + 'Past 90 days' => 7689600, # 60sec * 60min * 24hrs * 89days 'Past 6 months' => 15724800, # 60sec * 60min * 24hrs * 182days 'Past year' => 31486000, # 60sec * 60min * 24hrs * 364days 'Total' => $today, ; + my %before = ( + 'Today' => 86400, # 60sec * 60min * 24hrs + 'Yesterday' => 0, + 'Past week' => 86400, # 60sec * 60min * 24hrs + 'Past 30 days' => 86400, # 60sec * 60min * 24hrs + 'Past 60 days' => 86400, # 60sec * 60min * 24hrs + 'Past 90 days' => 86400, # 60sec * 60min * 24hrs + 'Past 6 months' => 86400, # 60sec * 60min * 24hrs + 'Past year' => 86400, # 60sec * 60min * 24hrs + 'Total' => 86400, # 60sec * 60min * 24hrs + ); - my $sth = dbh->prepare("SELECT COUNT(*) FROM h_cust_main - WHERE history_action = 'insert' - AND refnum = ? - AND history_date > ? ") + my $statement = "SELECT COUNT(*) FROM h_cust_main + WHERE history_action = 'insert' + AND refnum = ? + AND history_date >= ? + AND history_date < ? + "; + my $sth = dbh->prepare($statement) or die dbh->errstr; %> <%= table() %> Advertising source - >Customers + >Customers -<% for my $period ( keys %past ) { %> +<% for my $period ( keys %after ) { %> <%= $period %> <% } %> @@ -49,9 +64,11 @@ foreach my $part_referral ( sort { <%= $part_referral->refnum %> <%= $part_referral->referral %> - <% for my $period ( values %past ) { - $sth->execute($part_referral->refnum, $today-$period) - or die $sth->errstr; + <% for my $after ( values %after ) { + $sth->execute( $part_referral->refnum, + $today-$after, + $today+$before{$today}, + ) or die $sth->errstr; my $number = $sth->fetchrow_arrayref->[0]; %> <%= $number %> @@ -59,6 +76,23 @@ foreach my $part_referral ( sort { <% } %> +<% + $statement =~ s/AND refnum = \?//; + $sth = dbh->prepare($statement) + or die dbh->errstr; +%> + + Total + <% for my $after ( values %after ) { + $sth->execute( $today-$after, + $today+$before{$today}, + ) or die $sth->errstr; + my $number = $sth->fetchrow_arrayref->[0]; + %> + <%= $number %> + <% } %> + + -- cgit v1.2.1 From 95d7eccb2a441d225257181eb8db0911f38a5176 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 1 Apr 2004 11:09:28 +0000 Subject: oops! --- httemplate/browse/part_referral.cgi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index a326bd231..25397e1da 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -64,10 +64,10 @@ foreach my $part_referral ( sort { <%= $part_referral->refnum %> <%= $part_referral->referral %> - <% for my $after ( values %after ) { + <% for my $period ( keys %after ) { $sth->execute( $part_referral->refnum, - $today-$after, - $today+$before{$today}, + $today-$after{$period}, + $today+$before{$period}, ) or die $sth->errstr; my $number = $sth->fetchrow_arrayref->[0]; %> @@ -83,9 +83,9 @@ foreach my $part_referral ( sort { %> Total - <% for my $after ( values %after ) { - $sth->execute( $today-$after, - $today+$before{$today}, + <% for my $period ( keys %after ) { + $sth->execute( $today-$after{$period}, + $today+$before{$period}, ) or die $sth->errstr; my $number = $sth->fetchrow_arrayref->[0]; %> -- cgit v1.2.1 From 7ca594813a8426beb70d9f61544be1f6ac7b3d3f Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 1 Apr 2004 11:14:34 +0000 Subject: remove extraneous html --- httemplate/browse/part_referral.cgi | 1 - 1 file changed, 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index 25397e1da..581e01bb6 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -92,7 +92,6 @@ foreach my $part_referral ( sort { <%= $number %> <% } %> - -- cgit v1.2.1 From ea72b6b09a472a989e60fe5bba1884a629907e37 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 2 Apr 2004 11:23:34 +0000 Subject: add a fake .pdf extension to placate some versions of IE. yay IE. --- httemplate/view/cust_bill-pdf.cgi | 2 +- httemplate/view/cust_bill.cgi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_bill-pdf.cgi b/httemplate/view/cust_bill-pdf.cgi index 7aa69100d..4578b7b9c 100755 --- a/httemplate/view/cust_bill-pdf.cgi +++ b/httemplate/view/cust_bill-pdf.cgi @@ -2,7 +2,7 @@ #untaint invnum my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; +$query =~ /^(\d+)(.pdf)?$/; my $invnum = $1; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 50ee8b36c..7906af65b 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -31,7 +31,7 @@ print '

'; my $conf = new FS::Conf; if ( $conf->exists('invoice_latex') ) { print menubar( - 'View typeset invoice' => "${p}view/cust_bill-pdf.cgi?$invnum", + 'View typeset invoice' => "${p}view/cust_bill-pdf.cgi?$invnum.pdf", ), '

'; } -- cgit v1.2.1 From e5f676566d9fd2dd61d5e48c26ccd9f4387f8cc8 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 2 Apr 2004 13:44:56 +0000 Subject: remove Pragma:no-cache header, and set Content-Length and Cache-Control for viewing .pdf invoices with IE over SSL. http://support.microsoft.com/default.aspx?scid=kb;en-us;323308 --- httemplate/view/cust_bill-pdf.cgi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_bill-pdf.cgi b/httemplate/view/cust_bill-pdf.cgi index 4578b7b9c..2a86c3246 100755 --- a/httemplate/view/cust_bill-pdf.cgi +++ b/httemplate/view/cust_bill-pdf.cgi @@ -8,6 +8,10 @@ my $invnum = $1; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Invoice #$invnum not found!" unless $cust_bill; +my $pdf = $cust_bill->print_pdf; + http_header('Content-Type' => 'application/pdf' ); +http_header('Content-Length' => length($pdf) ); +http_header('Cache-control' => 'max-age=60' ); %> -<%= $cust_bill->print_pdf %> +<%= $pdf %> -- cgit v1.2.1 From 6211a2be71abf13187aaf10f3923ba377ae4c73e Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 3 Apr 2004 00:45:38 +0000 Subject: UI: stop making things small for no reason --- httemplate/search/cust_bill.cgi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 985e3dbf5..5b0538ca3 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -125,10 +125,10 @@ END my $view = popurl(2). "view/cust_bill.cgi?$invnum"; print < - $invnum - \$$owed - \$$charged - $pdate + $invnum + \$$owed + \$$charged + $pdate END my $custnum = $cust_bill->custnum; my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); @@ -139,8 +139,8 @@ END $cust_main->company, ); print <$name - $company + $name + $company END } else { print <$pager
". table(). <       Total
Balance
Total
Amount
- \$$tot_balance\$$tot_amount +        Total
BalanceTotal
Amount + \$$tot_balance\$$tot_amount -- cgit v1.2.1 From 304ad881f4bdfe687e7be5b76d46de916b01cdcd Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 4 Apr 2004 22:14:59 +0000 Subject: comment out extraneous warning --- httemplate/view/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index e8ea9943e..dd9cd3075 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -899,7 +899,7 @@ sub get_packages { ) ) { - warn "svcnum ". $cust_svc->svcnum. " / svcpart ". $cust_svc->svcpart. "\n"; + #warn "svcnum ". $cust_svc->svcnum. " / svcpart ". $cust_svc->svcpart. "\n"; my $svc = { 'svcnum' => $cust_svc->svcnum, 'label' => ($cust_svc->label)[1], -- cgit v1.2.1 From a5651d5945c790b0d3fee0cd5082269a21adc6ee Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 5 Apr 2004 09:08:39 +0000 Subject: add whois functionality internally instead of linking to geektools --- httemplate/docs/install.html | 2 +- httemplate/docs/upgrade-1.4.2.html | 1 + httemplate/misc/whois.cgi | 25 +++++++++++++++++++++++++ httemplate/view/svc_domain.cgi | 2 +- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 httemplate/misc/whois.cgi (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 5f2ca4ca6..41aacc51b 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -30,7 +30,7 @@ Before installing, you need:
  • HTML-Parser
  • libnet
  • Locale-Codes -
  • Net-Whois +
  • Net-Whois-Raw
  • libwww-perl
  • Business-CreditCard diff --git a/httemplate/docs/upgrade-1.4.2.html b/httemplate/docs/upgrade-1.4.2.html index b8c5fcf7e..eb40df8b3 100644 --- a/httemplate/docs/upgrade-1.4.2.html +++ b/httemplate/docs/upgrade-1.4.2.html @@ -14,6 +14,7 @@
  • Install Cache::Cache.
  • Install Net::SSH 0.08.
  • Install Crypt::PasswdMD5 +
  • Install Net::Whois::Raw
  • CGI.pm minimum version 2.47 is required. You will probably need to install a current CGI.pm from CPAN if you are using Perl 5.005 or earlier.
  • If using Apache::ASP, add PerlSetVar RequestBinaryRead Off to your Apache configuration and make sure you are using Apache::ASP minimum version 2.55.
  • Run make aspdocs or make masondocs. diff --git a/httemplate/misc/whois.cgi b/httemplate/misc/whois.cgi new file mode 100644 index 000000000..dd7851dc2 --- /dev/null +++ b/httemplate/misc/whois.cgi @@ -0,0 +1,25 @@ +<% + my $svcnum = $cgi->param('svcnum'); + my $custnum = $cgi->param('custnum'); + my $domain = $cgi->param('domain'); + +%> +<%= header("Whois $domain", menubar( + ( $custnum + ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : () + ), + "View this domain (#$svcnum)" => "${p}view/svc_domain.cgi?$svcnum", + "Main menu" => $p, +)) %> +<% my $whois = eval { whois($domain) }; + if ( $@ ) { + ( $whois = $@ ) =~ s/ at \/.*Net\/Whois\/Raw\.pm line \d+.*$//s; + } else { + $whois =~ s/^\n+//; + } +%> +
    <%= $whois %>
    + + diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index e4b16d998..1dbe16d23 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -47,7 +47,7 @@ Service #<%= $svcnum %>
    Domain name: <%= $domain %>
    Catch all email (change): <%= $email ? "$email" : "(none)" %> -

    View whois information. +

    View whois information.