Copy/create print format items creates duplicate fields. Fixes #50.
Integrated to iDempiere by Carlos Ruiz (globalqss) as a partial solution for IDEMPIERE-132 Avoid duplicate in print format http://adempiere.hg.sourceforge.net/hgweb/adempiere/contribution_adaxa/raw-rev/f94eae8928cd
This commit is contained in:
parent
162b0becf4
commit
bd991c49ec
|
@ -597,6 +597,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
||||||
+ "FROM AD_Field "
|
+ "FROM AD_Field "
|
||||||
+ "WHERE AD_Tab_ID=(SELECT MIN(AD_Tab_ID) FROM AD_Tab WHERE AD_Table_ID=?)"
|
+ "WHERE AD_Tab_ID=(SELECT MIN(AD_Tab_ID) FROM AD_Tab WHERE AD_Table_ID=?)"
|
||||||
+ " AND IsEncrypted='N' AND ObscureType IS NULL "
|
+ " AND IsEncrypted='N' AND ObscureType IS NULL "
|
||||||
|
+ " AND AD_Column_ID NOT IN (SELECT pfi.AD_Column_ID FROM AD_PrintFormatItem pfi WHERE pfi.AD_PrintFormat_ID=? AND pfi.AD_Column_ID IS NOT NULL) "
|
||||||
+ "ORDER BY COALESCE(IsDisplayed,'N') DESC, SortNo, SeqNo, Name";
|
+ "ORDER BY COALESCE(IsDisplayed,'N') DESC, SortNo, SeqNo, Name";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
@ -604,6 +605,7 @@ public class MPrintFormat extends X_AD_PrintFormat
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, format.get_TrxName());
|
pstmt = DB.prepareStatement(sql, format.get_TrxName());
|
||||||
pstmt.setInt(1, format.getAD_Table_ID());
|
pstmt.setInt(1, format.getAD_Table_ID());
|
||||||
|
pstmt.setInt(2, format.getAD_PrintFormat_ID());
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
int seqNo = 1;
|
int seqNo = 1;
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
|
@ -631,11 +633,13 @@ public class MPrintFormat extends X_AD_PrintFormat
|
||||||
sql = "SELECT AD_Column_ID "
|
sql = "SELECT AD_Column_ID "
|
||||||
+ "FROM AD_Column "
|
+ "FROM AD_Column "
|
||||||
+ "WHERE AD_Table_ID=? "
|
+ "WHERE AD_Table_ID=? "
|
||||||
|
+ " AND AD_Column_ID NOT IN (SELECT pfi.AD_Column_ID FROM AD_PrintFormatItem pfi WHERE pfi.AD_PrintFormat_ID=? AND pfi.AD_Column_ID IS NOT NULL) "
|
||||||
+ "ORDER BY IsIdentifier DESC, SeqNo, Name";
|
+ "ORDER BY IsIdentifier DESC, SeqNo, Name";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, format.get_TrxName());
|
pstmt = DB.prepareStatement(sql, format.get_TrxName());
|
||||||
pstmt.setInt(1, format.getAD_Table_ID());
|
pstmt.setInt(1, format.getAD_Table_ID());
|
||||||
|
pstmt.setInt(2, format.getAD_PrintFormat_ID());
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
int seqNo = 1;
|
int seqNo = 1;
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
|
|
Loading…
Reference in New Issue