Seems bug in infowindow

67 views
Skip to first unread message

Kubavat Hardik

unread,
Oct 28, 2015, 7:45:43 AM10/28/15
to iDempiere
Hello Community,

I am working on one customization through infowindow, in which I have put the Group by clause in Other SQL Clause field in infowindow, which leads and error in some scenario. The problem I have found in testCount() method in infopanel and infowindow class in which this clause is not appended while building the query so m_count and actual line count while rending lines are different. 

I have put the code for appending other Sql clause in this method and works fine. Anyone has faced this scenarios and is there any impact of below code : 

protected boolean testCount()
{
long start = System.currentTimeMillis();
String dynWhere = getSQLWhere();
StringBuilder sql = new StringBuilder (m_sqlCount);

if (dynWhere.length() > 0)
sql.append(dynWhere);   //  includes first AND

String countSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
if (countSql.trim().endsWith("WHERE")) {
countSql = countSql.trim();
countSql = countSql.substring(0, countSql.length() - 5);
}
countSql = MRole.getDefault().addAccessSQL(countSql, getTableName(), MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
// start
if (infoWindow.getOtherClause() != null && infoWindow.getOtherClause().trim().length() > 0) {
String otherClause = infoWindow.getOtherClause();
if (otherClause.indexOf("@") >= 0) {
String s = Env.parseContext(Env.getCtx(), p_WindowNo, otherClause, false, false);
if (s.length() == 0) {
log.severe("Failed to parse other clause. " + otherClause);
} else {
otherClause = s;
}
}
countSql = countSql + " " + otherClause;
}// end
if (log.isLoggable(Level.FINER))
log.finer(countSql);
m_count = -1;

PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(countSql, null);
setParameters (pstmt, true);
rs = pstmt.executeQuery();

if (rs.next())
m_count = rs.getInt(1);
}
catch (Exception e)
{
log.log(Level.SEVERE, countSql, e);
m_count = -2;
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}

if (log.isLoggable(Level.FINE))
log.fine("#" + m_count + " - " + (System.currentTimeMillis()-start) + "ms");

return true;
} // testCount

Thanks

Carlos Antonio Ruiz Gomez

unread,
Oct 28, 2015, 8:58:38 AM10/28/15
to idem...@googlegroups.com
Thanks Kubavat for reporting, it sounds like a bug, please check if is reproducible in https://test.idempiere.org/webui and if it is please open a JIRA ticket providing the steps to reproduce or a 2pack with the info window configuration that triggers the error.

Regards,

Carlos Ruiz

hardik.kubavat

unread,
Oct 29, 2015, 8:54:05 AM10/29/15
to idem...@googlegroups.com
Hi Carlos,

I have tried to reproduce on https://test.idempiere.org/webui with attached 2Pack and need to set up data in Payment Selection window with multiple lines in Prepared Payment tab. I am able to reproduce it on my local. May be I am using old version of idempiere which causes the problem.
--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/idempiere/5630C679.7040508%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
Hardik Kubavat
Consultant
KNOWARTH

11, Aryan Corporate Park, Nr. Shilaj Railway Crossing, Thaltej, Ahmedabad, Gujarat, INDIA

Mobile : +91 88668 58347
Skype : hlkubavat

 
Email : hardik....@knowarth.com
Web : www.knowarth.com
KNOWARTH KNOWARTH KNOWARTH KNOWARTH
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. If you have received this email in error, please notify KNOWARTH immediately by e-mail or telephone and delete the e-mail from any computer. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
checkrun.zip
Reply all
Reply to author
Forward
0 new messages