Applying again changes from revision 4491

This commit is contained in:
Carlos Ruiz 2008-02-09 05:54:43 +00:00
parent 2d148d573e
commit fa68ad7513
1 changed files with 24 additions and 12 deletions

View File

@ -449,7 +449,7 @@ public class MSequence extends X_AD_Sequence
if (DB.isOracle() == false || DB.isRemoteObjects()) if (DB.isOracle() == false || DB.isRemoteObjects())
{ {
if (isStartNewYear) { if (isStartNewYear) {
selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, s.Prefix, s.Suffix, s.AD_Sequence_ID " selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, s.Prefix, s.Suffix, s.DecimalPattern, s.AD_Sequence_ID "
+ "FROM AD_Sequence_No y, AD_Sequence s " + "FROM AD_Sequence_No y, AD_Sequence s "
+ "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID " + "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID "
+ "AND s.Name = ? " + "AND s.Name = ? "
@ -459,7 +459,7 @@ public class MSequence extends X_AD_Sequence
+ "ORDER BY s.AD_Client_ID DESC " + "ORDER BY s.AD_Client_ID DESC "
+ "FOR UPDATE OF AD_Sequence_No"; + "FOR UPDATE OF AD_Sequence_No";
} else { } else {
selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Sequence_ID " selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, DecimalPattern, AD_Sequence_ID "
+ "FROM AD_Sequence " + "FROM AD_Sequence "
+ "WHERE Name = ? " + "WHERE Name = ? "
+ "AND AD_Client_ID = ? " + "AND AD_Client_ID = ? "
@ -472,7 +472,7 @@ public class MSequence extends X_AD_Sequence
else else
{ {
if (isStartNewYear) { if (isStartNewYear) {
selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, Prefix, Suffix, s.AD_Sequence_ID " selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, Prefix, Suffix, DecimalPattern, s.AD_Sequence_ID "
+ "FROM AD_Sequence_No y, AD_Sequence s " + "FROM AD_Sequence_No y, AD_Sequence s "
+ "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID " + "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID "
+ "AND s.Name = ? " + "AND s.Name = ? "
@ -481,7 +481,7 @@ public class MSequence extends X_AD_Sequence
+ "AND s.IsActive='Y' AND s.IsTableID='N' AND s.IsAutoSequence='Y' " + "AND s.IsActive='Y' AND s.IsTableID='N' AND s.IsAutoSequence='Y' "
+ "ORDER BY s.AD_Client_ID DESC"; + "ORDER BY s.AD_Client_ID DESC";
} else { } else {
selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Sequence_ID " selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, DecimalPattern, AD_Sequence_ID "
+ "FROM AD_Sequence " + "FROM AD_Sequence "
+ "WHERE Name = ? " + "WHERE Name = ? "
+ "AND AD_Client_ID = ? " + "AND AD_Client_ID = ? "
@ -498,6 +498,7 @@ public class MSequence extends X_AD_Sequence
int next = -1; int next = -1;
String prefix = ""; String prefix = "";
String suffix = ""; String suffix = "";
String decimalPattern = "";
String calendarYear = ""; String calendarYear = "";
try try
{ {
@ -538,9 +539,10 @@ public class MSequence extends X_AD_Sequence
// + " - Type=" + pstmt.getResultSetType() + " - Concur=" + pstmt.getResultSetConcurrency()); // + " - Type=" + pstmt.getResultSetType() + " - Concur=" + pstmt.getResultSetConcurrency());
if (rs.next()) if (rs.next())
{ {
AD_Sequence_ID = rs.getInt(6); AD_Sequence_ID = rs.getInt(7);
prefix = rs.getString(4); prefix = rs.getString(4);
suffix = rs.getString(5); suffix = rs.getString(5);
decimalPattern = rs.getString(6);
incrementNo = rs.getInt(3); incrementNo = rs.getInt(3);
if (USE_PROCEDURE) if (USE_PROCEDURE)
{ {
@ -620,6 +622,11 @@ public class MSequence extends X_AD_Sequence
StringBuffer doc = new StringBuffer(); StringBuffer doc = new StringBuffer();
if (prefix != null && prefix.length() > 0) if (prefix != null && prefix.length() > 0)
doc.append(parseVariable(prefix, po, trxName)); doc.append(parseVariable(prefix, po, trxName));
if (decimalPattern != null && decimalPattern.length() > 0) {
doc.append(new DecimalFormat(decimalPattern).format(next));
} else {
doc.append(next);
}
doc.append(next); doc.append(next);
if (suffix != null && suffix.length() > 0) if (suffix != null && suffix.length() > 0)
doc.append(parseVariable(suffix, po, trxName)); doc.append(parseVariable(suffix, po, trxName));
@ -822,7 +829,7 @@ public class MSequence extends X_AD_Sequence
{ {
if (isStartNewYear) if (isStartNewYear)
{ {
selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, s.Prefix, s.Suffix, s.AD_Client_ID, s.AD_Sequence_ID " selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, s.Prefix, s.Suffix, s.DecimalPattern, s.AD_Client_ID, s.AD_Sequence_ID "
+ "FROM AD_Sequence_No y, AD_Sequence s " + "FROM AD_Sequence_No y, AD_Sequence s "
+ "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID " + "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID "
+ "AND s.AD_Sequence_ID = ? " + "AND s.AD_Sequence_ID = ? "
@ -832,7 +839,7 @@ public class MSequence extends X_AD_Sequence
} }
else else
{ {
selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Client_ID, AD_Sequence_ID " selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, DecimalPattern, AD_Client_ID, AD_Sequence_ID "
+ "FROM AD_Sequence " + "FROM AD_Sequence "
+ "WHERE AD_Sequence_ID = ? " + "WHERE AD_Sequence_ID = ? "
+ "AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' " + "AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' "
@ -843,14 +850,14 @@ public class MSequence extends X_AD_Sequence
else else
{ {
if (isStartNewYear) { if (isStartNewYear) {
selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, s.Prefix, s.Suffix, s.AD_Client_ID, s.AD_Sequence_ID " selectSQL = "SELECT y.CurrentNext, s.CurrentNextSys, s.IncrementNo, s.Prefix, s.Suffix, s.DecimalPattern, s.AD_Client_ID, s.AD_Sequence_ID "
+ "FROM AD_Sequence_No y, AD_Sequence s " + "FROM AD_Sequence_No y, AD_Sequence s "
+ "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID " + "WHERE y.AD_Sequence_ID = s.AD_Sequence_ID "
+ "AND s.AD_Sequence_ID = ? " + "AND s.AD_Sequence_ID = ? "
+ "AND y.CalendarYear = ? " + "AND y.CalendarYear = ? "
+ "AND s.IsActive='Y' AND s.IsTableID='N' AND s.IsAutoSequence='Y' "; + "AND s.IsActive='Y' AND s.IsTableID='N' AND s.IsAutoSequence='Y' ";
} else { } else {
selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Client_ID, AD_Sequence_ID " selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, DecimalPattern, AD_Client_ID, AD_Sequence_ID "
+ "FROM AD_Sequence " + "FROM AD_Sequence "
+ "WHERE AD_Sequence_ID = ? " + "WHERE AD_Sequence_ID = ? "
+ "AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' "; + "AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' ";
@ -865,6 +872,7 @@ public class MSequence extends X_AD_Sequence
int next = -1; int next = -1;
String prefix = ""; String prefix = "";
String suffix = ""; String suffix = "";
String decimalPattern = "";
String calendarYear = ""; String calendarYear = "";
try try
{ {
@ -909,10 +917,11 @@ public class MSequence extends X_AD_Sequence
incrementNo = rs.getInt(3); incrementNo = rs.getInt(3);
prefix = rs.getString(4); prefix = rs.getString(4);
suffix = rs.getString(5); suffix = rs.getString(5);
int AD_Client_ID = rs.getInt(6); decimalPattern = rs.getString(6);
int AD_Client_ID = rs.getInt(7);
if (adempiereSys && AD_Client_ID > 11) if (adempiereSys && AD_Client_ID > 11)
adempiereSys = false; adempiereSys = false;
AD_Sequence_ID = rs.getInt(7); AD_Sequence_ID = rs.getInt(8);
if (USE_PROCEDURE) if (USE_PROCEDURE)
{ {
@ -988,7 +997,10 @@ public class MSequence extends X_AD_Sequence
StringBuffer doc = new StringBuffer(); StringBuffer doc = new StringBuffer();
if (prefix != null && prefix.length() > 0) if (prefix != null && prefix.length() > 0)
doc.append(parseVariable(prefix, po, trxName)); doc.append(parseVariable(prefix, po, trxName));
doc.append(next); if (decimalPattern != null && decimalPattern.length() > 0)
doc.append(new DecimalFormat(decimalPattern).format(next));
else
doc.append(next);
if (suffix != null && suffix.length() > 0) if (suffix != null && suffix.length() > 0)
doc.append(parseVariable(suffix, po, trxName)); doc.append(parseVariable(suffix, po, trxName));
String documentNo = doc.toString(); String documentNo = doc.toString();