diff --git a/migration/i5.1/oracle/201804251707_IDEMPIERE-3698.sql b/migration/i5.1/oracle/201804251707_IDEMPIERE-3698.sql
new file mode 100644
index 0000000000..c4874f48b2
--- /dev/null
+++ b/migration/i5.1/oracle/201804251707_IDEMPIERE-3698.sql
@@ -0,0 +1,16 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- R_MailText.MailText
+-- Apr 25, 2018 5:01:41 PM CEST
+UPDATE AD_Column SET FieldLength=0, AD_Reference_ID=36,Updated=TO_DATE('2018-04-25 17:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5414
+;
+
+-- Apr 25, 2018 5:01:48 PM CEST
+ALTER TABLE R_MailText ADD Tmp_MailText CLOB;
+UPDATE R_MailText SET Tmp_MailText = TO_CHAR(MailText);
+ALTER TABLE R_MailText DROP COLUMN MailText;
+ALTER TABLE R_MailText RENAME COLUMN Tmp_MailText TO MailText;
+
+SELECT register_migration_script('201804251707_IDEMPIERE-3698.sql') FROM dual
+;
diff --git a/migration/i5.1/oracle/201805011457_IDEMPIERE-3632.sql b/migration/i5.1/oracle/201805011457_IDEMPIERE-3632.sql
new file mode 100644
index 0000000000..1f6be598d7
--- /dev/null
+++ b/migration/i5.1/oracle/201805011457_IDEMPIERE-3632.sql
@@ -0,0 +1,19 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-1298 2Pack: Support copying of data from one client to another
+-- May 1, 2018 7:55:19 AM COT
+UPDATE AD_Column SET AD_Reference_ID=14,Updated=TO_DATE('2018-05-01 07:55:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3376
+;
+
+-- May 1, 2018 7:56:13 AM COT
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=3, IsToolbarButton=NULL,Updated=TO_DATE('2018-05-01 07:56:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=7543
+;
+
+-- May 1, 2018 7:56:38 AM COT
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=3, IsToolbarButton=NULL,Updated=TO_DATE('2018-05-01 07:56:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2577
+;
+
+SELECT register_migration_script('201805011457_IDEMPIERE-3632.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201805021545_IDEMPIERE-2852.sql b/migration/i5.1/oracle/201805021545_IDEMPIERE-2852.sql
new file mode 100644
index 0000000000..b6ef6fef4d
--- /dev/null
+++ b/migration/i5.1/oracle/201805021545_IDEMPIERE-2852.sql
@@ -0,0 +1,131 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-2852
+-- May 2, 2018 3:17:39 PM CEST
+UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_DATE('2018-05-02 15:17:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50039
+;
+
+-- May 2, 2018 3:18:25 PM CEST
+UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_DATE('2018-05-02 15:18:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200050
+;
+
+-- May 2, 2018 3:18:51 PM CEST
+UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_DATE('2018-05-02 15:18:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50024
+;
+
+update ad_sysconfig set ad_sysconfig_id=200118, ad_sysconfig_uu='4731096e-6ed8-4bc8-85d1-43d9caf8a2f8' where ad_client_id=0 and name='ALLOW_APPLY_PAYMENT_TO_CREDITMEMO';
+
+update ad_sysconfig set ad_sysconfig_id=200119, ad_sysconfig_uu='52933d5d-d70d-432a-9d4b-037a2d940b85' where ad_client_id=0 and name='ALLOW_OVER_APPLIED_PAYMENT';
+
+update ad_sysconfig set ad_sysconfig_id=200120, ad_sysconfig_uu='a69f35d6-3bbf-4eb6-81b6-d38be345f89c' where ad_client_id=0 and name='APPLICATION_URL';
+
+update ad_sysconfig set ad_sysconfig_id=200121, ad_sysconfig_uu='25fad374-325e-4f62-a00b-84f76e81d3a9' where ad_client_id=0 and name='CALENDAR_ALTERNATE_TIMEZONE';
+
+update ad_sysconfig set ad_sysconfig_id=200122, ad_sysconfig_uu='e367e204-35ca-4838-ad2a-cc096023add4' where ad_client_id=0 and name='ENABLE_PAYMENTBOX_BUTTON';
+
+update ad_sysconfig set ad_sysconfig_id=200123, ad_sysconfig_uu='638bd8a9-e72c-45f3-877c-f6f2ffa8453e' where ad_client_id=0 and name='HTML_REPORT_THEME';
+
+update ad_sysconfig set ad_sysconfig_id=200124, ad_sysconfig_uu='678852cf-bf78-4644-8cb5-79498785b961' where ad_client_id=0 and name='MAIL_DONT_SEND_TO_ADDRESS';
+
+update ad_sysconfig set ad_sysconfig_id=200125, ad_sysconfig_uu='ebdef833-b08b-4cd6-a250-e1ed7969b636' where ad_client_id=0 and name='MAIL_SEND_BCC_TO_ADDRESS';
+
+update ad_sysconfig set ad_sysconfig_id=200126, ad_sysconfig_uu='40688467-44aa-4189-b8f6-cf897d61d984' where ad_client_id=0 and name='MAX_ACTIVITIES_IN_LIST';
+
+update ad_sysconfig set ad_sysconfig_id=200127, ad_sysconfig_uu='5432f856-85e2-46b8-9095-8c8a73d874e3' where ad_client_id=0 and name='MFG_ValidateCostsDifferenceOnCreate';
+
+update ad_sysconfig set ad_sysconfig_id=200128, ad_sysconfig_uu='2bb77e84-41da-48ec-985e-f03223204b1d' where ad_client_id=0 and name='MFG_ValidateCostsOnCreate';
+
+update ad_sysconfig set ad_sysconfig_id=200129, ad_sysconfig_uu='79d83d91-f4d8-4118-a22b-7d336deccaea' where ad_client_id=0 and name='STANDARD_REPORT_FOOTER_TRADEMARK_TEXT';
+
+update ad_sysconfig set ad_sysconfig_id=200132, ad_sysconfig_uu='a6cc348b-d7c9-4af6-a5ae-416b23d9c220' where ad_client_id=0 and name='ZK_DECIMALBOX_PROCESS_DOTKEYPAD';
+
+update ad_sysconfig set ad_sysconfig_id=200133, ad_sysconfig_uu='0cefeb0f-2c5c-4d71-87c5-85a23731a6ac' where ad_client_id=0 and name='ZK_FOOTER_SERVER_DATETIME_FORMAT';
+
+update ad_sysconfig set ad_sysconfig_id=200134, ad_sysconfig_uu='a18d519b-eeb6-4ec6-a080-1495ad829dba' where ad_client_id=0 and name='ZK_FOOTER_SERVER_MSG';
+
+update ad_sysconfig set ad_sysconfig_id=200135, ad_sysconfig_uu='88547d79-3b61-4648-9a16-1f4e1a14f426' where ad_client_id=0 and name='ZK_GRID_MOBILE_MAX_COLUMNS';
+
+update ad_sysconfig set ad_sysconfig_id=200136, ad_sysconfig_uu='b535d0cb-8921-4f84-a1b5-01fb9620779e' where ad_client_id=0 and name='ZK_MOBILE_PAGING_SIZE';
+
+update ad_sysconfig set ad_sysconfig_id=200137, ad_sysconfig_uu='0599feeb-845f-4ccb-a740-94ad04c85d64' where ad_client_id=0 and name='ZK_SESSION_TIMEOUT_IN_SECONDS';
+
+-- May 2, 2018 3:19:49 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200118,0,0,TO_DATE('2018-05-02 15:19:49','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:19:49','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALLOW_APPLY_PAYMENT_TO_CREDITMEMO','N','Allow applying payment to a credit memo','D','C','4731096e-6ed8-4bc8-85d1-43d9caf8a2f8')
+;
+
+-- May 2, 2018 3:20:27 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200119,0,0,TO_DATE('2018-05-02 15:20:27','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:20:27','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALLOW_OVER_APPLIED_PAYMENT','N','Allow a payment to be over applied to an invoice','D','C','52933d5d-d70d-432a-9d4b-037a2d940b85')
+;
+
+-- May 2, 2018 3:22:55 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200120,0,0,TO_DATE('2018-05-02 15:22:54','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:22:54','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','APPLICATION_URL','USE_HARDCODED','Server URL to generate zoom for a record. When empty, or using the value USE_HARDCODED, the system generates an URL with current protocol, server name, port, context','D','C','a69f35d6-3bbf-4eb6-81b6-d38be345f89c')
+;
+
+-- May 2, 2018 3:24:05 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200121,0,0,TO_DATE('2018-05-02 15:24:05','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:24:05','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','CALENDAR_ALTERNATE_TIMEZONE','Pacific Time=PST','Alternate time zone to show in Calendar window. It can be defined as one zone or several zones separated by comma. A zone is defined by a title =timezone, title is shown in the calendar, and the timezone must conform to timezone standard. If set empty (a ','D','C','25fad374-325e-4f62-a00b-84f76e81d3a9')
+;
+
+-- May 2, 2018 3:28:04 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200122,0,0,TO_DATE('2018-05-02 15:28:04','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:28:04','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ENABLE_PAYMENTBOX_BUTTON','Y','Defines if the payment button besides the payment rule is shown or not','D','C','e367e204-35ca-4838-ad2a-cc096023add4')
+;
+
+-- May 2, 2018 3:29:55 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200123,0,0,TO_DATE('2018-05-02 15:29:55','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:29:55','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','HTML_REPORT_THEME','/','Name of optional theme for HTML reports on webui','D','C','638bd8a9-e72c-45f3-877c-f6f2ffa8453e')
+;
+
+-- May 2, 2018 3:30:36 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200124,0,0,TO_DATE('2018-05-02 15:30:36','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:30:36','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAIL_DONT_SEND_TO_ADDRESS','N','For test systems you can set up this key to avoid sending unwanted messages. If combined with MAIL_SEND_BCC_TO_ADDRESS, then it will send messages just to the configured address','D','C','678852cf-bf78-4644-8cb5-79498785b961')
+;
+
+-- May 2, 2018 3:31:46 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200125,0,0,TO_DATE('2018-05-02 15:31:45','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:31:45','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAIL_SEND_BCC_TO_ADDRESS',' ','You can register an e-mail address and all the outgoing mails from the system will be sent BCC there','D','C','ebdef833-b08b-4cd6-a250-e1ed7969b636')
+;
+
+-- May 2, 2018 3:32:36 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200126,0,0,TO_DATE('2018-05-02 15:32:35','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:32:35','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAX_ACTIVITIES_IN_LIST','200','Max number of activities in list','D','C','40688467-44aa-4189-b8f6-cf897d61d984')
+;
+
+-- May 2, 2018 3:34:16 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200127,0,0,TO_DATE('2018-05-02 15:34:16','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:34:16','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MFG_ValidateCostsDifferenceOnCreate','N','D','C','5432f856-85e2-46b8-9095-8c8a73d874e3')
+;
+
+-- May 2, 2018 3:35:00 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200128,0,0,TO_DATE('2018-05-02 15:35:00','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:35:00','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MFG_ValidateCostsOnCreate','N','D','C','2bb77e84-41da-48ec-985e-f03223204b1d')
+;
+
+-- May 2, 2018 3:36:24 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200129,0,0,TO_DATE('2018-05-02 15:36:24','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:36:24','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','STANDARD_REPORT_FOOTER_TRADEMARK_TEXT',' ','Define the system information to show on report footer','D','C','79d83d91-f4d8-4118-a22b-7d336deccaea')
+;
+
+-- May 2, 2018 3:38:50 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200132,0,0,TO_DATE('2018-05-02 15:38:50','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:38:50','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_DECIMALBOX_PROCESS_DOTKEYPAD','Y','Defines if numeric entry must treat the dot keypad as decimal separator on language','D','C','a6cc348b-d7c9-4af6-a5ae-416b23d9c220')
+;
+
+-- May 2, 2018 3:40:06 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200133,0,0,TO_DATE('2018-05-02 15:40:06','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:40:06','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_FOOTER_SERVER_DATETIME_FORMAT',' ','This key can change the format that is used on the dates on footer of reports','D','C','0cefeb0f-2c5c-4d71-87c5-85a23731a6ac')
+;
+
+-- May 2, 2018 3:42:17 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200134,0,0,TO_DATE('2018-05-02 15:42:17','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:42:17','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_FOOTER_SERVER_MSG',' ','This key allows to change the message that is shown on report footers','D','C','a18d519b-eeb6-4ec6-a080-1495ad829dba')
+;
+
+-- May 2, 2018 3:42:54 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200135,0,0,TO_DATE('2018-05-02 15:42:53','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:42:53','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_GRID_MOBILE_MAX_COLUMNS','10','The max number of columns to show in grid view on mobile screens','D','C','88547d79-3b61-4648-9a16-1f4e1a14f426')
+;
+
+-- May 2, 2018 3:43:54 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200136,0,0,TO_DATE('2018-05-02 15:43:54','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:43:54','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_MOBILE_PAGING_SIZE','20','Default paging size for grid view in mobile screens','D','C','b535d0cb-8921-4f84-a1b5-01fb9620779e')
+;
+
+-- May 2, 2018 3:45:09 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200137,0,0,TO_DATE('2018-05-02 15:45:08','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-05-02 15:45:08','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_SESSION_TIMEOUT_IN_SECONDS','-2','ZK session timeout. -2 meaning not set','D','O','0599feeb-845f-4ccb-a740-94ad04c85d64')
+;
+
+-- May 2, 2018 8:34:38 PM CEST
+UPDATE AD_SysConfig SET Name='JASPER_SWAP_MAX_PAGES',Updated=TO_DATE('2018-05-02 20:34:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200011
+;
+
+SELECT register_migration_script('201805021545_IDEMPIERE-2852.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201805091216_IDEMPIERE-2057.sql b/migration/i5.1/oracle/201805091216_IDEMPIERE-2057.sql
new file mode 100644
index 0000000000..f27e6442c2
--- /dev/null
+++ b/migration/i5.1/oracle/201805091216_IDEMPIERE-2057.sql
@@ -0,0 +1,19 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-2057
+-- May 9, 2018 12:15:12 PM CEST
+UPDATE AD_Field SET IsReadOnly='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-05-09 12:15:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203261
+;
+
+-- May 9, 2018 12:15:33 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2018-05-09 12:15:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203261
+;
+
+-- May 9, 2018 12:15:33 PM CEST
+UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-05-09 12:15:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204857
+;
+
+SELECT register_migration_script('201805091216_IDEMPIERE-2057.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201804251707_IDEMPIERE-3698.sql b/migration/i5.1/postgresql/201804251707_IDEMPIERE-3698.sql
new file mode 100644
index 0000000000..59ea8fd0c1
--- /dev/null
+++ b/migration/i5.1/postgresql/201804251707_IDEMPIERE-3698.sql
@@ -0,0 +1,11 @@
+-- R_MailText.MailText
+-- Apr 25, 2018 5:01:41 PM CEST
+UPDATE AD_Column SET FieldLength=0, AD_Reference_ID=36,Updated=TO_TIMESTAMP('2018-04-25 17:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=5414
+;
+
+-- Apr 25, 2018 5:01:48 PM CEST
+INSERT INTO t_alter_column values('r_mailtext','MailText','TEXT',null,null)
+;
+
+SELECT register_migration_script('201804251707_IDEMPIERE-3698.sql') FROM dual
+;
diff --git a/migration/i5.1/postgresql/201805011457_IDEMPIERE-3632.sql b/migration/i5.1/postgresql/201805011457_IDEMPIERE-3632.sql
new file mode 100644
index 0000000000..e6bf93deda
--- /dev/null
+++ b/migration/i5.1/postgresql/201805011457_IDEMPIERE-3632.sql
@@ -0,0 +1,16 @@
+-- IDEMPIERE-1298 2Pack: Support copying of data from one client to another
+-- May 1, 2018 7:55:19 AM COT
+UPDATE AD_Column SET AD_Reference_ID=14,Updated=TO_TIMESTAMP('2018-05-01 07:55:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3376
+;
+
+-- May 1, 2018 7:56:13 AM COT
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=3, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-05-01 07:56:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=7543
+;
+
+-- May 1, 2018 7:56:38 AM COT
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=3, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-05-01 07:56:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2577
+;
+
+SELECT register_migration_script('201805011457_IDEMPIERE-3632.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201805021545_IDEMPIERE-2852.sql b/migration/i5.1/postgresql/201805021545_IDEMPIERE-2852.sql
new file mode 100644
index 0000000000..9e2bb28e87
--- /dev/null
+++ b/migration/i5.1/postgresql/201805021545_IDEMPIERE-2852.sql
@@ -0,0 +1,128 @@
+-- IDEMPIERE-2852
+-- May 2, 2018 3:17:39 PM CEST
+UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_TIMESTAMP('2018-05-02 15:17:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50039
+;
+
+-- May 2, 2018 3:18:25 PM CEST
+UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_TIMESTAMP('2018-05-02 15:18:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200050
+;
+
+-- May 2, 2018 3:18:51 PM CEST
+UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_TIMESTAMP('2018-05-02 15:18:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=50024
+;
+
+update ad_sysconfig set ad_sysconfig_id=200118, ad_sysconfig_uu='4731096e-6ed8-4bc8-85d1-43d9caf8a2f8' where ad_client_id=0 and name='ALLOW_APPLY_PAYMENT_TO_CREDITMEMO';
+
+update ad_sysconfig set ad_sysconfig_id=200119, ad_sysconfig_uu='52933d5d-d70d-432a-9d4b-037a2d940b85' where ad_client_id=0 and name='ALLOW_OVER_APPLIED_PAYMENT';
+
+update ad_sysconfig set ad_sysconfig_id=200120, ad_sysconfig_uu='a69f35d6-3bbf-4eb6-81b6-d38be345f89c' where ad_client_id=0 and name='APPLICATION_URL';
+
+update ad_sysconfig set ad_sysconfig_id=200121, ad_sysconfig_uu='25fad374-325e-4f62-a00b-84f76e81d3a9' where ad_client_id=0 and name='CALENDAR_ALTERNATE_TIMEZONE';
+
+update ad_sysconfig set ad_sysconfig_id=200122, ad_sysconfig_uu='e367e204-35ca-4838-ad2a-cc096023add4' where ad_client_id=0 and name='ENABLE_PAYMENTBOX_BUTTON';
+
+update ad_sysconfig set ad_sysconfig_id=200123, ad_sysconfig_uu='638bd8a9-e72c-45f3-877c-f6f2ffa8453e' where ad_client_id=0 and name='HTML_REPORT_THEME';
+
+update ad_sysconfig set ad_sysconfig_id=200124, ad_sysconfig_uu='678852cf-bf78-4644-8cb5-79498785b961' where ad_client_id=0 and name='MAIL_DONT_SEND_TO_ADDRESS';
+
+update ad_sysconfig set ad_sysconfig_id=200125, ad_sysconfig_uu='ebdef833-b08b-4cd6-a250-e1ed7969b636' where ad_client_id=0 and name='MAIL_SEND_BCC_TO_ADDRESS';
+
+update ad_sysconfig set ad_sysconfig_id=200126, ad_sysconfig_uu='40688467-44aa-4189-b8f6-cf897d61d984' where ad_client_id=0 and name='MAX_ACTIVITIES_IN_LIST';
+
+update ad_sysconfig set ad_sysconfig_id=200127, ad_sysconfig_uu='5432f856-85e2-46b8-9095-8c8a73d874e3' where ad_client_id=0 and name='MFG_ValidateCostsDifferenceOnCreate';
+
+update ad_sysconfig set ad_sysconfig_id=200128, ad_sysconfig_uu='2bb77e84-41da-48ec-985e-f03223204b1d' where ad_client_id=0 and name='MFG_ValidateCostsOnCreate';
+
+update ad_sysconfig set ad_sysconfig_id=200129, ad_sysconfig_uu='79d83d91-f4d8-4118-a22b-7d336deccaea' where ad_client_id=0 and name='STANDARD_REPORT_FOOTER_TRADEMARK_TEXT';
+
+update ad_sysconfig set ad_sysconfig_id=200132, ad_sysconfig_uu='a6cc348b-d7c9-4af6-a5ae-416b23d9c220' where ad_client_id=0 and name='ZK_DECIMALBOX_PROCESS_DOTKEYPAD';
+
+update ad_sysconfig set ad_sysconfig_id=200133, ad_sysconfig_uu='0cefeb0f-2c5c-4d71-87c5-85a23731a6ac' where ad_client_id=0 and name='ZK_FOOTER_SERVER_DATETIME_FORMAT';
+
+update ad_sysconfig set ad_sysconfig_id=200134, ad_sysconfig_uu='a18d519b-eeb6-4ec6-a080-1495ad829dba' where ad_client_id=0 and name='ZK_FOOTER_SERVER_MSG';
+
+update ad_sysconfig set ad_sysconfig_id=200135, ad_sysconfig_uu='88547d79-3b61-4648-9a16-1f4e1a14f426' where ad_client_id=0 and name='ZK_GRID_MOBILE_MAX_COLUMNS';
+
+update ad_sysconfig set ad_sysconfig_id=200136, ad_sysconfig_uu='b535d0cb-8921-4f84-a1b5-01fb9620779e' where ad_client_id=0 and name='ZK_MOBILE_PAGING_SIZE';
+
+update ad_sysconfig set ad_sysconfig_id=200137, ad_sysconfig_uu='0599feeb-845f-4ccb-a740-94ad04c85d64' where ad_client_id=0 and name='ZK_SESSION_TIMEOUT_IN_SECONDS';
+
+-- May 2, 2018 3:19:49 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200118,0,0,TO_TIMESTAMP('2018-05-02 15:19:49','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:19:49','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALLOW_APPLY_PAYMENT_TO_CREDITMEMO','N','Allow applying payment to a credit memo','D','C','4731096e-6ed8-4bc8-85d1-43d9caf8a2f8')
+;
+
+-- May 2, 2018 3:20:27 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200119,0,0,TO_TIMESTAMP('2018-05-02 15:20:27','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:20:27','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ALLOW_OVER_APPLIED_PAYMENT','N','Allow a payment to be over applied to an invoice','D','C','52933d5d-d70d-432a-9d4b-037a2d940b85')
+;
+
+-- May 2, 2018 3:22:55 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200120,0,0,TO_TIMESTAMP('2018-05-02 15:22:54','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:22:54','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','APPLICATION_URL','USE_HARDCODED','Server URL to generate zoom for a record. When empty, or using the value USE_HARDCODED, the system generates an URL with current protocol, server name, port, context','D','C','a69f35d6-3bbf-4eb6-81b6-d38be345f89c')
+;
+
+-- May 2, 2018 3:24:05 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200121,0,0,TO_TIMESTAMP('2018-05-02 15:24:05','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:24:05','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','CALENDAR_ALTERNATE_TIMEZONE','Pacific Time=PST','Alternate time zone to show in Calendar window. It can be defined as one zone or several zones separated by comma. A zone is defined by a title =timezone, title is shown in the calendar, and the timezone must conform to timezone standard. If set empty (a ','D','C','25fad374-325e-4f62-a00b-84f76e81d3a9')
+;
+
+-- May 2, 2018 3:28:04 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200122,0,0,TO_TIMESTAMP('2018-05-02 15:28:04','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:28:04','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ENABLE_PAYMENTBOX_BUTTON','Y','Defines if the payment button besides the payment rule is shown or not','D','C','e367e204-35ca-4838-ad2a-cc096023add4')
+;
+
+-- May 2, 2018 3:29:55 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200123,0,0,TO_TIMESTAMP('2018-05-02 15:29:55','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:29:55','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','HTML_REPORT_THEME','/','Name of optional theme for HTML reports on webui','D','C','638bd8a9-e72c-45f3-877c-f6f2ffa8453e')
+;
+
+-- May 2, 2018 3:30:36 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200124,0,0,TO_TIMESTAMP('2018-05-02 15:30:36','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:30:36','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAIL_DONT_SEND_TO_ADDRESS','N','For test systems you can set up this key to avoid sending unwanted messages. If combined with MAIL_SEND_BCC_TO_ADDRESS, then it will send messages just to the configured address','D','C','678852cf-bf78-4644-8cb5-79498785b961')
+;
+
+-- May 2, 2018 3:31:46 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200125,0,0,TO_TIMESTAMP('2018-05-02 15:31:45','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:31:45','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAIL_SEND_BCC_TO_ADDRESS',' ','You can register an e-mail address and all the outgoing mails from the system will be sent BCC there','D','C','ebdef833-b08b-4cd6-a250-e1ed7969b636')
+;
+
+-- May 2, 2018 3:32:36 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200126,0,0,TO_TIMESTAMP('2018-05-02 15:32:35','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:32:35','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAX_ACTIVITIES_IN_LIST','200','Max number of activities in list','D','C','40688467-44aa-4189-b8f6-cf897d61d984')
+;
+
+-- May 2, 2018 3:34:16 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200127,0,0,TO_TIMESTAMP('2018-05-02 15:34:16','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:34:16','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MFG_ValidateCostsDifferenceOnCreate','N','D','C','5432f856-85e2-46b8-9095-8c8a73d874e3')
+;
+
+-- May 2, 2018 3:35:00 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200128,0,0,TO_TIMESTAMP('2018-05-02 15:35:00','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:35:00','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MFG_ValidateCostsOnCreate','N','D','C','2bb77e84-41da-48ec-985e-f03223204b1d')
+;
+
+-- May 2, 2018 3:36:24 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200129,0,0,TO_TIMESTAMP('2018-05-02 15:36:24','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:36:24','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','STANDARD_REPORT_FOOTER_TRADEMARK_TEXT',' ','Define the system information to show on report footer','D','C','79d83d91-f4d8-4118-a22b-7d336deccaea')
+;
+
+-- May 2, 2018 3:38:50 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200132,0,0,TO_TIMESTAMP('2018-05-02 15:38:50','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:38:50','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_DECIMALBOX_PROCESS_DOTKEYPAD','Y','Defines if numeric entry must treat the dot keypad as decimal separator on language','D','C','a6cc348b-d7c9-4af6-a5ae-416b23d9c220')
+;
+
+-- May 2, 2018 3:40:06 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200133,0,0,TO_TIMESTAMP('2018-05-02 15:40:06','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:40:06','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_FOOTER_SERVER_DATETIME_FORMAT',' ','This key can change the format that is used on the dates on footer of reports','D','C','0cefeb0f-2c5c-4d71-87c5-85a23731a6ac')
+;
+
+-- May 2, 2018 3:42:17 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200134,0,0,TO_TIMESTAMP('2018-05-02 15:42:17','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:42:17','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_FOOTER_SERVER_MSG',' ','This key allows to change the message that is shown on report footers','D','C','a18d519b-eeb6-4ec6-a080-1495ad829dba')
+;
+
+-- May 2, 2018 3:42:54 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200135,0,0,TO_TIMESTAMP('2018-05-02 15:42:53','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:42:53','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_GRID_MOBILE_MAX_COLUMNS','10','The max number of columns to show in grid view on mobile screens','D','C','88547d79-3b61-4648-9a16-1f4e1a14f426')
+;
+
+-- May 2, 2018 3:43:54 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200136,0,0,TO_TIMESTAMP('2018-05-02 15:43:54','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:43:54','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_MOBILE_PAGING_SIZE','20','Default paging size for grid view in mobile screens','D','C','b535d0cb-8921-4f84-a1b5-01fb9620779e')
+;
+
+-- May 2, 2018 3:45:09 PM CEST
+INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200137,0,0,TO_TIMESTAMP('2018-05-02 15:45:08','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-05-02 15:45:08','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_SESSION_TIMEOUT_IN_SECONDS','-2','ZK session timeout. -2 meaning not set','D','O','0599feeb-845f-4ccb-a740-94ad04c85d64')
+;
+
+-- May 2, 2018 8:34:38 PM CEST
+UPDATE AD_SysConfig SET Name='JASPER_SWAP_MAX_PAGES',Updated=TO_TIMESTAMP('2018-05-02 20:34:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200011
+;
+
+SELECT register_migration_script('201805021545_IDEMPIERE-2852.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201805091216_IDEMPIERE-2057.sql b/migration/i5.1/postgresql/201805091216_IDEMPIERE-2057.sql
new file mode 100644
index 0000000000..6c4f0944ea
--- /dev/null
+++ b/migration/i5.1/postgresql/201805091216_IDEMPIERE-2057.sql
@@ -0,0 +1,16 @@
+-- IDEMPIERE-2057
+-- May 9, 2018 12:15:12 PM CEST
+UPDATE AD_Field SET IsReadOnly='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-05-09 12:15:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203261
+;
+
+-- May 9, 2018 12:15:33 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-05-09 12:15:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203261
+;
+
+-- May 9, 2018 12:15:33 PM CEST
+UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-05-09 12:15:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204857
+;
+
+SELECT register_migration_script('201805091216_IDEMPIERE-2057.sql') FROM dual
+;
+
diff --git a/org.adempiere.base-feature/sign.database.build.launch b/org.adempiere.base-feature/sign.database.build.launch
index 87719eb972..6394255b5c 100644
--- a/org.adempiere.base-feature/sign.database.build.launch
+++ b/org.adempiere.base-feature/sign.database.build.launch
@@ -20,8 +20,8 @@
-
-
+
+
diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java
index a78788b2bd..28bb0d4b8c 100644
--- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java
+++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java
@@ -322,14 +322,20 @@ public class CalloutInvoice extends CalloutEngine
mTab.setValue("M_AttributeSetInstance_ID", null);
/***** Price Calculation see also qty ****/
- I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class);
+ boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
+ int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
+ BigDecimal Qty = (BigDecimal)mTab.getValue("QtyInvoiced");
IProductPricing pp = Core.getProductPricing();
+ pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
+ Timestamp invoiceDate = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced");
+ pp.setPriceDate(invoiceDate);
+ I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class);
pp.setInvoiceLine(invoiceLine, null);
+
//
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
pp.setM_PriceList_ID(M_PriceList_ID);
- Timestamp invoiceDate = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced");
/** PLV is only accurate if PL selected in header */
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
@@ -552,16 +558,20 @@ public class CalloutInvoice extends CalloutEngine
|| mField.getColumnName().equals("M_Product_ID"))
&& !"N".equals(Env.getContext(ctx, WindowNo, "DiscountSchema")))
{
+ int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
if (mField.getColumnName().equals("QtyEntered"))
QtyInvoiced = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered);
if (QtyInvoiced == null)
QtyInvoiced = QtyEntered;
- I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class);
+ boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
IProductPricing pp = Core.getProductPricing();
+ pp.setInitialValues(M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx, null);
+ Timestamp date = (Timestamp)mTab.getValue("DateInvoiced");
+ pp.setPriceDate(date);
+ I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class);
pp.setInvoiceLine(invoiceLine, null);
pp.setM_PriceList_ID(M_PriceList_ID);
- pp.setQty(QtyInvoiced);
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
//
@@ -836,13 +846,18 @@ public class CalloutInvoice extends CalloutEngine
}
/***** Price Calculation see also qty ****/
- I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class);
+ int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
+ BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
+ boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
IProductPricing pp = Core.getProductPricing();
+ pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
+ Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
+ pp.setPriceDate(orderDate);
+ I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class);
pp.setInvoiceLine(invoiceLine, null);
//
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
pp.setM_PriceList_ID(M_PriceList_ID);
- Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
/** PLV is only accurate if PL selected in header */
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java
index 4f300b068c..617ac5698f 100644
--- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java
+++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java
@@ -779,13 +779,18 @@ public class CalloutOrder extends CalloutEngine
mTab.setValue("M_AttributeSetInstance_ID", null);
/***** Price Calculation see also qty ****/
- I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class);
+ int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
+ BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
+ boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
IProductPricing pp = Core.getProductPricing();
+ pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
+ Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
+ pp.setPriceDate(orderDate);
+ I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class);
pp.setOrderLine(orderLine, null);
//
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
pp.setM_PriceList_ID(M_PriceList_ID);
- Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
/** PLV is only accurate if PL selected in header */
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
@@ -1075,15 +1080,19 @@ public class CalloutOrder extends CalloutEngine
|| mField.getColumnName().equals("M_Product_ID"))
&& !"N".equals(Env.getContext(ctx, WindowNo, "DiscountSchema")))
{
+ int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
if (mField.getColumnName().equals("QtyEntered"))
QtyOrdered = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered);
if (QtyOrdered == null)
QtyOrdered = QtyEntered;
- I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class);
+ boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
IProductPricing pp = Core.getProductPricing();
+ pp.setInitialValues(M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx, null);
+ Timestamp date = (Timestamp)mTab.getValue("DateOrdered");
+ pp.setPriceDate(date);
+ I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class);
pp.setOrderLine(orderLine, null);
- pp.setQty(QtyOrdered);
pp.setM_PriceList_ID(M_PriceList_ID);
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
@@ -1407,13 +1416,18 @@ public class CalloutOrder extends CalloutEngine
}
/***** Price Calculation see also qty ****/
- I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class);
+ int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
+ BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
+ boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
IProductPricing pp = Core.getProductPricing();
+ pp.setInitialValues(M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
+ Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
+ pp.setPriceDate(orderDate);
+ I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class);
pp.setOrderLine(orderLine, null);
//
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
pp.setM_PriceList_ID(M_PriceList_ID);
- Timestamp orderDate = (Timestamp)mTab.getValue("DateOrdered");
/** PLV is only accurate if PL selected in header */
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
if ( M_PriceList_Version_ID == 0 && M_PriceList_ID > 0)
diff --git a/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java b/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java
index db1ea95931..62758a9b8b 100644
--- a/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java
+++ b/org.adempiere.base/src/org/adempiere/base/AbstractProductPricing.java
@@ -16,9 +16,13 @@ package org.adempiere.base;
import java.math.BigDecimal;
import java.sql.Timestamp;
+import org.compiere.model.I_C_Invoice;
import org.compiere.model.I_C_InvoiceLine;
+import org.compiere.model.I_C_Order;
import org.compiere.model.I_C_OrderLine;
+import org.compiere.model.I_C_Project;
import org.compiere.model.I_C_ProjectLine;
+import org.compiere.model.I_M_RMA;
import org.compiere.model.I_M_RMALine;
import org.compiere.model.I_M_RequisitionLine;
import org.compiere.util.Env;
@@ -86,11 +90,14 @@ public abstract class AbstractProductPricing implements IProductPricing {
@Override
public void setOrderLine(I_C_OrderLine orderLine, String trxName) {
m_M_Product_ID = orderLine.getM_Product_ID();
+ if (orderLine.getC_Order_ID() > 0) {
+ I_C_Order order = orderLine.getC_Order();
+ m_isSOTrx = order.isSOTrx();
+ }
m_C_BPartner_ID = orderLine.getC_BPartner_ID();
BigDecimal qty = orderLine.getQtyOrdered();
if (qty != null && Env.ZERO.compareTo(qty) != 0)
m_Qty = qty;
- m_isSOTrx = orderLine.getC_Order().isSOTrx();
m_PriceDate = orderLine.getDateOrdered();
this.trxName = trxName;
}
@@ -98,20 +105,26 @@ public abstract class AbstractProductPricing implements IProductPricing {
@Override
public void setInvoiceLine(I_C_InvoiceLine invoiceLine, String trxName) {
m_M_Product_ID = invoiceLine.getM_Product_ID();
- m_C_BPartner_ID = invoiceLine.getC_Invoice().getC_BPartner_ID();
+ if (invoiceLine.getC_Invoice_ID() > 0) {
+ I_C_Invoice invoice = invoiceLine.getC_Invoice();
+ m_C_BPartner_ID = invoice.getC_BPartner_ID();
+ m_isSOTrx = invoice.isSOTrx();
+ m_PriceDate = invoice.getDateInvoiced();
+ }
BigDecimal qty = invoiceLine.getQtyInvoiced() != null ?
invoiceLine.getQtyInvoiced() : invoiceLine.getQtyEntered();
if (qty != null && Env.ZERO.compareTo(qty) != 0)
m_Qty = qty;
- m_isSOTrx = invoiceLine.getC_Invoice().isSOTrx();
- m_PriceDate = invoiceLine.getC_Invoice().getDateInvoiced();
this.trxName = trxName;
}
@Override
public void setProjectLine(I_C_ProjectLine projectLine, String trxName) {
m_M_Product_ID = projectLine.getM_Product_ID();
- m_C_BPartner_ID = projectLine.getC_Project().getC_BPartner_ID();
+ if (projectLine.getC_Project_ID() > 0) {
+ I_C_Project project = projectLine.getC_Project();
+ m_C_BPartner_ID = project.getC_BPartner_ID();
+ }
BigDecimal qty = projectLine.getPlannedQty();
if (qty != null && Env.ZERO.compareTo(qty) != 0)
m_Qty = qty;
@@ -133,9 +146,12 @@ public abstract class AbstractProductPricing implements IProductPricing {
@Override
public void setRMALine(I_M_RMALine rmaLine, String trxName) {
m_M_Product_ID = rmaLine.getM_Product_ID();
- m_C_BPartner_ID = rmaLine.getM_RMA().getC_BPartner_ID();
+ if (rmaLine.getM_RMA_ID() > 0) {
+ I_M_RMA rma = rmaLine.getM_RMA();
+ m_C_BPartner_ID = rma.getC_BPartner_ID();
+ m_isSOTrx = rma.isSOTrx();
+ }
m_Qty = Env.ONE;
- m_isSOTrx = rmaLine.getM_RMA().isSOTrx();
this.trxName = trxName;
}
}
diff --git a/org.adempiere.base/src/org/adempiere/impexp/AbstractExcelExporter.java b/org.adempiere.base/src/org/adempiere/impexp/AbstractExcelExporter.java
index 3a4bd374d4..db5d908eb9 100644
--- a/org.adempiere.base/src/org/adempiere/impexp/AbstractExcelExporter.java
+++ b/org.adempiere.base/src/org/adempiere/impexp/AbstractExcelExporter.java
@@ -343,14 +343,14 @@ public abstract class AbstractExcelExporter
footer.setLeft(Env.getStandardReportFooterTrademarkText());
String s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_MSG, "", Env.getAD_Client_ID(Env.getCtx()));
- if (Util.isEmpty(s))
+ if (Util.isEmpty(s, true))
footer.setCenter(Env.getHeader(getCtx(), 0));
else
footer.setCenter(Msg.parseTranslation(Env.getCtx(), s));
Timestamp now = new Timestamp(System.currentTimeMillis());
s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_DATETIME_FORMAT, Env.getAD_Client_ID(Env.getCtx()));
- if (!Util.isEmpty(s))
+ if (!Util.isEmpty(s, true))
footer.setRight(new SimpleDateFormat(s).format(System.currentTimeMillis()));
else
footer.setRight(DisplayType.getDateFormat(DisplayType.DateTime, getLanguage()).format(now));
diff --git a/org.adempiere.base/src/org/adempiere/model/GenericZoomProvider.java b/org.adempiere.base/src/org/adempiere/model/GenericZoomProvider.java
index 80d8c808b3..a9d811ce11 100644
--- a/org.adempiere.base/src/org/adempiere/model/GenericZoomProvider.java
+++ b/org.adempiere.base/src/org/adempiere/model/GenericZoomProvider.java
@@ -231,7 +231,7 @@ public class GenericZoomProvider implements IZoomProvider {
if (queries.containsKey(sql)) {
count = queries.get(sql);
} else {
- int timeout = MSysConfig.getIntValue("ZOOM_ACROSS_QUERY_TIMEOUT", 5, Env.getAD_Client_ID(Env.getCtx())); // default 5 seconds
+ int timeout = MSysConfig.getIntValue(MSysConfig.ZOOM_ACROSS_QUERY_TIMEOUT, 5, Env.getAD_Client_ID(Env.getCtx())); // default 5 seconds
count = getSQLValueTimeout(null, sql, timeout);
queries.put(sql, count);
}
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java b/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java
index c888349eac..2d598d3b17 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java
@@ -116,14 +116,16 @@ public class Doc_Payment extends Doc
return facts;
}
+ FactLine dr = null;
+ FactLine cr = null;
int AD_Org_ID = getBank_Org_ID(); // Bank Account Org
if (getDocumentType().equals(DOCTYPE_ARReceipt))
{
// Asset
- FactLine fl = fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as),
+ dr = fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as),
getC_Currency_ID(), getAmount(), null);
- if (fl != null && AD_Org_ID != 0)
- fl.setAD_Org_ID(AD_Org_ID);
+ if (dr != null && AD_Org_ID != 0)
+ dr.setAD_Org_ID(AD_Org_ID);
//
MAccount acct = null;
if (getC_Charge_ID() != 0)
@@ -132,11 +134,11 @@ public class Doc_Payment extends Doc
acct = getAccount(Doc.ACCTTYPE_C_Prepayment, as);
else
acct = getAccount(Doc.ACCTTYPE_UnallocatedCash, as);
- fl = fact.createLine(null, acct,
+ cr = fact.createLine(null, acct,
getC_Currency_ID(), null, getAmount());
- if (fl != null && AD_Org_ID != 0
+ if (cr != null && AD_Org_ID != 0
&& getC_Charge_ID() == 0) // don't overwrite charge
- fl.setAD_Org_ID(AD_Org_ID);
+ cr.setAD_Org_ID(AD_Org_ID);
}
// APP
else if (getDocumentType().equals(DOCTYPE_APPayment))
@@ -148,17 +150,17 @@ public class Doc_Payment extends Doc
acct = getAccount(Doc.ACCTTYPE_V_Prepayment, as);
else
acct = getAccount(Doc.ACCTTYPE_PaymentSelect, as);
- FactLine fl = fact.createLine(null, acct,
+ dr = fact.createLine(null, acct,
getC_Currency_ID(), getAmount(), null);
- if (fl != null && AD_Org_ID != 0
+ if (dr != null && AD_Org_ID != 0
&& getC_Charge_ID() == 0) // don't overwrite charge
- fl.setAD_Org_ID(AD_Org_ID);
+ dr.setAD_Org_ID(AD_Org_ID);
// Asset
- fl = fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as),
+ cr = fact.createLine(null, getAccount(Doc.ACCTTYPE_BankInTransit, as),
getC_Currency_ID(), null, getAmount());
- if (fl != null && AD_Org_ID != 0)
- fl.setAD_Org_ID(AD_Org_ID);
+ if (cr != null && AD_Org_ID != 0)
+ cr.setAD_Org_ID(AD_Org_ID);
}
else
{
@@ -166,6 +168,25 @@ public class Doc_Payment extends Doc
log.log(Level.SEVERE, p_Error);
fact = null;
}
+
+ // Avoid usage of clearing accounts
+ // If both accounts and orgs are the same then remove the posting
+ MAccount acct_dr = dr.getAccount();
+ MAccount acct_cr = cr.getAccount();
+ int org_dr = dr.getAD_Org_ID();
+ int org_cr = cr.getAD_Org_ID();
+ if (!as.isPostIfClearingEqual() && acct_dr!=null && acct_dr.equals(acct_cr) && org_dr == org_cr) {
+
+ BigDecimal debit = dr.getAmtSourceDr();
+ BigDecimal credit = cr.getAmtSourceCr();
+
+ if (debit.compareTo(credit) == 0) {
+ fact.remove(dr);
+ fact.remove(cr);
+ }
+
+ }
+ // End Avoid usage of clearing accounts
//
ArrayList facts = new ArrayList();
facts.add(fact);
diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_UserPreference.java b/org.adempiere.base/src/org/compiere/model/I_AD_UserPreference.java
index 482759b96b..f1d278eae9 100644
--- a/org.adempiere.base/src/org/compiere/model/I_AD_UserPreference.java
+++ b/org.adempiere.base/src/org/compiere/model/I_AD_UserPreference.java
@@ -164,6 +164,15 @@ public interface I_AD_UserPreference
/** Get Detailed Zoom Across */
public boolean isDetailedZoomAcross();
+ /** Column name IsUseSimilarTo */
+ public static final String COLUMNNAME_IsUseSimilarTo = "IsUseSimilarTo";
+
+ /** Set Use Similar To */
+ public void setIsUseSimilarTo (boolean IsUseSimilarTo);
+
+ /** Get Use Similar To */
+ public boolean isUseSimilarTo();
+
/** Column name ToggleOnDoubleClick */
public static final String COLUMNNAME_ToggleOnDoubleClick = "ToggleOnDoubleClick";
diff --git a/org.adempiere.base/src/org/compiere/model/MBankStatement.java b/org.adempiere.base/src/org/compiere/model/MBankStatement.java
index 13776817ff..7f1bf5e5e9 100644
--- a/org.adempiere.base/src/org/compiere/model/MBankStatement.java
+++ b/org.adempiere.base/src/org/compiere/model/MBankStatement.java
@@ -312,23 +312,25 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
}
// Lines
BigDecimal total = Env.ZERO;
- Timestamp minDate = getStatementDate();
- Timestamp maxDate = minDate;
+ // IDEMPIERE-480 changed the way accounting is posted, now lines post just with the accounting date of the statement header
+ // so, it is unnecessary to validate the period of lines
+ // Timestamp minDate = getStatementDate();
+ // Timestamp maxDate = minDate;
for (int i = 0; i < lines.length; i++)
{
MBankStatementLine line = lines[i];
if (!line.isActive())
continue;
total = total.add(line.getStmtAmt());
- if (line.getDateAcct().before(minDate))
- minDate = line.getDateAcct();
- if (line.getDateAcct().after(maxDate))
- maxDate = line.getDateAcct();
+ // if (line.getDateAcct().before(minDate))
+ // minDate = line.getDateAcct();
+ // if (line.getDateAcct().after(maxDate))
+ // maxDate = line.getDateAcct();
}
setStatementDifference(total);
setEndingBalance(getBeginningBalance().add(total));
- MPeriod.testPeriodOpen(getCtx(), minDate, MDocType.DOCBASETYPE_BankStatement, 0);
- MPeriod.testPeriodOpen(getCtx(), maxDate, MDocType.DOCBASETYPE_BankStatement, 0);
+ // MPeriod.testPeriodOpen(getCtx(), minDate, MDocType.DOCBASETYPE_BankStatement, getAD_Org_ID());
+ // MPeriod.testPeriodOpen(getCtx(), maxDate, MDocType.DOCBASETYPE_BankStatement, getAD_Org_ID());
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null)
diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java
index 35768187e1..8bdf013211 100644
--- a/org.adempiere.base/src/org/compiere/model/MInOut.java
+++ b/org.adempiere.base/src/org/compiere/model/MInOut.java
@@ -1154,13 +1154,17 @@ public class MInOut extends X_M_InOut implements DocAction
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
return DocAction.STATUS_Invalid;
}
- BigDecimal notInvoicedAmt = MBPartner.getNotInvoicedAmt(getC_BPartner_ID());
- if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(notInvoicedAmt)))
+ if (!MBPartner.SOCREDITSTATUS_NoCreditCheck.equals(bp.getSOCreditStatus())
+ && Env.ZERO.compareTo(bp.getSO_CreditLimit()) != 0)
{
- m_processMsg = "@BPartnerOverSCreditHold@ - @TotalOpenBalance@="
- + bp.getTotalOpenBalance() + ", @NotInvoicedAmt@=" + notInvoicedAmt
- + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
- return DocAction.STATUS_Invalid;
+ BigDecimal notInvoicedAmt = MBPartner.getNotInvoicedAmt(getC_BPartner_ID());
+ if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(notInvoicedAmt)))
+ {
+ m_processMsg = "@BPartnerOverSCreditHold@ - @TotalOpenBalance@="
+ + bp.getTotalOpenBalance() + ", @NotInvoicedAmt@=" + notInvoicedAmt
+ + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
+ return DocAction.STATUS_Invalid;
+ }
}
}
}
@@ -1190,12 +1194,7 @@ public class MInOut extends X_M_InOut implements DocAction
continue;
if (product != null && product.isASIMandatory(isSOTrx()))
{
- if(product.getAttributeSet()==null){
- m_processMsg = "@NoAttributeSet@=" + product.getValue();
- return DocAction.STATUS_Invalid;
-
- }
- if (! product.getAttributeSet().excludeTableEntry(MInOutLine.Table_ID, isSOTrx())) {
+ if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MInOutLine.Table_ID, isSOTrx())) {
m_processMsg = "@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #" + lines[i].getLine() +
", @M_Product_ID@=" + product.getValue() + ")";
return DocAction.STATUS_Invalid;
diff --git a/org.adempiere.base/src/org/compiere/model/MInOutLine.java b/org.adempiere.base/src/org/compiere/model/MInOutLine.java
index 7c97b18f4e..d20e0b66bc 100644
--- a/org.adempiere.base/src/org/compiere/model/MInOutLine.java
+++ b/org.adempiere.base/src/org/compiere/model/MInOutLine.java
@@ -578,7 +578,7 @@ public class MInOutLine extends X_M_InOutLine
}
}
- I_M_AttributeSet attributeset = getM_Product().getM_AttributeSet();
+ I_M_AttributeSet attributeset = MProduct.get(getCtx(), getM_Product_ID()).getM_AttributeSet();
boolean isAutoGenerateLot = false;
if (attributeset != null)
isAutoGenerateLot = attributeset.isAutoGenerateLot();
diff --git a/org.adempiere.base/src/org/compiere/model/MInventory.java b/org.adempiere.base/src/org/compiere/model/MInventory.java
index 86d192bd33..a57288f670 100644
--- a/org.adempiere.base/src/org/compiere/model/MInventory.java
+++ b/org.adempiere.base/src/org/compiere/model/MInventory.java
@@ -343,7 +343,7 @@ public class MInventory extends X_M_Inventory implements DocAction
MProduct product = MProduct.get(getCtx(), line.getM_Product_ID());
if (product != null && product.isASIMandatory(line.isSOTrx()))
{
- if (! product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, line.isSOTrx())) {
+ if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, line.isSOTrx())) {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
String docSubTypeInv = dt.getDocSubTypeInv();
BigDecimal qtyDiff = line.getQtyInternalUse();
diff --git a/org.adempiere.base/src/org/compiere/model/MInventoryLine.java b/org.adempiere.base/src/org/compiere/model/MInventoryLine.java
index fe3ec77e96..c56dd88947 100644
--- a/org.adempiere.base/src/org/compiere/model/MInventoryLine.java
+++ b/org.adempiere.base/src/org/compiere/model/MInventoryLine.java
@@ -261,27 +261,6 @@ public class MInventoryLine extends X_M_InventoryLine
log.saveError("ParentComplete", Msg.translate(getCtx(), "M_InventoryLine"));
return false;
}
- /* IDEMPIERE-1770 - ASI validation must be moved to MInventory.prepareIt, saving a line without ASI is ok on draft
- if (m_isManualEntry)
- {
- // Product requires ASI
- if (getM_AttributeSetInstance_ID() == 0)
- {
- MProduct product = MProduct.get(getCtx(), getM_Product_ID());
- if (product != null && product.isASIMandatory(isSOTrx()))
- {
- if(product.getAttributeSet()==null){
- log.saveError("NoAttributeSet", product.getValue());
- return false;
- }
- if (! product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, isSOTrx())) {
- log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID));
- return false;
- }
- }
- } // No ASI
- } // manual
- */
// Set Line No
if (getLine() == 0)
diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java
index 62b5ccff73..9c75155fc9 100644
--- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java
+++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java
@@ -44,10 +44,6 @@ import org.compiere.util.Msg;
* @author Teo Sarca, www.arhipac.ro
* BF [ 2804142 ] MInvoice.setRMALine should work only for CreditMemo invoices
* https://sourceforge.net/tracker/?func=detail&aid=2804142&group_id=176962&atid=879332
- * @author Michael Judd, www.akunagroup.com
- * BF [ 1733602 ] Price List including Tax Error - when a user changes the orderline or
- * invoice line for a product on a price list that includes tax, the net amount is
- * incorrectly calculated.
* @author red1 FR: [ 2214883 ] Remove SQL code and Replace for Query
*/
public class MInvoiceLine extends X_C_InvoiceLine
@@ -478,47 +474,6 @@ public class MInvoiceLine extends X_C_InvoiceLine
{
// Calculations & Rounding
BigDecimal bd = getPriceActual().multiply(getQtyInvoiced());
-
- boolean documentLevel = getTax().isDocumentLevel();
-
- // juddm: Tax Exempt & Tax Included in Price List & not Document Level - Adjust Line Amount
- // http://sourceforge.net/tracker/index.php?func=detail&aid=1733602&group_id=176962&atid=879332
- if (isTaxIncluded() && !documentLevel) {
- BigDecimal taxStdAmt = Env.ZERO, taxThisAmt = Env.ZERO;
-
- MTax invoiceTax = getTax();
- MTax stdTax = null;
-
- if (getProduct() == null)
- {
- if (getCharge() != null) // Charge
- {
- stdTax = new MTax (getCtx(),
- ((MTaxCategory) getCharge().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(),
- get_TrxName());
- }
-
- }
- else // Product
- stdTax = new MTax (getCtx(),
- ((MTaxCategory) getProduct().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(),
- get_TrxName());
-
- if (stdTax != null)
- {
-
- if (log.isLoggable(Level.FINE)) log.fine("stdTax rate is " + stdTax.getRate());
- if (log.isLoggable(Level.FINE)) log.fine("invoiceTax rate is " + invoiceTax.getRate());
-
- taxThisAmt = taxThisAmt.add(invoiceTax.calculateTax(bd, isTaxIncluded(), getPrecision()));
- taxStdAmt = taxStdAmt.add(stdTax.calculateTax(bd, isTaxIncluded(), getPrecision()));
-
- bd = bd.subtract(taxStdAmt).add(taxThisAmt);
-
- if (log.isLoggable(Level.FINE)) log.fine("Price List includes Tax and Tax Changed on Invoice Line: New Tax Amt: "
- + taxThisAmt + " Standard Tax Amt: " + taxStdAmt + " Line Net Amt: " + bd);
- }
- }
int precision = getPrecision();
if (bd.scale() > precision)
bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP);
diff --git a/org.adempiere.base/src/org/compiere/model/MMovement.java b/org.adempiere.base/src/org/compiere/model/MMovement.java
index d84c0d717f..9b23f2d412 100644
--- a/org.adempiere.base/src/org/compiere/model/MMovement.java
+++ b/org.adempiere.base/src/org/compiere/model/MMovement.java
@@ -298,7 +298,7 @@ public class MMovement extends X_M_Movement implements DocAction
MProduct product = line.getProduct();
if (line.getM_AttributeSetInstance_ID() == 0) {
if (product != null && product.isASIMandatory(true)) {
- if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing
+ if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing
BigDecimal qtyDiff = line.getMovementQty();
// verify if the ASIs are captured on lineMA
MMovementLineMA mas[] = MMovementLineMA.get(getCtx(),
@@ -320,7 +320,7 @@ public class MMovement extends X_M_Movement implements DocAction
{
if (product != null && product.isASIMandatory(false) && line.getM_AttributeSetInstanceTo_ID() == 0)
{
- if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming
+ if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming
m_processMsg = "@Line@ " + line.getLine() + ": @FillMandatory@ @M_AttributeSetInstanceTo_ID@";
return DocAction.STATUS_Invalid;
}
diff --git a/org.adempiere.base/src/org/compiere/model/MMovementLine.java b/org.adempiere.base/src/org/compiere/model/MMovementLine.java
index 5c54a07052..ac2c73e162 100644
--- a/org.adempiere.base/src/org/compiere/model/MMovementLine.java
+++ b/org.adempiere.base/src/org/compiere/model/MMovementLine.java
@@ -208,22 +208,6 @@ public class MMovementLine extends X_M_MovementLine
if (newRecord || is_ValueChanged(COLUMNNAME_MovementQty))
setMovementQty(getMovementQty());
- // Mandatory Instance
- /* IDEMPIERE-1770 - ASI validation must be moved to MMovement.prepareIt, saving a line without ASI is ok on draft
- MProduct product = getProduct();
- if (getM_AttributeSetInstance_ID() == 0) {
- if (product != null && product.isASIMandatory(true)) {
- if (product.getAttributeSet()==null) {
- log.saveError("NoAttributeSet", product.getValue());
- return false;
- }
- if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing
- log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID));
- return false;
- }
- }
- }
- */
if (getM_AttributeSetInstanceTo_ID() == 0)
{
//instance id default to same for movement between locator
@@ -233,19 +217,6 @@ public class MMovementLine extends X_M_MovementLine
setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID());
}
- /* IDEMPIERE-1770 - ASI validation must be moved to MMovement.prepareIt, saving a line without ASI is ok on draft
- if (product != null && product.isASIMandatory(false) && getM_AttributeSetInstanceTo_ID() == 0)
- {
- if (product.getAttributeSet()==null) {
- log.saveError("NoAttributeSet", product.getValue());
- return false;
- }
- if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming
- log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstanceTo_ID));
- return false;
- }
- }
- */
} // ASI
return true;
diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java
index afb98078fa..83b3cbaa96 100644
--- a/org.adempiere.base/src/org/compiere/model/MOrder.java
+++ b/org.adempiere.base/src/org/compiere/model/MOrder.java
@@ -1347,12 +1347,7 @@ public class MOrder extends X_C_Order implements DocAction
if (line.getM_Product_ID() > 0 && line.getM_AttributeSetInstance_ID() == 0) {
MProduct product = line.getProduct();
if (product.isASIMandatory(isSOTrx())) {
- if(product.getAttributeSet()==null){
- m_processMsg = "@NoAttributeSet@=" + product.getValue();
- return DocAction.STATUS_Invalid;
-
- }
- if (! product.getAttributeSet().excludeTableEntry(MOrderLine.Table_ID, isSOTrx())) {
+ if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MOrderLine.Table_ID, isSOTrx())) {
StringBuilder msg = new StringBuilder("@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #")
.append(line.getLine())
.append(", @M_Product_ID@=")
diff --git a/org.adempiere.base/src/org/compiere/model/MOrderLine.java b/org.adempiere.base/src/org/compiere/model/MOrderLine.java
index c4858e018a..f92d1deb5c 100644
--- a/org.adempiere.base/src/org/compiere/model/MOrderLine.java
+++ b/org.adempiere.base/src/org/compiere/model/MOrderLine.java
@@ -49,10 +49,6 @@ import org.compiere.util.Msg;
*
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
* BF [ 2588043 ] Insufficient message ProductNotOnPriceList
- * @author Michael Judd, www.akunagroup.com
- * BF [ 1733602 ] Price List including Tax Error - when a user changes the orderline or
- * invoice line for a product on a price list that includes tax, the net amount is
- * incorrectly calculated.
*/
public class MOrderLine extends X_C_OrderLine
{
@@ -358,50 +354,6 @@ public class MOrderLine extends X_C_OrderLine
public void setLineNetAmt ()
{
BigDecimal bd = getPriceActual().multiply(getQtyOrdered());
-
- boolean documentLevel = getTax().isDocumentLevel();
-
- // juddm: Tax Exempt & Tax Included in Price List & not Document Level - Adjust Line Amount
- // http://sourceforge.net/tracker/index.php?func=detail&aid=1733602&group_id=176962&atid=879332
- if (isTaxIncluded() && !documentLevel) {
- BigDecimal taxStdAmt = Env.ZERO, taxThisAmt = Env.ZERO;
-
- MTax orderTax = getTax();
- MTax stdTax = null;
-
- // get the standard tax
- if (getProduct() == null)
- {
- if (getCharge() != null) // Charge
- {
- stdTax = new MTax (getCtx(),
- ((MTaxCategory) getCharge().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(),
- get_TrxName());
- }
-
- }
- else // Product
- stdTax = new MTax (getCtx(),
- ((MTaxCategory) getProduct().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(),
- get_TrxName());
-
- if (stdTax != null)
- {
- if (log.isLoggable(Level.FINE)){
- log.fine("stdTax rate is " + stdTax.getRate());
- log.fine("orderTax rate is " + orderTax.getRate());
- }
-
- taxThisAmt = taxThisAmt.add(orderTax.calculateTax(bd, isTaxIncluded(), getPrecision()));
- taxStdAmt = taxStdAmt.add(stdTax.calculateTax(bd, isTaxIncluded(), getPrecision()));
-
- bd = bd.subtract(taxStdAmt).add(taxThisAmt);
-
- if (log.isLoggable(Level.FINE)) log.fine("Price List includes Tax and Tax Changed on Order Line: New Tax Amt: "
- + taxThisAmt + " Standard Tax Amt: " + taxStdAmt + " Line Net Amt: " + bd);
- }
-
- }
int precision = getPrecision();
if (bd.scale() > precision)
bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP);
diff --git a/org.adempiere.base/src/org/compiere/model/MRMALine.java b/org.adempiere.base/src/org/compiere/model/MRMALine.java
index 4150085e01..f37d2a8871 100644
--- a/org.adempiere.base/src/org/compiere/model/MRMALine.java
+++ b/org.adempiere.base/src/org/compiere/model/MRMALine.java
@@ -19,7 +19,6 @@ package org.compiere.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Properties;
-import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.base.IProductPricing;
@@ -248,51 +247,6 @@ public class MRMALine extends X_M_RMALine
public BigDecimal getTotalAmt()
{
BigDecimal bd = getAmt().multiply(getQty());
-
- boolean documentLevel = getTax().isDocumentLevel();
-
- // juddm: Tax Exempt & Tax Included in Price List & not Document Level - Adjust Line Amount
- // http://sourceforge.net/tracker/index.php?func=detail&aid=1733602&group_id=176962&atid=879332
- if (getParent().isTaxIncluded() && !documentLevel)
- {
- BigDecimal taxStdAmt = Env.ZERO, taxThisAmt = Env.ZERO;
-
- MTax orderTax = getTax();
- MTax stdTax = null;
-
- // get the standard tax
- if (getProduct() == null)
- {
- if (getCharge() != null) // Charge
- {
- stdTax = new MTax (getCtx(),
- ((MTaxCategory) getCharge().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(),
- get_TrxName());
- }
-
- }
- else // Product
- stdTax = new MTax (getCtx(),
- ((MTaxCategory) getProduct().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(),
- get_TrxName());
-
- if (stdTax != null)
- {
- if (log.isLoggable(Level.FINE)){
- log.fine("stdTax rate is " + stdTax.getRate());
- log.fine("orderTax rate is " + orderTax.getRate());
- }
-
- taxThisAmt = taxThisAmt.add(orderTax.calculateTax(bd, getParent().isTaxIncluded(), getPrecision()));
- taxStdAmt = taxStdAmt.add(stdTax.calculateTax(bd, getParent().isTaxIncluded(), getPrecision()));
-
- bd = bd.subtract(taxStdAmt).add(taxThisAmt);
-
- if (log.isLoggable(Level.FINE)) log.fine("Price List includes Tax and Tax Changed on Order Line: New Tax Amt: "
- + taxThisAmt + " Standard Tax Amt: " + taxStdAmt + " Line Net Amt: " + bd);
- }
-
- }
int precision = getPrecision();
if (bd.scale() > precision)
bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP);
diff --git a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java
index 73708233ee..a2445a894f 100644
--- a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java
+++ b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java
@@ -173,7 +173,7 @@ public class MStorageOnHand extends X_M_StorageOnHand
String sqlWhere = "M_Product_ID=? AND M_Locator_ID=? AND QtyOnHand <> 0";
Query query = new Query(ctx, MStorageOnHand.Table_Name, sqlWhere, trxName)
.setParameters(M_Product_ID, M_Locator_ID);
- MProduct product = new MProduct(ctx, M_Product_ID, trxName);
+ MProduct product = MProduct.get(ctx, M_Product_ID);
if (product.isUseGuaranteeDateForMPolicy())
{
query.addJoinClause(" LEFT OUTER JOIN M_AttributeSetInstance asi ON (M_StorageOnHand.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) ")
diff --git a/org.adempiere.base/src/org/compiere/model/MStorageReservation.java b/org.adempiere.base/src/org/compiere/model/MStorageReservation.java
index c0b9603871..c8b2a4d075 100644
--- a/org.adempiere.base/src/org/compiere/model/MStorageReservation.java
+++ b/org.adempiere.base/src/org/compiere/model/MStorageReservation.java
@@ -228,7 +228,7 @@ public class MStorageReservation extends X_M_StorageReservation {
return true;
/* Do NOT use FIFO ASI for reservation */
- MProduct prd = new MProduct(ctx, M_Product_ID, trxName);
+ MProduct prd = MProduct.get(ctx, M_Product_ID);
if (prd.getM_AttributeSet_ID() == 0 || ! prd.getM_AttributeSet().isInstanceAttribute()) {
// Product doesn't manage attribute set, always reserved with 0
M_AttributeSetInstance_ID = 0;
diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java
index 0a65e68d88..77bcaf5a63 100644
--- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java
+++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java
@@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
- private static final long serialVersionUID = 5886520708050807357L;
+ private static final long serialVersionUID = 8623809160538454497L;
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
@@ -79,20 +79,23 @@ public class MSysConfig extends X_AD_SysConfig
public static final String CHECK_CREDIT_ON_PREPAY_ORDER = "CHECK_CREDIT_ON_PREPAY_ORDER";
public static final String CLIENT_ACCOUNTING = "CLIENT_ACCOUNTING";
public static final String DEFAULT_COA_PATH = "DEFAULT_COA_PATH";
+ public static final String DEFAULT_ENTITYTYPE = "DEFAULT_ENTITYTYPE"; // used as default in entity type columns with get_sysconfig
public static final String DICTIONARY_ID_COMMENTS = "DICTIONARY_ID_COMMENTS";
public static final String DICTIONARY_ID_PASSWORD = "DICTIONARY_ID_PASSWORD";
public static final String DICTIONARY_ID_USE_CENTRALIZED_ID = "DICTIONARY_ID_USE_CENTRALIZED_ID";
public static final String DICTIONARY_ID_USER = "DICTIONARY_ID_USER";
public static final String DICTIONARY_ID_WEBSITE = "DICTIONARY_ID_WEBSITE";
public static final String DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME";
- public static final String DPVIEWS_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount";
- public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule";
+ public static final String DPViews_ShowInfoAccount = "DPViews_ShowInfoAccount";
+ public static final String DPViews_ShowInfoSchedule = "DPViews_ShowInfoSchedule";
public static final String EMAIL_NOTIFY_2PACK = "EMAIL_NOTIFY_2PACK";
public static final String ENABLE_PAYMENTBOX_BUTTON = "ENABLE_PAYMENTBOX_BUTTON";
public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS";
public static final String HTML_REPORT_THEME = "HTML_REPORT_THEME";
- public static final String IBAN_VALIDATION = "IBAN_VALIDATION" ;
- public static final String IDENTIFIER_SEPARATOR = "IDENTIFIER_SEPARATOR" ;
+ public static final String IBAN_VALIDATION = "IBAN_VALIDATION";
+ public static final String IDENTIFIER_SEPARATOR = "IDENTIFIER_SEPARATOR";
+ public static final String INFO_DEFAULTSELECTED = "INFO_DEFAULTSELECTED";
+ public static final String INFO_DOUBLECLICKTOGGLESSELECTION = "INFO_DOUBLECLICKTOGGLESSELECTION";
public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber";
public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES";
public static final String LASTRUN_RECORD_COUNT = "LASTRUN_RECORD_COUNT";
@@ -135,8 +138,6 @@ public class MSysConfig extends X_AD_SysConfig
public static final String START_VALUE_BPLOCATION_NAME = "START_VALUE_BPLOCATION_NAME";
public static final String SWING_LOGIN_ALLOW_REMEMBER_ME = "SWING_LOGIN_ALLOW_REMEMBER_ME";
public static final String SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR = "SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR";
- public static final String SYSCONFIG_INFO_DEFAULTSELECTED = "SYSCONFIG_INFO_DEFAULTSELECTED";
- public static final String SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION = "SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION";
public static final String SYSTEM_IN_MAINTENANCE_MODE = "SYSTEM_IN_MAINTENANCE_MODE";
public static final String SYSTEM_INSERT_CHANGELOG = "SYSTEM_INSERT_CHANGELOG";
public static final String SYSTEM_NATIVE_SEQUENCE = "SYSTEM_NATIVE_SEQUENCE";
@@ -184,6 +185,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String ZK_SESSION_TIMEOUT_IN_SECONDS = "ZK_SESSION_TIMEOUT_IN_SECONDS";
public static final String ZK_THEME = "ZK_THEME";
public static final String ZK_THEME_USE_FONT_ICON_FOR_IMAGE = "ZK_THEME_USE_FONT_ICON_FOR_IMAGE";
+ public static final String ZOOM_ACROSS_QUERY_TIMEOUT = "ZOOM_ACROSS_QUERY_TIMEOUT";
/**
* Standard Constructor
diff --git a/org.adempiere.base/src/org/compiere/model/MUser.java b/org.adempiere.base/src/org/compiere/model/MUser.java
index c376f53633..956457c375 100644
--- a/org.adempiere.base/src/org/compiere/model/MUser.java
+++ b/org.adempiere.base/src/org/compiere/model/MUser.java
@@ -21,7 +21,6 @@ import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
@@ -237,28 +236,10 @@ public class MUser extends X_AD_User
*/
public static String getNameOfUser (int AD_User_ID)
{
- String name = "?";
- // Get ID
- String sql = "SELECT Name FROM AD_User WHERE AD_User_ID=?";
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- try
- {
- pstmt = DB.prepareStatement(sql, null);
- pstmt.setInt(1, AD_User_ID);
- rs = pstmt.executeQuery();
- if (rs.next())
- name = rs.getString(1);
- }
- catch (SQLException e)
- {
- s_log.log(Level.SEVERE, sql, e);
- }
- finally
- {
- DB.close(rs, pstmt);
- }
- return name;
+ MUser user = get(Env.getCtx(), AD_User_ID);
+ if (user.getAD_User_ID() != AD_User_ID)
+ return "?";
+ return user.getName();
} // getNameOfUser
@@ -936,15 +917,14 @@ public class MUser extends X_AD_User
}
pwdrule.validate((getLDAPUser() != null ? getLDAPUser() : getName()), getPassword(), passwordHistorys);
}
-
+ setDatePasswordChanged(new Timestamp(new Date().getTime()));
}
// Hash password - IDEMPIERE-347
boolean hash_password = MSysConfig.getBooleanValue(MSysConfig.USER_PASSWORD_HASH, false);
if (hash_password)
setPassword(getPassword());
-
- setDatePasswordChanged(new Timestamp(new Date().getTime()));
+
}
return true;
diff --git a/org.adempiere.base/src/org/compiere/model/MViewComponent.java b/org.adempiere.base/src/org/compiere/model/MViewComponent.java
index 97074e6bc3..4bdbbab4d6 100644
--- a/org.adempiere.base/src/org/compiere/model/MViewComponent.java
+++ b/org.adempiere.base/src/org/compiere/model/MViewComponent.java
@@ -76,6 +76,7 @@ public class MViewComponent extends X_AD_ViewComponent {
Query query = new Query(getCtx(), MViewColumn.Table_Name, MViewColumn.COLUMNNAME_AD_ViewComponent_ID + "=?", get_TrxName());
query.setParameters(getAD_ViewComponent_ID());
+ query.setOnlyActiveRecords(true);
query.setOrderBy("SeqNo, AD_ViewColumn_ID");
List list = query.list();
diff --git a/org.adempiere.base/src/org/compiere/model/ProductCost.java b/org.adempiere.base/src/org/compiere/model/ProductCost.java
index fd63e86324..2062d733d5 100644
--- a/org.adempiere.base/src/org/compiere/model/ProductCost.java
+++ b/org.adempiere.base/src/org/compiere/model/ProductCost.java
@@ -48,7 +48,7 @@ public class ProductCost
{
m_M_Product_ID = M_Product_ID;
if (m_M_Product_ID != 0)
- m_product = new MProduct(ctx, M_Product_ID, trxName);
+ m_product = MProduct.get(ctx, M_Product_ID);
m_M_AttributeSetInstance_ID = M_AttributeSetInstance_ID;
m_trxName = trxName;
} // ProductCost
diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java
index 41481fc29e..f064122dec 100644
--- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java
+++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java
@@ -34,7 +34,7 @@ public class SystemIDs
public final static int COLUMN_C_PAYSELECTIONCHECK_C_PAYSELECTION_ID = 7670;
public final static int COLUMN_FACT_ACCT_C_ACCTSCHEMA_ID = 2513;
public final static int COLUMN_FACT_ACCT_M_PRODUCT_ID = 2527;
- public final static int COLUMN_M_MOVEMENTLINE_M_ATTRIBUTESETINSTANCE_ID = 8851;
+ public final static int COLUMN_M_MOVEMENTLINE_M_ATTRIBUTESETINSTANCE_ID = 8551;
public final static int COLUMN_M_PRODUCT_M_ATTRIBUTESETINSTANCE_ID = 8418;
public final static int COLUMN_S_RESOURCE_S_RESOURCETYPE_ID = 6851;
public final static int COLUMN_S_RESOURCEASSIGNMENT_S_RESOURCE_ID = 6826;
diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_UserPreference.java b/org.adempiere.base/src/org/compiere/model/X_AD_UserPreference.java
index 654f4d55c1..ce2825bbb9 100644
--- a/org.adempiere.base/src/org/compiere/model/X_AD_UserPreference.java
+++ b/org.adempiere.base/src/org/compiere/model/X_AD_UserPreference.java
@@ -29,7 +29,7 @@ public class X_AD_UserPreference extends PO implements I_AD_UserPreference, I_Pe
/**
*
*/
- private static final long serialVersionUID = 20180119L;
+ private static final long serialVersionUID = 20180502L;
/** Standard Constructor */
public X_AD_UserPreference (Properties ctx, int AD_UserPreference_ID, String trxName)
@@ -215,6 +215,27 @@ public class X_AD_UserPreference extends PO implements I_AD_UserPreference, I_Pe
return false;
}
+ /** Set Use Similar To.
+ @param IsUseSimilarTo Use Similar To */
+ public void setIsUseSimilarTo (boolean IsUseSimilarTo)
+ {
+ set_Value (COLUMNNAME_IsUseSimilarTo, Boolean.valueOf(IsUseSimilarTo));
+ }
+
+ /** Get Use Similar To.
+ @return Use Similar To */
+ public boolean isUseSimilarTo ()
+ {
+ Object oo = get_Value(COLUMNNAME_IsUseSimilarTo);
+ if (oo != null)
+ {
+ if (oo instanceof Boolean)
+ return ((Boolean)oo).booleanValue();
+ return "Y".equals(oo);
+ }
+ return false;
+ }
+
/** Set Toggle on Double Click.
@param ToggleOnDoubleClick
Defines if double click in a field on grid mode switch to form view
diff --git a/org.adempiere.base/src/org/compiere/print/DataEngine.java b/org.adempiere.base/src/org/compiere/print/DataEngine.java
index 552c84b0e6..16b3bab71c 100644
--- a/org.adempiere.base/src/org/compiere/print/DataEngine.java
+++ b/org.adempiere.base/src/org/compiere/print/DataEngine.java
@@ -25,6 +25,7 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
+import java.util.regex.Pattern;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MLookupFactory;
@@ -294,6 +295,15 @@ public class DataEngine
rs = pstmt.executeQuery();
m_synonym = "A"; // synonym
+
+ // init regular object to replace table name in virtual column
+ String orgTable = null;
+ Pattern regTranslateTable = null;
+ if (tableName.toLowerCase().endsWith("_vt")){
+ orgTable = MTable.getTableName(ctx, format.getAD_Table_ID());
+ regTranslateTable = Pattern.compile("\\b" + orgTable + "\\b", Pattern.CASE_INSENSITIVE);
+ }
+
while (rs.next())
{
// get Values from record
@@ -304,6 +314,12 @@ public class DataEngine
ColumnSQL = Env.parseContext(Env.getCtx(), -1, ColumnSQL, false, true);
if (ColumnSQL == null)
ColumnSQL = "";
+ else{
+ // replace table with translate table IDEMPIERE-2234
+ if (tableName.toLowerCase().endsWith("_vt")){
+ ColumnSQL = regTranslateTable.matcher(ColumnSQL).replaceAll(tableName);
+ }
+ }
int AD_Reference_ID = rs.getInt(3);
int AD_Reference_Value_ID = rs.getInt(4);
// ColumnInfo
diff --git a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java
index 03f0b834d2..e2abc30d48 100644
--- a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java
+++ b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java
@@ -975,7 +975,9 @@ public class LayoutEngine implements Pageable, Printable, Doc
element.setLocation(ft);
m_headerFooter.addElement(element);
//
- String s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_MSG, "@*Header@", Env.getAD_Client_ID(Env.getCtx()));
+ String s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_MSG, "", Env.getAD_Client_ID(Env.getCtx()));
+ if (Util.isEmpty(s, true))
+ s = "@*Header@";
element = new StringElement(s, font, color, null, true);
element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_Center);
element.setLocation(ft);
@@ -983,7 +985,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
//
String timestamp = "";
s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_DATETIME_FORMAT, Env.getAD_Client_ID(Env.getCtx()));
- if (!Util.isEmpty(s))
+ if (!Util.isEmpty(s, true))
timestamp = new SimpleDateFormat(s).format(System.currentTimeMillis());
else
timestamp = "@*CurrentDateTime@";
diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java
index 93c3886060..6309c53922 100644
--- a/org.adempiere.base/src/org/compiere/util/Env.java
+++ b/org.adempiere.base/src/org/compiere/util/Env.java
@@ -1967,7 +1967,7 @@ public final class Env
*/
public static String getStandardReportFooterTrademarkText() {
String s = MSysConfig.getValue(MSysConfig.STANDARD_REPORT_FOOTER_TRADEMARK_TEXT, Env.getAD_Client_ID(Env.getCtx()));
- if (Util.isEmpty(s))
+ if (Util.isEmpty(s, true))
s = Env.getContext(Env.getCtx(), STANDARD_REPORT_FOOTER_TRADEMARK_TEXT);
if (Util.isEmpty(s))
s = Adempiere.ADEMPIERE_R;
diff --git a/org.adempiere.server-feature/setup/configuration/config.ini b/org.adempiere.server-feature/setup/configuration/config.ini
index 64fe21cce6..f1b25e7b4e 100644
--- a/org.adempiere.server-feature/setup/configuration/config.ini
+++ b/org.adempiere.server-feature/setup/configuration/config.ini
@@ -28,6 +28,7 @@ osgi.bundles=org.eclipse.equinox.ds@1:start,\
org.apache.poi,\
org.eclipse.core.jobs,\
org.eclipse.equinox.preferences,\
+ org.eclipse.equinox.event,\
org.apache.commons.logging,\
javax.management.j2ee-api,\
org.eclipse.osgi,\
diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/search/Info.java b/org.adempiere.ui.swing/src/org/compiere/apps/search/Info.java
index a684b7158d..4c3016b143 100644
--- a/org.adempiere.ui.swing/src/org/compiere/apps/search/Info.java
+++ b/org.adempiere.ui.swing/src/org/compiere/apps/search/Info.java
@@ -327,9 +327,9 @@ public abstract class Info extends CDialog
/** Enable more than one selection */
protected boolean p_multiSelection;
/** Specify if the records should be checked(selected) by default (multi selection mode only) */
- private boolean p_isDefaultSelected = MSysConfig.getBooleanValue(MSysConfig.SYSCONFIG_INFO_DEFAULTSELECTED, false, Env.getAD_Client_ID(Env.getCtx()));
+ private boolean p_isDefaultSelected = MSysConfig.getBooleanValue(MSysConfig.INFO_DEFAULTSELECTED, false, Env.getAD_Client_ID(Env.getCtx()));
/** True if double click on a row toggles if row is selected (multi selection mode only) */
- private boolean p_doubleClickTogglesSelection = MSysConfig.getBooleanValue(MSysConfig.SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION, false, Env.getAD_Client_ID(Env.getCtx()));
+ private boolean p_doubleClickTogglesSelection = MSysConfig.getBooleanValue(MSysConfig.INFO_DOUBLECLICKTOGGLESSELECTION, false, Env.getAD_Client_ID(Env.getCtx()));
/** Initial WHERE Clause */
protected String p_whereClause = "";
diff --git a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
index fc2ce8f50c..d5e98d7741 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
+++ b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
@@ -40,7 +40,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
-+
+
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 0a7e1079eb..dc01963733 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
@@ -348,14 +348,10 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
StringBuilder cssContent = new StringBuilder();
- cssContent.append(".adtab-form-borderlayout .z-south-colpsd:before { ");
+ cssContent.append(".adtab-form-borderlayout .z-south-collapsed:before { ");
cssContent.append("content: \"");
cssContent.append(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Detail")));
cssContent.append("\"; ");
- cssContent.append("position: relative; font-size: 12px; font-weight: bold; ");
- cssContent.append("top: 3px; ");
- cssContent.append("left: 4px; ");
- cssContent.append("z-index: -1; ");
cssContent.append("} ");
Style style = new Style();
style.setContent(cssContent.toString());
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPViews.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPViews.java
index 28cd085f6d..34f0cd85f4 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPViews.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPViews.java
@@ -59,7 +59,7 @@ public class DPViews extends DashboardPanel implements EventListener {
{
Vbox vbox = new Vbox();
- if (MSysConfig.getBooleanValue(MSysConfig.DPVIEWS_SHOWINFOACCOUNT, true, Env.getAD_Client_ID(Env.getCtx()))
+ if (MSysConfig.getBooleanValue(MSysConfig.DPViews_ShowInfoAccount, true, Env.getAD_Client_ID(Env.getCtx()))
&& MRole.getDefault().isShowAcct() && MRole.getDefault().isAllow_Info_Account())
{
ToolBarButton btnViewItem = new ToolBarButton("InfoAccount");
@@ -74,7 +74,7 @@ public class DPViews extends DashboardPanel implements EventListener {
if (ThemeManager.isUseFontIconForImage())
LayoutUtils.addSclass("medium-toolbarbutton toolbarbutton-with-text", btnViewItem);
}
- if (MSysConfig.getBooleanValue(MSysConfig.DPVIEWS_SHOWINFOSCHEDULE, true, Env.getAD_Client_ID(Env.getCtx()))
+ if (MSysConfig.getBooleanValue(MSysConfig.DPViews_ShowInfoSchedule, true, Env.getAD_Client_ID(Env.getCtx()))
&& MRole.getDefault().isAllow_Info_Schedule())
{
ToolBarButton btnViewItem = new ToolBarButton("InfoSchedule");
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAccountEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAccountEditor.java
index 561581364d..c9aec426d2 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAccountEditor.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAccountEditor.java
@@ -171,6 +171,9 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, C_AcctSchema_ID);
+ boolean useSimilarTo = "Y".equals(Env.getContext(Env.getCtx(), "P|IsUseSimilarTo"));
+ if (useSimilarTo && text.contains("*"))
+ text = text.replaceAll("\\*", "\\\\*");
pstmt.setString(2, text.toUpperCase());
pstmt.setString(3, text.toUpperCase());
rs = pstmt.executeQuery();
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java
index b4f8691325..6cc16de445 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HelpController.java
@@ -16,8 +16,10 @@ package org.adempiere.webui.panel;
import java.util.Properties;
+import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Menupopup;
import org.adempiere.webui.desktop.IDesktop;
+import org.adempiere.webui.event.ZoomEvent;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.WCtxHelpSuggestion;
import org.compiere.model.GridField;
@@ -30,6 +32,7 @@ import org.compiere.model.MCtxHelpMsg;
import org.compiere.model.MForm;
import org.compiere.model.MInfoWindow;
import org.compiere.model.MProcess;
+import org.compiere.model.MQuery;
import org.compiere.model.MTab;
import org.compiere.model.MTask;
import org.compiere.model.PO;
@@ -103,7 +106,20 @@ public class HelpController
dashboardColumnLayout.appendChild(pnlQuickInfo);
content = new Panelchildren();
pnlQuickInfo.appendChild(content);
- content.appendChild(htmlQuickInfo = new Html());
+ content.appendChild(htmlQuickInfo = new Html());
+ Env.setContext(Env.getCtx(), "#clientInfo_QuickInfoComponentId", htmlQuickInfo.getUuid());
+ htmlQuickInfo.addEventListener(ZoomEvent.EVENT_NAME, new EventListener() {
+ public void onEvent(Event event) throws Exception {
+ if (event instanceof ZoomEvent) {
+ Clients.clearBusy();
+ ZoomEvent ze = (ZoomEvent) event;
+ if (ze.getData() != null && ze.getData() instanceof MQuery) {
+ AEnv.zoom((MQuery) ze.getData());
+ }
+ }
+
+ }
+ });
pnlToolTip = new Panel();
pnlToolTip.setSclass("dashboard-widget");
diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereService.java
index d063d53945..1b32318e58 100644
--- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereService.java
+++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereService.java
@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
import org.adempiere.util.ServerContext;
import org.compiere.model.MSession;
+import org.compiere.model.MSysConfig;
import org.compiere.model.MUser;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@@ -271,7 +272,12 @@ public class CompiereService {
m_AD_Role_ID = AD_Role_ID;
m_M_Warehouse_ID = M_Warehouse_ID;
m_locale = Lang;
- m_userName = MUser.getNameOfUser(m_AD_User_ID);
+ boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false);
+ MUser user = MUser.get(getCtx(), m_AD_User_ID);
+ if (email_login)
+ m_userName = user.getEMail();
+ else
+ m_userName = user.getName();
Env.setContext( getCtx(), "#AD_Language", Lang);
m_language = Language.getLanguage(Lang);