- should finish off the part_svc -> part_export s/one-to-many/many-to-many/
[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 Date::Format;
6 use Date::Parse;
7 use Tie::IxHash;
8 use HTML::Entities;
9 use IO::Handle;
10 use IO::File;
11 use String::Approx qw(amatch);
12 use HTML::Widgets::SelectLayers;
13 use FS::UID qw(cgisuidsetup dbh getotaker datasrc driver_name);
14 use FS::Record qw(qsearch qsearchs fields dbdef);
15 use FS::Conf;
16 use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot
17                small_custview myexit);
18 use FS::Msgcat qw(gettext geterror);
19
20 use FS::agent;
21 use FS::agent_type;
22 use FS::domain_record;
23 use FS::cust_bill;
24 use FS::cust_bill_pay;
25 use FS::cust_credit;
26 use FS::cust_credit_bill;
27 use FS::cust_main;
28 use FS::cust_main_county;
29 use FS::cust_pay;
30 use FS::cust_pkg;
31 use FS::cust_refund;
32 use FS::cust_svc;
33 use FS::nas;
34 use FS::part_bill_event;
35 use FS::part_pkg;
36 use FS::part_referral;
37 use FS::part_svc;
38 use FS::pkg_svc;
39 use FS::port;
40 use FS::queue qw(joblisting);
41 use FS::raddb;
42 use FS::session;
43 use FS::svc_acct;
44 use FS::svc_acct_pop qw(popselector);
45 use FS::svc_acct_sm;
46 use FS::svc_domain;
47 use FS::svc_forward;
48 use FS::svc_www;
49 use FS::type_pkgs;
50 use FS::part_export;
51 use FS::part_export_option;
52 use FS::export_svc;
53 use FS::msgcat;
54
55 sub Script_OnStart {
56   $Response->AddHeader('Pragma' => 'no-cache');
57   $Response->AddHeader('Cache-control' => 'no-cache');
58 #  $Response->AddHeader('Expires' => 0);
59   $Response->{Expires} = -36288000;
60
61   $cgi = new CGI;
62   &cgisuidsetup($cgi);
63   $p = popurl(2);
64   #print $cgi->header( '-expires' => 'now' );
65 }
66
67 sub Script_OnFlush {
68   my $ref = $Response->{BinaryRef};
69   $$ref = $cgi->header( @FS::CGI::header ) . $$ref;
70   if ( dbh->can('sprintProfile') ) {
71
72     $$ref =~ s/<\/BODY>[\s\n]*<\/HTML>[\s\n]*$//i
73       or warn "can't remove";
74   
75     #$$ref .= '<PRE>'. ("\n"x96). encode_entities(dbh->sprintProfile()). '</PRE>';
76     #  wtf?  konqueror...
77     $$ref .= '<PRE>'. ("\n"x4096). encode_entities(dbh->sprintProfile()). '</PRE>';
78
79     $$ref .= '</BODY></HTML>';
80     
81     dbh->{'private_profile'} = {};
82   }
83 }