Delete test.cls

This commit is contained in:
bagnol 2024-06-26 23:48:36 +00:00
parent 6300c2645e
commit 93e7eeac2f

116
test.cls
View file

@ -1,116 +0,0 @@
Class Custom.SWARH.Report.ZEN.ReportingServicesRedirectReport Extends Custom.SWARH.Report.ZEN.Abstract
{
/// Location and Revision of this file in Perforce (Auto-updating)
Parameter SrcVer = "$Id: //custom_ccrs/au/AUSW/T2018/LIVE/cls/Custom/SWARH/Report/ZEN/ReportingServicesRedirectReport.xml#8 $";
/// Report Parameter 1 - This should contain the Reporting Services report name either as a normal string OR as JSON with key "reportCode" populated
Property P1 As %String(ZENURL = "P1");
/// Report Parameter 2 - Passed to the Reporting Services report as P1 (if value is not empty)
Property P2 As %String(ZENURL = "P2");
/// Report Parameter 3 - Passed to the Reporting Services report as P2 (if value is not empty)
Property P3 As %String(ZENURL = "P3");
/// Report Parameter 4 - Passed to the Reporting Services report as P3 (if value is not empty)
Property P4 As %String(ZENURL = "P4");
/// Report Parameter 5 - Passed to the Reporting Services report as P4 (if value is not empty)
Property P5 As %String(ZENURL = "P5");
/// Report Parameter 6 - Passed to the Reporting Services report as P5 (if value is not empty)
Property P6 As %String(ZENURL = "P6");
/// Report Parameter 7 - Passed to the Reporting Services report as P6 (if value is not empty)
Property P7 As %String(ZENURL = "P7");
/// Report Parameter 8 - Passed to the Reporting Services report as P7 (if value is not empty)
Property P8 As %String(ZENURL = "P8");
/// Report Parameter 9 - Passed to the Reporting Services report as P8 (if value is not empty)
Property P9 As %String(ZENURL = "P9");
Parameter REPORTCOMMAND = "rs:Command=Render&rc:Parameters=false";
Parameter LOG = 1;
Parameter LOGFILE = "I:\RptSvcsRedirLog.txt";
ClassMethod %OnPreHTTP() As %Boolean
{
Set tSC = $$BuildQueryString(.tQueryString) Quit:$$$ISERR(tSC) 1
If ..#LOG {
Set tLogOpenParams = "WA" ; Write/Append
Set:'##class(%File).Exists(..#LOGFILE) tLogOpenParams="N"_tLogOpenParams
Open ..#LOGFILE:tLogOpenParams
Use ..#LOGFILE
}
&sql(select File_VirtualDirectory into :tURL from SQLUser.CF_SystemFileDefinition where FILE_Desc like 'RPTSVC')
if ($EXTRACT(tURL,*)'="/") { set tURL = tURL_"/" }
Set tURL = tURL_ tReportName
Set tURL = tURL_"&"_..#REPORTCOMMAND
Set:tQueryString'="" tURL = tURL_tQueryString
set tURL = tURL _extendedArgsObj.%Get("extendURI") // Add extended arguments (if P1 contained JSON)
Write:..#LOG $ZDATETIME($H)_": "_"ReportingServicesRedirectReport: Redirecting to report at URL "_tURL,!
Set %response.Redirect = tURL
Close:..#LOG ..#LOGFILE
// Return 0 (false) - stops CSP doing any more processing on this report page
Quit 0
BuildQueryString(tQueryString)
Do {
Set tSC = $$$OK
Set tDatasource=""
If $IsObject($G(%request)) {
Set tPS = $G(%request.Data("$PS",1),$$$GETPARAMETER("PS"))
Set tDatasource=$G(%request.Data("$DATASOURCE",1))
}
#; create instance of *this* report
Set tUserReport = ..%New()
//d ..%checkNameSpace(tEMBEDXSL, tUserReport)
#; handle datasource URL parameter
If tDatasource'="" {
Set tUserReport.Datasource=tDatasource
}
#; Set null properties to parameter values
Set tSC = tUserReport.%InitProperties() Quit:$$$ISERR(tSC)
#; copy URL parameters into specially marked properties.
Set tSC = tUserReport.%ApplyURLParms() Quit:$$$ISERR(tSC)
Set tSC = tUserReport.%OnBeforeReport() Quit:$$$ISERR(tSC)
set tReportName = tUserReport.P1
/* This code allows you to append data to the url by setting P1 (custom4 on the layout) to contain JSON
so {"reportCode":"SWARHRNAP1001Excel","extendURI":"&rs:Format=EXCELOPENXML"} will for example make it
use the SWARHNAP1001Excel.rdl report and the extendURI value makes it just save it as a .xlsx file
*/
set extendedArgsObj = {}
try {
set extendedArgsObj = {}.%FromJSON(tUserReport.P1)
set tReportName = extendedArgsObj.reportCode
} catch(tEC) {}
// Iterate through properties P2-P9 and build a query string with non-empty values, renumbering them to P1-P8
Set qs="" For i=2:1:9 {
Set tZENParamName = "P"_i,
tRptSvcParamName = "P"_(i-1),
tRptSvcParamVal = $property(tUserReport,tZENParamName)
// Add parameter to query string if not empty
Set:tRptSvcParamVal'="" qs=qs_"&"_tRptSvcParamName_"="_..EscapeURL(tRptSvcParamVal)
}
} While (0)
Set:$$$ISOK(tSC) tQueryString = qs
Quit tSC
}
}