Merge with default

This commit is contained in:
hieplq 2018-12-28 13:33:19 +07:00
commit 2338a02422
20 changed files with 396 additions and 62 deletions

View File

@ -0,0 +1,55 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3853 Bug in Auto Allocation
-- Dec 25, 2018, 8:48:26 PM CET
UPDATE C_Conversion_Rate SET IsActive='N',Updated=TO_DATE('2018-12-25 20:48:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Conversion_Rate_ID=137
;
-- Dec 25, 2018, 8:48:28 PM CET
UPDATE C_Conversion_Rate SET IsActive='N',Updated=TO_DATE('2018-12-25 20:48:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Conversion_Rate_ID=138
;
-- Dec 25, 2018, 8:56:17 PM CET
UPDATE AD_TableIndex SET IsUnique='Y',Updated=TO_DATE('2018-12-25 20:56:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_TableIndex_ID=200400
;
-- Dec 25, 2018, 8:56:20 PM CET
DROP INDEX c_conversionrate_once
;
-- Dec 25, 2018, 8:56:20 PM CET
CREATE UNIQUE INDEX c_conversionrate_once ON C_Conversion_Rate (AD_Client_ID,AD_Org_ID,C_Currency_ID,C_Currency_ID_To,C_ConversionType_ID,ValidFrom)
;
-- Dec 25, 2018, 9:34:13 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_DATE('2018-12-25 21:34:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10294
;
-- Dec 25, 2018, 9:34:19 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_DATE('2018-12-25 21:34:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=786
;
-- Dec 25, 2018, 9:34:23 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_DATE('2018-12-25 21:34:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=787
;
-- Dec 25, 2018, 9:34:34 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_DATE('2018-12-25 21:34:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=453
;
-- Dec 25, 2018, 9:34:49 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_DATE('2018-12-25 21:34:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=454
;
-- Dec 25, 2018, 9:35:46 PM CET
UPDATE AD_Field SET IsMandatory='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-25 21:35:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=436
;
-- Dec 25, 2018, 9:35:47 PM CET
UPDATE AD_Field SET IsMandatory='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-25 21:35:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1339
;
SELECT register_migration_script('201812252049_IDEMPIERE-3853.sql') FROM dual
;

View File

@ -0,0 +1,45 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3855 Implement AD_Tree.IsValueDisplayed
-- Dec 26, 2018, 2:00:58 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (213822,0,'Display Value','Displays Value column with the Display column','The Display Value checkbox indicates if the value column will display with the display column.',288,'IsValueDisplayed','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2018-12-26 14:00:58','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-12-26 14:00:58','YYYY-MM-DD HH24:MI:SS'),100,284,'Y','N','D','N','N','N','Y','2894fcac-3036-489d-8976-2f8bb178ecae','Y',0,'N','N','N')
;
-- Dec 26, 2018, 2:01:02 PM CET
ALTER TABLE AD_Tree ADD IsValueDisplayed CHAR(1) DEFAULT 'N' CHECK (IsValueDisplayed IN ('Y','N')) NOT NULL
;
-- Dec 26, 2018, 2:02:36 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (205898,'Display Value','Displays Value column with the Display column','The Display Value checkbox indicates if the value column will display with the display column.',243,213822,'Y',1,130,'N','N','N','N',0,0,'Y',TO_DATE('2018-12-26 14:02:35','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-12-26 14:02:35','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','1f428273-321c-4514-8f62-29d600deda79','Y',120,2,2)
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205898
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5228
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12421
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204379
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8371
;
-- Dec 26, 2018, 2:03:54 PM CET
UPDATE AD_Field SET Name='Display Search Key', Description='Displays Search Key in the tree', Help='The Display Search Key checkbox indicates if the Search Key will display in the tree before the Name', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-12-26 14:03:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205898
;
UPDATE AD_Tree SET IsValueDisplayed='Y' WHERE IsValueDisplayed='N' AND IsTreeDrivenByValue='Y';
SELECT register_migration_script('201812261404_IDEMPIERE-3855.sql') FROM dual
;

View File

@ -0,0 +1,52 @@
-- IDEMPIERE-3853 Bug in Auto Allocation
-- Dec 25, 2018, 8:48:26 PM CET
UPDATE C_Conversion_Rate SET IsActive='N',Updated=TO_TIMESTAMP('2018-12-25 20:48:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Conversion_Rate_ID=137
;
-- Dec 25, 2018, 8:48:28 PM CET
UPDATE C_Conversion_Rate SET IsActive='N',Updated=TO_TIMESTAMP('2018-12-25 20:48:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Conversion_Rate_ID=138
;
-- Dec 25, 2018, 8:56:17 PM CET
UPDATE AD_TableIndex SET IsUnique='Y',Updated=TO_TIMESTAMP('2018-12-25 20:56:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_TableIndex_ID=200400
;
-- Dec 25, 2018, 8:56:20 PM CET
DROP INDEX c_conversionrate_once
;
-- Dec 25, 2018, 8:56:20 PM CET
CREATE UNIQUE INDEX c_conversionrate_once ON C_Conversion_Rate (AD_Client_ID,AD_Org_ID,C_Currency_ID,C_Currency_ID_To,C_ConversionType_ID,ValidFrom)
;
-- Dec 25, 2018, 9:34:13 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_TIMESTAMP('2018-12-25 21:34:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10294
;
-- Dec 25, 2018, 9:34:19 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_TIMESTAMP('2018-12-25 21:34:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=786
;
-- Dec 25, 2018, 9:34:23 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_TIMESTAMP('2018-12-25 21:34:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=787
;
-- Dec 25, 2018, 9:34:34 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_TIMESTAMP('2018-12-25 21:34:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=453
;
-- Dec 25, 2018, 9:34:49 PM CET
UPDATE AD_Column SET IsUpdateable='N',Updated=TO_TIMESTAMP('2018-12-25 21:34:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=454
;
-- Dec 25, 2018, 9:35:46 PM CET
UPDATE AD_Field SET IsMandatory='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-25 21:35:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=436
;
-- Dec 25, 2018, 9:35:47 PM CET
UPDATE AD_Field SET IsMandatory='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-25 21:35:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1339
;
SELECT register_migration_script('201812252049_IDEMPIERE-3853.sql') FROM dual
;

View File

@ -0,0 +1,42 @@
-- IDEMPIERE-3855 Implement AD_Tree.IsValueDisplayed
-- Dec 26, 2018, 2:00:58 PM CET
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (213822,0,'Display Value','Displays Value column with the Display column','The Display Value checkbox indicates if the value column will display with the display column.',288,'IsValueDisplayed','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2018-12-26 14:00:58','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-12-26 14:00:58','YYYY-MM-DD HH24:MI:SS'),100,284,'Y','N','D','N','N','N','Y','2894fcac-3036-489d-8976-2f8bb178ecae','Y',0,'N','N','N')
;
-- Dec 26, 2018, 2:01:02 PM CET
ALTER TABLE AD_Tree ADD COLUMN IsValueDisplayed CHAR(1) DEFAULT 'N' CHECK (IsValueDisplayed IN ('Y','N')) NOT NULL
;
-- Dec 26, 2018, 2:02:36 PM CET
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (205898,'Display Value','Displays Value column with the Display column','The Display Value checkbox indicates if the value column will display with the display column.',243,213822,'Y',1,130,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2018-12-26 14:02:35','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-12-26 14:02:35','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','1f428273-321c-4514-8f62-29d600deda79','Y',120,2,2)
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205898
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5228
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12421
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204379
;
-- Dec 26, 2018, 2:03:06 PM CET
UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8371
;
-- Dec 26, 2018, 2:03:54 PM CET
UPDATE AD_Field SET Name='Display Search Key', Description='Displays Search Key in the tree', Help='The Display Search Key checkbox indicates if the Search Key will display in the tree before the Name', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-12-26 14:03:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205898
;
UPDATE AD_Tree SET IsValueDisplayed='Y' WHERE IsValueDisplayed='N' AND IsTreeDrivenByValue='Y';
SELECT register_migration_script('201812261404_IDEMPIERE-3855.sql') FROM dual
;

View File

@ -21,6 +21,7 @@ import java.sql.Timestamp;
import java.util.List;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MConversionType;
import org.compiere.model.MDocType;
@ -43,9 +44,10 @@ public class RevenueRecognition extends SvrProcess
private Timestamp p_Date = null;
/** GL Document Type */
private int p_C_DocType_ID = 0;
/** Recognition Type */
private int p_C_RevenueRecognition_ID = 0;
private int cntDocs = 0;
/**
* Prepare - e.g., get Parameters.
@ -83,14 +85,13 @@ public class RevenueRecognition extends SvrProcess
{
MAcctSchema[] schemas = MAcctSchema.getClientAcctSchema(getCtx(), getAD_Client_ID());
String result ="@OK@";
for (MAcctSchema schema : schemas)
{
result = createGLJournal(schema);
createGLJournal(schema);
}
//
return result;
return "@OK@ #" + cntDocs;
} // doIt
@ -98,7 +99,7 @@ public class RevenueRecognition extends SvrProcess
* Create GL Journal
* @return document info
*/
private String createGLJournal(MAcctSchema as)
private void createGLJournal(MAcctSchema as)
{
//
MDocType docType = MDocType.get(getCtx(), p_C_DocType_ID);
@ -138,6 +139,9 @@ public class RevenueRecognition extends SvrProcess
journal.setC_DocType_ID(p_C_DocType_ID);
journal.setDateDoc(p_Date);
journal.setDateAcct(p_Date);
if (journal.getC_Period_ID() == 0) {
throw new AdempiereException("@PeriodNotFound@");
}
journal.setC_Currency_ID(as.getC_Currency_ID());
journal.setC_AcctSchema_ID (as.getC_AcctSchema_ID());
journal.setC_Currency_ID(as.getC_Currency_ID());
@ -147,6 +151,8 @@ public class RevenueRecognition extends SvrProcess
journal.setDescription (getName() + " - " + org.getName());
journal.setGL_Category_ID (cat.getGL_Category_ID());
journal.saveEx();
cntDocs++;
addBufferLog(journal.getGL_Journal_ID(), journal.getDateAcct(), null, docType.getName() + " " + journal.getDocumentNo(), MJournal.Table_ID, journal.getGL_Journal_ID());
}
MInvoiceLine il = (MInvoiceLine) run.getC_RevenueRecognition_Plan().getC_InvoiceLine();
@ -195,10 +201,7 @@ public class RevenueRecognition extends SvrProcess
//
run.setGL_Journal_ID(journal.getGL_Journal_ID());
run.saveEx();
addBufferLog(journal.getGL_Journal_ID(), journal.getDateAcct(), null, docType.getName() + " " + journal.getDocumentNo(), MJournal.Table_ID, journal.getGL_Journal_ID());
}
return "@OK@ #" + list.size();
} // createGLJournal
} // Aging
} // RevenueRecognition

View File

@ -189,6 +189,19 @@ public interface I_AD_Tree
/** Get Driven by Search Key */
public boolean isTreeDrivenByValue();
/** Column name IsValueDisplayed */
public static final String COLUMNNAME_IsValueDisplayed = "IsValueDisplayed";
/** Set Display Value.
* Displays Value column with the Display column
*/
public void setIsValueDisplayed (boolean IsValueDisplayed);
/** Get Display Value.
* Displays Value column with the Display column
*/
public boolean isValueDisplayed();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";

View File

@ -1004,7 +1004,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
else if (invoice != null)
{
// adjust open balance by discount and write off amounts.
BigDecimal amt = MConversionRate.convertBase(getCtx(), line.getWriteOffAmt().add(line.getDiscountAmt()),
BigDecimal amt = MConversionRate.convertBase(getCtx(), allocAmt.negate(),
getC_Currency_ID(), invoice.getDateAcct(), invoice.getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID());
if (amt == null)
{

View File

@ -46,7 +46,7 @@ public class MConversionRate extends X_C_Conversion_Rate
/**
*
*/
private static final long serialVersionUID = -7938144674700640228L;
private static final long serialVersionUID = -3866898973541150020L;
/** Logger */
private static CLogger s_log = CLogger.getCLogger (MConversionRate.class);
@ -441,8 +441,60 @@ public class MConversionRate extends X_C_Conversion_Rate
log.saveError("Error", df.format(to) + " < " + df.format(from));
return false;
}
if (isActive()) {
String whereClause = "(? BETWEEN ValidFrom AND ValidTo OR ? BETWEEN ValidFrom AND ValidTo) "
+ "AND C_Currency_ID=? AND C_Currency_ID_To=? "
+ "AND C_Conversiontype_ID=? "
+ "AND AD_Client_ID=? AND AD_Org_ID=?";
List<MConversionRate> convs = new Query(getCtx(), MConversionRate.Table_Name, whereClause, get_TrxName())
.setOnlyActiveRecords(true)
.setParameters(getValidFrom(), getValidTo(),
getC_Currency_ID(), getC_Currency_ID_To(),
getC_ConversionType_ID(),
getAD_Client_ID(), getAD_Org_ID())
.list();
for (MConversionRate conv : convs) {
if (conv.getC_Conversion_Rate_ID() != getC_Conversion_Rate_ID()) {
log.saveError("Error", "Conversion rate overlaps with: " + conv.getValidFrom());
return false;
}
}
}
return true;
} // beforeSave
@Override
protected boolean afterSave(boolean newRecord, boolean success) {
if (success) {
String whereClause = "ValidFrom=? AND ValidTo=? "
+ "AND C_Currency_ID=? AND C_Currency_ID_To=? "
+ "AND C_ConversionType_ID=? "
+ "AND AD_Client_ID=? AND AD_Org_ID=?";
MConversionRate reciprocal = new Query(getCtx(), MConversionRate.Table_Name, whereClause, get_TrxName())
.setParameters(getValidFrom(), getValidTo(),
getC_Currency_ID_To(), getC_Currency_ID(),
getC_ConversionType_ID(),
getAD_Client_ID(), getAD_Org_ID())
.firstOnly();
if (reciprocal == null) {
// create reciprocal rate
reciprocal = new MConversionRate(getCtx(), 0, get_TrxName());
reciprocal.setValidFrom(getValidFrom());
reciprocal.setValidTo(getValidTo());
reciprocal.setC_ConversionType_ID(getC_ConversionType_ID());
reciprocal.setAD_Client_ID(getAD_Client_ID());
reciprocal.setAD_Org_ID(getAD_Org_ID());
// invert
reciprocal.setC_Currency_ID(getC_Currency_ID_To());
reciprocal.setC_Currency_ID_To(getC_Currency_ID());
}
reciprocal.setDivideRate(getMultiplyRate());
reciprocal.setMultiplyRate(getDivideRate());
reciprocal.saveEx();
}
return success;
}
} // MConversionRate

View File

@ -74,7 +74,7 @@ public class MJournal extends X_GL_Journal implements DocAction
//
setCurrencyRate (Env.ONE);
// setC_ConversionType_ID(0);
setDateAcct (new Timestamp(System.currentTimeMillis()));
// setDateAcct (new Timestamp(System.currentTimeMillis()));
setDateDoc (new Timestamp(System.currentTimeMillis()));
// setDescription (null);
setDocAction (DOCACTION_Complete);

View File

@ -481,7 +481,7 @@ public class MTree extends MTree_Base
String tableName =MTable.getTableName(getCtx(), getAD_Table_ID());
sqlNode.append("SELECT t.").append(tableName)
.append("_ID,");
if (isTreeDrivenByValue())
if (isValueDisplayed())
sqlNode.append("t.Value || ' - ' || t.Name,");
else
sqlNode.append("t.Name,");
@ -490,7 +490,7 @@ public class MTree extends MTree_Base
.append(" FROM ").append(tableName).append(" t ");
if (!m_editable)
sqlNode.append(" WHERE t.IsActive='Y'");
} else if (isTreeDrivenByValue()) {
} else if (isValueDisplayed()) {
sqlNode.append("SELECT t.").append(columnNameX)
.append("_ID, t.Value || ' - ' || t.Name, t.Description, t.IsSummary,").append(color)
.append(" FROM ").append(fromClause);

View File

@ -352,11 +352,15 @@ public class MTree_Base extends X_AD_Tree
log.saveError("Error", "IsSummary column required for tree tables");
return false;
}
if (isTreeDrivenByValue()) {
if (table.getColumnIndex("Value") < 0) {
if (table.getColumnIndex("Value") < 0) {
if (isTreeDrivenByValue()) {
// Value is mandatory column to have a tree driven by Value
setIsTreeDrivenByValue(false);
}
if (isValueDisplayed()) {
// Value is mandatory column to be displayed
setIsValueDisplayed(false);
}
}
return true;

View File

@ -30,7 +30,7 @@ public class X_AD_Tree extends PO implements I_AD_Tree, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20181104L;
private static final long serialVersionUID = 20181226L;
/** Standard Constructor */
public X_AD_Tree (Properties ctx, int AD_Tree_ID, String trxName)
@ -45,6 +45,8 @@ public class X_AD_Tree extends PO implements I_AD_Tree, I_Persistent
setIsLoadAllNodesImmediately (true);
// Y
setIsTreeDrivenByValue (false);
// N
setIsValueDisplayed (false);
// N
setName (null);
setTreeType (null);
@ -254,6 +256,30 @@ public class X_AD_Tree extends PO implements I_AD_Tree, I_Persistent
return false;
}
/** Set Display Value.
@param IsValueDisplayed
Displays Value column with the Display column
*/
public void setIsValueDisplayed (boolean IsValueDisplayed)
{
set_Value (COLUMNNAME_IsValueDisplayed, Boolean.valueOf(IsValueDisplayed));
}
/** Get Display Value.
@return Displays Value column with the Display column
*/
public boolean isValueDisplayed ()
{
Object oo = get_Value(COLUMNNAME_IsValueDisplayed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity

View File

@ -159,7 +159,7 @@
then all entries of the map will be copied to another JVM for
fail-safety. 0 means no backup.
-->
<backup-count>0</backup-count>
<backup-count>1</backup-count>
<!--
Number of async backups. 0 means no backup.
@ -185,7 +185,7 @@
then all entries of the map will be copied to another JVM for
fail-safety. 0 means no backup.
-->
<backup-count>1</backup-count>
<backup-count>0</backup-count>
<!--
Number of async backups. 0 means no backup.
-->

View File

@ -1499,7 +1499,9 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
String value = gridTab.getValue("Value").toString();
parentID = PO.retrieveIdOfParentValue(value, getTableName(), Env.getAD_Client_ID(Env.getCtx()), null);
parentNode = model.find(treeNode, parentID);
name = value + " - " + name;
if (isValueDisplayed()) {
name = value + " - " + name;
}
}
MTreeNode node = new MTreeNode (gridTab.getRecord_ID(), 0, name, description,
parentID, summary, imageIndicator, false, null);
@ -1544,7 +1546,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
}
boolean changed = false;
if (isTreeDrivenByValue()) {
if (isValueDisplayed()) {
String value = (String) gridTab.getValue("Value");
String name = (String) gridTab.getValue("Name");
String full = value + " - " + name;
@ -1879,6 +1881,13 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
return retValue;
}
private boolean isValueDisplayed() {
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) treePanel.getTree().getModel();
boolean retValue = false;
retValue = model.isValueDisplayed();
return retValue;
}
@Override
public void onPageDetached(Page page) {
if (formContainer.getSouth() != null) {

View File

@ -28,7 +28,9 @@ import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.model.MSysConfig;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Decimalbox;
@ -127,9 +129,20 @@ public class NumberBox extends Div
btn.setImage(ThemeManager.getThemeResource("images/Calculator16.png"));
btn.setTabindex(-1);
ZKUpdateUtil.setHflex(btn, "0");
btn.setWidgetListener("onClick", "try{var id=this.getPopup(); zk.Widget.$(id.substring(5, id.length - 1)).focus_(100);" +
"} catch(error) {}");
btn.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
if (btn.getPopup() != null) {
String uid = btn.getPopup();
if (uid.startsWith("uuid("))
uid = uid.substring(5, uid.length()-1);
HtmlBasedComponent comp = (HtmlBasedComponent) btn.getDesktop().getComponentByUuidIfAny(uid);
if (comp != null) {
comp.focus();
}
}
}
});
LayoutUtils.addSclass("editor-button", btn);
appendChild(btn);

View File

@ -48,7 +48,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
/**
*
*/
private static final long serialVersionUID = -2689107390272278321L;
private static final long serialVersionUID = -1591436379012706094L;
private static final CLogger logger = CLogger.getCLogger(SimpleTreeModel.class);
@ -83,6 +83,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
SimpleTreeModel treeModel = SimpleTreeModel.createFrom(root);
treeModel.setItemDraggable(true);
treeModel.setTreeDrivenByValue(vTree.isTreeDrivenByValue());
treeModel.setIsValueDisplayed(vTree.isValueDisplayed());
treeModel.addOnDropEventListener(new ADTreeOnDropListener(tree, treeModel, vTree, windowNo));
if (tree.getTreecols() == null)
@ -115,6 +116,16 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
this.isTreeDrivenByValue = isTreeDrivenByValue;
}
private boolean isValueDisplayed = false;
public boolean isValueDisplayed() {
return isValueDisplayed;
}
public void setIsValueDisplayed(boolean isValueDisplayed) {
this.isValueDisplayed = isValueDisplayed;
}
/**
*
* @param root

View File

@ -1278,6 +1278,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
// Get Language from previous - thanks Gunther Hoppe
if (m_reportEngine.getPrintFormat() != null)
{
setLanguage();
pf.setLanguage(m_reportEngine.getPrintFormat().getLanguage()); // needs to be re-set - otherwise viewer will be blank
pf.setTranslationLanguage(m_reportEngine.getPrintFormat().getLanguage());
}

View File

@ -57,14 +57,14 @@
polling - org.zkoss.zkex.ui.impl.PollingServerPush
comet - org.zkoss.zkmax.ui.comet.CometServerPush ( enterprise edition only )
-->
<!-- device-config>
<device-type>ajax</device-type>
<server-push-class>fi.jawsy.jawwa.zk.atmosphere.AtmosphereServerPush</server-push-class>
</device-config -->
<device-config>
<device-type>ajax</device-type>
<server-push-class>org.idempiere.ui.zk.websocket.WebSocketServerPush</server-push-class>
<server-push-class>fi.jawsy.jawwa.zk.atmosphere.AtmosphereServerPush</server-push-class>
</device-config>
<!-- device-config>
<device-type>ajax</device-type>
<server-push-class>org.idempiere.ui.zk.websocket.WebSocketServerPush</server-push-class>
</device-config -->
<!-- true for better performance and lower resource usage -->
<system-config>

View File

@ -36,6 +36,10 @@
<password>dev-pass</password>
</group>
<management-center enabled="false">http://localhost:8080/hazelcast-mancenter</management-center>
<!-- https://docs.hazelcast.org/docs/3.11/manual/html-single/index.html#time-window-for-split-brain-protection -->
<properties>
<property name="hazelcast.discovery.enabled">false</property>
</properties>
<network>
<port auto-increment="true" port-count="100">5701</port>
<outbound-ports>
@ -46,7 +50,7 @@
<ports>0</ports>
</outbound-ports>
<join>
<multicast enabled="true">
<multicast enabled="false">
<multicast-group>224.2.2.3</multicast-group>
<multicast-port>54327</multicast-port>
</multicast>
@ -90,6 +94,20 @@
<namespace>hazelcast</namespace>
</eureka>
<discovery-strategies>
<discovery-strategy enabled="false" class="com.hazelcast.aws.AwsDiscoveryStrategy">
<properties>
<property name="access-key">my-access-key</property>
<property name="secret-key">my-secret-key</property>
<!--optional, default is us-east-1 -->
<property name="region">us-east-1</property>
<property name="host-header">ec2.amazonaws.com</property>
<!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
<property name="security-group-name">hazelcast-sg</property>
<property name="tag-key">type</property>
<property name="tag-value">hz-nodes</property>
<property name="connection-timeout-seconds">30</property>
</properties>
</discovery-strategy>
</discovery-strategies>
</join>
<interfaces enabled="false">
@ -167,7 +185,7 @@
then all entries of the map will be copied to another JVM for
fail-safety. 0 means no backup.
-->
<backup-count>1</backup-count>
<backup-count>0</backup-count>
<!--
Number of async backups. 0 means no backup.
-->
@ -185,7 +203,7 @@
automatically evicted from the map. Entry is touched if get, put or containsKey is called.
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
-->
<max-idle-seconds>0</max-idle-seconds>
<max-idle-seconds>1800</max-idle-seconds>
<!--
Valid values are:
NONE (no eviction),
@ -193,14 +211,14 @@
LFU (Least Frequently Used).
NONE is the default.
-->
<eviction-policy>NONE</eviction-policy>
<eviction-policy>LRU</eviction-policy>
<!--
Maximum size of the map. When max size is reached,
map is evicted based on the policy defined.
Any integer between 0 and Integer.MAX_VALUE. 0 means
Integer.MAX_VALUE. Default is 0.
-->
<max-size policy="PER_NODE">0</max-size>
<max-size policy="PER_NODE">1000</max-size>
<!--
`eviction-percentage` property is deprecated and will be ignored when it is set.
@ -240,7 +258,11 @@
ALWAYS: Always cache deserialized values.
-->
<cache-deserialized-values>INDEX-ONLY</cache-deserialized-values>
<near-cache name="localNearCache">
<in-memory-format>OBJECT</in-memory-format>
<cache-local-entries>true</cache-local-entries>
</near-cache>
</map>
<!--

View File

@ -14,8 +14,6 @@
package org.idempiere.webservices;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
@ -40,6 +38,7 @@ import org.compiere.model.MWebService;
import org.compiere.model.MWebServiceType;
import org.compiere.model.PO;
import org.compiere.model.POInfo;
import org.compiere.model.Query;
import org.compiere.model.X_WS_WebServiceMethod;
import org.compiere.model.X_WS_WebServiceTypeAccess;
import org.compiere.util.CCache;
@ -234,28 +233,15 @@ public class AbstractService {
synchronized (s_WebServiceTypeCache) {
m_webservicetype = s_WebServiceTypeCache.get(key);
if (m_webservicetype == null) {
final String sql = "SELECT * FROM WS_WebServiceType " + "WHERE AD_Client_ID=? " + "AND WS_WebService_ID=? "
+ "AND WS_WebServiceMethod_ID=? " + "AND Value=? " + "AND IsActive='Y'";
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, m_cs.getAD_Client_ID());
pstmt.setInt(2, m_webservice.getWS_WebService_ID());
pstmt.setInt(3, m_webservicemethod.getWS_WebServiceMethod_ID());
pstmt.setString(4, serviceTypeValue);
rs = pstmt.executeQuery();
if (rs.next()) {
m_webservicetype = new MWebServiceType(m_cs.getCtx(), rs, null);
s_WebServiceTypeCache.put(key, m_webservicetype);
}
} catch (Exception e) {
throw new IdempiereServiceFault(e.getClass().toString() + " " + e.getMessage() + " sql=" + sql, e.getCause(), new QName(
"authenticate"));
} finally {
DB.close(rs, pstmt);
rs = null;
pstmt = null;
m_webservicetype = new Query(m_cs.getCtx(), MWebServiceType.Table_Name,
"AD_Client_ID IN (0,?) AND WS_WebService_ID=? AND WS_WebServiceMethod_ID=? AND Value=?",
null)
.setOnlyActiveRecords(true)
.setParameters(m_cs.getAD_Client_ID(), m_webservice.getWS_WebService_ID(), m_webservicemethod.getWS_WebServiceMethod_ID(), serviceTypeValue)
.setOrderBy("AD_Client_ID DESC") // IDEMPIERE-3394 give precedence to tenant defined if there are system+tenant
.first();
if (m_webservicetype != null) {
s_WebServiceTypeCache.put(key, m_webservicetype);
}
}
}