diff --git a/migration/i6.1/oracle/201812252049_IDEMPIERE-3853.sql b/migration/i6.1/oracle/201812252049_IDEMPIERE-3853.sql new file mode 100644 index 0000000000..6e268fd366 --- /dev/null +++ b/migration/i6.1/oracle/201812252049_IDEMPIERE-3853.sql @@ -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 +; + diff --git a/migration/i6.1/oracle/201812261404_IDEMPIERE-3855.sql b/migration/i6.1/oracle/201812261404_IDEMPIERE-3855.sql new file mode 100644 index 0000000000..d2195970cd --- /dev/null +++ b/migration/i6.1/oracle/201812261404_IDEMPIERE-3855.sql @@ -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 +; + diff --git a/migration/i6.1/postgresql/201812252049_IDEMPIERE-3853.sql b/migration/i6.1/postgresql/201812252049_IDEMPIERE-3853.sql new file mode 100644 index 0000000000..858659c18f --- /dev/null +++ b/migration/i6.1/postgresql/201812252049_IDEMPIERE-3853.sql @@ -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 +; + diff --git a/migration/i6.1/postgresql/201812261404_IDEMPIERE-3855.sql b/migration/i6.1/postgresql/201812261404_IDEMPIERE-3855.sql new file mode 100644 index 0000000000..9a0bf3a98b --- /dev/null +++ b/migration/i6.1/postgresql/201812261404_IDEMPIERE-3855.sql @@ -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 +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/RevenueRecognition.java b/org.adempiere.base.process/src/org/compiere/process/RevenueRecognition.java index 21af14d1fb..f5070b2ad2 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RevenueRecognition.java +++ b/org.adempiere.base.process/src/org/compiere/process/RevenueRecognition.java @@ -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 diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Tree.java b/org.adempiere.base/src/org/compiere/model/I_AD_Tree.java index 6be88c527a..e2c8ba770f 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Tree.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Tree.java @@ -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"; diff --git a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java index e6146929e8..9463781960 100644 --- a/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/model/MAllocationHdr.java @@ -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) { diff --git a/org.adempiere.base/src/org/compiere/model/MConversionRate.java b/org.adempiere.base/src/org/compiere/model/MConversionRate.java index 74c8de8287..f16016bc98 100644 --- a/org.adempiere.base/src/org/compiere/model/MConversionRate.java +++ b/org.adempiere.base/src/org/compiere/model/MConversionRate.java @@ -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 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 diff --git a/org.adempiere.base/src/org/compiere/model/MJournal.java b/org.adempiere.base/src/org/compiere/model/MJournal.java index 05e8ece324..a5bfe3f9aa 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournal.java +++ b/org.adempiere.base/src/org/compiere/model/MJournal.java @@ -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); diff --git a/org.adempiere.base/src/org/compiere/model/MTree.java b/org.adempiere.base/src/org/compiere/model/MTree.java index 0d7af47776..53e4a68b54 100644 --- a/org.adempiere.base/src/org/compiere/model/MTree.java +++ b/org.adempiere.base/src/org/compiere/model/MTree.java @@ -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); diff --git a/org.adempiere.base/src/org/compiere/model/MTree_Base.java b/org.adempiere.base/src/org/compiere/model/MTree_Base.java index d6160b0ddc..26b6438221 100644 --- a/org.adempiere.base/src/org/compiere/model/MTree_Base.java +++ b/org.adempiere.base/src/org/compiere/model/MTree_Base.java @@ -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; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Tree.java b/org.adempiere.base/src/org/compiere/model/X_AD_Tree.java index f9d08155ae..7975dd588f 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Tree.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Tree.java @@ -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 diff --git a/org.adempiere.server-feature/hazelcast-template.xml b/org.adempiere.server-feature/hazelcast-template.xml index 79c9a70f84..5fa61d879f 100644 --- a/org.adempiere.server-feature/hazelcast-template.xml +++ b/org.adempiere.server-feature/hazelcast-template.xml @@ -159,7 +159,7 @@ then all entries of the map will be copied to another JVM for fail-safety. 0 means no backup. --> - 0 + 1 - 1 + 0 diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index dc01963733..e21dd3ebf0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -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) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java index 27701017fb..97f11373e6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java @@ -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() { + @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); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/SimpleTreeModel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/SimpleTreeModel.java index a08de46680..cc48dc008d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/SimpleTreeModel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/SimpleTreeModel.java @@ -48,7 +48,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel 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 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 impl this.isTreeDrivenByValue = isTreeDrivenByValue; } + private boolean isValueDisplayed = false; + + public boolean isValueDisplayed() { + return isValueDisplayed; + } + + public void setIsValueDisplayed(boolean isValueDisplayed) { + this.isValueDisplayed = isValueDisplayed; + } + /** * * @param root diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index b9ecff22c6..95fd83e4ea 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -1278,6 +1278,7 @@ public class ZkReportViewer extends Window implements EventListener, 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()); } diff --git a/org.adempiere.ui.zk/WEB-INF/zk.xml b/org.adempiere.ui.zk/WEB-INF/zk.xml index e26bfde163..e6c4579b4f 100644 --- a/org.adempiere.ui.zk/WEB-INF/zk.xml +++ b/org.adempiere.ui.zk/WEB-INF/zk.xml @@ -57,14 +57,14 @@ polling - org.zkoss.zkex.ui.impl.PollingServerPush comet - org.zkoss.zkmax.ui.comet.CometServerPush ( enterprise edition only ) --> - ajax - org.idempiere.ui.zk.websocket.WebSocketServerPush + fi.jawsy.jawwa.zk.atmosphere.AtmosphereServerPush + diff --git a/org.idempiere.hazelcast.service.config/hazelcast.xml b/org.idempiere.hazelcast.service.config/hazelcast.xml index 7def213cf7..fa1c70cfe8 100644 --- a/org.idempiere.hazelcast.service.config/hazelcast.xml +++ b/org.idempiere.hazelcast.service.config/hazelcast.xml @@ -36,6 +36,10 @@ dev-pass http://localhost:8080/hazelcast-mancenter + + + false + 5701 @@ -46,7 +50,7 @@ 0 - + 224.2.2.3 54327 @@ -90,6 +94,20 @@ hazelcast + + + my-access-key + my-secret-key + + us-east-1 + ec2.amazonaws.com + + hazelcast-sg + type + hz-nodes + 30 + + @@ -167,7 +185,7 @@ then all entries of the map will be copied to another JVM for fail-safety. 0 means no backup. --> - 1 + 0 @@ -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. --> - 0 + 1800 - NONE + LRU - 0 + 1000 INDEX-ONLY - + + + OBJECT + true +