From 1bc39a532aaf34f7aae0d4f22f319ccc7b001e5b Mon Sep 17 00:00:00 2001 From: Daniel Quathamer Date: Thu, 5 Oct 2023 10:00:14 +0200 Subject: [PATCH] Bugfix Paketerzeugung #1 --- .../module/qa/masken/37140_maskeninfo.unl | 16 +-- .../edit/qa/qa_show_mask_execution_result.jsp | 108 ++++++++++++++++++ 2 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 superx/edit/qa/qa_show_mask_execution_result.jsp diff --git a/src-modules/module/qa/masken/37140_maskeninfo.unl b/src-modules/module/qa/masken/37140_maskeninfo.unl index 6ac281b..b4ce19a 100644 --- a/src-modules/module/qa/masken/37140_maskeninfo.unl +++ b/src-modules/module/qa/masken/37140_maskeninfo.unl @@ -13,12 +13,11 @@ R.orderbyclause,\ T.tid,\ T.uniquename,\ T.name,\ -T.whereclause,\ -C.tid as testcase_id\ -FROM qa_testcase C, qa_dbtest T, qa_resultset R\ -where C.dbtest_id=T.tid\ -and T.resultset_id=R.tid\ -and C.is_active=1\ +T.whereclause\ +FROM qa_dbtest T, qa_resultset R\ +where \ +T.resultset_id=R.tid\ +and T.active=1\ ;\ \ \ @@ -51,10 +50,10 @@ from qa_dbtest T where T.active=1)\ \ /* <#assign dbtest_id="<>" />*/\ \ -\ create temp table tmp_qa_dbtest_result_id\ (qa_dbtest_result_id integer);\ \ +\ <#foreach dbtest in qa_dbtests>\ <#if dbtest_id == "" || dbtest_id==dbtest.tid?string>\ \ @@ -66,13 +65,16 @@ order by ${dbtest.orderbyclause}\ ))::integer as _rownumber\ into temp tmp_rs\ from ${dbtest.fromclause}\ +\ <#if dbtest.whereclause !=''>\ where <#assign inlineTemplate=dbtest.whereclause?interpret />\ <@inlineTemplate/>\ \ +\ <#if dbtest.groupbyclause !=''>\ group by ${dbtest.groupbyclause}\ \ +\ <#if dbtest.orderbyclause !=''>\ order by ${dbtest.orderbyclause}\ \ diff --git a/superx/edit/qa/qa_show_mask_execution_result.jsp b/superx/edit/qa/qa_show_mask_execution_result.jsp new file mode 100644 index 0000000..e178d79 --- /dev/null +++ b/superx/edit/qa/qa_show_mask_execution_result.jsp @@ -0,0 +1,108 @@ +<%@page pageEncoding="UTF-8" contentType="text/html" %> +<%@ page import ="org.dbforms.config.DbFormsConfigRegistry,java.sql.Connection,java.sql.PreparedStatement,java.sql.Statement,java.sql.ResultSet,de.superx.common.SxUser" %> +<% +SxUser user = (SxUser) request.getSession().getAttribute("user"); + +if (user != null && user.isAdmin()) { + + StringBuffer LinkMandantID=new StringBuffer(""); + + +int MAXCHARLENGTH_OF_KEYS = 50; +String ALLOWED_KEY_CHARS = "abcdefghijklmnopqrstuvwxyzäöüßABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ_1234567890"; + +String IdOutput=request.getParameter("tid"); +String typeOutput="html"; //TODO:parametrisierbar request.getParameter("type"); +String defaultMandantenIDParam=request.getParameter("MandantID"); +//Check Validity: + boolean entryOK=true; + if(IdOutput.length()> MAXCHARLENGTH_OF_KEYS) + entryOK=false; + + for (int i = 0; i < IdOutput.length(); i++) { + char lookingAt = IdOutput.charAt(i); + if (ALLOWED_KEY_CHARS.indexOf(lookingAt)==-1) { + entryOK=false; + + } + + } + + +if(!entryOK) + throw new IllegalArgumentException( + "output Parameter contains forbidden characters or length"); + + + +if(defaultMandantenIDParam != null && !defaultMandantenIDParam.toString().equals("")) { + LinkMandantID.append("/"+defaultMandantenIDParam.toString()); +} + /* + if (request.getSession()!=null&&request.getSession().getAttribute("sessiontype")!=null&& + request.getSession().getAttribute("sessiontype").equals("superx")) { +*/ +Object mandantobject=request.getSession().getAttribute("MandantenID"); +//Object userid=request.getSession().getAttribute("UserID"); +String mandantenid=""; +if(mandantobject != null) + mandantenid=mandantobject.toString(); + else + { + if(defaultMandantenIDParam != null) + mandantenid=defaultMandantenIDParam.toString(); + } +//der superx-Default-Mandant ist bei dbforms ein Leerstring +if(mandantenid.equals("default")) + mandantenid=""; + + +Connection conmm=null; + +try { + +conmm = DbFormsConfigRegistry.instance().lookup().getConnection(mandantenid); + + +//Ausgabe holen: + +PreparedStatement st_output; +ResultSet rs_output; +st_output=conmm.prepareStatement("select result_html from qa_mask_execution_result where tid=? "); +st_output.setInt(1,Integer.valueOf(IdOutput)); +rs_output = st_output.executeQuery(); +String sb_output=""; +while (rs_output.next()) +{ if(rs_output.getObject(1) !=null) + sb_output=rs_output.getObject(1).toString().trim(); +} +rs_output.close(); +st_output.close(); +if(sb_output==null || sb_output.equals("")) + sb_output="

Text konnte nicht geladen werden, wenden Sie sich an den Administrator

"; +//Ende Ausgabe holen + +String sb_titel=""; +sb_titel="Show HTML content"; + + +conmm.close(); + +out.println(sb_output); + + +} //ende Suche DB Verbindung +catch (Exception e) { +out.print("Fehler bei Datenverbindung: "+e+ "
MandantID: "+mandantenid+""); +} + +} +else { + + if (request.getSession()!=null) session.invalidate(); + String send_redirect="/superx/index.jsp"; //" + LinkMandantID.toString() + " + response.sendRedirect(send_redirect); + return; + } +%> +