20ef1467d7ca1e536e2eca8056b45b06f26ca531
[freeside.git] / htetc / global.asa
1 use strict;
2 use vars qw( $cgi $p );
3 use CGI;
4 #use CGI::Carp qw(fatalsToBrowser);
5 use HTML::Entities;
6 use Date::Format;
7 use Date::Parse;
8 use Tie::IxHash;
9 use FS::UID qw(cgisuidsetup dbh);
10 use FS::Record qw(qsearch qsearchs fields);
11 use FS::part_svc;
12 use FS::part_pkg;
13 use FS::pkg_svc;
14 use FS::cust_pkg;
15 use FS::cust_svc;
16 use FS::part_bill_event;
17 use FS::CGI qw(header menubar popurl table itable ntable);
18
19 sub Script_OnStart {
20   $cgi = new CGI;
21   &cgisuidsetup($cgi);
22   $p = popurl(2);
23   #print $cgi->header( '-expires' => 'now' );
24 }
25
26 sub Script_OnFlush {
27   my $ref = $Response->{BinaryRef};
28   $$ref = $cgi->header( @FS::CGI::header ) . $$ref;
29   if ( dbh->can('sprintProfile') ) {
30
31     $$ref =~ s/<\/BODY>[\s\n]*<\/HTML>[\s\n]*$//i
32       or warn "can't remove";
33   
34     $$ref .= '<PRE>'. ("\n"x96). encode_entities(dbh->sprintProfile()). '</PRE>';
35
36     $$ref .= '</BODY></HTML>';
37     
38     dbh->{'private_profile'} = {};
39   }
40 }