use lib "D:/WebContent/Archive/modules"; # use strict; use warnings; # use win32::EventLog; use ArchiveInput; use ArchiveOutput; use ArchiveRender; use Win32::ODBC; ####################################################################################################### my %in = (); my $deny = '[^a-zA-Z0-9 \-\_\/\(\)\,\.\:]'; my %clean = ( 'K', '^(-?\d{1,2})$' , # key (index) to search 'Q', '^([^&=|`\x5C]{1,25})$', # query (value) to search for in key 'R', '^([^&=|`\x5C]{1,200})$', # query match to start list from (for scrolling through list) 'A', '^(.{1,50})$', # account number 'OA', '^(.{1,50})$', # old account number 'P', '^(\d{1,6})$', # page number 'S', '^([012345]{1})$', # size for GIF display 'D', '^(.{1,50})$', # document for account (typically just a date) 'DT', '^(.{1,16})$', 'DF', '^(.{1,256})$', 'DO', '^([0-9A-Z]{1,16})$', 'O', '^([0-3])$', 'F', '^([124])$', 'DB', '^([a-zA-Z0-9]{1,99})$', # CHANGE 10-20-2005 set DB length to 99 'I', '^([0-2])$', 'Z', '^([0-1])$', 'ARCGUID','^(.{1,100})$', #dmw - added key 'IACGUID','^(.{1,100})$', #dmw - added key 'VTGGUID','^(.{1,100})$', #dmw - added key 'SSN', '^(.{1,100})$' , 'UserID','^(.{1,100})$' , 'CaseNo','^(.{1,100})$' , ); my %default = ( 'K', '', 'Q', '', 'R', '', 'A', '', 'OA', '', 'P', 1, 'S', 1, 'D', '', 'DT', '', 'DF', '', 'DO', '', 'O', 0, 'F', 1, 'DB', '', 'I', 0, 'Z', 0, 'ARCGUID', '', #dmw - added key 'IACGUID', '', #dmw - added key 'VTGGUID', '', #dmw - added key 'SSN', 'x' , 'UserID','x' , 'CaseNo','x' , ); my $forcepdf=0; # force the documents to be shown as PDFs in an IFRAME my $framegifs=0; # force GIFs to be displayed in IFRAMES, disables side-by-side viewing (0=off, 1=just gif, 2=gif in relay page) my $batchselect=0; # show selection checkboxes in search results listing documents my %substitute = (); my $interface="agent-access.plx"; my $image="imagea.plx"; my $relay="relay.plx"; my $imgdirectory='../images'; my $advanceby=5; my $includepath = 'D:/WebContent/Archive/templates/'; my $page; my @rx=(512,640,800,1024,1280,1600); my @ry=(662,828,1035,1325,1656,2070); my @accounts; my @search; my @documents; my @reports; my $found; my $temp; my $lastpage; my $lastset; my $i; my $larger; my $smaller; my $next; my $previous; my $forward; my $backward; my $rotleft; my $rotright; my $facing; my $reportname; my $reportpage; my $reportpagecount; my $recaccount; my $recname; my $recaddress; my $reckey; my $html; my $selected; my $checkaccount; my @indexlist; my $index; my $indexfound; my $indexnumber; my $indexflags; my $indexdescription; my @databaselist; my $dbshort; my $dbdescription; my $matchvalue; my $matchaccount; my $matchdocument; my $matchtype; my $matchfile; my $matchoffset; my $matchpages; my $column; my $row; my @rowcolumns; my $searchtable = "cellpadding=\"3\" class=\"outline\""; my $searchtitle = "class=\"headers\""; my $searchrow = "bgcolor=\"#BBBBFF\""; my $linkset; my $imageurl; my $baseurl; my $input = new ArchiveInput(\%in,\%clean,\%default,$deny); my $output = new ArchiveOutput(); my $archive = new ArchiveRender("ip,7003",300); # CHANGE 10-20-2005 Changed timeout from default 120 to 300 #added DMW ****************************************** # Init Vars my %info; my $GUID = ''; my $UserID = $ENV{HTTP_SYMUSER}; my $CaseNo = "x"; my $SSN = "x"; my $ReturnCode= 9; my $sqldatabase; my $whichguid; # my @aawevent; # Retrieve GUID from URL and set Variables; fail if no GUID if ($in{ARCGUID} ne '') { $in{DB} = "RetirementServicesStatements"; # CHANGE 10-20-2005 removed access to RetAll database $GUID = $in{ARCGUID}; $whichguid = 'ARCGUID'; } elsif ($in{IACGUID} ne '') { $in{DB} = "IndividualStatements"; $GUID = $in{IACGUID}; $whichguid = 'IACGUID'; } elsif ($in{VTGGUID} ne '') { $in{DB} = "RetirementServicesStatements"; # CHANGE 10-20-2005 removed access to RetAll database $GUID = $in{VTGGUID}; $whichguid = 'VTGGUID'; } else { print "Content-type: text/html\n\n"; print "Invalid Access - No GUID Supplied"; die; #where's my guid!!! } # Call SQL $sqldatabase = new Win32::ODBC("DSN=;uid=;pwd="); # Init Connection if( ! $sqldatabase->Sql( "exec spf_SessionData_s02 '$GUID','$UserID',$CaseNo,$SSN,$ReturnCode" ) ) # Only proceed if ReturnCode is 0 { while( $sqldatabase->FetchRow() ) { $in{SSN} = $sqldatabase->Data ('SSN'); # Get SSN $in{CaseNo} = $sqldatabase->Data ('CaseNo'); #Get CaseNo (Account Number) $in{ReturnCode} = $sqldatabase->Data ('ReturnCode'); #Get CaseNo (Account Number) } }else{ print "Content-type: text/html\n\n"; print "Invalid Access - Credentials cannot be verified"; $sqldatabase->Close(); # Close Database Connection # CHANGE 10-26-2005 die; #Bad user! No Document for you! } $sqldatabase->Close(); # Close Database Connection if ( $in{ReturnCode} == 0){ # do nothing } else { print "Content-type: text/html\n\n"; if ( $in{ReturnCode} == 1){ print "The requested customer statement is not available."; } elsif ( $in{ReturnCode} == 2){ print "The requested customer statement is not available."; } elsif ( $in{ReturnCode} == 3){ print "Session timed out. To view statements for this account please start a new session by closing this window, clicking on the ‘Another Account’ tab, and re-entering the account number."; } die; } if ($in{ARCGUID} ne '') { # If ARC, Filter results based on SSN $in{Q} = $in{SSN}; $in{K} = 5; # MDW clumsy - should just use the replace operator... replace - with nothing... # my @SSNparts = (' ',' ',' '); # @SSNparts = split (/-/, $in{SSN}); # $in{SSN} = $SSNparts[0] . $SSNparts[1] . $SSNparts[2]; $in{SSN} =~ s/-//g; } elsif ($in{IACGUID} ne '') { # If IRC, Show results based on Date $in{K} = 2; } elsif ($in{VTGGUID} ne '') { # If VTG, Show results based on Date $in{K} = 2; } $in{A} = $in{CaseNo}; # Set the Account number to the encoded account number # $in{OA} = $in{A}; # " $in{SSN} = ''; $in{UserID} = ''; $in{CaseNo} = ''; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # validate database parameter # @databaselist=$archive->queryExtendedDatabaseList(); # @databaselist=('mtc1;Metacode Data','afp1;AFP Data'); # @databaselist=('Contracts;Contracts','RetirementServicesStatements;Statements','RetirementServicesBillingStatements;Billing Statements','RetirementServicesCorrespondence;Correspondence','Archie;Archie','RetAll;All'); $found='NO'; foreach $temp (@databaselist) { ($dbshort,$dbdescription)=split(/;/,$temp); if($in{DB} eq $dbshort) { $found='YES' } } if ($found ne 'YES') { ($in{DB})=split(/;/,$databaselist[0]); } $archive->setdatabase($in{DB}); # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ####################################################################################################### # # determine operating mode # $page='default'; $page='search'; # multiple matches if ($in{OA} ne '') { $page='view'; # we are viewing an account } else { @indexlist=$archive->queryExtendedQueryList(); if ($in{K} ne '') { $indexfound=0; foreach $index (@indexlist) { ($indexnumber,$indexflags,$indexdescription)=split(/;/,$index); if($in{K}<1) { if ($indexflags=~m/w/) { $in{K}=$indexnumber; $indexfound=1; $batchselect=0; last; } } elsif($in{K} eq $indexnumber) { $indexfound=1; last; } } if($indexfound==1) { # a query was just submitted if ($indexflags=~m/h/) { # OK, can use batch selection } else { $batchselect=0; } $input->reset('OA','D','DT','DF','DO','P','B','N'); # clean up page display variables just in case there are any hanging around if($in{R} eq "") { $in{R}=$in{Q}; } @search=$archive->queryExtendedIndexQueryWithPageCount($in{K},$in{Q},$in{R},$in{A},""); $in{R} = ""; if ($indexflags=~m/j/ && $#search==1) { $page='view'; # single match ($matchvalue,$matchaccount,$matchdocument,$matchtype,$matchfile,$matchoffset)=split(/;/,$search[1]); $in{A}=$matchaccount; $in{OA}=$matchaccount; $in{D}=$matchdocument; $in{DT}=$matchtype; $in{DF}=$matchfile; $in{DO}=$matchoffset; $input->reset('K','Q','R'); } elsif ($#search<1){ $page='nomatch'; # no match } else { $page='search'; # multiple matches } } else { $batchselect=0; $indexdescription=""; } } } #print "Content-type: text/html\n\n"; #$input->dump(); #die; ####################################################################################################### # # get date and report list # if ($page eq 'view') { @documents=$archive->queryExtendedDocuments($in{A}); # get list of available documents # check for valid date $found='NO'; if($in{D} ne "" && $in{DF} ne "" && $in{DO} ne "") { foreach $temp (@documents) { ($matchdocument,$matchtype,$matchfile,$matchoffset)=split(/;/,$temp); if($in{D} eq $matchdocument && $in{DT} eq $matchtype && $in{DF} eq $matchfile && $in{DO} eq $matchoffset) { $found='YES'; last; } } } if($found ne 'YES') { if($in{D} ne "" && $in{DF} ne "" && $in{DO} ne "") { # a document is specified but our list may be too short to include it # (it could also be invalid, but we have no way to detect the difference between the two states right now) push @documents,"$in{D};$in{DT};$in{DF};$in{DO}"; } elsif ($#documents>=0) { # no document specified, choose the more recent #print "Content-type: text/html\n\n"; #print "The requested customer statement is not available."; #die; ($matchdocument,$matchtype,$matchfile,$matchoffset)=split(/;/,$documents[0]); $in{D}=$matchdocument; $in{DT}=$matchtype; $in{DF}=$matchfile; $in{DO}=$matchoffset; } else { # no document specified, empty list of documents $input->reset('D','DF','DT','DO'); $page='nodocuments'; # dump user to no documents screen } } } $lastpage=$default{'P'}; if ($page eq 'view') { @reports=$archive->queryExtendedReports($in{A},$in{D},$in{DT},$in{DF},$in{DO}); # get report list if ($#reports>=0) { $lastpage=shift @reports; # BSG specific, translate french characters for($i=0;$i<=$#reports;$i++) { $reports[$i]=~tr/\x82\x87\x96/\xE9\xE7\xFB/; } } else { # no report list for some reason $page='nodocuments'; # dump user to no documents screen } } ####################################################################################################### # # check page related parameters # if ($in{F}<1) {$in{F}=1;} if ($in{F}>4) {$in{F}=4;} if ($in{P}<1) {$in{P}=1;} if ($in{P}>$lastpage) {$in{P}=$lastpage;} ####################################################################################################### # # generate new settings for buttons # $larger =$in{S}+1; if ($larger>5) {$larger=5;} $smaller =$in{S}-1; if ($smaller<0) {$smaller=0;} $next =$in{P}+$in{F}; if ($next>$lastpage) {$next=$lastpage;} $previous =$in{P}-$in{F}; if ($previous<1) {$previous=1;} $forward =$in{P}+$advanceby*$in{F}; if ($forward>$lastpage) {$forward=$lastpage;} $backward =$in{P}-$advanceby*$in{F}; if ($backward<1) {$backward=1;} $rotleft =$in{O}+1; if ($rotleft>3) {$rotleft=0;} $rotright =$in{O}-1; if ($rotright<0) {$rotright=3;} $lastset =$lastpage+1-$in{F}; if ($lastset<1) {$lastset=1;} if($in{F}==1) { $facing=2; } elsif ($in{F}==2) { $facing=4; } else { $facing=1; } ####################################################################################################### # # build substitution table # $input->copyto(\%substitute); $substitute{INDEXDESC} = $indexdescription; $substitute{INTERFACE} = $interface; $substitute{IMGDIR} = $imgdirectory; $substitute{PAGES} = $lastpage; $substitute{RESULTS} = $#search; $substitute{PIXELSX} = $rx[$in{S}]; $substitute{PIXELSY} = $ry[$in{S}]; $substitute{NEWSEARCH} = $interface . '?' . $input->url($whichguid,$GUID,'S','A','DB','F'); $substitute{PDF} = $image . '?' . $input->urlwith('P',1,'N',$lastpage,'I',0); $substitute{PDFNOBG} = $image . '?' . $input->urlwith('P',1,'N',$lastpage,'B',0,'I',0); $substitute{TEXT} = $image . '?' . $input->urlwith('P',1,'N',$lastpage,'CPIX',20,'CPIY',10,'I',0); $substitute{TARGET} = 'target="_blank"'; $substitute{ZOOMIN} = $interface . '?' . $input->urlwith('S',$larger); $substitute{ZOOMOUT} = $interface . '?' . $input->urlwith('S',$smaller); $substitute{ZOOMNORM} = $interface . '?' . $input->urlwith('S',$default{S}); $substitute{FIRST} = $interface . '?' . $input->urlwith('P',1); $substitute{LAST} = $interface . '?' . $input->urlwith('P',$lastset); $substitute{NEXT} = $interface . '?' . $input->urlwith('P',$next); $substitute{PREVIOUS} = $interface . '?' . $input->urlwith('P',$previous); $substitute{FASTFORWARD} = $interface . '?' . $input->urlwith('P',$forward); $substitute{REWIND} = $interface . '?' . $input->urlwith('P',$backward); $substitute{MORE} = ""; $substitute{ROTLEFT} = $interface . '?' . $input->urlwith('O',$rotleft); $substitute{ROTRIGHT} = $interface . '?' . $input->urlwith('O',$rotright); $substitute{ROTNORM} = $interface . '?' . $input->urlwith('O',$default{O}); $substitute{FACING} = $interface . '?' . $input->urlwith('F',$facing); $substitute{FLIPSIDE} = $interface . '?' . $input->urlwith('Z',1-$in{Z}); $substitute{ADVANCEBY} = $advanceby; $substitute{USERNAME} = $ENV{REMOTE_USER}; ####################################################################################################### # # generate document and report lists and image url # if($page eq 'view') { $selected=0; $substitute{DOCUMENTS}=''; foreach $temp (@documents) { ($matchdocument,$matchtype,$matchfile,$matchoffset)=split(/;/,$temp); $substitute{DOCUMENTS}.="\n"; } else { $substitute{DOCUMENTS}.=">" . $matchdocument . "\n"; } } $reportpage=1; $substitute{REPORTS}.="\n"; $substitute{PDFREPORTS}.="\n"; foreach $temp (@reports) { ($reportname,$reportpagecount)=split(/;/,$temp); $substitute{REPORTS}.="\n"; $substitute{PDFREPORTS}.="\n"; $reportpage+=$reportpagecount; } if($#reports<0) { $page='view-noreport'; } elsif($#reports==0 && $reports[0] =~ "^Start of Document;") { $page='view-noreport'; } if($forcepdf==1) { $imageurl=$substitute{PDF}; } elsif($framegifs==2) { $imageurl=$relay . '?' . $input->urlwith('P',$in{P}+0); } else { $imageurl=$image . '?' . $input->urlwith('P',$in{P}+0); } if ($in{I}>0 || $framegifs>0 || $forcepdf==1 || $in{DT} =~ m/HTML/i || $in{DT} =~ m/XML/i || substr($in{DT},0,1) eq ".") { $substitute{IMAGE}=""; } else { $substitute{IMAGE} ="
| Select | \n"; } foreach $column (split(/;/,$search[0])) { $substitute{SEARCH}.="$column | \n"; } $substitute{SEARCH}.="|
| urlwith($whichguid,$GUID,'K','','Q','','A',$matchaccount,'OA',$matchaccount,'D',$matchdocument,'DT',$matchtype,'DF',$matchfile,'DO',$matchoffset,'N','100') . "\""; if($matchtype eq "HTML" || $matchtype eq "XML") { $substitute{SEARCH}.=" output=\"HTML\""; } else { $substitute{SEARCH}.=" output=\"PDF\""; } $substitute{SEARCH}.=" account=\"" . $matchaccount . "\" document=\"" . $matchdocument . "\" pages=\"" . $matchpages . "\">"; } foreach $column (@rowcolumns) { if($column eq "_____") { last; } if($linkset==1) { $substitute{SEARCH}.=" | $column | \n"; } else { $substitute{SEARCH}.="urlwith($whichguid,$GUID,'K','','Q','','A',$matchaccount,'OA',$matchaccount,'D',$matchdocument,'DT',$matchtype,'DF',$matchfile,'DO',$matchoffset) . "\">$column | \n"; $linkset=1; } } $substitute{SEARCH}.="