diff --git a/db/ddlutils/oracle/views/AD_FIELD_V.sql b/db/ddlutils/oracle/views/AD_FIELD_V.sql
index fe4bd6b096..75a5b5d7c6 100644
--- a/db/ddlutils/oracle/views/AD_FIELD_V.sql
+++ b/db/ddlutils/oracle/views/AD_FIELD_V.sql
@@ -1,5 +1,5 @@
CREATE OR REPLACE VIEW ad_field_v AS
- SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(f.placeholder, c.placeholder) AS placeholder
+ SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(f.placeholder, c.placeholder) AS placeholder, c.ishtml
FROM ad_field f
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
diff --git a/db/ddlutils/oracle/views/AD_FIELD_VT.sql b/db/ddlutils/oracle/views/AD_FIELD_VT.sql
index 1f50419a79..9ad9c01890 100644
--- a/db/ddlutils/oracle/views/AD_FIELD_VT.sql
+++ b/db/ddlutils/oracle/views/AD_FIELD_VT.sql
@@ -1,5 +1,5 @@
CREATE OR REPLACE VIEW ad_field_vt AS
- SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(trl.placeholder, ct.placeholder) AS placeholder
+ SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(trl.placeholder, ct.placeholder) AS placeholder, c.ishtml
FROM ad_field f
JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
diff --git a/db/ddlutils/postgresql/functions/altercolumn.sql b/db/ddlutils/postgresql/functions/altercolumn.sql
index 18cfe053fd..4d9475b873 100644
--- a/db/ddlutils/postgresql/functions/altercolumn.sql
+++ b/db/ddlutils/postgresql/functions/altercolumn.sql
@@ -1,10 +1,14 @@
-create or replace function altercolumn(tablename name, columnname name, datatype name,
-nullclause varchar, defaultclause varchar) returns void as $$
+CREATE OR REPLACE FUNCTION adempiere.altercolumn(tablename name, columnname name, datatype name, nullclause character varying, defaultclause character varying, namespace name)
+ RETURNS void
+ LANGUAGE plpgsql
+AS $function$
declare
command text;
viewtext text[];
viewname name[];
dropviews name[];
+ perms text[];
+ privs text;
i int;
j int;
v record;
@@ -15,12 +19,14 @@ begin
if datatype is not null then
select pg_type.typname, format_type(pg_type.oid, pg_attribute.atttypmod)
into typename, sqltype
- from pg_class, pg_attribute, pg_type
+ from pg_class, pg_attribute, pg_type, pg_namespace
where relname = lower(tablename)
and relkind = 'r'
and pg_class.oid = pg_attribute.attrelid
and attname = lower(columnname)
- and atttypid = pg_type.oid;
+ and atttypid = pg_type.oid
+ and pg_class.relnamespace = pg_namespace.oid
+ and pg_namespace.nspname = lower(namespace);
sqltype_short := sqltype;
if typename = 'numeric' then
sqltype_short := replace(sqltype, ',0', '');
@@ -34,7 +40,7 @@ begin
for v in
with recursive depv(relname, viewoid, depth) as (
select distinct a.relname, a.oid, 1
- from pg_class a, pg_depend b, pg_depend c, pg_class d, pg_attribute e
+ from pg_class a, pg_depend b, pg_depend c, pg_class d, pg_attribute e, pg_namespace
where a.oid = b.refobjid
and b.objid = c.objid
and b.refobjid <> c.refobjid
@@ -46,6 +52,8 @@ begin
and e.attname = lower(columnname)
and c.refobjsubid = e.attnum
and a.relkind = 'v'
+ and a.relnamespace = pg_namespace.oid
+ and pg_namespace.nspname = lower(namespace)
union all
select distinct dependee.relname, dependee.oid, depv.depth+1
from pg_depend
@@ -54,9 +62,12 @@ begin
join pg_class as dependent on pg_depend.refobjid = dependent.oid
join pg_attribute ON pg_depend.refobjid = pg_attribute.attrelid and pg_depend.refobjsubid = pg_attribute.attnum and pg_attribute.attnum > 0
join depv on dependent.relname = depv.relname
+ join pg_namespace on dependee.relnamespace = pg_namespace.oid
+ where pg_namespace.nspname = lower(namespace)
)
select relname, viewoid, max(depth) from depv group by relname, viewoid order by 3 desc
loop
+ raise notice 'view -> % %', v.relname, v.viewoid;
i := i + 1;
viewtext[i] := pg_get_viewdef(v.viewoid);
viewname[i] := v.relname;
@@ -64,6 +75,11 @@ begin
if i > 0 then
begin
for j in 1 .. i loop
+ SELECT String_agg('grant ' || privilege_type || ' on ' || viewname[j] || ' to ' || grantee, '; ')
+ into privs
+ FROM information_schema.role_table_grants
+ WHERE table_name=viewname[j];
+ perms[j] := privs;
command := 'drop view ' || viewname[j];
raise notice 'executing -> %', command;
execute command;
@@ -91,6 +107,9 @@ begin
command := 'create or replace view ' || dropviews[j] || ' as ' || viewtext[j];
raise notice 'executing -> %', 'create view ' || dropviews[j];
execute command;
+ command := perms[j];
+ raise notice 'executing -> %', 'grant ' || perms[j];
+ execute command;
end loop;
end if;
end if;
@@ -122,7 +141,7 @@ begin
end if;
end if;
end;
-$$ language plpgsql;
+$function$
/*
create table t_alter_column
diff --git a/db/ddlutils/postgresql/views/AD_FIELD_V.sql b/db/ddlutils/postgresql/views/AD_FIELD_V.sql
index 467aff6b5f..7070237bc8 100644
--- a/db/ddlutils/postgresql/views/AD_FIELD_V.sql
+++ b/db/ddlutils/postgresql/views/AD_FIELD_V.sql
@@ -7,7 +7,7 @@ COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandator
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype,
fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid,
f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus,
-c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(f.placeholder, c.placeholder) AS placeholder
+c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(f.placeholder, c.placeholder) AS placeholder, c.ishtml
FROM ad_field f
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
diff --git a/db/ddlutils/postgresql/views/AD_FIELD_VT.sql b/db/ddlutils/postgresql/views/AD_FIELD_VT.sql
index 3f8b8ec1a7..3b452fa86e 100644
--- a/db/ddlutils/postgresql/views/AD_FIELD_VT.sql
+++ b/db/ddlutils/postgresql/views/AD_FIELD_VT.sql
@@ -6,7 +6,7 @@ CREATE OR REPLACE VIEW ad_field_vt AS
c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype,
fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid,
- f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(trl.placeholder, ct.placeholder) AS placeholder
+ f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(trl.placeholder, ct.placeholder) AS placeholder, c.ishtml
FROM ad_field f
JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
diff --git a/migration/i5.1/oracle/201312231347_IDEMPIERE-1539.sql b/migration/i5.1/oracle/201312231347_IDEMPIERE-1539.sql
new file mode 100644
index 0000000000..312cdd69d3
--- /dev/null
+++ b/migration/i5.1/oracle/201312231347_IDEMPIERE-1539.sql
@@ -0,0 +1,11 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- Dec 23, 2013 1:36:38 PM COT
+-- IDEMPIERE-1539
+INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,Created,CreatedBy,Updated,UpdatedBy,IsActive,EntityType,AD_Client_ID,AD_Org_ID) VALUES (200168,200061,'9562f4db-97a9-4df5-99d0-b2f5bc0e2b4c','Full Like','LIKE',TO_DATE('2013-12-23 13:36:48','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-12-23 13:36:48','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,0)
+;
+
+SELECT register_migration_script('201312231347_IDEMPIERE-1539.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201803221017_IDEMPIERE-3664.sql b/migration/i5.1/oracle/201803221017_IDEMPIERE-3664.sql
new file mode 100644
index 0000000000..74d8baf049
--- /dev/null
+++ b/migration/i5.1/oracle/201803221017_IDEMPIERE-3664.sql
@@ -0,0 +1,15 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3664
+-- Mar 22, 2018 10:16:54 AM BRT
+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 (200116,0,0,TO_DATE('2018-03-22 10:16:53','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-03-22 10:16:53','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','AUTO_ASSIGN_ROLE_TO_CREATOR_USER','N','Defines if a role is assigned to the creator user when creating a new role ','D','S','dc4be8d1-a164-4e6d-8e02-be6c498d1669')
+;
+
+-- Mar 22, 2018 10:17:03 AM BRT
+UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_DATE('2018-03-22 10:17:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200116
+;
+
+SELECT register_migration_script('201803221017_IDEMPIERE-3664.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201804121657_IDEMPIERE-3685.sql b/migration/i5.1/oracle/201804121657_IDEMPIERE-3685.sql
new file mode 100644
index 0000000000..b1578a80b7
--- /dev/null
+++ b/migration/i5.1/oracle/201804121657_IDEMPIERE-3685.sql
@@ -0,0 +1,11 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3685
+-- Apr 12, 2018 4:51:48 PM CEST
+UPDATE AD_Tab SET WhereClause='(AD_Field.IsDisplayed=''Y'' OR AD_Field.IsDisplayedGrid=''Y'')', OrderByClause='AD_Field.SeqNo, AD_Field.SeqNoGrid',Updated=TO_DATE('2018-04-12 16:51:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=107
+;
+
+SELECT register_migration_script('201804121657_IDEMPIERE-3685.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201804170900_IDEMPIERE-3691.sql b/migration/i5.1/oracle/201804170900_IDEMPIERE-3691.sql
new file mode 100644
index 0000000000..f9fcf03b7b
--- /dev/null
+++ b/migration/i5.1/oracle/201804170900_IDEMPIERE-3691.sql
@@ -0,0 +1,10 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3691 "Row" tooltip is not translated
+-- Apr 17, 2018 9:04:04 AM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Row',0,0,'Y',TO_DATE('2018-04-17 09:04:03','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2018-04-17 09:04:03','YYYY-MM-DD HH24:MI:SS'),0,200452,'Row','D','df5d9baf-0fd2-477c-aa27-da90069bbd07')
+;
+
+SELECT register_migration_script('201804170900_IDEMPIERE-3691.sql') FROM dual
+;
\ No newline at end of file
diff --git a/migration/i5.1/oracle/201804170941_IDEMPIERE-3678.sql b/migration/i5.1/oracle/201804170941_IDEMPIERE-3678.sql
new file mode 100644
index 0000000000..3fd28b19ae
--- /dev/null
+++ b/migration/i5.1/oracle/201804170941_IDEMPIERE-3678.sql
@@ -0,0 +1,107 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3678
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62137
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62128
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62129
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62116
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62131
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62133
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62134
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62132
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62135
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62143
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62140
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62725
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62724
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62139
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62144
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62155
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62147
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62148
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=220, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62149
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62150
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62130
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204611
+;
+
+-- Apr 17, 2018 9:40:56 AM CEST
+UPDATE AD_Field SET DisplayLogic='@C_BPartner_ID@!0', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsAllowCopy='N', IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:40:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62137
+;
+
+-- Apr 17, 2018 9:46:44 AM CEST
+UPDATE AD_Process_Para SET MandatoryLogic='@CreateOpportunity@=Y',Updated=TO_DATE('2018-04-17 09:46:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53585
+;
+
+-- Apr 17, 2018 9:48:43 AM CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ReadOnlyLogic='@C_BPartner_ID@!0', IsToolbarButton=NULL,Updated=TO_DATE('2018-04-17 09:48:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62116
+;
+
+SELECT register_migration_script('201804170941_IDEMPIERE-3678.sql') FROM dual
+;
+
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/oracle/201805200007_IDEMPIERE-3716.sql b/migration/i5.1/oracle/201805200007_IDEMPIERE-3716.sql
new file mode 100644
index 0000000000..5f2dae28e3
--- /dev/null
+++ b/migration/i5.1/oracle/201805200007_IDEMPIERE-3716.sql
@@ -0,0 +1,16 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- May 19, 2018 11:01:06 PM CEST
+-- IDEMPIERE-3716 Extend the length of the Column SQL field in AD_ViewColumn to allow more advanced queries
+UPDATE AD_Column SET FieldLength=2000,Updated=TO_DATE('2018-05-19 23:01:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210586
+;
+
+-- May 19, 2018 11:01:08 PM CEST
+ALTER TABLE AD_ViewColumn ADD Tmp_ColumnSQL VARCHAR2(2000) DEFAULT NULL;
+UPDATE AD_ViewColumn SET Tmp_ColumnSQL = ColumnSQL;
+ALTER TABLE AD_ViewColumn DROP COLUMN ColumnSQL;
+ALTER TABLE AD_ViewColumn RENAME COLUMN Tmp_ColumnSQL TO ColumnSQL;
+
+SELECT register_migration_script('201805200007_IDEMPIERE-3716.sql') FROM dual
+;
diff --git a/migration/i5.1/oracle/201805221532_IDEMPIERE-918.sql b/migration/i5.1/oracle/201805221532_IDEMPIERE-918.sql
new file mode 100644
index 0000000000..1bc6b1560f
--- /dev/null
+++ b/migration/i5.1/oracle/201805221532_IDEMPIERE-918.sql
@@ -0,0 +1,51 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-918
+-- May 22, 2018 3:17:13 PM CEST
+INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200100,0,0,'Y',TO_DATE('2018-05-22 15:17:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:17:13','YYYY-MM-DD HH24:MI:SS'),100,'Create Credit Memo','Creates a credit memo based on the invoice.','The invoice should be correct and completed.','N','InvoiceCreateCreditMemo','N','org.idempiere.process.InvoiceCreateCreditMemo','1','D',0,0,'N','N','Y','N','68540275-9c56-4e1b-99f5-d155eb62a12b')
+;
+
+-- May 22, 2018 3:22:56 PM CEST
+INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200118,'C_DocTypeTarget AR/AP Credit Memos','Target Document Type AR/AP Credit Memos','S','C_DocType.DocBaseType IN (''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',0,0,'Y',TO_DATE('2018-05-22 15:22:56','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:22:56','YYYY-MM-DD HH24:MI:SS'),100,'D','b27e8ab7-8128-43b2-b94d-175c3f77e4cf')
+;
+
+-- May 22, 2018 3:24:44 PM CEST
+INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200228,0,0,'Y',TO_DATE('2018-05-22 15:24:44','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:24:44','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',200100,10,19,'N',200118,10,'Y','C_DocType_ID','Y','D',196,'0022f86c-0629-4d70-84c3-cc6a506fdf7c','N')
+;
+
+-- May 22, 2018 3:28:49 PM CEST
+INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200229,0,0,'Y',TO_DATE('2018-05-22 15:28:49','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:28:49','YYYY-MM-DD HH24:MI:SS'),100,'Date Invoiced','Date printed on Invoice','The Date Invoice indicates the date printed on the invoice.',200100,20,15,'N',10,'Y','@#Date@','DateInvoiced','Y','D',267,'0c954e16-967b-4b48-9075-8a134b72e2d2','N')
+;
+
+-- May 22, 2018 3:29:12 PM CEST
+INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200230,0,0,'Y',TO_DATE('2018-05-22 15:29:12','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:29:12','YYYY-MM-DD HH24:MI:SS'),100,'Account Date','Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.',200100,30,15,'N',10,'Y','@#Date@','DateAcct','Y','D',263,'4edbbf7b-c6d3-4b3d-84b7-1591c204b91d','N')
+;
+
+-- May 22, 2018 3:30:49 PM CEST
+INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200231,0,0,'Y',TO_DATE('2018-05-22 15:30:49','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:30:49','YYYY-MM-DD HH24:MI:SS'),100,'Document Action','The targeted status of the document','You find the current status in the Document Status field. The options are listed in a popup',200100,40,17,135,'N',219,0,'N','DocAction','Y','D',287,'ce0b15c4-5e79-4dfd-b11b-0992911df4b4','N')
+;
+
+-- May 22, 2018 3:32:01 PM CEST
+INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,Action,AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo) VALUES (0,0,TO_DATE('2018-05-22 15:32:01','YYYY-MM-DD HH24:MI:SS'),100,'InvoiceCustomerCreateCreditMemo','Y',200096,'InvoiceCustomerCreateCreditMemo',TO_DATE('2018-05-22 15:32:01','YYYY-MM-DD HH24:MI:SS'),100,'N','ebf24687-2124-496b-89ee-5d75e05743a3','W',263,200100,'@DocStatus@=''CO'' | @DocStatus@=''CL''',10)
+;
+
+-- May 22, 2018 3:32:35 PM CEST
+INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,Action,AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo) VALUES (0,0,TO_DATE('2018-05-22 15:32:34','YYYY-MM-DD HH24:MI:SS'),100,'InvoiceVendorCreateCreditMemo','Y',200097,'InvoiceVendorCreateCreditMemo',TO_DATE('2018-05-22 15:32:34','YYYY-MM-DD HH24:MI:SS'),100,'N','2e2c53e9-4e1e-4789-8caf-c772e601e107','W',290,200100,'@DocStatus@=''CO'' | @DocStatus@=''CL''',10)
+;
+
+-- May 22, 2018 7:25:46 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Invoice has already allocations',0,0,'Y',TO_DATE('2018-05-22 19:25:46','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 19:25:46','YYYY-MM-DD HH24:MI:SS'),100,200471,'InvoiceHasAllocations','D','f0dc5362-437e-4fd9-bdc9-c8b472678765')
+;
+
+-- May 22, 2018 7:26:13 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Cannot create a credit memo from a credit memo',0,0,'Y',TO_DATE('2018-05-22 19:26:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 19:26:13','YYYY-MM-DD HH24:MI:SS'),100,200472,'CannotCreateCreditMemoFromCreditMemo','D','36370a38-ec58-4e1f-8804-e869a17730ac')
+;
+
+-- May 22, 2018 7:26:37 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Credit Memo already exists',0,0,'Y',TO_DATE('2018-05-22 19:26:37','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 19:26:37','YYYY-MM-DD HH24:MI:SS'),100,200473,'CreditMemoAlreadyExists','D','c67e63fc-4a41-45dc-b52c-317688b125d2')
+;
+
+SELECT register_migration_script('201805221532_IDEMPIERE-918.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201806041252_IDEMPIERE-3651.sql b/migration/i5.1/oracle/201806041252_IDEMPIERE-3651.sql
new file mode 100644
index 0000000000..b0d194dda7
--- /dev/null
+++ b/migration/i5.1/oracle/201806041252_IDEMPIERE-3651.sql
@@ -0,0 +1,11 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values
+-- Jun 4, 2018 12:51:33 PM CEST
+UPDATE AD_Column SET AD_Val_Rule_ID=258,Updated=TO_DATE('2018-06-04 12:51:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6026
+;
+
+SELECT register_migration_script('201806041252_IDEMPIERE-3651.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201806061111_IDEMPIERE-585.sql b/migration/i5.1/oracle/201806061111_IDEMPIERE-585.sql
new file mode 100644
index 0000000000..3772ff1712
--- /dev/null
+++ b/migration/i5.1/oracle/201806061111_IDEMPIERE-585.sql
@@ -0,0 +1,68 @@
+-- Mar 5, 2013 9:52:39 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:52:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=327
+;
+
+-- Mar 5, 2013 9:52:55 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:52:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=323
+;
+
+-- Mar 5, 2013 9:53:10 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:53:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=337
+;
+
+-- Mar 5, 2013 9:53:36 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:53:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=331
+;
+
+-- Mar 5, 2013 9:53:52 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:53:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=419
+;
+
+-- Mar 5, 2013 9:54:09 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:54:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53112
+;
+
+-- Mar 5, 2013 9:54:40 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:54:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=210
+;
+
+-- Mar 5, 2013 9:54:50 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:54:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=324
+;
+
+-- Mar 5, 2013 9:56:01 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:56:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=422
+;
+
+-- Mar 5, 2013 9:56:14 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:56:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=333
+;
+
+-- Mar 5, 2013 9:56:27 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:56:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53077
+;
+
+-- Mar 5, 2013 9:56:44 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:56:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=209
+;
+
+-- Mar 5, 2013 9:57:04 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_DATE('2013-03-05 09:57:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=334
+;
+
+SELECT register_migration_script('201806061111_IDEMPIERE-585.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201806061330_IDEMPIERE-3651.sql b/migration/i5.1/oracle/201806061330_IDEMPIERE-3651.sql
new file mode 100644
index 0000000000..05a769502f
--- /dev/null
+++ b/migration/i5.1/oracle/201806061330_IDEMPIERE-3651.sql
@@ -0,0 +1,12 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values
+-- Jun 6, 2018 1:29:52 PM CEST
+UPDATE AD_Val_Rule SET Code='C_ElementValue.C_Element_ID IN
+(SELECT C_Element_ID FROM C_AcctSchema_Element WHERE AD_Client_ID=@#AD_Client_ID@ AND (ElementType=''@ElementType@'' OR (''@ElementType@''=''CO'' AND ElementType=''AC'')))',Updated=TO_DATE('2018-06-06 13:29:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=258
+;
+
+SELECT register_migration_script('201806061330_IDEMPIERE-3651.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201806131433_IDEMPIERE-3651.sql b/migration/i5.1/oracle/201806131433_IDEMPIERE-3651.sql
new file mode 100644
index 0000000000..439eb5d228
--- /dev/null
+++ b/migration/i5.1/oracle/201806131433_IDEMPIERE-3651.sql
@@ -0,0 +1,12 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values
+-- Jun 13, 2018 2:32:06 PM CEST
+UPDATE AD_Val_Rule SET Code='C_ElementValue.C_Element_ID IN
+(SELECT C_Element_ID FROM C_AcctSchema_Element WHERE IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND (ElementType=''@ElementType@'' OR (''@ElementType@''=''CO'' AND ElementType=''AC'')))',Updated=TO_DATE('2018-06-13 14:32:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=258
+;
+
+SELECT register_migration_script('201806131433_IDEMPIERE-3651.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201807041616_IDEMPIERE-3738.sql b/migration/i5.1/oracle/201807041616_IDEMPIERE-3738.sql
new file mode 100644
index 0000000000..41fab20a29
--- /dev/null
+++ b/migration/i5.1/oracle/201807041616_IDEMPIERE-3738.sql
@@ -0,0 +1,135 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3738 Reference Color broken
+-- Jul 4, 2018 4:02:49 PM CEST
+INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203229,0,0,'Y',TO_DATE('2018-07-04 16:02:37','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-07-04 16:02:37','YYYY-MM-DD HH24:MI:SS'),100,'Color','Color',NULL,NULL,'Color','D','c43cfcc2-2c92-4e91-88b8-88947297184d')
+;
+
+-- Jul 4, 2018 4:03:02 PM CEST
+INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,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) VALUES (213570,0,'Color',135,'Color',7,'N','N','N','N','N',0,'N',27,0,0,'Y',TO_DATE('2018-07-04 16:03:02','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-07-04 16:03:02','YYYY-MM-DD HH24:MI:SS'),100,203229,'Y','N','D','N','N','N','Y','46472ac6-1648-48d8-b0bd-aef0d61a447f','Y',0,'N','N')
+;
+
+-- Jul 4, 2018 4:03:03 PM CEST
+ALTER TABLE Test ADD Color VARCHAR2(7) DEFAULT NULL
+;
+
+-- Jul 4, 2018 4:03:17 PM CEST
+INSERT INTO AD_Field (AD_Field_ID,Name,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,ColumnSpan) VALUES (205590,'Color',152,213570,'Y',7,260,'N','N','N','N',0,0,'Y',TO_DATE('2018-07-04 16:03:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-07-04 16:03:16','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','dc447e1a-b62a-4a90-92db-17203eb7d6ac','Y',260,2)
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=10, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=415
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=20, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2024
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=30, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=417
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=418
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=419
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=420
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=423
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=424
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=90, AD_FieldGroup_ID=103, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=421
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_FieldGroup_ID=103, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=422
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3059
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3062
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_FieldGroup_ID=50003, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=425
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, AD_FieldGroup_ID=50003, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=426
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_FieldGroup_ID=200016, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3209
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3902
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3210
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4251
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3057
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3056
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_FieldGroup_ID=123, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205590
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=416
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205058
+;
+
+-- Jul 4, 2018 4:08:25 PM CEST
+UPDATE Test SET Color='#bfca3f',Updated=TO_DATE('2018-07-04 16:08:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE Test_ID=103
+;
+
+-- Jul 4, 2018 4:09:13 PM CEST
+UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2018-07-04 16:09:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=294
+;
+
+-- Jul 4, 2018 4:09:21 PM CEST
+UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2018-07-04 16:09:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=225
+;
+
+-- Jul 4, 2018 4:13:03 PM CEST
+UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=19 | @AD_Reference_ID@=30 | @AD_Reference_ID@=18 | @AD_Reference_ID@=21 | @AD_Reference_ID@=25 | @AD_Reference_ID@=31 | @AD_Reference_ID@=35 | @AD_Reference_ID@=33 | @AD_Reference_ID@=32 | @AD_Reference_ID@=53370', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:13:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202518
+;
+
+-- Jul 4, 2018 4:13:12 PM CEST
+UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=19 | @AD_Reference_ID@=30 | @AD_Reference_ID@=18 | @AD_Reference_ID@=21 | @AD_Reference_ID@=25 | @AD_Reference_ID@=31 | @AD_Reference_ID@=35 | @AD_Reference_ID@=33 | @AD_Reference_ID@=32 | @AD_Reference_ID@=53370', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-04 16:13:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202519
+;
+
+SELECT register_migration_script('201807041616_IDEMPIERE-3738.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201807111333_Ticket_AP2-357.sql b/migration/i5.1/oracle/201807111333_Ticket_AP2-357.sql
new file mode 100644
index 0000000000..7bec05ec77
--- /dev/null
+++ b/migration/i5.1/oracle/201807111333_Ticket_AP2-357.sql
@@ -0,0 +1,4 @@
+-- just for postgresql
+
+SELECT register_migration_script('201807111333_Ticket_AP2-357.sql') FROM dual
+;
diff --git a/migration/i5.1/oracle/201807111626_IDEMPIERE-1421.sql b/migration/i5.1/oracle/201807111626_IDEMPIERE-1421.sql
new file mode 100644
index 0000000000..9abfa8e9c4
--- /dev/null
+++ b/migration/i5.1/oracle/201807111626_IDEMPIERE-1421.sql
@@ -0,0 +1,11 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-1421 Tax Group field is enabled in the window Customer
+-- Jul 11, 2018 4:25:37 PM CEST
+UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-11 16:25:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62773
+;
+
+SELECT register_migration_script('201807111626_IDEMPIERE-1421.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201807161530_IDEMPIERE-3746.sql b/migration/i5.1/oracle/201807161530_IDEMPIERE-3746.sql
new file mode 100644
index 0000000000..01e0c6d16c
--- /dev/null
+++ b/migration/i5.1/oracle/201807161530_IDEMPIERE-3746.sql
@@ -0,0 +1,18 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3719 : Add display name when sending emails
+-- Jul 16, 2018 3:27:06 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-16 15:27:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11175
+;
+
+-- Jul 16, 2018 3:27:06 PM CEST
+UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-16 15:27:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201884
+;
+
+-- Jul 16, 2018 3:27:06 PM CEST
+UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-16 15:27:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5226
+;
+
+SELECT register_migration_script('201807161530_IDEMPIERE-3746.sql') FROM dual
+;
\ No newline at end of file
diff --git a/migration/i5.1/oracle/201807232033_IDEMPIERE-3737.sql b/migration/i5.1/oracle/201807232033_IDEMPIERE-3737.sql
new file mode 100644
index 0000000000..a3bb15792e
--- /dev/null
+++ b/migration/i5.1/oracle/201807232033_IDEMPIERE-3737.sql
@@ -0,0 +1,19 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- I do not forgot to set the DICTIONARY_ID_COMMENTS System Configurator
+-- After a year , i get the answer for a very nice question from https://groups.google.com/d/msg/idempiere/gkrkQ7gEPBI/bw-C6JTdBQAJ
+
+-- 2018-7-3 下午04时06分21秒
+-- Update User reference of AD_Reference for System system . If using Table Direct , System cannt got other clients' user_id lead to null replace in preference window.
+UPDATE AD_Column SET AD_Reference_ID=30, AD_Reference_Value_ID=200145, FKConstraintType=NULL,Updated=TO_DATE('2018-07-03 16:06:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1471
+;
+
+-- 2018-7-3 下午04时06分38秒
+-- Implementing a tab sqlwhere to filter some useless preference value in other clients and display all data for system.
+UPDATE AD_Tab SET WhereClause='AD_Preference.CreatedBy IN (SELECT AD_User_ID FROM AD_User WHERE AD_Client_ID = @#AD_Client_ID@) OR @#AD_Client_ID@ = 0',Updated=TO_DATE('2018-07-03 16:06:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=156
+;
+
+SELECT register_migration_script('201807232033_IDEMPIERE-3737.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201807240936_IDEMPIERE-3757.sql b/migration/i5.1/oracle/201807240936_IDEMPIERE-3757.sql
new file mode 100644
index 0000000000..2e7ba299e2
--- /dev/null
+++ b/migration/i5.1/oracle/201807240936_IDEMPIERE-3757.sql
@@ -0,0 +1,15 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3757
+-- Jul 24, 2018 9:30:27 AM CEST
+UPDATE AD_Table SET AccessLevel='4',Updated=TO_DATE('2018-07-24 09:30:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=116
+;
+
+DELETE FROM ad_window_access WHERE ad_window_id=105
+AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND userlevel NOT LIKE 'S%')
+;
+
+SELECT register_migration_script('201807240936_IDEMPIERE-3757.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201807271000_IDEMPIERE-3762.sql b/migration/i5.1/oracle/201807271000_IDEMPIERE-3762.sql
new file mode 100644
index 0000000000..e363a3d44d
--- /dev/null
+++ b/migration/i5.1/oracle/201807271000_IDEMPIERE-3762.sql
@@ -0,0 +1,14 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3762 : Fix AD_Column_ID / AD_Field_ID : Loader - Too many records
+-- Jul 26, 2018 10:06:34 AM CEST
+UPDATE AD_Field SET AD_Reference_ID=30,Updated=TO_DATE('2018-07-26 10:06:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=4599
+;
+
+-- Jul 26, 2018 10:06:42 AM CEST
+UPDATE AD_Field SET AD_Reference_ID=30,Updated=TO_DATE('2018-07-26 10:06:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=59576
+;
+
+SELECT register_migration_script('201807271000_IDEMPIERE-3762.sql') FROM dual
+;
diff --git a/migration/i5.1/oracle/201808010900_IDEMPIERE-3769.sql b/migration/i5.1/oracle/201808010900_IDEMPIERE-3769.sql
new file mode 100644
index 0000000000..87f4f8063d
--- /dev/null
+++ b/migration/i5.1/oracle/201808010900_IDEMPIERE-3769.sql
@@ -0,0 +1,10 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3769 : IBAN : Invalid message is not translated - force to uppercase
+-- Aug 1, 2018 8:56:43 AM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','IBAN is invalid',0,0,'Y',TO_DATE('2018-08-01 08:56:42','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2018-08-01 08:56:42','YYYY-MM-DD HH24:MI:SS'),0,200480,'InvalidIBAN','D','4cc792d9-9af0-4e37-b90a-7dcc9f5e82ec')
+;
+
+SELECT register_migration_script('201808010900_IDEMPIERE-3769.sql') FROM dual
+;
\ No newline at end of file
diff --git a/migration/i5.1/oracle/201808071226_IDEMPIERE-2442.sql b/migration/i5.1/oracle/201808071226_IDEMPIERE-2442.sql
new file mode 100644
index 0000000000..cd38771a40
--- /dev/null
+++ b/migration/i5.1/oracle/201808071226_IDEMPIERE-2442.sql
@@ -0,0 +1,31 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-2442 Always using default conversion type in Order & Invoice window's amount summary information
+-- Aug 7, 2018 12:22:32 PM CEST
+UPDATE AD_StatusLine SET SQLStatement='SELECT COUNT(DISTINCT C_OrderLine_ID) AS Lines,o.TotalLines,o.GrandTotal,c.ISO_Code,
+currencyConvert(o.GrandTotal,o.C_Currency_ID,ac.C_Currency_ID,o.DateAcct,o.C_ConversionType_ID,o.AD_Client_ID,o.AD_Org_ID) AS ConvAmt
+FROM C_Order o
+INNER JOIN C_Currency c ON (o.C_Currency_ID=c.C_Currency_ID)
+LEFT JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID)
+LEFT JOIN AD_ClientInfo ci ON (ci.AD_Client_ID=o.AD_Client_ID)
+LEFT JOIN C_AcctSchema ac ON (ci.C_AcctSchema1_ID=ac.C_AcctSchema_ID)
+WHERE o.C_Order_ID=@C_Order_ID@
+GROUP BY o.C_Currency_ID, ac.C_Currency_ID, o.C_ConversionType_ID, c.ISO_Code, o.TotalLines, o.GrandTotal, o.DateAcct, o.AD_Client_ID, o.AD_Org_ID',Updated=TO_DATE('2018-08-07 12:22:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_StatusLine_ID=200000
+;
+
+-- Aug 7, 2018 12:25:27 PM CEST
+UPDATE AD_StatusLine SET SQLStatement='SELECT COUNT(DISTINCT C_InvoiceLine_ID) AS Lines,o.TotalLines,o.GrandTotal,c.ISO_Code,
+currencyConvert(o.GrandTotal,o.C_Currency_ID,ac.C_Currency_ID,o.DateAcct,o.C_ConversionType_ID,o.AD_Client_ID,o.AD_Org_ID) AS ConvAmt
+FROM C_Invoice o
+INNER JOIN C_Currency c ON (o.C_Currency_ID=c.C_Currency_ID)
+LEFT JOIN C_InvoiceLine l ON (o.C_Invoice_ID=l.C_Invoice_ID)
+LEFT JOIN AD_ClientInfo ci ON (ci.AD_Client_ID=o.AD_Client_ID)
+LEFT JOIN C_AcctSchema ac ON (ci.C_AcctSchema1_ID=ac.C_AcctSchema_ID)
+WHERE o.C_Invoice_ID=@C_Invoice_ID@
+GROUP BY o.C_Currency_ID, ac.C_Currency_ID, o.C_ConversionType_ID, c.ISO_Code, o.TotalLines, o.GrandTotal, o.DateAcct, o.AD_Client_ID, o.AD_Org_ID',Updated=TO_DATE('2018-08-07 12:25:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_StatusLine_ID=200002
+;
+
+SELECT register_migration_script('201808071226_IDEMPIERE-2442.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201312231347_IDEMPIERE-1539.sql b/migration/i5.1/postgresql/201312231347_IDEMPIERE-1539.sql
new file mode 100644
index 0000000000..38642b8993
--- /dev/null
+++ b/migration/i5.1/postgresql/201312231347_IDEMPIERE-1539.sql
@@ -0,0 +1,8 @@
+-- Dec 23, 2013 1:36:38 PM COT
+-- IDEMPIERE-1539
+INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,Created,CreatedBy,Updated,UpdatedBy,IsActive,EntityType,AD_Client_ID,AD_Org_ID) VALUES (200168,200061,'9562f4db-97a9-4df5-99d0-b2f5bc0e2b4c','Full Like','LIKE',TO_TIMESTAMP('2013-12-23 13:36:48','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-12-23 13:36:48','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,0)
+;
+
+SELECT register_migration_script('201312231347_IDEMPIERE-1539.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201803221017_IDEMPIERE-3664.sql b/migration/i5.1/postgresql/201803221017_IDEMPIERE-3664.sql
new file mode 100644
index 0000000000..064cb34c56
--- /dev/null
+++ b/migration/i5.1/postgresql/201803221017_IDEMPIERE-3664.sql
@@ -0,0 +1,12 @@
+-- IDEMPIERE-3664
+-- Mar 22, 2018 10:16:54 AM BRT
+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 (200116,0,0,TO_TIMESTAMP('2018-03-22 10:16:53','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-03-22 10:16:53','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','AUTO_ASSIGN_ROLE_TO_CREATOR_USER','N','Defines if a role is assigned to the creator user when creating a new role ','D','S','dc4be8d1-a164-4e6d-8e02-be6c498d1669')
+;
+
+-- Mar 22, 2018 10:17:03 AM BRT
+UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_TIMESTAMP('2018-03-22 10:17:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200116
+;
+
+SELECT register_migration_script('201803221017_IDEMPIERE-3664.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201804121657_IDEMPIERE-3685.sql b/migration/i5.1/postgresql/201804121657_IDEMPIERE-3685.sql
new file mode 100644
index 0000000000..4dab3d3c60
--- /dev/null
+++ b/migration/i5.1/postgresql/201804121657_IDEMPIERE-3685.sql
@@ -0,0 +1,8 @@
+-- IDEMPIERE-3685
+-- Apr 12, 2018 4:51:48 PM CEST
+UPDATE AD_Tab SET WhereClause='(AD_Field.IsDisplayed=''Y'' OR AD_Field.IsDisplayedGrid=''Y'')', OrderByClause='SeqNo, SeqNoGrid',Updated=TO_TIMESTAMP('2018-04-12 16:51:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=107
+;
+
+SELECT register_migration_script('201804121657_IDEMPIERE-3685.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201804170900_IDEMPIERE-3691.sql b/migration/i5.1/postgresql/201804170900_IDEMPIERE-3691.sql
new file mode 100644
index 0000000000..09ca4426ce
--- /dev/null
+++ b/migration/i5.1/postgresql/201804170900_IDEMPIERE-3691.sql
@@ -0,0 +1,7 @@
+-- IDEMPIERE-3691 "Row" tooltip is not translated
+-- Apr 17, 2018 9:04:04 AM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Row',0,0,'Y',TO_TIMESTAMP('2018-04-17 09:04:03','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2018-04-17 09:04:03','YYYY-MM-DD HH24:MI:SS'),0,200452,'Row','D','df5d9baf-0fd2-477c-aa27-da90069bbd07')
+;
+
+SELECT register_migration_script('201804170900_IDEMPIERE-3691.sql') FROM dual
+;
\ No newline at end of file
diff --git a/migration/i5.1/postgresql/201804170941_IDEMPIERE-3678.sql b/migration/i5.1/postgresql/201804170941_IDEMPIERE-3678.sql
new file mode 100644
index 0000000000..938182b6f4
--- /dev/null
+++ b/migration/i5.1/postgresql/201804170941_IDEMPIERE-3678.sql
@@ -0,0 +1,104 @@
+-- IDEMPIERE-3678
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62137
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62128
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62129
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62116
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62131
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62133
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62134
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62132
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62135
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62143
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62140
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62725
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62724
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62139
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62144
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62155
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62147
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62148
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=220, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62149
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62150
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62130
+;
+
+-- Apr 17, 2018 9:39:44 AM CEST
+UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204611
+;
+
+-- Apr 17, 2018 9:40:56 AM CEST
+UPDATE AD_Field SET DisplayLogic='@C_BPartner_ID@!0', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsAllowCopy='N', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:40:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62137
+;
+
+-- Apr 17, 2018 9:46:44 AM CEST
+UPDATE AD_Process_Para SET MandatoryLogic='@CreateOpportunity@=Y',Updated=TO_TIMESTAMP('2018-04-17 09:46:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53585
+;
+
+-- Apr 17, 2018 9:48:43 AM CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ReadOnlyLogic='@C_BPartner_ID@!0', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-04-17 09:48:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62116
+;
+
+SELECT register_migration_script('201804170941_IDEMPIERE-3678.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/migration/i5.1/postgresql/201805200007_IDEMPIERE-3716.sql b/migration/i5.1/postgresql/201805200007_IDEMPIERE-3716.sql
new file mode 100644
index 0000000000..619204a22b
--- /dev/null
+++ b/migration/i5.1/postgresql/201805200007_IDEMPIERE-3716.sql
@@ -0,0 +1,11 @@
+-- May 19, 2018 11:01:06 PM CEST
+-- IDEMPIERE-3716 Extend the length of the Column SQL field in AD_ViewColumn to allow more advanced queries
+UPDATE AD_Column SET FieldLength=2000,Updated=TO_TIMESTAMP('2018-05-19 23:01:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210586
+;
+
+-- May 21, 2018 1:37:18 PM CEST
+INSERT INTO t_alter_column values('ad_viewcolumn','ColumnSQL','VARCHAR(2000)',null,'NULL')
+;
+
+SELECT register_migration_script('201805200007_IDEMPIERE-3716.sql') FROM dual
+;
diff --git a/migration/i5.1/postgresql/201805221532_IDEMPIERE-918.sql b/migration/i5.1/postgresql/201805221532_IDEMPIERE-918.sql
new file mode 100644
index 0000000000..e074f1617f
--- /dev/null
+++ b/migration/i5.1/postgresql/201805221532_IDEMPIERE-918.sql
@@ -0,0 +1,48 @@
+-- IDEMPIERE-918
+-- May 22, 2018 3:17:13 PM CEST
+INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200100,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:17:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:17:13','YYYY-MM-DD HH24:MI:SS'),100,'Create Credit Memo','Creates a credit memo based on the invoice.','The invoice should be correct and completed.','N','InvoiceCreateCreditMemo','N','org.idempiere.process.InvoiceCreateCreditMemo','1','D',0,0,'N','N','Y','N','68540275-9c56-4e1b-99f5-d155eb62a12b')
+;
+
+-- May 22, 2018 3:22:56 PM CEST
+INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200118,'C_DocTypeTarget AR/AP Credit Memos','Target Document Type AR/AP Credit Memos','S','C_DocType.DocBaseType IN (''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',0,0,'Y',TO_TIMESTAMP('2018-05-22 15:22:56','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:22:56','YYYY-MM-DD HH24:MI:SS'),100,'D','b27e8ab7-8128-43b2-b94d-175c3f77e4cf')
+;
+
+-- May 22, 2018 3:24:44 PM CEST
+INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200228,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:24:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:24:44','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',200100,10,19,'N',200118,10,'Y','C_DocType_ID','Y','D',196,'0022f86c-0629-4d70-84c3-cc6a506fdf7c','N')
+;
+
+-- May 22, 2018 3:28:49 PM CEST
+INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200229,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:28:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:28:49','YYYY-MM-DD HH24:MI:SS'),100,'Date Invoiced','Date printed on Invoice','The Date Invoice indicates the date printed on the invoice.',200100,20,15,'N',10,'Y','@#Date@','DateInvoiced','Y','D',267,'0c954e16-967b-4b48-9075-8a134b72e2d2','N')
+;
+
+-- May 22, 2018 3:29:12 PM CEST
+INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200230,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:29:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:29:12','YYYY-MM-DD HH24:MI:SS'),100,'Account Date','Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.',200100,30,15,'N',10,'Y','@#Date@','DateAcct','Y','D',263,'4edbbf7b-c6d3-4b3d-84b7-1591c204b91d','N')
+;
+
+-- May 22, 2018 3:30:49 PM CEST
+INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200231,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:30:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:30:49','YYYY-MM-DD HH24:MI:SS'),100,'Document Action','The targeted status of the document','You find the current status in the Document Status field. The options are listed in a popup',200100,40,17,135,'N',219,0,'N','DocAction','Y','D',287,'ce0b15c4-5e79-4dfd-b11b-0992911df4b4','N')
+;
+
+-- May 22, 2018 3:32:01 PM CEST
+INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,"action",AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo) VALUES (0,0,TO_TIMESTAMP('2018-05-22 15:32:01','YYYY-MM-DD HH24:MI:SS'),100,'InvoiceCustomerCreateCreditMemo','Y',200096,'InvoiceCustomerCreateCreditMemo',TO_TIMESTAMP('2018-05-22 15:32:01','YYYY-MM-DD HH24:MI:SS'),100,'N','ebf24687-2124-496b-89ee-5d75e05743a3','W',263,200100,'@DocStatus@=''CO'' | @DocStatus@=''CL''',10)
+;
+
+-- May 22, 2018 3:32:35 PM CEST
+INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,"action",AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo) VALUES (0,0,TO_TIMESTAMP('2018-05-22 15:32:34','YYYY-MM-DD HH24:MI:SS'),100,'InvoiceVendorCreateCreditMemo','Y',200097,'InvoiceVendorCreateCreditMemo',TO_TIMESTAMP('2018-05-22 15:32:34','YYYY-MM-DD HH24:MI:SS'),100,'N','2e2c53e9-4e1e-4789-8caf-c772e601e107','W',290,200100,'@DocStatus@=''CO'' | @DocStatus@=''CL''',10)
+;
+
+-- May 22, 2018 7:25:46 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Invoice has already allocations',0,0,'Y',TO_TIMESTAMP('2018-05-22 19:25:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 19:25:46','YYYY-MM-DD HH24:MI:SS'),100,200471,'InvoiceHasAllocations','D','f0dc5362-437e-4fd9-bdc9-c8b472678765')
+;
+
+-- May 22, 2018 7:26:13 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Cannot create a credit memo from a credit memo',0,0,'Y',TO_TIMESTAMP('2018-05-22 19:26:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 19:26:13','YYYY-MM-DD HH24:MI:SS'),100,200472,'CannotCreateCreditMemoFromCreditMemo','D','36370a38-ec58-4e1f-8804-e869a17730ac')
+;
+
+-- May 22, 2018 7:26:37 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Credit Memo already exists',0,0,'Y',TO_TIMESTAMP('2018-05-22 19:26:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 19:26:37','YYYY-MM-DD HH24:MI:SS'),100,200473,'CreditMemoAlreadyExists','D','c67e63fc-4a41-45dc-b52c-317688b125d2')
+;
+
+SELECT register_migration_script('201805221532_IDEMPIERE-918.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201806041252_IDEMPIERE-3651.sql b/migration/i5.1/postgresql/201806041252_IDEMPIERE-3651.sql
new file mode 100644
index 0000000000..ec9616ab0e
--- /dev/null
+++ b/migration/i5.1/postgresql/201806041252_IDEMPIERE-3651.sql
@@ -0,0 +1,8 @@
+-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values
+-- Jun 4, 2018 12:51:33 PM CEST
+UPDATE AD_Column SET AD_Val_Rule_ID=258,Updated=TO_TIMESTAMP('2018-06-04 12:51:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6026
+;
+
+SELECT register_migration_script('201806041252_IDEMPIERE-3651.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201806061111_IDEMPIERE-585.sql b/migration/i5.1/postgresql/201806061111_IDEMPIERE-585.sql
new file mode 100644
index 0000000000..c0aee54331
--- /dev/null
+++ b/migration/i5.1/postgresql/201806061111_IDEMPIERE-585.sql
@@ -0,0 +1,68 @@
+-- Mar 5, 2013 9:52:39 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:52:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=327
+;
+
+-- Mar 5, 2013 9:52:55 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:52:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=323
+;
+
+-- Mar 5, 2013 9:53:10 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:53:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=337
+;
+
+-- Mar 5, 2013 9:53:36 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:53:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=331
+;
+
+-- Mar 5, 2013 9:53:52 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:53:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=419
+;
+
+-- Mar 5, 2013 9:54:09 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:54:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53112
+;
+
+-- Mar 5, 2013 9:54:40 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:54:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=210
+;
+
+-- Mar 5, 2013 9:54:50 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:54:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=324
+;
+
+-- Mar 5, 2013 9:56:01 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:56:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=422
+;
+
+-- Mar 5, 2013 9:56:14 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:56:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=333
+;
+
+-- Mar 5, 2013 9:56:27 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:56:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53077
+;
+
+-- Mar 5, 2013 9:56:44 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:56:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=209
+;
+
+-- Mar 5, 2013 9:57:04 AM CET
+-- IDEMPIERE 585
+UPDATE AD_Tab SET IsInsertRecord='N',Updated=TO_TIMESTAMP('2013-03-05 09:57:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=334
+;
+
+SELECT register_migration_script('201806061111_IDEMPIERE-585.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201806061330_IDEMPIERE-3651.sql b/migration/i5.1/postgresql/201806061330_IDEMPIERE-3651.sql
new file mode 100644
index 0000000000..855cd3992d
--- /dev/null
+++ b/migration/i5.1/postgresql/201806061330_IDEMPIERE-3651.sql
@@ -0,0 +1,9 @@
+-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values
+-- Jun 6, 2018 1:29:52 PM CEST
+UPDATE AD_Val_Rule SET Code='C_ElementValue.C_Element_ID IN
+(SELECT C_Element_ID FROM C_AcctSchema_Element WHERE AD_Client_ID=@#AD_Client_ID@ AND (ElementType=''@ElementType@'' OR (''@ElementType@''=''CO'' AND ElementType=''AC'')))',Updated=TO_TIMESTAMP('2018-06-06 13:29:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=258
+;
+
+SELECT register_migration_script('201806061330_IDEMPIERE-3651.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201806131433_IDEMPIERE-3651.sql b/migration/i5.1/postgresql/201806131433_IDEMPIERE-3651.sql
new file mode 100644
index 0000000000..f113b121ef
--- /dev/null
+++ b/migration/i5.1/postgresql/201806131433_IDEMPIERE-3651.sql
@@ -0,0 +1,9 @@
+-- IDEMPIERE-3651 Report Column Set=>Report Column=>User Element List1 not displaying User1_ID values
+-- Jun 13, 2018 2:32:06 PM CEST
+UPDATE AD_Val_Rule SET Code='C_ElementValue.C_Element_ID IN
+(SELECT C_Element_ID FROM C_AcctSchema_Element WHERE IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND (ElementType=''@ElementType@'' OR (''@ElementType@''=''CO'' AND ElementType=''AC'')))',Updated=TO_TIMESTAMP('2018-06-13 14:32:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=258
+;
+
+SELECT register_migration_script('201806131433_IDEMPIERE-3651.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201807041616_IDEMPIERE-3738.sql b/migration/i5.1/postgresql/201807041616_IDEMPIERE-3738.sql
new file mode 100644
index 0000000000..03c3a059b9
--- /dev/null
+++ b/migration/i5.1/postgresql/201807041616_IDEMPIERE-3738.sql
@@ -0,0 +1,132 @@
+-- IDEMPIERE-3738 Reference Color broken
+-- Jul 4, 2018 4:02:49 PM CEST
+INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203229,0,0,'Y',TO_TIMESTAMP('2018-07-04 16:02:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-07-04 16:02:37','YYYY-MM-DD HH24:MI:SS'),100,'Color','Color',NULL,NULL,'Color','D','c43cfcc2-2c92-4e91-88b8-88947297184d')
+;
+
+-- Jul 4, 2018 4:03:02 PM CEST
+INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,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) VALUES (213570,0,'Color',135,'Color',7,'N','N','N','N','N',0,'N',27,0,0,'Y',TO_TIMESTAMP('2018-07-04 16:03:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-07-04 16:03:02','YYYY-MM-DD HH24:MI:SS'),100,203229,'Y','N','D','N','N','N','Y','46472ac6-1648-48d8-b0bd-aef0d61a447f','Y',0,'N','N')
+;
+
+-- Jul 4, 2018 4:03:03 PM CEST
+ALTER TABLE Test ADD COLUMN Color VARCHAR(7) DEFAULT NULL
+;
+
+-- Jul 4, 2018 4:03:17 PM CEST
+INSERT INTO AD_Field (AD_Field_ID,Name,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,ColumnSpan) VALUES (205590,'Color',152,213570,'Y',7,260,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2018-07-04 16:03:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-07-04 16:03:16','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','dc447e1a-b62a-4a90-92db-17203eb7d6ac','Y',260,2)
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=10, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=415
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=20, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2024
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=30, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=417
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=40, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=418
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=419
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=420
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=423
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=424
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=90, AD_FieldGroup_ID=103, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=421
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_FieldGroup_ID=103, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=422
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3059
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3062
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_FieldGroup_ID=50003, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=425
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=140, AD_FieldGroup_ID=50003, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=426
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_FieldGroup_ID=200016, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3209
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3902
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3210
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4251
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3057
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3056
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_FieldGroup_ID=123, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205590
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=416
+;
+
+-- Jul 4, 2018 4:07:48 PM CEST
+UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:07:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205058
+;
+
+-- Jul 4, 2018 4:08:25 PM CEST
+UPDATE Test SET Color='#bfca3f',Updated=TO_TIMESTAMP('2018-07-04 16:08:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE Test_ID=103
+;
+
+-- Jul 4, 2018 4:09:13 PM CEST
+UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2018-07-04 16:09:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=294
+;
+
+-- Jul 4, 2018 4:09:21 PM CEST
+UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2018-07-04 16:09:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=225
+;
+
+-- Jul 4, 2018 4:13:03 PM CEST
+UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=19 | @AD_Reference_ID@=30 | @AD_Reference_ID@=18 | @AD_Reference_ID@=21 | @AD_Reference_ID@=25 | @AD_Reference_ID@=31 | @AD_Reference_ID@=35 | @AD_Reference_ID@=33 | @AD_Reference_ID@=32 | @AD_Reference_ID@=53370', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:13:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202518
+;
+
+-- Jul 4, 2018 4:13:12 PM CEST
+UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=19 | @AD_Reference_ID@=30 | @AD_Reference_ID@=18 | @AD_Reference_ID@=21 | @AD_Reference_ID@=25 | @AD_Reference_ID@=31 | @AD_Reference_ID@=35 | @AD_Reference_ID@=33 | @AD_Reference_ID@=32 | @AD_Reference_ID@=53370', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-04 16:13:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202519
+;
+
+SELECT register_migration_script('201807041616_IDEMPIERE-3738.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201807111333_Ticket_AP2-357.sql b/migration/i5.1/postgresql/201807111333_Ticket_AP2-357.sql
new file mode 100644
index 0000000000..75cc9833d7
--- /dev/null
+++ b/migration/i5.1/postgresql/201807111333_Ticket_AP2-357.sql
@@ -0,0 +1,148 @@
+CREATE OR REPLACE FUNCTION adempiere.altercolumn(tablename name, columnname name, datatype name, nullclause character varying, defaultclause character varying, namespace name)
+ RETURNS void
+ LANGUAGE plpgsql
+AS $function$
+declare
+ command text;
+ viewtext text[];
+ viewname name[];
+ dropviews name[];
+ perms text[];
+ privs text;
+ i int;
+ j int;
+ v record;
+ sqltype text;
+ sqltype_short text;
+ typename name;
+begin
+ if datatype is not null then
+ select pg_type.typname, format_type(pg_type.oid, pg_attribute.atttypmod)
+ into typename, sqltype
+ from pg_class, pg_attribute, pg_type, pg_namespace
+ where relname = lower(tablename)
+ and relkind = 'r'
+ and pg_class.oid = pg_attribute.attrelid
+ and attname = lower(columnname)
+ and atttypid = pg_type.oid
+ and pg_class.relnamespace = pg_namespace.oid
+ and pg_namespace.nspname = lower(namespace);
+ sqltype_short := sqltype;
+ if typename = 'numeric' then
+ sqltype_short := replace(sqltype, ',0', '');
+ elsif strpos(sqltype,'character varying') = 1 then
+ sqltype_short := replace(sqltype, 'character varying', 'varchar');
+ elsif sqltype = 'timestamp without time zone' then
+ sqltype_short := 'timestamp';
+ end if;
+ if lower(datatype) <> sqltype and lower(datatype) <> sqltype_short then
+ i := 0;
+ for v in
+ with recursive depv(relname, viewoid, depth) as (
+ select distinct a.relname, a.oid, 1
+ from pg_class a, pg_depend b, pg_depend c, pg_class d, pg_attribute e, pg_namespace
+ where a.oid = b.refobjid
+ and b.objid = c.objid
+ and b.refobjid <> c.refobjid
+ and b.deptype = 'n'
+ and c.refobjid = d.oid
+ and d.relname = lower(tablename)
+ and d.relkind = 'r'
+ and d.oid = e.attrelid
+ and e.attname = lower(columnname)
+ and c.refobjsubid = e.attnum
+ and a.relkind = 'v'
+ and a.relnamespace = pg_namespace.oid
+ and pg_namespace.nspname = lower(namespace)
+ union all
+ select distinct dependee.relname, dependee.oid, depv.depth+1
+ from pg_depend
+ join pg_rewrite on pg_depend.objid = pg_rewrite.oid
+ join pg_class as dependee on pg_rewrite.ev_class = dependee.oid
+ join pg_class as dependent on pg_depend.refobjid = dependent.oid
+ join pg_attribute ON pg_depend.refobjid = pg_attribute.attrelid and pg_depend.refobjsubid = pg_attribute.attnum and pg_attribute.attnum > 0
+ join depv on dependent.relname = depv.relname
+ join pg_namespace on dependee.relnamespace = pg_namespace.oid
+ where pg_namespace.nspname = lower(namespace)
+ )
+ select relname, viewoid, max(depth) from depv group by relname, viewoid order by 3 desc
+ loop
+ raise notice 'view -> % %', v.relname, v.viewoid;
+ i := i + 1;
+ viewtext[i] := pg_get_viewdef(v.viewoid);
+ viewname[i] := v.relname;
+ end loop;
+ if i > 0 then
+ begin
+ for j in 1 .. i loop
+ SELECT String_agg('grant ' || privilege_type || ' on ' || viewname[j] || ' to ' || grantee, '; ')
+ into privs
+ FROM information_schema.role_table_grants
+ WHERE table_name=viewname[j];
+ perms[j] := privs;
+ command := 'drop view ' || viewname[j];
+ raise notice 'executing -> %', command;
+ execute command;
+ dropviews[j] := viewname[j];
+ end loop;
+ exception
+ when others then
+ i := array_upper(dropviews, 1);
+ if i > 0 then
+ for j in reverse i .. 1 loop
+ command := 'create or replace view ' || dropviews[j] || ' as ' || viewtext[j];
+ raise notice 'executing -> %', 'create view ' || dropviews[j];
+ execute command;
+ end loop;
+ end if;
+ raise exception 'Failed to recreate dependent view. SQLERRM=%', SQLERRM;
+ end;
+ end if;
+ command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' type ' || lower(datatype);
+ raise notice 'executing -> %', command;
+ execute command;
+ i := array_upper(dropviews, 1);
+ if i > 0 then
+ for j in reverse i .. 1 loop
+ command := 'create or replace view ' || dropviews[j] || ' as ' || viewtext[j];
+ raise notice 'executing -> %', 'create view ' || dropviews[j];
+ execute command;
+ command := perms[j];
+ raise notice 'executing -> %', 'grant ' || perms[j];
+ execute command;
+ end loop;
+ end if;
+ end if;
+ end if;
+
+ if defaultclause is not null then
+ if lower(defaultclause) = 'null' then
+ command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' drop default ';
+ else
+ if defaultclause ~ '.*[(].*[)].*' or lower(defaultclause) = 'current_timestamp' then
+ command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' set default ' || defaultclause;
+ else
+ command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' set default ''' || defaultclause || '''';
+ end if;
+ end if;
+ raise notice 'executing -> %', command;
+ execute command;
+ end if;
+
+ if nullclause is not null then
+ if lower(nullclause) = 'not null' then
+ command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' set not null';
+ raise notice 'executing -> %', command;
+ execute command;
+ elsif lower(nullclause) = 'null' then
+ command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' drop not null';
+ raise notice 'executing -> %', command;
+ execute command;
+ end if;
+ end if;
+end;
+$function$
+;
+
+SELECT register_migration_script('201807111333_Ticket_AP2-357.sql') FROM dual
+;
diff --git a/migration/i5.1/postgresql/201807111626_IDEMPIERE-1421.sql b/migration/i5.1/postgresql/201807111626_IDEMPIERE-1421.sql
new file mode 100644
index 0000000000..c8146664c5
--- /dev/null
+++ b/migration/i5.1/postgresql/201807111626_IDEMPIERE-1421.sql
@@ -0,0 +1,8 @@
+-- IDEMPIERE-1421 Tax Group field is enabled in the window Customer
+-- Jul 11, 2018 4:25:37 PM CEST
+UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-11 16:25:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62773
+;
+
+SELECT register_migration_script('201807111626_IDEMPIERE-1421.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201807161530_IDEMPIERE-3746.sql b/migration/i5.1/postgresql/201807161530_IDEMPIERE-3746.sql
new file mode 100644
index 0000000000..1cd787975b
--- /dev/null
+++ b/migration/i5.1/postgresql/201807161530_IDEMPIERE-3746.sql
@@ -0,0 +1,15 @@
+-- IDEMPIERE-3719 : Add display name when sending emails
+-- Jul 16, 2018 3:27:06 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-16 15:27:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11175
+;
+
+-- Jul 16, 2018 3:27:06 PM CEST
+UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-16 15:27:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201884
+;
+
+-- Jul 16, 2018 3:27:06 PM CEST
+UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-16 15:27:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5226
+;
+
+SELECT register_migration_script('201807161530_IDEMPIERE-3746.sql') FROM dual
+;
diff --git a/migration/i5.1/postgresql/201807232033_IDEMPIERE-3737.sql b/migration/i5.1/postgresql/201807232033_IDEMPIERE-3737.sql
new file mode 100644
index 0000000000..9ef9ceeb59
--- /dev/null
+++ b/migration/i5.1/postgresql/201807232033_IDEMPIERE-3737.sql
@@ -0,0 +1,16 @@
+-- I do not forgot to set the DICTIONARY_ID_COMMENTS System Configurator
+-- After a year , i get the answer for a very nice question from https://groups.google.com/d/msg/idempiere/gkrkQ7gEPBI/bw-C6JTdBQAJ
+
+-- Update User reference of AD_Reference for System system . If using Table Direct , System cannt got other clients' user_id lead to null replace in preference window.
+-- 2018-7-3 下午04时06分21秒
+UPDATE AD_Column SET AD_Reference_ID=30, AD_Reference_Value_ID=200145, FKConstraintType=NULL,Updated=TO_TIMESTAMP('2018-07-03 16:06:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1471
+;
+
+-- Implementing a tab sqlwhere to filter some useless preference value in other clients and display all data for system.
+-- 2018-7-3 下午04时06分38秒
+UPDATE AD_Tab SET WhereClause='AD_Preference.CreatedBy IN (SELECT AD_User_ID FROM AD_User WHERE AD_Client_ID = @#AD_Client_ID@) OR @#AD_Client_ID@ = 0',Updated=TO_TIMESTAMP('2018-07-03 16:06:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=156
+;
+
+SELECT register_migration_script('201807232033_IDEMPIERE-3737.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201807240936_IDEMPIERE-3757.sql b/migration/i5.1/postgresql/201807240936_IDEMPIERE-3757.sql
new file mode 100644
index 0000000000..427a6235d3
--- /dev/null
+++ b/migration/i5.1/postgresql/201807240936_IDEMPIERE-3757.sql
@@ -0,0 +1,12 @@
+-- IDEMPIERE-3757
+-- Jul 24, 2018 9:30:27 AM CEST
+UPDATE AD_Table SET AccessLevel='4',Updated=TO_TIMESTAMP('2018-07-24 09:30:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=116
+;
+
+DELETE FROM ad_window_access WHERE ad_window_id=105
+AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND userlevel NOT LIKE 'S%')
+;
+
+SELECT register_migration_script('201807240936_IDEMPIERE-3757.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201807271000_IDEMPIERE-3762.sql b/migration/i5.1/postgresql/201807271000_IDEMPIERE-3762.sql
new file mode 100644
index 0000000000..38ffc0168b
--- /dev/null
+++ b/migration/i5.1/postgresql/201807271000_IDEMPIERE-3762.sql
@@ -0,0 +1,11 @@
+-- IDEMPIERE-3762 : Fix AD_Column_ID / AD_Field_ID : Loader - Too many records
+-- Jul 26, 2018 10:06:34 AM CEST
+UPDATE AD_Field SET AD_Reference_ID=30,Updated=TO_TIMESTAMP('2018-07-26 10:06:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=4599
+;
+
+-- Jul 26, 2018 10:06:42 AM CEST
+UPDATE AD_Field SET AD_Reference_ID=30,Updated=TO_TIMESTAMP('2018-07-26 10:06:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=59576
+;
+
+SELECT register_migration_script('201807271000_IDEMPIERE-3762.sql') FROM dual
+;
diff --git a/migration/i5.1/postgresql/201808010900_IDEMPIERE-3769.sql b/migration/i5.1/postgresql/201808010900_IDEMPIERE-3769.sql
new file mode 100644
index 0000000000..80650157a4
--- /dev/null
+++ b/migration/i5.1/postgresql/201808010900_IDEMPIERE-3769.sql
@@ -0,0 +1,7 @@
+-- IDEMPIERE-3769 : IBAN : Invalid message is not translated - force to uppercase
+-- Aug 1, 2018 8:56:43 AM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','IBAN is invalid',0,0,'Y',TO_TIMESTAMP('2018-08-01 08:56:42','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2018-08-01 08:56:42','YYYY-MM-DD HH24:MI:SS'),0,200480,'InvalidIBAN','D','4cc792d9-9af0-4e37-b90a-7dcc9f5e82ec')
+;
+
+SELECT register_migration_script('201808010900_IDEMPIERE-3769.sql') FROM dual
+;
\ No newline at end of file
diff --git a/migration/i5.1/postgresql/201808071226_IDEMPIERE-2442.sql b/migration/i5.1/postgresql/201808071226_IDEMPIERE-2442.sql
new file mode 100644
index 0000000000..7b4334e166
--- /dev/null
+++ b/migration/i5.1/postgresql/201808071226_IDEMPIERE-2442.sql
@@ -0,0 +1,28 @@
+-- IDEMPIERE-2442 Always using default conversion type in Order & Invoice window's amount summary information
+-- Aug 7, 2018 12:22:32 PM CEST
+UPDATE AD_StatusLine SET SQLStatement='SELECT COUNT(DISTINCT C_OrderLine_ID) AS Lines,o.TotalLines,o.GrandTotal,c.ISO_Code,
+currencyConvert(o.GrandTotal,o.C_Currency_ID,ac.C_Currency_ID,o.DateAcct,o.C_ConversionType_ID,o.AD_Client_ID,o.AD_Org_ID) AS ConvAmt
+FROM C_Order o
+INNER JOIN C_Currency c ON (o.C_Currency_ID=c.C_Currency_ID)
+LEFT JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID)
+LEFT JOIN AD_ClientInfo ci ON (ci.AD_Client_ID=o.AD_Client_ID)
+LEFT JOIN C_AcctSchema ac ON (ci.C_AcctSchema1_ID=ac.C_AcctSchema_ID)
+WHERE o.C_Order_ID=@C_Order_ID@
+GROUP BY o.C_Currency_ID, ac.C_Currency_ID, o.C_ConversionType_ID, c.ISO_Code, o.TotalLines, o.GrandTotal, o.DateAcct, o.AD_Client_ID, o.AD_Org_ID',Updated=TO_TIMESTAMP('2018-08-07 12:22:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_StatusLine_ID=200000
+;
+
+-- Aug 7, 2018 12:25:27 PM CEST
+UPDATE AD_StatusLine SET SQLStatement='SELECT COUNT(DISTINCT C_InvoiceLine_ID) AS Lines,o.TotalLines,o.GrandTotal,c.ISO_Code,
+currencyConvert(o.GrandTotal,o.C_Currency_ID,ac.C_Currency_ID,o.DateAcct,o.C_ConversionType_ID,o.AD_Client_ID,o.AD_Org_ID) AS ConvAmt
+FROM C_Invoice o
+INNER JOIN C_Currency c ON (o.C_Currency_ID=c.C_Currency_ID)
+LEFT JOIN C_InvoiceLine l ON (o.C_Invoice_ID=l.C_Invoice_ID)
+LEFT JOIN AD_ClientInfo ci ON (ci.AD_Client_ID=o.AD_Client_ID)
+LEFT JOIN C_AcctSchema ac ON (ci.C_AcctSchema1_ID=ac.C_AcctSchema_ID)
+WHERE o.C_Invoice_ID=@C_Invoice_ID@
+GROUP BY o.C_Currency_ID, ac.C_Currency_ID, o.C_ConversionType_ID, c.ISO_Code, o.TotalLines, o.GrandTotal, o.DateAcct, o.AD_Client_ID, o.AD_Org_ID',Updated=TO_TIMESTAMP('2018-08-07 12:25:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_StatusLine_ID=200002
+;
+
+SELECT register_migration_script('201808071226_IDEMPIERE-2442.sql') FROM dual
+;
+
diff --git a/migration/i5.1z/oracle/201411190748_IDEMPIERE-2319.sql b/migration/i5.1z/oracle/201411190748_IDEMPIERE-2319.sql
new file mode 100644
index 0000000000..0fc7fde97f
--- /dev/null
+++ b/migration/i5.1z/oracle/201411190748_IDEMPIERE-2319.sql
@@ -0,0 +1,42 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- Nov 18, 2014 5:10:06 PM IST
+-- IDEMPIERE-2319: Adding date value type support in Attribute set
+INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType,Created,Updated) VALUES ('ValueDate',202805,'Value Date','Value Date','ba9c466b-4436-47ec-b193-5d3b5e9ce30a',0,100,100,'Y',0,'D',TO_DATE('2014-11-18 17:10:05','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-11-18 17:10:05','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 5:10:42 PM IST
+INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,Updated) VALUES (0,'N',0,211801,'N','N','N',0,'N',7,'N','N','N','Y','986f6b4a-a721-4fa3-a865-89416a9adb6e','Y','ValueDate','Value Date','Y',100,0,'Y',TO_DATE('2014-11-18 17:10:41','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',202805,15,561,TO_DATE('2014-11-18 17:10:41','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 5:10:50 PM IST
+ALTER TABLE M_AttributeInstance ADD ValueDate DATE DEFAULT NULL
+;
+
+-- Nov 18, 2014 3:37:28 PM IST
+INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,MandatoryLogic,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,Updated) VALUES (0,'N',0,211800,'N','N','N',0,'N',20,'N','N','N','Y','@AttributeValueType@=''D''','e5d9f3a8-5bc5-44ea-8bd0-4c00f54785c0','Y','DateFormat','Date format used in the input format','The date format is usually detected, but sometimes need to be defined.','Date Format','Y',100,0,'Y',TO_DATE('2014-11-18 15:37:27','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',2286,10,562,TO_DATE('2014-11-18 15:37:27','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 3:37:33 PM IST
+ALTER TABLE M_Attribute ADD DateFormat VARCHAR2(20) DEFAULT NULL
+;
+
+-- Nov 18, 2014 3:39:07 PM IST
+INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,Name,AD_Ref_List_UU,Value,CreatedBy,UpdatedBy,Created,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Updated) VALUES (200279,326,'Date','34c7fbc0-6718-433e-a55c-6d203496e06a','D',100,100,TO_DATE('2014-11-18 15:39:07','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_DATE('2014-11-18 15:39:07','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 3:41:05 PM IST
+UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2014-11-18 15:41:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211800
+;
+
+-- Nov 18, 2014 3:41:33 PM IST
+INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,Created,Updated) VALUES ('N',462,20,'N','N',100,'Y',203472,'N','The date format is usually detected, but sometimes need to be defined.','Date format used in the input format','Date Format','361e4d18-9ad0-4b74-b730-bc6620502b40','Y','N',100,0,100,'Y','Y',100,0,2,211800,'D',TO_DATE('2014-11-18 15:41:32','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-11-18 15:41:32','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 3:43:32 PM IST
+UPDATE AD_Field SET DisplayLogic='@AttributeValueType@=''D''', MandatoryLogic='@AttributeValueType@=''D''',Updated=TO_DATE('2014-11-18 15:43:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203472
+;
+
+SELECT register_migration_script('201411190748_IDEMPIERE-2319.sql') FROM dual
+;
diff --git a/migration/i5.1z/oracle/201507032015_IDEMPIERE-2709.sql b/migration/i5.1z/oracle/201507032015_IDEMPIERE-2709.sql
new file mode 100644
index 0000000000..c2b4acd210
--- /dev/null
+++ b/migration/i5.1z/oracle/201507032015_IDEMPIERE-2709.sql
@@ -0,0 +1,35 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-2709: Adding support for editable field on info window
+-- Jul 3, 2015 6:10:42 PM IST
+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,IsToolbarButton,IsSecure) VALUES (212216,0,'Read Only','Field is read only','The Read Only indicates that this field may only be Read. It may not be updated.',897,'IsReadOnly','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2015-07-03 18:10:41','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-07-03 18:10:41','YYYY-MM-DD HH24:MI:SS'),100,405,'Y','N','D','N','N','N','Y','3a94dcce-25f4-4382-9547-a8f18949bbe7','Y','N','N')
+;
+
+-- Jul 3, 2015 6:10:49 PM IST
+ALTER TABLE AD_InfoColumn ADD IsReadOnly CHAR(1) DEFAULT 'Y' CHECK (IsReadOnly IN ('Y','N')) NOT NULL
+;
+
+-- Jul 3, 2015 6:15:02 PM IST
+INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,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,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (203829,'Read Only','Field is read only','The Read Only indicates that this field may only be Read. It may not be updated.',844,212216,'Y',0,165,0,'N','N','N','N',0,0,'Y',TO_DATE('2015-07-03 18:14:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-07-03 18:14:59','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ebc3464e-96a2-447d-a846-b964ede1b66f','Y',170,1,1,1,'N','N','N')
+;
+
+-- Table: t_selection_infowindow
+
+-- DROP TABLE t_selection_infowindow;
+
+CREATE TABLE t_selection_infowindow
+(
+ ad_pinstance_id NUMBER(10,0) NOT NULL,
+ t_selection_id NUMBER(10,0) NOT NULL,
+ viewid VARCHAR2(30),
+ columnname VARCHAR2(255) NOT NULL,
+ value_string VARCHAR2(255),
+ value_date date,
+ value_number NUMBER,
+ info VARCHAR2(60),
+ CONSTRAINT t_selection_infowindow_key PRIMARY KEY (ad_pinstance_id, t_selection_id, columnname)
+);
+
+SELECT register_migration_script('201507032015_IDEMPIERE-2709.sql') FROM dual
+;
diff --git a/migration/i5.1z/oracle/201803261255_IDEMPIERE-3705.sql b/migration/i5.1z/oracle/201803261255_IDEMPIERE-3705.sql
new file mode 100644
index 0000000000..14e1c01780
--- /dev/null
+++ b/migration/i5.1z/oracle/201803261255_IDEMPIERE-3705.sql
@@ -0,0 +1,22 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- Mar 26, 2018 12:53:01 PM CEST
+-- IDEMPIERE-3705 Define customer or vendor by context when creating new BPs via QuickEntry
+UPDATE AD_Field SET AD_Val_Rule_ID=NULL, IsQuickEntry='Y', AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-03-26 12:53:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614
+;
+
+-- Mar 26, 2018 12:53:05 PM CEST
+UPDATE AD_Field SET AD_Val_Rule_ID=NULL, IsQuickEntry='Y', AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-03-26 12:53:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623
+;
+
+-- Mar 26, 2018 12:53:10 PM CEST
+UPDATE AD_Field SET DisplayLogic='@_QUICK_ENTRY_MODE_@!Y', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-03-26 12:53:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614
+;
+
+-- Mar 26, 2018 12:53:13 PM CEST
+UPDATE AD_Field SET DisplayLogic='@_QUICK_ENTRY_MODE_@!Y', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-03-26 12:53:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623
+;
+
+SELECT register_migration_script('201803261255_IDEMPIERE-3705.sql') FROM dual
+;
diff --git a/migration/i5.1z/oracle/201804162050_IDEMPIERE-3705.sql b/migration/i5.1z/oracle/201804162050_IDEMPIERE-3705.sql
new file mode 100644
index 0000000000..8585eaeab0
--- /dev/null
+++ b/migration/i5.1z/oracle/201804162050_IDEMPIERE-3705.sql
@@ -0,0 +1,14 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- Apr 16, 2018 8:50:16 PM CEST
+-- AP2-15 Define customer or vendor by context when creating new BPs via QuickEntry
+UPDATE AD_Menu SET IsSOTrx='Y',Updated=TO_DATE('2018-04-16 20:50:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=328
+;
+
+-- Apr 16, 2018 8:50:44 PM CEST
+UPDATE AD_Menu SET IsSOTrx='N',Updated=TO_DATE('2018-04-16 20:50:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=335
+;
+
+SELECT register_migration_script('201804162050_IDEMPIERE-3705.sql') FROM dual
+;
diff --git a/migration/i5.1z/oracle/201804242200_IDEMPIERE-3696.sql b/migration/i5.1z/oracle/201804242200_IDEMPIERE-3696.sql
new file mode 100644
index 0000000000..ee35cd1e07
--- /dev/null
+++ b/migration/i5.1z/oracle/201804242200_IDEMPIERE-3696.sql
@@ -0,0 +1,18 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3696 Implementing warning to encourage user to change their password before it is expired
+-- Apr 24, 2018 9:44:15 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Your password will expire in {0} days',0,0,'Y',TO_DATE('2018-04-24 21:44:15','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2018-04-24 21:44:15','YYYY-MM-DD HH24:MI:SS'),0,200453,'YourPasswordWillExpireInDays','D','85f74e09-67bf-4044-a276-a0bb07bb73f9')
+;
+
+-- Apr 24, 2018 9:44:22 PM CEST
+UPDATE AD_Message SET EntityType='D',Updated=TO_DATE('2018-04-24 21:44:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200453
+;
+
+-- Apr 24, 2018 9:44:44 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 (200117,0,0,TO_DATE('2018-04-24 21:44:44','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-04-24 21:44:44','YYYY-MM-DD HH24:MI:SS'),0,0,'Y','USER_LOCKING_PASSWORD_NOTIFY_DAY','0','Define a period (before password is expired) where a popup will appears to encourage user to change its password','D','S','92d15407-ddc2-4100-b2ae-bdccca3098d6')
+;
+
+SELECT register_migration_script('201804242200_IDEMPIERE-3696.sql') FROM dual
+;
diff --git a/migration/i5.1z/oracle/201806181810_IDEMPIERE-2709.sql b/migration/i5.1z/oracle/201806181810_IDEMPIERE-2709.sql
new file mode 100644
index 0000000000..4f2007a8b6
--- /dev/null
+++ b/migration/i5.1z/oracle/201806181810_IDEMPIERE-2709.sql
@@ -0,0 +1,54 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- InfoWindow selection editable fields
+-- 18-giu-2018 16.11.33 CEST
+INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203216,0,0,'Y',TO_DATE('2018-06-18 16:11:32','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-06-18 16:11:32','YYYY-MM-DD HH24:MI:SS'),100,'InputFieldValidation','Input field validation','Input field validaton query','Input field validaton query','Input field validation','D','b457c250-ced2-415f-aaae-9bc7e545cb01')
+;
+
+-- 18-giu-2018 16.12.33 CEST
+INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,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) VALUES (213525,0,'Input field validation','Input field validaton query','Input field validaton query',897,'InputFieldValidation',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_DATE('2018-06-18 16:12:33','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-06-18 16:12:33','YYYY-MM-DD HH24:MI:SS'),100,203216,'Y','N','D','N','N','N','Y','d0a5e559-7621-496c-9269-715b1040395b','Y',0,'N','N')
+;
+
+-- 18-giu-2018 16.12.49 CEST
+UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2018-06-18 16:12:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213525
+;
+
+-- 18-giu-2018 16.21.51 CEST
+INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,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,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205588,'Input field validation','Input field validaton query','Input field validaton query',844,213525,'Y',0,280,0,'N','N','N','N',0,0,'Y',TO_DATE('2018-06-18 16:21:50','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-06-18 16:21:50','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','26da27d1-b040-49dc-a3e6-ecd9f273636f','Y',190,1,1,1,'N','N','N')
+;
+
+-- 18-giu-2018 16.22.23 CEST
+UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-06-18 16:22:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205588
+;
+
+-- 18-giu-2018 16.24.44 CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=5, NumLines=3, IsToolbarButton=NULL,Updated=TO_DATE('2018-06-18 16:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205588
+;
+
+-- 18-giu-2018 16.25.24 CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsDisplayedGrid='N', IsToolbarButton=NULL,Updated=TO_DATE('2018-06-18 16:25:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205588
+;
+
+-- 18-giu-2018 16.26.02 CEST
+ALTER TABLE AD_InfoColumn ADD InputFieldValidation VARCHAR2(2000) DEFAULT NULL
+;
+
+-- 18-giu-2018 17.39.36 CEST
+UPDATE AD_Field SET DisplayLogic='@IsReadOnly@=N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-06-18 17:39:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205588
+;
+
+-- 18-giu-2018 18.00.13 CEST
+UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2018-06-18 18:00:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212216
+;
+
+-- 18-giu-2018 18.04.58 CEST
+UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_DATE('2018-06-18 18:04:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203829
+;
+
+-- 18-giu-2018 18.05.07 CEST
+UPDATE AD_Column SET Help='Input field validaton query. If this query returns at least a row, an error will be displayed and the new value will be refused. The query can use all the fields in row as context fields (using the usual @...@ syntax). The error messages is composed appending the first column of every rows of the result, and its then translated, so the message can contains traslatable parts in the form @@ and/or @@',Updated=TO_DATE('2018-06-18 18:05:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213525
+;
+
+SELECT register_migration_script('201806181810_IDEMPIERE-2709.sql') FROM dual
+;
diff --git a/migration/i5.1z/oracle/201807232133_IDEMPIERE-2310.sql b/migration/i5.1z/oracle/201807232133_IDEMPIERE-2310.sql
new file mode 100644
index 0000000000..36149fd1c3
--- /dev/null
+++ b/migration/i5.1z/oracle/201807232133_IDEMPIERE-2310.sql
@@ -0,0 +1,56 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-2310 Improve description field with inline Html editor and html rendering
+-- Mar 30, 2017 2:02:53 AM ICT
+INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,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,FKConstraintType) VALUES (213622,0,'HTML','Text has HTML tags',101,'IsHtml','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_DATE('2017-03-30 02:02:53','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-03-30 02:02:53','YYYY-MM-DD HH24:MI:SS'),100,1510,'Y','N','D','Y','N','N','Y','351dd31d-d9ba-45bf-b53e-63931a60b4b1','Y',0,'N','N','N')
+;
+
+-- Mar 30, 2017 2:03:03 AM ICT
+ALTER TABLE AD_Column ADD IsHtml CHAR(1) DEFAULT 'N' CHECK (IsHtml IN ('Y','N'))
+;
+
+
+-- Mar 30, 2017 3:17:09 AM ICT
+INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,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,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205668,'HTML','Text has HTML tags',101,213622,'Y',0,480,0,'N','N','N','N',0,0,'Y',TO_DATE('2017-03-30 03:17:09','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-03-30 03:17:09','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','2d929e3b-4bad-4001-8af2-b1b6572f190b','Y',450,1,1,1,'N','N','N')
+;
+
+-- Mar 30, 2017 3:18:45 AM ICT
+UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=34|@AD_Reference_ID@=10|@AD_Reference_ID@=14|@AD_Reference_ID@=36', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-03-30 03:18:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205668
+;
+
+-- Mar 30, 2017 3:19:21 AM ICT
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=135, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_DATE('2017-03-30 03:19:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205668
+;
+
+CREATE OR REPLACE VIEW ad_field_v AS
+ SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(f.placeholder, c.placeholder) AS placeholder, c.ishtml
+ FROM ad_field f
+ JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
+ LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
+ LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
+ JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
+ LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
+ WHERE f.isactive = 'Y' AND c.isactive = 'Y'
+;
+
+CREATE OR REPLACE VIEW ad_field_vt AS
+ SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue, c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid, f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(trl.placeholder, ct.placeholder) AS placeholder, c.ishtml
+ FROM ad_field f
+ JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
+ JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
+ LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
+ LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language = fgt.ad_language
+ LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
+ LEFT JOIN ad_column_trl ct ON f.ad_column_id = ct.ad_column_id AND trl.ad_language = ct.ad_language
+ JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
+ LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
+ WHERE f.isactive = 'Y' AND c.isactive = 'Y'
+;
+
+-- Jul 24, 2018 1:02:40 AM CEST
+UPDATE AD_Column SET FieldLength=0, IsHtml='Y',Updated=TO_DATE('2018-07-24 01:02:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10012
+;
+
+SELECT register_migration_script('201807232133_IDEMPIERE-2310.sql') FROM dual
+;
diff --git a/migration/i5.1z/oracle/201807251833_IDEMPIERE-3760.sql b/migration/i5.1z/oracle/201807251833_IDEMPIERE-3760.sql
new file mode 100644
index 0000000000..8ec5204bdc
--- /dev/null
+++ b/migration/i5.1z/oracle/201807251833_IDEMPIERE-3760.sql
@@ -0,0 +1,173 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3760 Implement Virtual UI Column
+-- Jul 25, 2018 6:02:03 PM CEST
+UPDATE AD_Column SET FieldLength=4000,Updated=TO_DATE('2018-07-25 18:02:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13448
+;
+
+-- Jul 25, 2018 6:02:05 PM CEST
+ALTER TABLE AD_Column MODIFY ColumnSQL VARCHAR2(4000) DEFAULT NULL
+;
+
+-- Jul 25, 2018 6:02:36 PM CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=2, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:02:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11264
+;
+
+-- Jul 25, 2018 6:05:35 PM CEST
+UPDATE AD_Field SET Help='You can define virtual columns (not stored in the database). If defined, the Column name is the synonym of the SQL expression defined here. The SQL expression must be valid.
+Example: "Updated-Created" would list the age of the entry in days.
+You can also use the syntax @SQL= to define a UI virtual column - this is calculated on the fly and can use context variables in the query, virtual UI columns are not searchable, and they are not shown in reports.', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:05:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11264
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=170
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=172
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=158
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205668
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56279
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56374
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=310
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2526
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=220, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59619
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204220
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=171
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2574
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2573
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=161
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=162
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202518
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202519
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=160
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=166
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2370
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10128
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5122
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=169
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4941
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50188
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=168
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=159
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=410, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4940
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=420, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200288
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=430, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56317
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=440, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62467
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=450, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202257
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=460, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200648
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=470, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=167
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=480, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=825
+;
+
+-- Jul 25, 2018 6:29:46 PM CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:29:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=160
+;
+
+-- Jul 25, 2018 6:29:56 PM CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-07-25 18:29:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4941
+;
+
+SELECT register_migration_script('201807251833_IDEMPIERE-3760.sql') FROM dual
+;
+
diff --git a/migration/i5.1z/postgresql/201411190748_IDEMPIERE-2319.sql b/migration/i5.1z/postgresql/201411190748_IDEMPIERE-2319.sql
new file mode 100644
index 0000000000..e1dd7662d4
--- /dev/null
+++ b/migration/i5.1z/postgresql/201411190748_IDEMPIERE-2319.sql
@@ -0,0 +1,39 @@
+-- Nov 18, 2014 5:10:06 PM IST
+-- IDEMPIERE-2319: Adding date value type support in Attribute set
+INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType,Created,Updated) VALUES ('ValueDate',202805,'Value Date','Value Date','ba9c466b-4436-47ec-b193-5d3b5e9ce30a',0,100,100,'Y',0,'D',TO_TIMESTAMP('2014-11-18 17:10:05','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-11-18 17:10:05','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 5:10:42 PM IST
+INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,Updated) VALUES (0,'N',0,211801,'N','N','N',0,'N',7,'N','N','N','Y','986f6b4a-a721-4fa3-a865-89416a9adb6e','Y','ValueDate','Value Date','Y',100,0,'Y',TO_TIMESTAMP('2014-11-18 17:10:41','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',202805,15,561,TO_TIMESTAMP('2014-11-18 17:10:41','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 5:10:50 PM IST
+ALTER TABLE M_AttributeInstance ADD COLUMN ValueDate TIMESTAMP DEFAULT NULL
+;
+
+-- Nov 18, 2014 3:37:28 PM IST
+INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,MandatoryLogic,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Reference_ID,AD_Table_ID,Updated) VALUES (0,'N',0,211800,'N','N','N',0,'N',20,'N','N','N','Y','@AttributeValueType@=''D''','e5d9f3a8-5bc5-44ea-8bd0-4c00f54785c0','Y','DateFormat','Date format used in the input format','The date format is usually detected, but sometimes need to be defined.','Date Format','Y',100,0,'Y',TO_TIMESTAMP('2014-11-18 15:37:27','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',2286,10,562,TO_TIMESTAMP('2014-11-18 15:37:27','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 3:37:33 PM IST
+ALTER TABLE M_Attribute ADD COLUMN DateFormat VARCHAR(20) DEFAULT NULL
+;
+
+-- Nov 18, 2014 3:39:07 PM IST
+INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,Name,AD_Ref_List_UU,Value,CreatedBy,UpdatedBy,Created,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Updated) VALUES (200279,326,'Date','34c7fbc0-6718-433e-a55c-6d203496e06a','D',100,100,TO_TIMESTAMP('2014-11-18 15:39:07','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_TIMESTAMP('2014-11-18 15:39:07','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 3:41:05 PM IST
+UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2014-11-18 15:41:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=211800
+;
+
+-- Nov 18, 2014 3:41:33 PM IST
+INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,AD_Client_ID,ColumnSpan,AD_Column_ID,EntityType,Created,Updated) VALUES ('N',462,20,'N','N',100,'Y',203472,'N','The date format is usually detected, but sometimes need to be defined.','Date format used in the input format','Date Format','361e4d18-9ad0-4b74-b730-bc6620502b40','Y','N',100,0,100,'Y','Y',100,0,2,211800,'D',TO_TIMESTAMP('2014-11-18 15:41:32','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-11-18 15:41:32','YYYY-MM-DD HH24:MI:SS'))
+;
+
+-- Nov 18, 2014 3:43:32 PM IST
+UPDATE AD_Field SET DisplayLogic='@AttributeValueType@=''D''', MandatoryLogic='@AttributeValueType@=''D''',Updated=TO_TIMESTAMP('2014-11-18 15:43:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203472
+;
+
+SELECT register_migration_script('201411190748_IDEMPIERE-2319.sql') FROM dual
+;
diff --git a/migration/i5.1z/postgresql/201507032015_IDEMPIERE-2709.sql b/migration/i5.1z/postgresql/201507032015_IDEMPIERE-2709.sql
new file mode 100644
index 0000000000..66dcf4ddf5
--- /dev/null
+++ b/migration/i5.1z/postgresql/201507032015_IDEMPIERE-2709.sql
@@ -0,0 +1,32 @@
+-- IDEMPIERE-2709: Adding support for editable field on info window
+-- Jul 3, 2015 6:10:42 PM IST
+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,IsToolbarButton,IsSecure) VALUES (212216,0,'Read Only','Field is read only','The Read Only indicates that this field may only be Read. It may not be updated.',897,'IsReadOnly','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2015-07-03 18:10:41','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-07-03 18:10:41','YYYY-MM-DD HH24:MI:SS'),100,405,'Y','N','D','N','N','N','Y','3a94dcce-25f4-4382-9547-a8f18949bbe7','Y','N','N')
+;
+
+-- Jul 3, 2015 6:10:49 PM IST
+ALTER TABLE AD_InfoColumn ADD COLUMN IsReadOnly CHAR(1) DEFAULT 'Y' CHECK (IsReadOnly IN ('Y','N')) NOT NULL
+;
+
+-- Jul 3, 2015 6:15:02 PM IST
+INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,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,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (203829,'Read Only','Field is read only','The Read Only indicates that this field may only be Read. It may not be updated.',844,212216,'Y',0,165,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-07-03 18:14:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-07-03 18:14:59','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','ebc3464e-96a2-447d-a846-b964ede1b66f','Y',170,1,1,1,'N','N','N')
+;
+
+-- Table: t_selection_infowindow
+
+-- DROP TABLE t_selection_infowindow;
+
+CREATE TABLE t_selection_infowindow
+(
+ ad_pinstance_id numeric(10) NOT NULL,
+ t_selection_id numeric(10) NOT NULL,
+ viewid varchar(30),
+ columnname varchar(255) NOT NULL,
+ value_string varchar(255),
+ value_date timestamp,
+ value_number numeric,
+ info varchar(60),
+ CONSTRAINT t_selection_infowindow_key PRIMARY KEY (ad_pinstance_id, t_selection_id, columnname)
+);
+
+SELECT register_migration_script('201507032015_IDEMPIERE-2709.sql') FROM dual
+;
diff --git a/migration/i5.1z/postgresql/201803261255_IDEMPIERE-3705.sql b/migration/i5.1z/postgresql/201803261255_IDEMPIERE-3705.sql
new file mode 100644
index 0000000000..5969e5cc75
--- /dev/null
+++ b/migration/i5.1z/postgresql/201803261255_IDEMPIERE-3705.sql
@@ -0,0 +1,19 @@
+-- Mar 26, 2018 12:53:01 PM CEST
+-- IDEMPIERE-3705 Define customer or vendor by context when creating new BPs via QuickEntry
+UPDATE AD_Field SET AD_Val_Rule_ID=NULL, IsQuickEntry='Y', AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-03-26 12:53:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614
+;
+
+-- Mar 26, 2018 12:53:05 PM CEST
+UPDATE AD_Field SET AD_Val_Rule_ID=NULL, IsQuickEntry='Y', AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-03-26 12:53:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623
+;
+
+-- Mar 26, 2018 12:53:10 PM CEST
+UPDATE AD_Field SET DisplayLogic='@_QUICK_ENTRY_MODE_@!Y', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-03-26 12:53:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614
+;
+
+-- Mar 26, 2018 12:53:13 PM CEST
+UPDATE AD_Field SET DisplayLogic='@_QUICK_ENTRY_MODE_@!Y', AD_Val_Rule_ID=NULL, AD_Reference_Value_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-03-26 12:53:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623
+;
+
+SELECT register_migration_script('201803261255_IDEMPIERE-3705.sql') FROM dual
+;
diff --git a/migration/i5.1z/postgresql/201804162050_IDEMPIERE-3705.sql b/migration/i5.1z/postgresql/201804162050_IDEMPIERE-3705.sql
new file mode 100644
index 0000000000..93eb709698
--- /dev/null
+++ b/migration/i5.1z/postgresql/201804162050_IDEMPIERE-3705.sql
@@ -0,0 +1,11 @@
+-- Apr 16, 2018 8:50:16 PM CEST
+-- IDEMPIERE-3705 Define customer or vendor by context when creating new BPs via QuickEntry
+UPDATE AD_Menu SET IsSOTrx='Y',Updated=TO_TIMESTAMP('2018-04-16 20:50:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=328
+;
+
+-- Apr 16, 2018 8:50:44 PM CEST
+UPDATE AD_Menu SET IsSOTrx='N',Updated=TO_TIMESTAMP('2018-04-16 20:50:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=335
+;
+
+SELECT register_migration_script('201804162050_IDEMPIERE-3705.sql') FROM dual
+;
diff --git a/migration/i5.1z/postgresql/201804242200_IDEMPIERE-3696.sql b/migration/i5.1z/postgresql/201804242200_IDEMPIERE-3696.sql
new file mode 100644
index 0000000000..ad545dd894
--- /dev/null
+++ b/migration/i5.1z/postgresql/201804242200_IDEMPIERE-3696.sql
@@ -0,0 +1,15 @@
+-- IDEMPIERE-3696 Implementing warning to encourage user to change their password before it is expired
+-- Apr 24, 2018 9:44:15 PM CEST
+INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Your password will expire in {0} days',0,0,'Y',TO_TIMESTAMP('2018-04-24 21:44:15','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2018-04-24 21:44:15','YYYY-MM-DD HH24:MI:SS'),0,200453,'YourPasswordWillExpireInDays','D','85f74e09-67bf-4044-a276-a0bb07bb73f9')
+;
+
+-- Apr 24, 2018 9:44:22 PM CEST
+UPDATE AD_Message SET EntityType='D',Updated=TO_TIMESTAMP('2018-04-24 21:44:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=200453
+;
+
+-- Apr 24, 2018 9:44:44 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 (200117,0,0,TO_TIMESTAMP('2018-04-24 21:44:44','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-04-24 21:44:44','YYYY-MM-DD HH24:MI:SS'),0,0,'Y','USER_LOCKING_PASSWORD_NOTIFY_DAY','0','Define a period (before password is expired) where a popup will appears to encourage user to change its password','D','S','92d15407-ddc2-4100-b2ae-bdccca3098d6')
+;
+
+SELECT register_migration_script('201804242200_IDEMPIERE-3696.sql') FROM dual
+;
diff --git a/migration/i5.1z/postgresql/201806181810_IDEMPIERE-2709.sql b/migration/i5.1z/postgresql/201806181810_IDEMPIERE-2709.sql
new file mode 100644
index 0000000000..6a43444496
--- /dev/null
+++ b/migration/i5.1z/postgresql/201806181810_IDEMPIERE-2709.sql
@@ -0,0 +1,51 @@
+-- InfoWindow selection editable fields
+-- 18-giu-2018 16.11.33 CEST
+INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203216,0,0,'Y',TO_TIMESTAMP('2018-06-18 16:11:32','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-06-18 16:11:32','YYYY-MM-DD HH24:MI:SS'),100,'InputFieldValidation','Input field validation','Input field validaton query','Input field validaton query','Input field validation','D','b457c250-ced2-415f-aaae-9bc7e545cb01')
+;
+
+-- 18-giu-2018 16.12.33 CEST
+INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,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) VALUES (213525,0,'Input field validation','Input field validaton query','Input field validaton query',897,'InputFieldValidation',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_TIMESTAMP('2018-06-18 16:12:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-06-18 16:12:33','YYYY-MM-DD HH24:MI:SS'),100,203216,'Y','N','D','N','N','N','Y','d0a5e559-7621-496c-9269-715b1040395b','Y',0,'N','N')
+;
+
+-- 18-giu-2018 16.12.49 CEST
+UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2018-06-18 16:12:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213525
+;
+
+-- 18-giu-2018 16.21.51 CEST
+INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,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,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205588,'Input field validation','Input field validaton query','Input field validaton query',844,213525,'Y',0,280,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2018-06-18 16:21:50','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-06-18 16:21:50','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','26da27d1-b040-49dc-a3e6-ecd9f273636f','Y',190,1,1,1,'N','N','N')
+;
+
+-- 18-giu-2018 16.22.23 CEST
+UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-06-18 16:22:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205588
+;
+
+-- 18-giu-2018 16.24.44 CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=5, NumLines=3, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-06-18 16:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205588
+;
+
+-- 18-giu-2018 16.25.24 CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsDisplayedGrid='N', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-06-18 16:25:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205588
+;
+
+-- 18-giu-2018 16.26.02 CEST
+ALTER TABLE AD_InfoColumn ADD COLUMN InputFieldValidation VARCHAR(2000) DEFAULT NULL
+;
+
+-- 18-giu-2018 17.39.36 CEST
+UPDATE AD_Field SET DisplayLogic='@IsReadOnly@=N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-06-18 17:39:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205588
+;
+
+-- 18-giu-2018 18.00.13 CEST
+UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2018-06-18 18:00:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=212216
+;
+
+-- 18-giu-2018 18.04.58 CEST
+UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-06-18 18:04:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203829
+;
+
+-- 18-giu-2018 18.05.07 CEST
+UPDATE AD_Column SET Help='Input field validaton query. If this query returns at least a row, an error will be displayed and the new value will be refused. The query can use all the fields in row as context fields (using the usual @...@ syntax). The error messages is composed appending the first column of every rows of the result, and its then translated, so the message can contains traslatable parts in the form @@ and/or @@',Updated=TO_TIMESTAMP('2018-06-18 18:05:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213525
+;
+
+SELECT register_migration_script('201806181810_IDEMPIERE-2709.sql') FROM dual
+;
diff --git a/migration/i5.1z/postgresql/201807232133_IDEMPIERE-2310.sql b/migration/i5.1z/postgresql/201807232133_IDEMPIERE-2310.sql
new file mode 100644
index 0000000000..391420d4a2
--- /dev/null
+++ b/migration/i5.1z/postgresql/201807232133_IDEMPIERE-2310.sql
@@ -0,0 +1,68 @@
+-- IDEMPIERE-2310 Improve description field with inline Html editor and html rendering
+-- Mar 30, 2017 2:02:53 AM ICT
+INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,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,FKConstraintType) VALUES (213622,0,'HTML','Text has HTML tags',101,'IsHtml','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2017-03-30 02:02:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-03-30 02:02:53','YYYY-MM-DD HH24:MI:SS'),100,1510,'Y','N','D','Y','N','N','Y','351dd31d-d9ba-45bf-b53e-63931a60b4b1','Y',0,'N','N','N')
+;
+
+-- Mar 30, 2017 2:03:03 AM ICT
+ALTER TABLE AD_Column ADD COLUMN IsHtml CHAR(1) DEFAULT 'N' CHECK (IsHtml IN ('Y','N'))
+;
+
+
+-- Mar 30, 2017 3:17:09 AM ICT
+INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,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,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205668,'HTML','Text has HTML tags',101,213622,'Y',0,480,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-03-30 03:17:09','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-03-30 03:17:09','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','2d929e3b-4bad-4001-8af2-b1b6572f190b','Y',450,1,1,1,'N','N','N')
+;
+
+-- Mar 30, 2017 3:18:45 AM ICT
+UPDATE AD_Field SET DisplayLogic='@AD_Reference_ID@=34|@AD_Reference_ID@=10|@AD_Reference_ID@=14|@AD_Reference_ID@=36', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-03-30 03:18:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205668
+;
+
+-- Mar 30, 2017 3:19:21 AM ICT
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=135, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-03-30 03:19:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205668
+;
+
+CREATE OR REPLACE VIEW ad_field_v AS
+ SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline,
+f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
+c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
+c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable, c.isalwaysupdateable) AS isalwaysupdateable,
+COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
+c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype,
+fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid,
+f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus,
+c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(f.placeholder, c.placeholder) AS placeholder, c.ishtml
+ FROM ad_field f
+ JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
+ LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
+ LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
+ JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
+ LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
+ WHERE f.isactive = 'Y' AND c.isactive = 'Y'
+;
+
+CREATE OR REPLACE VIEW ad_field_vt AS
+ SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno,
+ f.sortno, f.issameline, f.isheading, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, COALESCE(f.VFormat, c.VFormat) AS VFormat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
+ c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated, COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
+ c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id, COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, COALESCE(f.isalwaysupdateable,
+ c.isalwaysupdateable) AS isalwaysupdateable, COALESCE(f.readonlylogic, c.readonlylogic) AS readonlylogic, COALESCE(f.mandatorylogic, c.mandatorylogic) AS mandatorylogic, COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
+ c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype,
+ fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete, COALESCE(f.isallowcopy, c.isallowcopy) AS isallowcopy, f.isdisplayedgrid,
+ f.seqnogrid, c.seqnoselection, f.xposition, f.columnspan, f.numlines, COALESCE(f.istoolbarbutton, c.istoolbarbutton) AS istoolbarbutton, c.formatpattern, f.isadvancedfield, f.isdefaultfocus, c.ad_chart_id, f.ad_labelstyle_id, f.ad_fieldstyle_id, c.pa_dashboardcontent_id, COALESCE(trl.placeholder, ct.placeholder) AS placeholder, c.ishtml
+ FROM ad_field f
+ JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
+ JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
+ LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
+ LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language::text = fgt.ad_language::text
+ LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
+ LEFT JOIN ad_column_trl ct ON f.ad_column_id = ct.ad_column_id AND trl.ad_language::text = ct.ad_language::text
+ JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
+ LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
+ WHERE f.isactive = 'Y' AND c.isactive = 'Y'
+;
+
+-- Jul 24, 2018 1:02:40 AM CEST
+UPDATE AD_Column SET FieldLength=0, IsHtml='Y',Updated=TO_TIMESTAMP('2018-07-24 01:02:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10012
+;
+
+SELECT register_migration_script('201807232133_IDEMPIERE-2310.sql') FROM dual
+;
diff --git a/migration/i5.1z/postgresql/201807251833_IDEMPIERE-3760.sql b/migration/i5.1z/postgresql/201807251833_IDEMPIERE-3760.sql
new file mode 100644
index 0000000000..514875e705
--- /dev/null
+++ b/migration/i5.1z/postgresql/201807251833_IDEMPIERE-3760.sql
@@ -0,0 +1,170 @@
+-- IDEMPIERE-3760 Implement Virtual UI Column
+-- Jul 25, 2018 6:02:03 PM CEST
+UPDATE AD_Column SET FieldLength=4000,Updated=TO_TIMESTAMP('2018-07-25 18:02:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13448
+;
+
+-- Jul 25, 2018 6:02:05 PM CEST
+INSERT INTO t_alter_column values('ad_column','ColumnSQL','VARCHAR(4000)',null,'NULL')
+;
+
+-- Jul 25, 2018 6:02:36 PM CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:02:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11264
+;
+
+-- Jul 25, 2018 6:05:35 PM CEST
+UPDATE AD_Field SET Help='You can define virtual columns (not stored in the database). If defined, the Column name is the synonym of the SQL expression defined here. The SQL expression must be valid.
+Example: "Updated-Created" would list the age of the entry in days.
+You can also use the syntax @SQL= to define a UI virtual column - this is calculated on the fly and can use context variables in the query, virtual UI columns are not searchable, and they are not shown in reports.', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:05:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11264
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=170
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=172
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=158
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205668
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56279
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56374
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=310
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2526
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=220, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59619
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204220
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=171
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2574
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2573
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=161
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=162
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202518
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202519
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=160
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=166
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2370
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10128
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5122
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=169
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4941
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50188
+;
+
+-- Jul 25, 2018 6:28:27 PM CEST
+UPDATE AD_Field SET SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=168
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=159
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=410, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4940
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=420, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200288
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=430, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56317
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=440, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62467
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=450, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202257
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET IsDisplayed='Y', SeqNo=460, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200648
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=470, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=167
+;
+
+-- Jul 25, 2018 6:28:28 PM CEST
+UPDATE AD_Field SET SeqNo=480, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:28:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=825
+;
+
+-- Jul 25, 2018 6:29:46 PM CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:29:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=160
+;
+
+-- Jul 25, 2018 6:29:56 PM CEST
+UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-07-25 18:29:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4941
+;
+
+SELECT register_migration_script('201807251833_IDEMPIERE-3760.sql') FROM dual
+;
+
diff --git a/org.adempiere.base-feature/feature.xml b/org.adempiere.base-feature/feature.xml
index 9d844df915..2e1ae03e5f 100644
--- a/org.adempiere.base-feature/feature.xml
+++ b/org.adempiere.base-feature/feature.xml
@@ -387,7 +387,7 @@
unpack="false"/>
-
+
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/META-INF/MANIFEST.MF b/org.adempiere.base.callout/META-INF/MANIFEST.MF
index 0b46c1dfb7..3fec665a66 100644
--- a/org.adempiere.base.callout/META-INF/MANIFEST.MF
+++ b/org.adempiere.base.callout/META-INF/MANIFEST.MF
@@ -6,7 +6,7 @@ Bundle-Version: 5.1.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.adempiere.base;bundle-version="0.0.0"
Eclipse-RegisterBuddy: org.adempiere.base
-Service-Component: OSGI-INF/costadjustmentcalloutfactory.xml
+Service-Component: OSGI-INF/costadjustmentcalloutfactory.xml, OSGI-INF/bpartnerquickentrycalloutFactory.xml
Bundle-ActivationPolicy: lazy
Export-Package: org.compiere.model
Bundle-ClassPath: .
diff --git a/org.adempiere.base.callout/OSGI-INF/bpartnerquickentrycalloutFactory.xml b/org.adempiere.base.callout/OSGI-INF/bpartnerquickentrycalloutFactory.xml
new file mode 100644
index 0000000000..91c9d02b1b
--- /dev/null
+++ b/org.adempiere.base.callout/OSGI-INF/bpartnerquickentrycalloutFactory.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/org.adempiere.base.callout/src/org/adempiere/base/callout/BPartnerCalloutFactory.java b/org.adempiere.base.callout/src/org/adempiere/base/callout/BPartnerCalloutFactory.java
new file mode 100644
index 0000000000..e49e88f217
--- /dev/null
+++ b/org.adempiere.base.callout/src/org/adempiere/base/callout/BPartnerCalloutFactory.java
@@ -0,0 +1,30 @@
+/******************************************************************************
+ * Copyright (C) 2013 Diego Ruiz *
+ * Copyright (C) 2013 Trek Global *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.adempiere.base.callout;
+
+import org.adempiere.base.IColumnCallout;
+import org.adempiere.base.IColumnCalloutFactory;
+import org.adempiere.model.CalloutBPartnerQuickEntry;
+import org.compiere.model.MBPartner;
+
+public class BPartnerCalloutFactory implements IColumnCalloutFactory {
+
+ @Override
+ public IColumnCallout[] getColumnCallouts(String tableName, String columnName) {
+ if (tableName.equalsIgnoreCase(MBPartner.Table_Name)) {
+ return new IColumnCallout[]{new CalloutBPartnerQuickEntry()};
+ }
+ return null;
+ }
+}
diff --git a/org.adempiere.base.callout/src/org/adempiere/model/CalloutBPartnerQuickEntry.java b/org.adempiere.base.callout/src/org/adempiere/model/CalloutBPartnerQuickEntry.java
new file mode 100644
index 0000000000..7e990cb629
--- /dev/null
+++ b/org.adempiere.base.callout/src/org/adempiere/model/CalloutBPartnerQuickEntry.java
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * Copyright (C) 2013 Diego Ruiz *
+ * Copyright (C) 2013 Trek Global *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.adempiere.model;
+
+import java.util.Properties;
+
+import org.adempiere.base.IColumnCallout;
+import org.compiere.model.GridField;
+import org.compiere.model.GridTab;
+import org.compiere.model.MBPartner;
+import org.compiere.util.Env;
+import org.compiere.util.Util;
+
+public class CalloutBPartnerQuickEntry implements IColumnCallout {
+
+ @Override
+ public String start(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
+ // this callout is just for quick entry window
+ if ("Y".equals(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_MODE_"))) {
+ int parent_windowNo = Integer.parseInt(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_CALLER_WINDOW_"));
+
+ String docSOTrx = Env.getContext(ctx, parent_windowNo, "IsSOTrx", false);
+
+ if (!Util.isEmpty(docSOTrx)) {
+ boolean isSOTrx = "Y".equals(docSOTrx);
+ mTab.setValue(MBPartner.COLUMNNAME_IsCustomer, isSOTrx);
+ mTab.setValue(MBPartner.COLUMNNAME_IsVendor, !isSOTrx);
+ }
+ }
+ return null;
+ }
+
+}
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..63a68e61fc 100644
--- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java
+++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java
@@ -453,8 +453,6 @@ public class CalloutOrder extends CalloutEngine
*/
public String bPartnerBill (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
- if (isCalloutActive())
- return "";
Integer bill_BPartner_ID = (Integer)value;
if (bill_BPartner_ID == null || bill_BPartner_ID.intValue() == 0)
return "";
@@ -651,58 +649,31 @@ public class CalloutOrder extends CalloutEngine
Integer M_PriceList_ID = (Integer) mTab.getValue("M_PriceList_ID");
if (M_PriceList_ID == null || M_PriceList_ID.intValue()== 0)
return "";
- if (steps) log.warning("init");
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- String sql = "SELECT pl.IsTaxIncluded,pl.EnforcePriceLimit,pl.C_Currency_ID,c.StdPrecision,"
- + "plv.M_PriceList_Version_ID,plv.ValidFrom "
- + "FROM M_PriceList pl,C_Currency c,M_PriceList_Version plv "
- + "WHERE pl.C_Currency_ID=c.C_Currency_ID"
- + " AND pl.M_PriceList_ID=plv.M_PriceList_ID"
- + " AND pl.M_PriceList_ID=? " // 1
- + " AND plv.ValidFrom <= ? "
- + "ORDER BY plv.ValidFrom DESC";
- // Use newest price list - may not be future
- try
- {
- pstmt = DB.prepareStatement(sql, null);
- pstmt.setInt(1, M_PriceList_ID.intValue());
- Timestamp date = new Timestamp(System.currentTimeMillis());
+
+ MPriceList pl = MPriceList.get(ctx, M_PriceList_ID, null);
+ if (pl != null && pl.getM_PriceList_ID() == M_PriceList_ID) {
+ if (!readonly) {
+ // Tax Included
+ mTab.setValue("IsTaxIncluded", pl.isTaxIncluded());
+ // Currency
+ mTab.setValue("C_Currency_ID", pl.getC_Currency_ID());
+ }
+ // Price Limit Enforce
+ Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pl.isEnforcePriceLimit());
+
+ // PriceList Version
+ Timestamp date = null;
if (mTab.getAD_Table_ID() == I_C_Order.Table_ID)
date = Env.getContextAsDate(ctx, WindowNo, "DateOrdered");
else if (mTab.getAD_Table_ID() == I_C_Invoice.Table_ID)
date = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced");
- pstmt.setTimestamp(2, date);
-
- rs = pstmt.executeQuery();
- if (rs.next())
- {
- // Tax Included
- if (!readonly) {
- mTab.setValue("IsTaxIncluded", new Boolean("Y".equals(rs.getString(1))));
- }
- // Price Limit Enforce
- Env.setContext(ctx, WindowNo, "EnforcePriceLimit", rs.getString(2));
- // Currency
- if (!readonly) {
- Integer ii = new Integer(rs.getInt(3));
- mTab.setValue("C_Currency_ID", ii);
- }
- // PriceList Version
- Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", rs.getInt(5));
+ MPriceListVersion plv = pl.getPriceListVersion(date);
+ if (plv != null && plv.getM_PriceList_Version_ID() > 0) {
+ Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", plv.getM_PriceList_Version_ID());
+ } else {
+ Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", (String) null);
}
}
- catch (SQLException e)
- {
- log.log(Level.SEVERE, sql, e);
- return e.getLocalizedMessage();
- }
- finally
- {
- DB.close(rs, pstmt);
- rs = null; pstmt = null;
- }
- if (steps) log.warning("fini");
return "";
} // priceListFill
@@ -779,13 +750,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 +1051,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 +1387,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.process/src/org/compiere/process/ExpenseAPInvoice.java b/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java
index be286a8349..55b6ebb36b 100644
--- a/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java
+++ b/org.adempiere.base.process/src/org/compiere/process/ExpenseAPInvoice.java
@@ -25,6 +25,7 @@ import org.compiere.model.MBPartner;
import org.compiere.model.MDocType;
import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
+import org.compiere.model.MPriceList;
import org.compiere.model.MTimeExpense;
import org.compiere.model.MTimeExpenseLine;
import org.compiere.util.DB;
@@ -136,6 +137,10 @@ public class ExpenseAPInvoice extends SvrProcess
break;
}
invoice.setM_PriceList_ID(te.getM_PriceList_ID());
+
+ MPriceList pl = MPriceList.get(getCtx(), te.getM_PriceList_ID(), get_TrxName());
+ invoice.setIsTaxIncluded(pl.isTaxIncluded());
+
invoice.setSalesRep_ID(te.getDoc_User_ID());
StringBuilder descr = new StringBuilder().append(Msg.translate(getCtx(), "S_TimeExpense_ID"))
.append(": ").append(te.getDocumentNo()).append(" " )
@@ -182,6 +187,7 @@ public class ExpenseAPInvoice extends SvrProcess
//
// il.setPrice(); // not really a list/limit price for reimbursements
il.setPrice(line.getPriceReimbursed()); //
+
il.setTax();
if (!il.save())
throw new IllegalStateException("Cannot save Invoice Line");
diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java b/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java
index efd6608de1..9da59775f0 100644
--- a/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java
+++ b/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java
@@ -655,7 +655,7 @@ public class ImportInvoice extends SvrProcess
int lineNo = 0;
while (rs.next ())
{
- X_I_Invoice imp = new X_I_Invoice (getCtx (), rs, null);
+ X_I_Invoice imp = new X_I_Invoice (getCtx (), rs, get_TrxName());
String cmpDocumentNo = imp.getDocumentNo();
if (cmpDocumentNo == null)
cmpDocumentNo = "";
@@ -680,7 +680,7 @@ public class ImportInvoice extends SvrProcess
if (oldDocumentNo == null)
oldDocumentNo = "";
//
- invoice = new MInvoice (getCtx(), 0, null);
+ invoice = new MInvoice (getCtx(), 0, get_TrxName());
invoice.setClientOrg (imp.getAD_Client_ID(), imp.getAD_Org_ID());
invoice.setC_DocTypeTarget_ID(imp.getC_DocType_ID());
invoice.setIsSOTrx(imp.isSOTrx());
diff --git a/org.adempiere.base.process/src/org/idempiere/process/InvoiceCreateCreditMemo.java b/org.adempiere.base.process/src/org/idempiere/process/InvoiceCreateCreditMemo.java
new file mode 100644
index 0000000000..6654076b90
--- /dev/null
+++ b/org.adempiere.base.process/src/org/idempiere/process/InvoiceCreateCreditMemo.java
@@ -0,0 +1,222 @@
+/***********************************************************************
+ * This file is part of iDempiere ERP Open Source *
+ * http://www.idempiere.org *
+ * *
+ * Copyright (C) Contributors *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301, USA. *
+ * *
+ * Contributors: *
+ * - Carlos Ruiz *
+ **********************************************************************/
+package org.idempiere.process;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.logging.Level;
+
+import org.adempiere.exceptions.AdempiereException;
+import org.compiere.model.MAllocationHdr;
+import org.compiere.model.MAllocationLine;
+import org.compiere.model.MDocType;
+import org.compiere.model.MInvoice;
+import org.compiere.model.MInvoiceLine;
+import org.compiere.model.MPeriod;
+import org.compiere.process.DocAction;
+import org.compiere.process.ProcessInfoParameter;
+import org.compiere.process.SvrProcess;
+import org.compiere.util.DB;
+import org.compiere.util.Env;
+import org.compiere.util.Msg;
+
+/**
+ * IDEMPIERE-918 Generate credit memo from invoice
+ * @author Carlos Ruiz - globalqss
+ */
+public class InvoiceCreateCreditMemo extends SvrProcess {
+ /* The document type for the credit memo */
+ private int p_C_DocType_ID = 0;
+ /* Invoice Date */
+ private Timestamp p_DateInvoiced = null;
+ /* Accounting Date */
+ private Timestamp p_DateAcct = null;
+ /* Document Action */
+ private String p_DocAction = null;
+ /* Create allocation between the invoice and the credit memo */
+ private boolean p_IsCreateAllocation = false;
+ /* The invoice being credited */
+ private MInvoice invoice = null;
+
+ /**
+ * Prepare - e.g., get Parameters.
+ */
+ protected void prepare() {
+ for (ProcessInfoParameter para : getParameter()) {
+ String name = para.getParameterName();
+ switch (name) {
+ case "C_DocType_ID":
+ p_C_DocType_ID = para.getParameterAsInt();
+ break;
+ case "DateInvoiced":
+ p_DateInvoiced = para.getParameterAsTimestamp();
+ break;
+ case "DateAcct":
+ p_DateAcct = para.getParameterAsTimestamp();
+ break;
+ case "DocAction":
+ p_DocAction = para.getParameterAsString();
+ break;
+ case "IsCreateAllocation":
+ p_IsCreateAllocation = para.getParameterAsBoolean();
+ break;
+ default:
+ log.log(Level.SEVERE, "Unknown Parameter: " + name);
+ }
+ }
+ invoice = new MInvoice(getCtx(), getRecord_ID(), get_TrxName());
+ } // prepare
+
+ /**
+ * Perform process.
+ * @return Message
+ * @throws Exception
+ */
+ protected String doIt() throws Exception {
+ if (log.isLoggable(Level.INFO)) log.info("C_Invoice_ID" + invoice.getC_Invoice_ID() + ", C_DocType_ID=" + p_C_DocType_ID + ", DateInvoiced=" + p_DateInvoiced
+ + ", DateAcct=" + p_DateAcct + ", DocAction=" + p_DocAction);
+
+ if (p_IsCreateAllocation) {
+ // validate - cannot create allocation if the invoice is already paid or partially paid
+ MAllocationHdr[] allocs = MAllocationHdr.getOfInvoice(getCtx(), invoice.getC_Invoice_ID(), get_TrxName());
+ if (allocs.length > 0) {
+ throw new AdempiereException(Msg.getMsg(getCtx(), "InvoiceHasAllocations"));
+ }
+ }
+ // validate just for invoices, not for credit memos
+ if (invoice.isCreditMemo()) {
+ throw new AdempiereException(Msg.getMsg(getCtx(), "CannotCreateCreditMemoFromCreditMemo"));
+ }
+ // Validate if there is already another credit memo for this invoice (via POReference)
+ final String sql = ""
+ + "SELECT C_Invoice_ID "
+ + "FROM C_Invoice i "
+ + " JOIN C_DocType dt ON ( i.C_DocType_ID = dt.C_DocType_ID ) "
+ + "WHERE i.POReference = ? "
+ + " AND dt.DocBaseType IN ( ?, ? ) "
+ + " AND i.C_BPartner_ID = ? "
+ + " AND i.AD_Client_ID = ? "
+ + " AND i.AD_Org_ID = ?";
+ int id = DB.getSQLValue(get_TrxName(), sql,
+ invoice.getDocumentNo(),
+ MDocType.DOCBASETYPE_APCreditMemo, MDocType.DOCBASETYPE_ARCreditMemo,
+ invoice.getC_BPartner_ID(),
+ invoice.getAD_Client_ID(), invoice.getAD_Org_ID());
+ if (id > 0) {
+ MInvoice actualCreditMemo = MInvoice.get(getCtx(), id);
+ MDocType dtc = MDocType.get(getCtx(), actualCreditMemo.getC_DocTypeTarget_ID());
+ addLog(0, null, null, dtc.getName() + " " + actualCreditMemo.getDocumentNo(), MInvoice.Table_ID, actualCreditMemo.getC_Invoice_ID());
+ throw new AdempiereException(Msg.getMsg(getCtx(), "CreditMemoAlreadyExists"));
+ }
+
+ MInvoice creditMemo = credit();
+ if (creditMemo != null) {
+ MDocType dtc = MDocType.get(getCtx(), creditMemo.getC_DocTypeTarget_ID());
+ addLog(0, null, null, dtc.getName() + " " + creditMemo.getDocumentNo(), MInvoice.Table_ID, creditMemo.getC_Invoice_ID());
+ }
+
+ return "@OK@";
+ } // doIt
+
+ private MInvoice credit() {
+ Timestamp creditDate = p_DateAcct;
+ Timestamp creditDateInvoiced = p_DateInvoiced;
+ MPeriod.testPeriodOpen(getCtx(), creditDate, p_C_DocType_ID, invoice.getAD_Org_ID());
+
+ // Deep Copy
+ MInvoice creditMemo = null;
+ creditMemo = MInvoice.copyFrom(invoice, creditDateInvoiced, creditDate, p_C_DocType_ID, invoice.isSOTrx(), false, get_TrxName(), true);
+ if (creditMemo == null) {
+ throw new AdempiereException("Could not create Credit Memo");
+ }
+
+ // Reverse Line Qty
+ MInvoiceLine[] oLines = invoice.getLines(false);
+ MInvoiceLine[] rLines = creditMemo.getLines(true);
+ if (oLines.length != rLines.length) {
+ throw new AdempiereException("Credit Memo created with different number of lines than invoice");
+ }
+ for (int i = 0; i < rLines.length; i++) {
+ MInvoiceLine rLine = rLines[i];
+ MInvoiceLine oLine = oLines[i];
+ rLine.setQtyEntered(oLine.getQtyEntered());
+ rLine.setQtyInvoiced(oLine.getQtyInvoiced());
+ rLine.setLineNetAmt(oLine.getLineNetAmt());
+ rLine.setTaxAmt(oLine.getTaxAmt());
+ rLine.setLineTotalAmt(oLine.getLineTotalAmt());
+ rLine.setPriceActual(oLine.getPriceActual());
+ rLine.setPriceList(oLine.getPriceList());
+ rLine.setPriceLimit(oLine.getPriceLimit());
+ rLine.setPriceEntered(oLine.getPriceEntered());
+ rLine.setC_UOM_ID(oLine.getC_UOM_ID());
+ if (!rLine.save(get_TrxName())) {
+ throw new AdempiereException("Could not create credit memo line");
+ }
+ }
+ if (MInvoice.PAYMENTRULE_Cash.equals(creditMemo.getPaymentRule())) {
+ creditMemo.setPaymentRule(MInvoice.PAYMENTRULE_OnCredit); // avoid creation of automatic payment
+ }
+ creditMemo.setC_Order_ID(invoice.getC_Order_ID());
+ StringBuilder msgadd = new StringBuilder("{->").append(invoice.getDocumentNo()).append(")");
+ creditMemo.addDescription(msgadd.toString());
+ creditMemo.setPOReference(invoice.getDocumentNo());
+ creditMemo.saveEx(get_TrxName());
+ //
+ if (p_DocAction != null) {
+ if (!creditMemo.processIt(p_DocAction)) {
+ throw new AdempiereException("ERROR processing credit memo " + p_DocAction + " -> " + creditMemo.getProcessMsg());
+ }
+ if (p_IsCreateAllocation && DocAction.ACTION_Complete.equals(p_DocAction)) {
+ // Create Allocation
+ StringBuilder msgall = new StringBuilder().append(Msg.translate(getCtx(), "C_Invoice_ID")).append(": ").append(invoice.getDocumentNo()).append("/").append(creditMemo.getDocumentNo());
+ MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, creditDate,
+ invoice.getC_Currency_ID(),
+ msgall.toString(),
+ get_TrxName());
+ alloc.setAD_Org_ID(invoice.getAD_Org_ID());
+ alloc.saveEx();
+ // Amount
+ BigDecimal gt = invoice.getGrandTotal(true);
+ if (!invoice.isSOTrx())
+ gt = gt.negate();
+ // Invoice Line
+ MAllocationLine aLine = new MAllocationLine (alloc, gt, Env.ZERO, Env.ZERO, Env.ZERO);
+ aLine.setC_Invoice_ID(invoice.getC_Invoice_ID());
+ aLine.saveEx();
+ // Credit Line
+ MAllocationLine cLine = new MAllocationLine (alloc, gt.negate(), Env.ZERO, Env.ZERO, Env.ZERO);
+ cLine.setC_Invoice_ID(creditMemo.getC_Invoice_ID());
+ cLine.saveEx();
+ if (!alloc.processIt(DocAction.ACTION_Complete))
+ throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg());
+ // end added
+ alloc.saveEx();
+ }
+ }
+
+ return creditMemo;
+ }
+
+} // InvoiceCreateCreditMemo
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 3e39c0f8a5..db5d908eb9 100644
--- a/org.adempiere.base/src/org/adempiere/impexp/AbstractExcelExporter.java
+++ b/org.adempiere.base/src/org/adempiere/impexp/AbstractExcelExporter.java
@@ -19,6 +19,7 @@ import java.io.OutputStream;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.NumberFormat;
+import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Properties;
import java.util.logging.Level;
@@ -34,6 +35,7 @@ import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.compiere.model.MSysConfig;
import org.compiere.util.CLogger;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
@@ -339,9 +341,20 @@ public abstract class AbstractExcelExporter
// Sheet Footer
HSSFFooter footer = sheet.getFooter();
footer.setLeft(Env.getStandardReportFooterTrademarkText());
- footer.setCenter(Env.getHeader(getCtx(), 0));
+
+ String s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_MSG, "", Env.getAD_Client_ID(Env.getCtx()));
+ 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());
- footer.setRight(DisplayType.getDateFormat(DisplayType.DateTime, getLanguage()).format(now));
+ s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_DATETIME_FORMAT, Env.getAD_Client_ID(Env.getCtx()));
+ if (!Util.isEmpty(s, true))
+ footer.setRight(new SimpleDateFormat(s).format(System.currentTimeMillis()));
+ else
+ footer.setRight(DisplayType.getDateFormat(DisplayType.DateTime, getLanguage()).format(now));
+
}
protected void formatPage(HSSFSheet sheet)
diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java
index 524d44bd43..81193e7a82 100644
--- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java
+++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java
@@ -52,8 +52,10 @@ import org.compiere.model.MLocation;
import org.compiere.model.MProcess;
import org.compiere.model.MQuery;
import org.compiere.model.MRefList;
+import org.compiere.model.MRefTable;
import org.compiere.model.MTable;
import org.compiere.model.PO;
+import org.compiere.model.Query;
import org.compiere.process.ProcessInfo;
import org.compiere.tools.FileUtil;
import org.compiere.util.CLogger;
@@ -63,6 +65,7 @@ import org.compiere.util.Env;
import org.compiere.util.Language;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
+import org.compiere.util.Util;
import org.compiere.util.ValueNamePair;
import org.compiere.wf.MWFProcess;
import org.supercsv.cellprocessor.Optional;
@@ -962,7 +965,7 @@ public class GridTabCSVImporter implements IGridTabImporter
if("AD_Ref_List".equals(foreignTable))
idS= resolveForeignList(column,foreignColumn,value,null);
else
- id = resolveForeign(foreignTable,foreignColumn,value,null);
+ id = resolveForeign(foreignTable,foreignColumn,value,field,null);
if(idS == null && id < 0){
//it could be that record still doesn't exist if import mode is inserting or merging
@@ -1025,7 +1028,7 @@ public class GridTabCSVImporter implements IGridTabImporter
if(isForeing && !"(null)".equals(value)){
String foreignTable = columnName.substring(0,columnName.length()-3);
- int id = resolveForeign(foreignTable,foreignColumn,value,null);
+ int id = resolveForeign(foreignTable,foreignColumn,value,field,null);
if (id < 0)
return new StringBuilder(Msg.getMsg(Env.getCtx(), id==-2?"ForeignMultipleResolved":"ForeignNotResolved" ,new Object[]{header.get(j),value}));
}
@@ -1075,11 +1078,11 @@ public class GridTabCSVImporter implements IGridTabImporter
address = new MLocation (Env.getCtx(),C_Location_ID,trx.getTrxName());
}
}
-
+ GridField field = gridTab.getField(columnName);
if(!"(null)".equals(value.toString().trim())){
if(isForeing) {
String foreignTable = columnName.substring(0,columnName.length()-3);
- setValue = resolveForeign(foreignTable,foreignColumn,value,trx);
+ setValue = resolveForeign(foreignTable,foreignColumn,value,field,trx);
if("C_City".equals(foreignTable))
address.setCity(value.toString());
}else
@@ -1125,7 +1128,7 @@ public class GridTabCSVImporter implements IGridTabImporter
if ("AD_Ref_List".equals(foreignTable))
idS= resolveForeignList(column, foreignColumn, value,trx);
else
- id = resolveForeign(foreignTable,foreignColumn,value,trx);
+ id = resolveForeign(foreignTable,foreignColumn,value, field, trx);
if(idS == null && id < 0)
return Msg.getMsg(Env.getCtx(),id==-2?"ForeignMultipleResolved":"ForeignNotResolved",new Object[]{header.get(i),value});
@@ -1169,7 +1172,7 @@ public class GridTabCSVImporter implements IGridTabImporter
isThereRow =true;
} else {
- int id = resolveForeign(foreignTable, foreignColumn, value,trx);
+ int id = resolveForeign(foreignTable, foreignColumn, value,field,trx);
if (id < 0)
return Msg.getMsg(Env.getCtx(),id==-2?"ForeignMultipleResolved":"ForeignNotResolved",new Object[]{header.get(i),value});
@@ -1276,8 +1279,9 @@ public class GridTabCSVImporter implements IGridTabImporter
if(isForeing)
foreignColumn = columnName.substring(columnName.indexOf("[")+1,columnName.indexOf("]"));
- columnName = getColumnName(false,isForeing,true,columnName);
- MColumn column = MColumn.get(Env.getCtx(),gridTab.getField(columnName).getAD_Column_ID());
+ columnName = getColumnName(false,isForeing,true,columnName);
+ GridField field = gridTab.getField(columnName);
+ MColumn column = MColumn.get(Env.getCtx(),field.getAD_Column_ID());
if (isForeing){
String foreignTable = column.getReferenceTableName();
if ("AD_Ref_List".equals(foreignTable)) {
@@ -1287,7 +1291,7 @@ public class GridTabCSVImporter implements IGridTabImporter
setValue = idS;
} else {
- int id = resolveForeign(foreignTable, foreignColumn, setValue,trx);
+ int id = resolveForeign(foreignTable, foreignColumn, setValue, field, trx);
if (id < 0)
return Msg.getMsg(Env.getCtx(),id==-2?"ForeignMultipleResolved":"ForeignNotResolved",new Object[]{columnName,setValue});
@@ -1371,7 +1375,7 @@ public class GridTabCSVImporter implements IGridTabImporter
String idS = resolveForeignList(column, foreignColumn, tmpValue,trx);
setValue = idS;
}else {
- int id = resolveForeign(foreignTable, foreignColumn, tmpValue,trx);
+ int id = resolveForeign(foreignTable, foreignColumn, tmpValue,field,trx);
setValue = id;
}
}else{
@@ -1400,7 +1404,8 @@ public class GridTabCSVImporter implements IGridTabImporter
if(columnName!=null){
boolean isForeing = columnName.indexOf("[") > 0 && columnName.indexOf("]")>0;
columnwithKey = getColumnName(false,isForeing,true,columnName);
- MColumn column = MColumn.get(Env.getCtx(),gridTab.getField(columnwithKey).getAD_Column_ID());
+ GridField field = gridTab.getField(columnwithKey);
+ MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID());
String foreignColumn = null;
if(isForeing){
foreignColumn = columnName.substring(columnName.indexOf("[")+1,columnName.indexOf("]"));
@@ -1409,7 +1414,7 @@ public class GridTabCSVImporter implements IGridTabImporter
String idS = resolveForeignList(column,foreignColumn,value,trx);
value = idS;
}else {
- int id = resolveForeign(foreignTable,foreignColumn,value,trx);
+ int id = resolveForeign(foreignTable,foreignColumn,value,field,trx);
value = id;
}
}
@@ -1462,7 +1467,7 @@ public class GridTabCSVImporter implements IGridTabImporter
return idS;
}
- private int resolveForeign(String foreignTable, String foreignColumn, Object value,Trx trx) {
+ private int resolveForeign(String foreignTable, String foreignColumn, Object value, GridField field, Trx trx) {
boolean systemAccess = false;
if (!"AD_Client".equals(foreignTable)) {
MTable ft = MTable.get(Env.getCtx(), foreignTable);
@@ -1480,7 +1485,32 @@ public class GridTabCSVImporter implements IGridTabImporter
StringBuilder postSelect = new StringBuilder(" FROM ")
.append(foreignTable).append(" WHERE ")
.append(foreignColumn).append("=? AND IsActive='Y' AND AD_Client_ID=?");
-
+ if (field != null ) {
+ if (!Util.isEmpty(field.getVO().ValidationCode)) {
+ String dynamicValid = Env.parseContext(Env.getCtx(), field.getWindowNo(), field.getGridTab().getTabNo(), field.getVO().ValidationCode, false);
+ if (Util.isEmpty(dynamicValid)) {
+ return 0;// it's parse error but simple consider like ForeignNotResolved
+ }else {
+ postSelect.append(" AND (").append(dynamicValid).append(")");
+ }
+ }
+ int ref = field.getVO().displayType;
+ int refval = field.getVO().AD_Reference_Value_ID;
+ if (refval > 0 && (ref == DisplayType.Table || ref == DisplayType.Search)) {
+ final MRefTable refTable = new Query(Env.getCtx(), MRefTable.Table_Name, "AD_Reference_ID=?", trxName)
+ .setParameters(refval)
+ .firstOnly();
+ String whereClause = refTable.getWhereClause();
+ if (!Util.isEmpty(whereClause)) {
+ String dynamicValid = Env.parseContext(Env.getCtx(), field.getWindowNo(), field.getGridTab().getTabNo(), whereClause, false);
+ if (Util.isEmpty(dynamicValid)) {
+ return 0;// it's parse error but simple consider like ForeignNotResolved
+ }else {
+ postSelect.append(" AND (").append(dynamicValid).append(")");
+ }
+ }
+ }
+ }
StringBuilder selectCount = new StringBuilder("SELECT COUNT(*)").append(postSelect);
StringBuilder selectId = new StringBuilder("SELECT ").append(foreignTable).append("_ID").append(postSelect);
int count = DB.getSQLValueEx(trxName, selectCount.toString(), value, thisClientId);
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_AllocationHdr.java b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java
index a82746bc1a..6780f17807 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java
@@ -19,7 +19,8 @@ package org.compiere.acct;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import java.util.ArrayList;
+import java.util.ArrayList;
+import java.util.List;
import java.util.logging.Level;
import org.compiere.model.MAccount;
@@ -28,7 +29,8 @@ import org.compiere.model.MAcctSchemaElement;
import org.compiere.model.MAllocationHdr;
import org.compiere.model.MAllocationLine;
import org.compiere.model.MCashLine;
-import org.compiere.model.MConversionRate;
+import org.compiere.model.MConversionRate;
+import org.compiere.model.MCurrency;
import org.compiere.model.MFactAcct;
import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
@@ -197,6 +199,7 @@ public class Doc_AllocationHdr extends Doc
FactLine fl = null;
FactLine flForRGL = null;
MAccount bpAcct = null; // Liability/Receivables
+ MAccount payAcct = null; // Payment Selection
//
MPayment payment = null;
if (line.getC_Payment_ID() != 0)
@@ -258,8 +261,9 @@ public class Doc_AllocationHdr extends Doc
// Payment/Cash DR
if (line.getC_Payment_ID() != 0)
- {
- fl = fact.createLine (line, getPaymentAcct(as, line.getC_Payment_ID()),
+ {
+ payAcct = getPaymentAcct(as, line.getC_Payment_ID());
+ fl = fact.createLine (line, payAcct,
getC_Currency_ID(), line.getAmtSource(), null);
if (fl != null && payment != null)
fl.setAD_Org_ID(payment.getAD_Org_ID());
@@ -388,8 +392,9 @@ public class Doc_AllocationHdr extends Doc
}
// Payment/Cash CR
if (isUsingClearing && line.getC_Payment_ID() != 0) // Avoid usage of clearing accounts
- {
- fl = fact.createLine (line, getPaymentAcct(as, line.getC_Payment_ID()),
+ {
+ payAcct = getPaymentAcct(as, line.getC_Payment_ID());
+ fl = fact.createLine (line, payAcct,
getC_Currency_ID(), null, line.getAmtSource().negate());
if (fl != null && payment != null)
fl.setAD_Org_ID(payment.getAD_Org_ID());
@@ -430,7 +435,7 @@ public class Doc_AllocationHdr extends Doc
&& (getC_Currency_ID() != as.getC_Currency_ID() // payment allocation in foreign currency
|| getC_Currency_ID() != line.getInvoiceC_Currency_ID())) // allocation <> invoice currency
{
- p_Error = createRealizedGainLoss (line, as, fact, bpAcct, invoice,
+ p_Error = createRealizedGainLoss (line, as, fact, bpAcct, invoice, payAcct, payment,
allocationSource, allocationAccounted);
if (p_Error != null)
return null;
@@ -692,102 +697,164 @@ public class Doc_AllocationHdr extends Doc
* Accounted Amount of the Allocation
* @param as accounting schema
* @param fact fact
- * @param acct account
+ * @param invAcct invoice account
* @param invoice invoice
+ * @param payAcct payment account
+ * @param payment payment
* @param allocationSource source amt
* @param allocationAccounted acct amt
* @return Error Message or null if OK
*/
- private String createRealizedGainLoss (DocLine line, MAcctSchema as, Fact fact, MAccount acct,
- MInvoice invoice, BigDecimal allocationSource, BigDecimal allocationAccounted)
+ private String createRealizedGainLoss (DocLine line, MAcctSchema as, Fact fact, MAccount invAcct,
+ MInvoice invoice, MAccount payAcct, MPayment payment, BigDecimal allocationSource, BigDecimal allocationAccounted)
{
BigDecimal invoiceSource = null;
BigDecimal invoiceAccounted = null;
+ BigDecimal paymentSource = null;
+ BigDecimal paymentAccounted = null;
//
- StringBuilder sql = new StringBuilder("SELECT ")
- .append(invoice.isSOTrx()
- ? "SUM(AmtSourceDr), SUM(AmtAcctDr)" // so
- : "SUM(AmtSourceCr), SUM(AmtAcctCr)") // po
+ StringBuilder sql = new StringBuilder()
+ .append("SELECT SUM(AmtSourceDr), SUM(AmtAcctDr), SUM(AmtSourceCr), SUM(AmtAcctCr)")
.append(" FROM Fact_Acct ")
- .append("WHERE AD_Table_ID=318 AND Record_ID=?") // Invoice
+ .append("WHERE AD_Table_ID=? AND Record_ID=?")
.append(" AND C_AcctSchema_ID=?")
- .append(" AND PostingType='A'");
- //AND C_Currency_ID=102
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- try
- {
- pstmt = DB.prepareStatement(sql.toString(), getTrxName());
- pstmt.setInt(1, invoice.getC_Invoice_ID());
- pstmt.setInt(2, as.getC_AcctSchema_ID());
- rs = pstmt.executeQuery();
- if (rs.next())
- {
- invoiceSource = rs.getBigDecimal(1);
- invoiceAccounted = rs.getBigDecimal(2);
- }
- }
- catch (Exception e)
- {
- log.log(Level.SEVERE, sql.toString(), e);
- }
- finally {
- DB.close(rs, pstmt);
- rs = null; pstmt = null;
+ .append(" AND PostingType='A'");
+
+ // For Invoice
+ List
");
+
+ m_AD_Process_UU = rs.getString(6);
}
}
catch (SQLException e)
@@ -301,6 +304,7 @@ public class ProcessModalDialog extends CDialog
// Move from APanel.actionButton
m_pi = new ProcessInfo(m_Name, m_AD_Process_ID, m_tableId, m_recordId);
+ m_pi.setAD_Process_UU(m_AD_Process_UU);
m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi);
diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java
index c0e9f6a1d3..7135fb4829 100644
--- a/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java
+++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VPaySelect.java
@@ -49,6 +49,8 @@ import org.compiere.grid.ed.VComboBox;
import org.compiere.grid.ed.VDate;
import org.compiere.minigrid.MiniTable;
import static org.compiere.model.SystemIDs.*;
+
+import org.compiere.model.MProcess;
import org.compiere.model.X_C_PaySelection;
import org.compiere.plaf.CompiereColor;
import org.compiere.process.ProcessInfo;
@@ -373,6 +375,7 @@ public class VPaySelect extends PaySelect implements FormPanel, ActionListener,
X_C_PaySelection.Table_ID, m_ps.getC_PaySelection_ID());
pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
+ pi.setAD_Process_UU(new MProcess(Env.getCtx(), AD_Proces_ID, null).getAD_Process_UU());
ProcessParameterPanel pp = new ProcessParameterPanel(m_WindowNo, pi);
// Execute Process
diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/search/Find.java b/org.adempiere.ui.swing/src/org/compiere/apps/search/Find.java
index 50688e2cf5..212f02edc6 100644
--- a/org.adempiere.ui.swing/src/org/compiere/apps/search/Find.java
+++ b/org.adempiere.ui.swing/src/org/compiere/apps/search/Find.java
@@ -1054,6 +1054,8 @@ public final class Find extends CDialog
// globalqss - Carlos Ruiz - 20060711
// fix a bug with virtualColumn + isSelectionColumn not yielding results
GridField field = getTargetMField(ColumnName.toString());
+ if (field.isVirtualUIColumn())
+ continue;
boolean isProductCategoryField = isProductCategoryField(field.getAD_Column_ID());
StringBuilder ColumnSQL = new StringBuilder().append(field.getColumnSQL(false));
//
@@ -1159,7 +1161,7 @@ public final class Find extends CDialog
String infoName = column.toString();
//
GridField field = getTargetMField(ColumnName.toString());
- if (field == null)
+ if (field == null || field.isVirtualUIColumn())
continue;
boolean isProductCategoryField = isProductCategoryField(field.getAD_Column_ID());
String ColumnSQL = field.getColumnSQL(false);
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.swing/src/org/compiere/apps/search/InfoGeneral.java b/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoGeneral.java
index 0465d310c1..6f2571bcbe 100644
--- a/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoGeneral.java
+++ b/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoGeneral.java
@@ -256,6 +256,8 @@ public class InfoGeneral extends Info
{
m_queryColumns.add(rs.getString(1));
String columnSql = rs.getString(4);
+ if (columnSql != null && columnSql.length() > 0 && columnSql.contains("@"))
+ columnSql = "NULL";
if (columnSql != null && columnSql.contains("@"))
columnSql = Env.parseContext(Env.getCtx(), -1, columnSql, false, true);
if (columnSql != null && columnSql.length() > 0)
@@ -327,6 +329,8 @@ public class InfoGeneral extends Info
int AD_Reference_Value_ID = rs.getInt(5);
// teo_sarca
String columnSql = rs.getString(6);
+ if (columnSql != null && columnSql.length() > 0 && columnSql.contains("@"))
+ columnSql = "NULL";
if (columnSql != null && columnSql.contains("@"))
columnSql = Env.parseContext(Env.getCtx(), -1, columnSql, false, true);
if (columnSql == null || columnSql.length() == 0)
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/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java
index 66c5887ae0..6c76294bd3 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java
@@ -699,8 +699,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
.append(mTab.getTableName());
if (where.length() > 0)
sql.append(" WHERE ").append(where);
- // Does not consider security
- int no = DB.getSQLValue(null, sql.toString());
+ String finalSQL = MRole.getDefault().addAccessSQL(sql.toString(),
+ mTab.getTableName(), MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
+ int no = DB.getSQLValue(null, finalSQL.toString());
//
require = MRole.getDefault().isQueryRequire(no);
}
@@ -806,7 +807,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
@Override
public void onCallback(Boolean result) {
if (result) {
- adTabbox.getSelectedGridTab().navigate(0);
+ adTabbox.getSelectedGridTab().navigate(-1); // not zero because of IDEMPIERE-3736
focusToActivePanel();
}
}
@@ -1397,11 +1398,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|| GridTab.DEFAULT_STATUS_MESSAGE.equals(adInfo)
|| GridTable.DATA_REFRESH_MESSAGE.equals(adInfo)
|| GridTable.DATA_INSERTED_MESSAGE.equals(adInfo)
+ || GridTable.DATA_IGNORED_MESSAGE.equals(adInfo)
|| GridTable.DATA_UPDATE_COPIED_MESSAGE.equals(adInfo)
) {
String prefix = null;
- if (dbInfo.contains("*"))
+ if (dbInfo.contains("*") || dbInfo.contains("?")) // ? used when not-autosave
prefix = "*";
String titleLogic = null;
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java
index 19978b73a6..5387b2dcc1 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java
@@ -574,7 +574,7 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt
}
GridRowCtx ctx = new GridRowCtx(Env.getCtx(), gridTab, rowIndex);
- if (!gridPanelFields[i].isDisplayed(ctx, true)){
+ if (! (gridPanelFields[i].isDisplayed(ctx, true) || gridPanelFields[i].isDisplayedGrid())){
// IDEMPIERE-2253
component.setVisible(false);
}
@@ -594,7 +594,7 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt
row.setStyle("cursor:pointer");
row.addEventListener(Events.ON_CLICK, rowListener);
row.addEventListener(Events.ON_OK, rowListener);
- row.setTooltiptext("Row " + (rowIndex+1));
+ row.setTooltiptext(Msg.getMsg(Env.getCtx(), "Row") + " " + (rowIndex+1));
if (isActive == null) {
Object isActiveValue = gridTab.getValue(rowIndex, "IsActive");
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java
index ec5f896301..034b53b650 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
@@ -592,27 +593,43 @@ public final class AEnv
DocumentException, FileNotFoundException {
Document document = null;
PdfWriter copy = null;
- for (File f : pdfList)
- {
- PdfReader reader = new PdfReader(f.getAbsolutePath());
- if (document == null)
+
+ List pdfReaders = new ArrayList();
+
+ try
+ {
+ for (File f : pdfList)
{
- document = new Document(reader.getPageSizeWithRotation(1));
- copy = PdfWriter.getInstance(document, new FileOutputStream(outFile));
- document.open();
+ PdfReader reader = new PdfReader(f.getAbsolutePath());
+
+ pdfReaders.add(reader);
+
+ if (document == null)
+ {
+ document = new Document(reader.getPageSizeWithRotation(1));
+ copy = PdfWriter.getInstance(document, new FileOutputStream(outFile));
+ document.open();
+ }
+ int pages = reader.getNumberOfPages();
+ PdfContentByte cb = copy.getDirectContent();
+ for (int i = 1; i <= pages; i++) {
+ document.newPage();
+ copy.newPage();
+ PdfImportedPage page = copy.getImportedPage(reader, i);
+ cb.addTemplate(page, 0, 0);
+ copy.releaseTemplate(page);
+ }
}
- int pages = reader.getNumberOfPages();
- PdfContentByte cb = copy.getDirectContent();
- for (int i = 1; i <= pages; i++) {
- document.newPage();
- copy.newPage();
- PdfImportedPage page = copy.getImportedPage(reader, i);
- cb.addTemplate(page, 0, 0);
- copy.releaseTemplate(page);
+ document.close();
+ }
+ finally
+ {
+ for(PdfReader reader:pdfReaders)
+ {
+ reader.close();
}
}
- document.close();
- }
+ }
/**
* Get window title
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java
index 026c80f83c..0b636cff00 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java
@@ -100,11 +100,11 @@ import org.zkoss.zul.Vlayout;
public abstract class AbstractProcessDialog extends Window implements IProcessUI, EventListener
{
-
/**
*
*/
- private static final long serialVersionUID = 8307953279095577359L;
+ private static final long serialVersionUID = 2821858988648268894L;
+
private static final String ON_COMPLETE = "onComplete";
private static final String ON_STATUS_UPDATE = "onStatusUpdate";
@@ -132,6 +132,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
private Future> future;
private List downloadFiles;
private boolean m_locked = false;
+ private String m_AD_Process_UU = "";
protected AbstractProcessDialog()
{
@@ -161,11 +162,11 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
log.config("");
//
boolean trl = !Env.isBaseLanguage(m_ctx, "AD_Process");
- String sql = "SELECT Name, Description, Help, IsReport, ShowHelp "
+ String sql = "SELECT Name, Description, Help, IsReport, ShowHelp, AD_Process_UU "
+ "FROM AD_Process "
+ "WHERE AD_Process_ID=?";
if (trl)
- sql = "SELECT t.Name, t.Description, t.Help, p.IsReport, p.ShowHelp "
+ sql = "SELECT t.Name, t.Description, t.Help, p.IsReport, p.ShowHelp, AD_Process_UU "
+ "FROM AD_Process p, AD_Process_Trl t "
+ "WHERE p.AD_Process_ID=t.AD_Process_ID"
+ " AND p.AD_Process_ID=? AND t.AD_Language=?";
@@ -196,6 +197,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
s = rs.getString(3); // Help
if (!rs.wasNull())
buildMsg.append("").append(s).append("
");
+ m_AD_Process_UU = rs.getString(6);
}
initialMessage = buildMsg.toString();
@@ -221,6 +223,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
m_pi.setTitle(m_Name);
+ m_pi.setAD_Process_UU(m_AD_Process_UU);
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi);
if ( !parameterPanel.init() ) {
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/FeedbackRequestWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/FeedbackRequestWindow.java
index 0f915c1812..8984e55d86 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/FeedbackRequestWindow.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/FeedbackRequestWindow.java
@@ -114,10 +114,10 @@ public class FeedbackRequestWindow extends Window implements EventListener> doubleClickListeners = new ArrayList>();
private List> onDropListeners = new ArrayList>();
private boolean draggable;
@@ -333,5 +334,17 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener gridFields)
+ {
+ this.infoColumns = infoColumns;
+ this.gridFields = gridFields.toArray(new GridField[infoColumns.length]);
+ this.infoWindow = infoWindow;
+ }
+
+ public WInfoWindowListItemRenderer(InfoWindow infoWindow, MInfoColumn[] infoColumns, List gridFields, List extends String> columnNames)
+ {
+ super(columnNames);
+ this.infoColumns = infoColumns;
+ this.gridFields = gridFields.toArray(new GridField[infoColumns.length]);
+ this.infoWindow = infoWindow;
+ }
+
+ private void calculateFieldOffest()
+ {
+ int colCount = getTableColumns().size();
+
+ if(colCount > infoColumns.length) // Added columns: selecetion
+ gridFieldsOffset = colCount - infoColumns.length;
+ }
+
+ @Override
+ protected Listcell getCellComponent(WListbox table, Object field,
+ final int rowIndex, final int columnIndex)
+ {
+ if(gridFieldsOffset < 0) // Just do it once, this assumes this rendered is not shared between grids
+ calculateFieldOffest();
+
+ Listcell listcell = null;
+ ListModelTable model = table.getModel();
+ Object obj = model.get(rowIndex);
+
+ int effectiveFieldIndex = columnIndex - gridFieldsOffset;
+
+ if(effectiveFieldIndex >= 0
+ && model.isSelected(obj) )
+ {
+ MInfoColumn infoColumn = infoColumns[effectiveFieldIndex];
+
+ if(infoColumn.isReadOnly() == false
+ && columnIndex > 0)
+ {
+ ListCell listCell = new ListCell();
+
+ final GridField gridField = gridFields[effectiveFieldIndex];
+ final WEditor editor = WebEditorFactory.getEditor(gridField, false);
+
+ // Set editor value
+
+ Object value = table.getValueAt(rowIndex, columnIndex);
+
+ if(value instanceof IDColumn)
+ {
+ IDColumn idc = (IDColumn)value;
+ value = idc.getRecord_ID();
+ }
+ else if(value instanceof KeyNamePair)
+ {
+ KeyNamePair knp = (KeyNamePair)value;
+ value = knp.getKey();
+ }
+
+ editor.setValue(value);
+
+ editor.addValueChangeListener(new ValueChangeListener()
+ {
+ @Override
+ public void valueChange(ValueChangeEvent evt)
+ {
+ infoWindow.onCellEditCallback(evt, rowIndex, columnIndex, editor, gridField);
+ }
+ });
+
+ listCell.appendChild(editor.getComponent());
+ listcell = listCell;
+ }
+ }
+
+ if(listcell == null)
+ listcell = super.getCellComponent(table, field, rowIndex, columnIndex);
+
+ return listcell;
+ }
+
+}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java
index e8e9931174..9a9776755c 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java
@@ -25,6 +25,7 @@ import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
@@ -197,7 +198,7 @@ public class WListItemRenderer implements ListitemRenderer, EventListene
* @param columnIndex The column in which the cell is to be placed.
* @return The list cell component.
*/
- private Listcell getCellComponent(WListbox table, Object field,
+ protected Listcell getCellComponent(WListbox table, Object field,
int rowIndex, int columnIndex)
{
ListCell listcell = new ListCell();
@@ -294,8 +295,14 @@ public class WListItemRenderer implements ListitemRenderer, EventListene
}
else if (field instanceof Timestamp)
{
+ int refId = 0;
+ if (m_tableColumns != null && columnIndex < m_tableColumns.size()) {
+ refId = m_tableColumns.get(columnIndex).getAD_Reference_ID();
+ }
- SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date, AEnv.getLanguage(Env.getCtx()));
+ if (refId == 0)
+ refId = DisplayType.Date;
+ SimpleDateFormat dateFormat = DisplayType.getDateFormat(refId, AEnv.getLanguage(Env.getCtx()));
listcell.setValue(dateFormat.format((Timestamp)field));
if (isCellEditable)
{
@@ -396,7 +403,10 @@ public class WListItemRenderer implements ListitemRenderer, EventListene
{
addColumn(header, null);
}
-
+ public void addColumn(String header, String description)
+ {
+ addColumn(header, description, 0);
+ }
/**
* Add Table Column.
* after adding a column, you need to set the column classes again
@@ -405,13 +415,14 @@ public class WListItemRenderer implements ListitemRenderer, EventListene
* @param header The header text for the column
* @param description
*/
- public void addColumn(String header, String description)
+ public void addColumn(String header, String description, int AD_Reference_ID)
{
WTableColumn tableColumn;
tableColumn = new WTableColumn();
tableColumn.setHeaderValue(Util.cleanAmp(header));
tableColumn.setTooltipText(description);
+ tableColumn.setAD_Reference_ID(AD_Reference_ID);
m_tableColumns.add(tableColumn);
return;
@@ -854,6 +865,10 @@ public class WListItemRenderer implements ListitemRenderer, EventListene
m_tableColumns.get(index).setColumnClass(classType);
}
}
+
+ public List getTableColumns() {
+ return Collections.unmodifiableList(m_tableColumns);
+ }
class CellListener implements EventListener {
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java
index ef04eaffbc..f442ceb2a2 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WListbox.java
@@ -59,7 +59,7 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
/**
*
*/
- private static final long serialVersionUID = -706774424788688953L;
+ private static final long serialVersionUID = -5501893389366975849L;
/** Logger. */
private static CLogger logger = CLogger.getCLogger(WListbox.class);
@@ -81,6 +81,9 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
private int m_colorColumnIndex = -1;
/** Color Column compare data. */
private Object m_colorDataCompare = Env.ZERO;
+
+ // F3P: support IDColumn for selection
+ private boolean allowIDColumnForReadWrite = false;
/**
* Default constructor.
@@ -194,12 +197,27 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
public boolean isCellEditable(int row, int column)
{
// if the first column holds a boolean and it is false, it is not editable
- if (column != 0
- && (getValueAt(row, 0) instanceof Boolean)
- && !((Boolean)getValueAt(row, 0)).booleanValue())
+
+ // F3P: If allowed, use idcolumn as a switch for read/write
+
+ if (column != 0)
+ return false;
+
+ Object val = getValueAt(row, 0);
+
+ if ((val instanceof Boolean)
+ && !((Boolean)val).booleanValue())
{
return false;
}
+
+ if(val instanceof IDColumn)
+ {
+ IDColumn idc = (IDColumn)val;
+
+ if(!idc.isSelected())
+ return false;
+ }
// is the column read/write?
if (m_readWriteColumn.contains(new Integer(column)))
@@ -371,7 +389,7 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
}
// add to model
- addColumn(layout[columnIndex].getColHeader(), layout[columnIndex].getColDescription());
+ addColumn(layout[columnIndex].getColHeader(), layout[columnIndex].getColDescription(), layout[columnIndex].getAD_Reference_ID());
// set the colour column
if (layout[columnIndex].isColorColumn())
@@ -438,16 +456,20 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
addColumn(header, null);
}
+ public void addColumn (String header, String description)
+ {
+ addColumn(header, description, 0);
+ }
/**
* Add Table Column and specify the column header.
*
* @param header name of column header
* @param description
*/
- public void addColumn (String header, String description)
+ public void addColumn (String header, String description, int AD_Reference_ID)
{
WListItemRenderer renderer = (WListItemRenderer)getItemRenderer();
- renderer.addColumn(Util.cleanAmp(header), description);
+ renderer.addColumn(Util.cleanAmp(header), description, AD_Reference_ID);
getModel().addColumn();
return;
@@ -1224,4 +1246,14 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
}
}
+ public boolean isAllowIDColumnForReadWrite()
+ {
+ return allowIDColumnForReadWrite;
+ }
+
+ public void setAllowIDColumnForReadWrite(boolean allowIDColumnForReadWrite)
+ {
+ this.allowIDColumnForReadWrite = allowIDColumnForReadWrite;
+ }
+
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java
index 05a34d4289..24b6753a9a 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/WTableColumn.java
@@ -45,6 +45,8 @@ public class WTableColumn
protected String tooltipText;
+ private int AD_Reference_ID;
+
/**
* Cover method, using a default width of 75
* @see #WTableColumn(int)
@@ -288,4 +290,12 @@ public class WTableColumn
public void setTooltipText(String tooltipText) {
this.tooltipText = tooltipText;
}
+
+ public int getAD_Reference_ID() {
+ return AD_Reference_ID;
+ }
+
+ public void setAD_Reference_ID(int AD_Reference_ID) {
+ this.AD_Reference_ID=AD_Reference_ID;
+ }
}
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..2796cd1889 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
@@ -85,8 +85,8 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
@Override
public Object getValue()
{
- //if (m_mAccount.C_ValidCombination_ID == 0)
- // return null;
+ if (m_mAccount.C_ValidCombination_ID == 0)
+ return null;
return new Integer (m_mAccount.C_ValidCombination_ID);
}
@@ -101,7 +101,11 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
*/
public void cmd_button()
{
- int C_AcctSchema_ID = Env.getContextAsInt(Env.getCtx(), gridField.getWindowNo(), "C_AcctSchema_ID");
+ int C_AcctSchema_ID;
+ if (gridField.getGridTab() != null)
+ C_AcctSchema_ID = Env.getContextAsInt(Env.getCtx(), gridField.getWindowNo(), gridField.getGridTab().getTabNo(), "C_AcctSchema_ID");
+ else
+ C_AcctSchema_ID = Env.getContextAsInt(Env.getCtx(), gridField.getWindowNo(), "C_AcctSchema_ID");
// Try to get C_AcctSchema_ID from global context - teo_sarca BF [ 1830531 ]
if (C_AcctSchema_ID <= 0)
{
@@ -171,6 +175,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/editor/WEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java
index 28118f43c1..a725ebbc15 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java
@@ -756,14 +756,14 @@ public abstract class WEditor implements EventListener, PropertyChangeLis
* @return boolean
*/
protected boolean isShowPreference() {
- return MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn();
+ return MRole.getDefault().isShowPreference() && gridField != null && !gridField.isEncrypted() && !gridField.isEncryptedColumn() && !gridField.isVirtualColumn();
}
/**
* @param popupMenu
*/
protected void addChangeLogMenu(WEditorPopupMenu popupMenu) {
- if (popupMenu != null && gridField != null && gridField.getGridTab() != null)
+ if (popupMenu != null && gridField != null && gridField.getGridTab() != null && !gridField.isVirtualColumn())
{
WFieldRecordInfo.addMenu(popupMenu);
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WHtmlEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WHtmlEditor.java
new file mode 100644
index 0000000000..4dea40686c
--- /dev/null
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WHtmlEditor.java
@@ -0,0 +1,237 @@
+/******************************************************************************
+ * Product: BrERP Business Solution (http://brerp.org) *
+ * *
+ * Copyright (C) 2014 devCoffee Sistemas de Gestão Integrada Ltda. *
+ * *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+
+package org.adempiere.webui.editor;
+
+
+import java.util.logging.Level;
+
+import org.adempiere.webui.LayoutUtils;
+import org.adempiere.webui.ValuePreference;
+import org.adempiere.webui.adwindow.ADWindow;
+import org.adempiere.webui.adwindow.AbstractADWindowContent;
+import org.adempiere.webui.event.ContextMenuEvent;
+import org.adempiere.webui.event.ContextMenuListener;
+import org.adempiere.webui.event.DialogEvents;
+import org.adempiere.webui.event.ValueChangeEvent;
+import org.adempiere.webui.session.SessionManager;
+import org.adempiere.webui.window.WFieldRecordInfo;
+import org.adempiere.webui.window.WTextEditorDialog;
+import org.compiere.model.GridField;
+import org.compiere.util.CLogger;
+import org.zkoss.zk.ui.Component;
+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.Div;
+import org.zkoss.zul.Html;
+
+
+/**
+ * HTML Editor
+ * Implementation of an editor to show HTML content
+ *
+ * Based on contribution from
+ * @author muriloht (muriloht@devcoffee.com.br, http://www.devcoffee.com.br)
+ * @version $Id: WHTMLEditor.java, v1.0 11/11/2014 20:25:06, muriloht Exp $
+ */
+public class WHtmlEditor extends WEditor implements ContextMenuListener
+{
+
+ private String oldValue;
+
+ private AbstractADWindowContent adwindowContent;
+
+ /** HTML Model */
+ private Html box = null;
+
+ private boolean m_mandatory;
+
+ private boolean readwrite;
+
+ /** Logger */
+ private static CLogger log = CLogger.getCLogger(WHtmlEditor.class);
+
+ public WHtmlEditor(GridField gridField)
+ {
+ super(new Div(), gridField);
+ init();
+ }
+
+ @Override
+ public Div getComponent() {
+ return (Div) component;
+ }
+
+ private void init()
+ {
+ if (log.isLoggable(Level.INFO)) log.info("Initializing component");
+
+ if (gridField != null)
+ {
+ Div div = (Div) getComponent();
+ if (gridField.getNumLines() > 1) {
+ int height = 24 * gridField.getNumLines();
+ div.setHeight(height + "px");
+ }
+ div.setWidth("100%");
+ LayoutUtils.addSclass("html-field", div);
+ div.addEventListener(Events.ON_DOUBLE_CLICK, this);
+
+ box = new Html();
+ box.setParent(div);
+
+ popupMenu = new WEditorPopupMenu(false, false, isShowPreference());
+ addTextEditorMenu(popupMenu);
+ addChangeLogMenu(popupMenu);
+ }
+ }
+
+ @Override
+ public String getDisplay()
+ {
+ return box.getContent();
+ }
+
+ @Override
+ public Object getValue()
+ {
+ return box.getContent();
+ }
+
+ @Override
+ public boolean isMandatory()
+ {
+ return m_mandatory;
+ }
+
+
+ @Override
+ public void setMandatory(boolean mandatory)
+ {
+ super.setMandatory(mandatory);
+ m_mandatory = mandatory;
+ }
+
+ @Override
+ public boolean isReadWrite() {
+ return readwrite;
+ }
+
+ @Override
+ public void setReadWrite(boolean readWrite) {
+ this.readwrite = readWrite;
+ }
+
+ @Override
+ public void setValue(Object value)
+ {
+ if (value != null)
+ {
+ box.setContent(value.toString());
+ }
+ else
+ {
+ box.setContent("");
+ }
+ oldValue = box.getContent();
+ }
+
+
+ @Override
+ public String getDisplayTextForGridView(Object value) {
+ if (value == null) {
+ return "";
+ } else {
+ return (String)value;
+ }
+ }
+
+ @Override
+ public Component getDisplayComponent() {
+ return new Html();
+ }
+
+ @Override
+ public void onMenu(ContextMenuEvent evt) {
+ if (WEditorPopupMenu.PREFERENCE_EVENT.equals(evt.getContextEvent()))
+ {
+ if (isShowPreference())
+ ValuePreference.start (getComponent(), this.getGridField(), getValue());
+ return;
+ }
+ else if (WEditorPopupMenu.EDITOR_EVENT.equals(evt.getContextEvent()))
+ {
+ editorEvent();
+ }
+ else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
+ {
+ WFieldRecordInfo.start(gridField);
+ }
+ }
+
+ private void editorEvent() {
+ adwindowContent = findADWindowContent();
+ final WTextEditorDialog dialog = new WTextEditorDialog(gridField.getVO().Header, getDisplay(),
+ isReadWrite(), gridField.getFieldLength(), true);
+ dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
+ @Override
+ public void onEvent(Event event) throws Exception {
+ if (adwindowContent != null) {
+ adwindowContent.hideBusyMask();
+ }
+ if (!dialog.isCancelled()) {
+ box.setContent(dialog.getText());
+ String newText = box.getContent();
+ ValueChangeEvent changeEvent = new ValueChangeEvent(WHtmlEditor.this, WHtmlEditor.this.getColumnName(), oldValue, newText);
+ WHtmlEditor.super.fireValueChange(changeEvent);
+ oldValue = newText;
+ }
+ }
+ });
+ if (adwindowContent != null)
+ {
+ adwindowContent.getComponent().getParent().appendChild(dialog);
+ adwindowContent.showBusyMask(dialog);
+ LayoutUtils.openOverlappedWindow(adwindowContent.getComponent().getParent(), dialog, "middle_center");
+ }
+ else
+ {
+ SessionManager.getAppDesktop().showWindow(dialog);
+ }
+ dialog.focus();
+ }
+
+ private AbstractADWindowContent findADWindowContent() {
+ Component parent = getComponent().getParent();
+ while(parent != null) {
+ if (parent.getAttribute(ADWindow.AD_WINDOW_ATTRIBUTE_KEY) != null) {
+ ADWindow adwindow = (ADWindow) parent.getAttribute(ADWindow.AD_WINDOW_ATTRIBUTE_KEY);
+ return adwindow.getADWindowContent();
+ }
+ parent = parent.getParent();
+ }
+ return null;
+ }
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ if (Events.ON_DOUBLE_CLICK.equals(event.getName()) && readwrite) {
+ editorEvent();
+ }
+ }
+
+}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java
index 913d590d1b..358e2247b8 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java
@@ -179,6 +179,7 @@ public class WLocationEditor extends WEditor implements EventListener, Pr
{
if (log.isLoggable(Level.CONFIG)) log.config( "actionPerformed - " + m_value);
final WLocationDialog ld = new WLocationDialog(Msg.getMsg(Env.getCtx(), "Location"), m_value, gridField);
+ final int oldValue = m_value == null ? 0 : m_value.getC_Location_ID();
ld.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
@Override
@@ -194,10 +195,8 @@ public class WLocationEditor extends WEditor implements EventListener, Pr
if (m_value != null)
C_Location_ID = m_value.getC_Location_ID();
Integer ii = new Integer(C_Location_ID);
- // force Change - user does not realize that embedded object is already saved.
- ValueChangeEvent valuechange = new ValueChangeEvent(WLocationEditor.this,getColumnName(),null,null);
- fireValueChange(valuechange); // resets m_mLocation
- if (C_Location_ID != 0)
+
+ if (C_Location_ID != 0 && oldValue == 0)
{
ValueChangeEvent vc = new ValueChangeEvent(WLocationEditor.this,getColumnName(),null,ii);
fireValueChange(vc);
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java
index 780011076a..09fc87c0bf 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java
@@ -561,7 +561,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
}
- protected void showInfoPanel(final InfoPanel ip) {
+ public void showInfoPanel(final InfoPanel ip) {
ip.setVisible(true);
ip.setStyle("border: 2px");
ip.setClosable(true);
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java
index 2354c738cc..6613b0a5fe 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java
@@ -34,6 +34,7 @@ import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.WFieldRecordInfo;
import org.adempiere.webui.window.WTextEditorDialog;
import org.compiere.model.GridField;
+import org.compiere.model.I_R_MailText;
import org.compiere.util.DisplayType;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
@@ -258,7 +259,8 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|| gridField.getDisplayType() == DisplayType.TextLong
|| gridField.getDisplayType() == DisplayType.Memo)
&& adwindowContent != null
- && adwindowContent.getActiveGridTab() != null) {
+ && adwindowContent.getActiveGridTab() != null
+ && adwindowContent.getActiveGridTab().getAD_Table_ID() == I_R_MailText.Table_ID) {
isHtml = adwindowContent.getActiveGridTab().getValueAsBoolean("IsHtml");
}
final WTextEditorDialog dialog = new WTextEditorDialog(gridField.getVO().Header, getDisplay(),
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java
index c2d269b612..470d927d6c 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java
@@ -24,6 +24,7 @@ import org.adempiere.webui.editor.WDatetimeEditor;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WFileDirectoryEditor;
import org.adempiere.webui.editor.WFilenameEditor;
+import org.adempiere.webui.editor.WHtmlEditor;
import org.adempiere.webui.editor.WImageEditor;
import org.adempiere.webui.editor.WLocationEditor;
import org.adempiere.webui.editor.WLocatorEditor;
@@ -79,7 +80,10 @@ public class DefaultEditorFactory implements IEditorFactory {
}
else
{
- editor = new WStringEditor(gridField, tableEditor);
+ if (gridField.isHtml())
+ editor = new WHtmlEditor(gridField);
+ else
+ editor = new WStringEditor(gridField, tableEditor);
}
//enable html5 color input type
if (displayType == DisplayType.Color)
@@ -112,7 +116,10 @@ public class DefaultEditorFactory implements IEditorFactory {
/** Text */
else if (displayType == DisplayType.Text || displayType == DisplayType.Memo || displayType == DisplayType.TextLong || displayType == DisplayType.ID)
{
- editor = new WStringEditor(gridField, tableEditor);
+ if (gridField.isHtml())
+ editor = new WHtmlEditor(gridField);
+ else
+ editor = new WStringEditor(gridField, tableEditor);
}
/** Date */
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java
index 1401808269..29e64fbeb7 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java
@@ -18,7 +18,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
-import org.adempiere.base.Core;
import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Label;
@@ -34,6 +33,7 @@ import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
+import org.compiere.model.GridTable;
import org.compiere.model.GridWindow;
import org.compiere.model.MField;
import org.compiere.model.MLookup;
@@ -66,9 +66,10 @@ public class WQuickEntry extends Window implements EventListener, ValueCh
/**
*
*/
- private static final long serialVersionUID = -8530102231615195037L;
+ private static final long serialVersionUID = -1397302187339942732L;
public static final String QUICK_ENTRY_MODE = "_QUICK_ENTRY_MODE_";
+ public static final String QUICK_ENTRY_CALLER_WINDOW = "_QUICK_ENTRY_CALLER_WINDOW_";
private static CLogger log = CLogger.getCLogger(WQuickEntry.class);
@@ -119,6 +120,7 @@ public class WQuickEntry extends Window implements EventListener, ValueCh
}
Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_MODE, "Y");
+ Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_CALLER_WINDOW, parent_WindowNo);
initPOs();
} // WQuickEntry
@@ -295,7 +297,7 @@ public class WQuickEntry extends Window implements EventListener, ValueCh
} else {
if (Record_ID > 0) {
String columnname = gridtab.getTableName() + "_ID";
- id = Env.getContextAsInt(Env.getCtx(), parent_WindowNo, columnname);
+ id = Env.getContextAsInt(Env.getCtx(), parent_WindowNo, columnname, true);
}
}
MQuery query = new MQuery(gridtab.getAD_Table_ID());
@@ -530,12 +532,16 @@ public class WQuickEntry extends Window implements EventListener, ValueCh
WEditor editor = quickEditors.get(idx);
GridTab gridTab = field.getGridTab();
String columnName = field.getColumnName();
+ GridTable mTable = gridTab.getTableModel();
+ int row = gridTab.getCurrentRow();
+ int col = mTable.findColumn(columnName);
// process dependencies and callouts for the changed field
if (evt.getSource() instanceof WLocationEditor && evt.getNewValue() == null && editor.getValue() != null) {
// ignore first call of WLocationEditor valuechange set to null
// it will be called later with correct value
// see WLocationEditor firing twice ValueChangeEvent (first with null and then with value)
} else {
+ mTable.setValueAt(evt.getNewValue(), row, col);
field.setValue(evt.getNewValue(), field.getGridTab().getTableModel().isInserting());
gridTab.processFieldChange(field);
}
@@ -553,12 +559,8 @@ public class WQuickEntry extends Window implements EventListener, ValueCh
mLookup.refresh();
}
}
- } // for all dependent fields
- if ( dependants.size() > 0
- || field.getCallout().length() > 0
- || Core.findCallout(gridTab.getTableName(), columnName).size() > 0) {
- dynamicDisplay();
- }
+ }
+ dynamicDisplay();
}
}
}
@@ -570,8 +572,13 @@ public class WQuickEntry extends Window implements EventListener, ValueCh
{
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
GridField field = quickFields.get(idxf);
+ GridTab gridTab = field.getGridTab();
+ String columnName = field.getColumnName();
+ GridTable mTable = gridTab.getTableModel();
+ int row = gridTab.getCurrentRow();
+ int col = mTable.findColumn(columnName);
WEditor editor = quickEditors.get(idxf);
- editor.setValue(field.getValue());
+ editor.setValue(mTable.getValueAt(row, col)); //In case a callout changed the value and it is not reflected in field yet
editor.setReadWrite(field.isEditable(true));
editor.setVisible(field.isDisplayed(true));
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java
index 7984de97fe..ff8afc7823 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/InfoWindow.java
@@ -3,17 +3,22 @@
*/
package org.adempiere.webui.info;
-import java.math.BigDecimal;
+import java.io.File;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.TreeMap;
import java.util.logging.Level;
+import org.adempiere.exceptions.AdempiereException;
+import org.adempiere.impexp.AbstractExcelExporter;
import org.adempiere.model.IInfoColumn;
import org.adempiere.model.MInfoProcess;
import org.adempiere.model.MInfoRelated;
@@ -41,6 +46,7 @@ import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs;
+import org.adempiere.webui.component.WInfoWindowListItemRenderer;
import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WSearchEditor;
@@ -49,6 +55,8 @@ import org.adempiere.webui.editor.WebEditorFactory;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
+import org.adempiere.webui.event.WTableModelEvent;
+import org.adempiere.webui.factory.ButtonFactory;
import org.adempiere.webui.grid.WQuickEntry;
import org.adempiere.webui.panel.InfoPanel;
import org.adempiere.webui.session.SessionManager;
@@ -63,6 +71,7 @@ import org.compiere.model.AccessSqlParser.TableInfo;
import org.compiere.model.GridField;
import org.compiere.model.GridFieldVO;
import org.compiere.model.GridWindow;
+import org.compiere.model.Lookup;
import org.compiere.model.MInfoColumn;
import org.compiere.model.MInfoWindow;
import org.compiere.model.MLookupFactory;
@@ -77,14 +86,17 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
+import org.compiere.util.Trx;
import org.compiere.util.Util;
import org.compiere.util.ValueNamePair;
+import org.zkoss.util.media.AMedia;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.Component;
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.zk.ui.event.SelectEvent;
import org.zkoss.zk.ui.event.SwipeEvent;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Center;
@@ -92,13 +104,17 @@ import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.ComboitemRenderer;
import org.zkoss.zul.Div;
+import org.zkoss.zul.Filedownload;
import org.zkoss.zul.ListModelList;
+import org.zkoss.zul.Listitem;
import org.zkoss.zul.Menuitem;
import org.zkoss.zul.North;
+import org.zkoss.zul.Paging;
import org.zkoss.zul.Separator;
import org.zkoss.zul.South;
import org.zkoss.zul.Space;
import org.zkoss.zul.Vbox;
+import org.zkoss.zul.Vlayout;
/**
* AD_InfoWindow implementation
@@ -123,6 +139,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
/** embedded Panel **/
Tabbox embeddedPane = new Tabbox();
ArrayList embeddedWinList = new ArrayList ();
+ Map relatedMap = new HashMap<>();
/** Max Length of Fields */
public static final int FIELDLENGTH = 20;
@@ -135,6 +152,16 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
private List gridFields;
private Checkbox checkAND;
+
+ // F3P: Keep original values: when a row is unselected, restore original values
+
+ private boolean hasEditable = false;
+ private Map> cacheOriginalValues = new HashMap<>();
+ private Map> temporarySelectedData = new HashMap<>();
+
+ // F3P: export
+
+ private Button exportButton = null;
/**
* Menu contail process menu item
@@ -185,7 +212,21 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
//Xolali IDEMPIERE-1045
contentPanel.addActionListener(new EventListener() {
public void onEvent(Event event) throws Exception {
- updateSubcontent();
+
+ int row = -1;
+
+ if(event instanceof SelectEvent, ?>)
+ {
+ @SuppressWarnings("unchecked")
+ SelectEvent> selEvent = (SelectEvent>)event;
+
+ if(selEvent.getReference() != null)
+ {
+ row = selEvent.getReference().getIndex();
+ }
+ }
+
+ updateSubcontent(row);
}
}); //xolali --end-
@@ -220,14 +261,21 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
ClientInfo.onClientInfo(this, this::onClientInfo);
}
+ // F3P: add export button
+
+ initExport();
}
- /**
+ /**
+ *
* {@inheritDoc}
*/
@Override
- protected void updateSubcontent (){
- int row = contentPanel.getSelectedRow();
+ protected void updateSubcontent (int row){ // F3P: For multi-selection info, using selected row blocks the dislay to the first selected
+
+ if(row < 0)
+ row = contentPanel.getSelectedRow();
+
if (row >= 0) {
for (EmbedWinInfo embed : embeddedWinList) {
// default link column is key column
@@ -236,11 +284,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
// get index of link column
indexData = p_layout.length + columnDataIndex.get(embed.getParentLinkColumnID());
}
- refresh(contentPanel.getValueAt(row,indexData),embed);
+ RelatedInfoWindow relatedInfoWindow = relatedMap.get(embed.getInfowin().getAD_InfoWindow_ID());
+ relatedInfoWindow.refresh(contentPanel.getValueAt(row,indexData));
}// refresh for all
}else{
for (EmbedWinInfo embed : embeddedWinList) {
- refresh(embed);
+ reset(embed);
}
}
}
@@ -558,6 +607,36 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
gridFields.add(gridField);
}
+ // If we have a process and at least one process and an editable field, change to the info window rendered
+
+ int processCount = 0;
+
+ if(infoWindow != null)
+ {
+ MInfoProcess processes[] = infoWindow.getInfoProcess(false);
+ processCount = processes.length;
+ }
+
+ if(processCount > 0)
+ {
+ for(MInfoColumn infoColumn:infoColumns)
+ {
+ if(infoColumn.isReadOnly() == false)
+ {
+ hasEditable = true;
+ break;
+ }
+ }
+
+ if(hasEditable)
+ {
+ WInfoWindowListItemRenderer renderer = new WInfoWindowListItemRenderer(this, infoColumns, gridFields);
+ contentPanel.setItemRenderer(renderer);
+ contentPanel.setAllowIDColumnForReadWrite(true);
+ renderer.addTableValueChangeListener(contentPanel); // Replicated from WListbox constructor
+ }
+ }
+
StringBuilder builder = new StringBuilder(p_whereClause != null ? p_whereClause.trim() : "");
String infoWhereClause = infoWindow.getWhereClause();
if (infoWhereClause != null && infoWhereClause.indexOf("@") >= 0) {
@@ -630,6 +709,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
String s_sqlFrom = embedInfo.getFromClause();
/** Where Clause */
String s_sqlWhere = relatedInfo.getLinkColumnName() + "=?";
+ String s_sqlCount = "SELECT COUNT(*) FROM " + s_sqlFrom + " WHERE " + s_sqlWhere;
m_sqlEmbedded = embeddedTbl.prepareTable(s_layoutEmbedded, s_sqlFrom, s_sqlWhere, false, tableName);
embeddedTbl.setMultiSelection(false);
@@ -639,10 +719,19 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
embeddedTbl.getModel().addTableModelListener(this);
ZKUpdateUtil.setVflex(embeddedTbl, "1");
-
+ Paging embeddedPaging = new Paging();
+ embeddedPaging.setPageSize(pageSize);
+ embeddedPaging.setTotalSize(0);
+ ZKUpdateUtil.setHflex(embeddedPaging, "1");
+ embeddedPaging.setMold("os");
+ embeddedPaging.setVisible(false);
+ embeddedPaging.setSclass("infowindow-related-paging");
+
//Xolali - add embeddedTbl to list, add m_sqlembedded to list
EmbedWinInfo ewinInfo = new EmbedWinInfo(embedInfo,embeddedTbl,m_sqlEmbedded,relatedInfo.getLinkColumnName(), relatedInfo.getLinkInfoColumn(), relatedInfo.getParentRelatedColumn_ID());
embeddedWinList.add(ewinInfo);
+ RelatedInfoWindow relatedInfoWindow = new RelatedInfoWindow(ewinInfo, this, embeddedPaging, s_sqlCount, s_layoutEmbedded);
+ relatedMap.put(embedInfo.getAD_InfoWindow_ID(), relatedInfoWindow);
MInfoWindow riw = (MInfoWindow) relatedInfo.getRelatedInfo();
String tabTitle;
@@ -655,7 +744,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
Tabpanel desktopTabPanel = new Tabpanel();
//desktopTabPanel.
ZKUpdateUtil.setHeight(desktopTabPanel, "100%");
- desktopTabPanel.appendChild(embeddedTbl);
+ Vlayout vlayout = new Vlayout();
+ ZKUpdateUtil.setVflex(vlayout, "1");
+ desktopTabPanel.appendChild(vlayout);
+ vlayout.appendChild(embeddedPaging);
+ vlayout.appendChild(embeddedTbl);
tabPanels.appendChild(desktopTabPanel);
}
@@ -671,8 +764,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
: tableInfos[0].getTableName();
String keySelectClause = keyTableAlias+"."+p_keyColumn;
- list.add(new ColumnInfo(" ", keySelectClause, IDColumn.class));
+ list.add(new ColumnInfo(" ", keySelectClause, IDColumn.class, true, false, null, p_keyColumn));
+ boolean haveNotProcess = !haveProcess; // A field is editabile only if is not readonly and theres a process
+
int i = 0;
for(MInfoColumn infoColumn : infoColumns)
{
@@ -687,7 +782,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (infoColumn.getSelectClause().equalsIgnoreCase(keySelectClause))
continue;
- columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true));
+ columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true), infoColumn.isReadOnly() || haveNotProcess);
}
else if (DisplayType.isLookup(infoColumn.getAD_Reference_ID()))
{
@@ -698,7 +793,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
editor.setMandatory(false);
editor.setReadWrite(false);
editorMap.put(colSQL, editor);
- columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, ValueNamePair.class, (String)null);
+ columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, ValueNamePair.class, (String)null, infoColumn.isReadOnly() || haveNotProcess);
}
else
{
@@ -707,10 +802,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
else
{
- columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true));
+ columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, DisplayType.getClass(infoColumn.getAD_Reference_ID(), true), infoColumn.isReadOnly() || haveNotProcess);
}
columnInfo.setColDescription(infoColumn.get_Translation("Description"));
+ columnInfo.setAD_Reference_ID(infoColumn.getAD_Reference_ID());
columnInfo.setGridField(gridFields.get(i));
+ columnInfo.setColumnName(infoColumn.getColumnName());
list.add(columnInfo);
if (keyColumnOfView == infoColumn){
@@ -738,6 +835,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
MLookupInfo lookupInfo = MLookupFactory.getLookupInfo(Env.getCtx(), p_WindowNo, 0, infoColumn.getAD_Reference_ID(), Env.getLanguage(Env.getCtx()), columnName, infoColumn.getAD_Reference_Value_ID(), false, validationCode);
String displayColumn = lookupInfo.DisplayColumn;
+ boolean haveNotProcess = !haveProcess; // A field is editabile only if is not readonly and theres a process;
+
int index = infoColumn.getSelectClause().indexOf(".");
if (index == infoColumn.getSelectClause().lastIndexOf("."))
{
@@ -749,7 +848,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (tableInfo.getTableName().equalsIgnoreCase(lookupInfo.TableName))
{
displayColumn = displayColumn.replace(lookupInfo.TableName+".", tableInfo.getSynonym()+".");
- ColumnInfo columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), displayColumn, KeyNamePair.class, infoColumn.getSelectClause());
+ ColumnInfo columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), displayColumn, KeyNamePair.class, infoColumn.getSelectClause(), infoColumn.isReadOnly() || haveNotProcess);
return columnInfo;
}
break;
@@ -766,7 +865,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
if (! colSQL.toUpperCase().contains(" AS "))
colSQL += " AS " + infoColumn.getColumnName();
editorMap.put(colSQL, editor);
- ColumnInfo columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, KeyNamePair.class, (String)null);
+ ColumnInfo columnInfo = new ColumnInfo(infoColumn.get_Translation("Name"), colSQL, KeyNamePair.class, (String)null, infoColumn.isReadOnly() || haveNotProcess);
return columnInfo;
}
@@ -860,8 +959,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
builder.append(columnClause)
.append(" ")
- .append(mInfoColumn.getQueryOperator())
- .append(" ?");
+ .append(mInfoColumn.getQueryOperator());
+ if (columnClause.toUpperCase().startsWith("UPPER(")) {
+ builder.append(" UPPER(?)");
+ } else {
+ builder.append(" ?");
+ }
}
}
if (count > 0 && !checkAND.isChecked()) {
@@ -979,20 +1082,23 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* @throws SQLException
*/
protected void setParameter (PreparedStatement pstmt, int parameterIndex, Object value, String queryOperator) throws SQLException{
- if (value instanceof Boolean) {
- pstmt.setString(parameterIndex, ((Boolean) value).booleanValue() ? "Y" : "N");
- } else if (value instanceof String) {
+ if (value instanceof Boolean) {
+ pstmt.setString(parameterIndex, ((Boolean) value).booleanValue() ? "Y" : "N");
+ } else if (value instanceof String) {
+ StringBuilder valueStr = new StringBuilder(value.toString());
if (queryOperator.equals(X_AD_InfoColumn.QUERYOPERATOR_Like)) {
- StringBuilder valueStr = new StringBuilder(value.toString().toUpperCase());
- if (!valueStr.toString().endsWith("%"))
- valueStr.append("%");
- pstmt.setString(parameterIndex, valueStr.toString());
- } else {
- pstmt.setString(parameterIndex, (String)value);
- }
- } else {
- pstmt.setObject(parameterIndex, value);
- }
+ if (!valueStr.toString().endsWith("%"))
+ valueStr.append("%");
+ } else if (queryOperator.equals(X_AD_InfoColumn.QUERYOPERATOR_FullLike)) {
+ if (!valueStr.toString().startsWith("%"))
+ valueStr.insert(0, "%");
+ if (!valueStr.toString().endsWith("%"))
+ valueStr.append("%");
+ }
+ pstmt.setString(parameterIndex, valueStr.toString());
+ } else {
+ pstmt.setObject(parameterIndex, value);
+ }
}
@Override
@@ -1055,7 +1161,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
* or parentLink of infoRelateWindow.
*
* this function just add column name of hidden infoWindow to end of query
- * @param sqlMain main sql to append column
+ * @param sqlMain main sql to append column
* @param listInfoColumn list of PO contain infoColumnID, this infoColumnID will add to query
* @return sql after append column
*/
@@ -1176,7 +1282,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
div.setStyle("width :100%; height: 100%");
ZKUpdateUtil.setVflex(div, "1");
ZKUpdateUtil.setHflex(div, "1");
- div.appendChild(contentPanel);
+ div.appendChild(contentPanel);
Borderlayout inner = new Borderlayout();
ZKUpdateUtil.setWidth(inner, "100%");
@@ -1548,8 +1654,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
@Override
protected void executeQuery() {
- prepareTable();
+ if (!isRequeryByRunSuccessProcess)
+ prepareTable();
super.executeQuery();
+ cacheOriginalValues.clear(); // F3P: Clear original values
if (ClientInfo.maxHeight(ClientInfo.SMALL_HEIGHT-1) ||
ClientInfo.maxWidth(ClientInfo.SMALL_WIDTH-1)) {
layout.getNorth().setOpen(false);
@@ -1889,56 +1997,10 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
/**
- * @author xolali IDEMPIERE-1045
- * refresh(Object obj, EmbedWinInfo relatedInfo)
+ * reset to empty
+ * @param relatedInfo
*/
- protected void refresh(Object obj, EmbedWinInfo relatedInfo)
- {
- StringBuilder sql = new StringBuilder();
- sql.append(relatedInfo.getInfoSql()); // delete get sql method from MInfoWindow
- if (log.isLoggable(Level.FINEST))
- log.finest(sql.toString());
-
- Object linkPara = null;
- if (obj != null && obj instanceof IDColumn){
- IDColumn ID = (IDColumn) obj;
- linkPara = ID.getRecord_ID();
- }else if (obj != null){
- linkPara = obj.toString();
- }else {
- //TODO:hard case
- }
-
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- try
- {
- pstmt = DB.prepareStatement(relatedInfo.getInfoSql(), null);
- //TODO: implicit type conversion. will exception in some case must recheck
- if (relatedInfo.getTypeDataOfLink().equals(String.class)){
- pstmt.setString(1, (String)linkPara);
- }else if (relatedInfo.getTypeDataOfLink().equals(int.class)){
- pstmt.setInt(1, Integer.parseInt(linkPara.toString()));
-
- }else{
- pstmt.setObject(1, linkPara);
- }
-
- rs = pstmt.executeQuery();
- loadEmbedded(rs, relatedInfo);
- }
- catch (Exception e)
- {
- log.log(Level.WARNING, sql.toString(), e);
- }
- finally
- {
- DB.close(rs, pstmt);
- rs = null; pstmt = null;
- }
- } // refresh
-
- protected void refresh(EmbedWinInfo relatedInfo){
+ protected void reset(EmbedWinInfo relatedInfo){
if (relatedInfo.getInfoTbl() != null){
if (((WListbox)relatedInfo.getInfoTbl()).getModel() != null)
((WListbox)relatedInfo.getInfoTbl()).getModel().clear();
@@ -1946,38 +2008,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
((WListbox)relatedInfo.getInfoTbl()).clear();
}
}
-
- /**
- * @author xolali IDEMPIERE-1045
- * loadEmbedded(ResultSet rs, EmbedWinInfo info)
- */
- public void loadEmbedded(ResultSet rs, EmbedWinInfo info) throws SQLException{
-
- ListModelTable model;
- ArrayList list = new ArrayList();
- list = getInfoColumnslayout(info.getInfowin());
-
- // Convert ArrayList to Array
- ColumnInfo[] s_layoutEmbedded = new ColumnInfo[list.size()];
- list.toArray(s_layoutEmbedded);
- List data = new ArrayList();
- ArrayList lines = new ArrayList();
-
- while (rs.next())
- {
- try {
- data = readData(rs, s_layoutEmbedded);
- } catch (SQLException e) {
- //Xolali - Auto-generated catch block
- e.printStackTrace();
- }
- lines.add(data);
- }
- model = new ListModelTable(lines);
-
- WListbox content = (WListbox) info.getInfoTbl();
- content.setData(model, null);
- }
/**
* @author xolali IDEMPIERE-1045
@@ -2005,80 +2035,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
return gridField;
}
- protected ArrayList readData(ResultSet rs, ColumnInfo[] p_layout) throws SQLException {
-
- int colOffset = 1; // columns start with 1
- ArrayList data = new ArrayList();
- for (int col = 0; col < p_layout.length; col++)
- {
- Object value = null;
- Class> c = p_layout[col].getColClass();
- int colIndex = col + colOffset;
- if (c == IDColumn.class)
- {
- value = new IDColumn(rs.getInt(colIndex));
- }
- else if (c == Boolean.class)
- value = new Boolean("Y".equals(rs.getString(colIndex)));
- else if (c == Timestamp.class)
- value = rs.getTimestamp(colIndex);
- else if (c == BigDecimal.class)
- value = rs.getBigDecimal(colIndex);
- else if (c == Double.class)
- value = new Double(rs.getDouble(colIndex));
- else if (c == Integer.class)
- value = new Integer(rs.getInt(colIndex));
- else if (c == KeyNamePair.class)
- {
- if (p_layout[col].isKeyPairCol())
- {
- String display = rs.getString(colIndex);
- int key = rs.getInt(colIndex+1);
- if (! rs.wasNull()) {
- value = new KeyNamePair(key, display);
- }
- colOffset++;
- }
- else
- {
- int key = rs.getInt(colIndex);
- if (! rs.wasNull()) {
- WEditor editor = editorMap.get(p_layout[col].getColSQL()); // rework this, it will fail
- if (editor != null)
- {
- editor.setValue(key);
- value = new KeyNamePair(key, editor.getDisplayTextForGridView(key));
- }
- else
- {
- value = new KeyNamePair(key, Integer.toString(key));
- }
- }
- }
- }
- else if (c == ValueNamePair.class)
- {
- String key = rs.getString(colIndex);
- WEditor editor = editorMap.get(p_layout[col].getColSQL());
- if (editor != null)
- {
- value = new ValueNamePair(key, editor.getDisplayTextForGridView(key));
- }
- else
- {
- value = new ValueNamePair(key, key);
- }
- }
- else
- {
- value = rs.getString(colIndex);
- }
- data.add(value);
- }
-
- return data;
- }
-
/**
* {@inheritDoc}
@@ -2093,7 +2049,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
// cancel editor not display
if (wEditor == null || !wEditor.isVisible() || wEditor.getGridField() == null){
continue;
-}
+ }
isValid = isValid & validateField (wEditor);
}
@@ -2193,5 +2149,504 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
}
}
}
+
+ // Edit Callback method and original values management
+
+ public Properties getRowaAsCtx(int row, int editingColumn, Object editingValue)
+ {
+ ListModelTable model = contentPanel.getModel();
+ Properties ctx = new Properties(Env.getCtx()); // Allow session values
+
+ // Parameter dditors
+
+ for(WEditor e:editors)
+ {
+ Object val = e.getValue();
+ String column = e.getColumnName();
+
+ if(val != null)
+ {
+ if(val instanceof Integer)
+ Env.setContext(ctx, 0, column, (Integer)val);
+ else if(val instanceof Timestamp)
+ Env.setContext(ctx, 0, column, (Timestamp)val);
+ else if(val instanceof Boolean)
+ Env.setContext(ctx, 0, column, (Boolean)val);
+ else
+ Env.setContext(ctx, 0, column, val.toString());
+ }
+ }
+
+ for(int i=0; i < p_layout.length; i++)
+ {
+ String column = p_layout[i].getColumnName();
+
+ Object val = null;
+
+ if(i != editingColumn)
+ val = model.getValueAt(row, i);
+ else
+ val = editingValue;
+
+ // Get id from 'complex' types
+
+ if(val != null)
+ {
+ if(val instanceof IDColumn)
+ {
+ IDColumn idc = (IDColumn)val;
+ val = idc.getRecord_ID();
+ }
+ else if(val instanceof KeyNamePair)
+ {
+ KeyNamePair knp = (KeyNamePair)val;
+ val = knp.getKey();
+ }
+
+ if(val instanceof Integer)
+ Env.setContext(ctx, 0, column, (Integer)val);
+ else if(val instanceof Timestamp)
+ Env.setContext(ctx, 0, column, (Timestamp)val);
+ else if(val instanceof Boolean)
+ Env.setContext(ctx, 0, column, (Boolean)val);
+ else
+ Env.setContext(ctx, 0, column, val.toString());
+ }
+ }
+
+ return ctx;
+ }
+
+ public void onCellEditCallback(ValueChangeEvent event, int rowIndex, int colIndex, WEditor editor, GridField field)
+ {
+ Object val = event.getNewValue();
+
+ if(val != null && columnInfos[colIndex].getColClass().equals(KeyNamePair.class))
+ {
+ Integer iVal = (Integer)val;
+ String display = editor.getDisplay();
+
+ KeyNamePair kdc = new KeyNamePair(iVal, display);
+ val = kdc;
+ }
+
+ MInfoColumn infoColumn = infoColumns[colIndex - 1];
+ boolean changeIsValid = true;
+ String validationSQL = null;
+
+ if(!Util.isEmpty(infoColumn.getInputFieldValidation(), true)) // Run validation
+ {
+ changeIsValid = false;
+
+ Properties ctx = getRowaAsCtx(rowIndex, colIndex, val);
+
+ String rawSQL = infoColumn.getInputFieldValidation();
+ validationSQL = Env.parseContext(ctx, 0, rawSQL, false);
+
+ try
+ {
+ List> errors = DB.getSQLArrayObjectsEx(null, validationSQL);
+
+ if(errors != null && errors.size() > 0)
+ {
+ StringBuilder sbError = new StringBuilder();
+ for(List line:errors)
+ {
+ if(line.size() > 0)
+ {
+ if(sbError.length() > 0)
+ sbError.append('\n');
+
+ sbError.append(line.get(0));
+ }
+ }
+
+ String msg = Msg.translate(ctx, sbError.toString());
+ FDialog.error(0, this, "ValidationError", msg); // TODO messaggio
+ }
+ else
+ changeIsValid = true;
+ }
+ catch(Exception e)
+ {
+ log.log(Level.SEVERE, "Error executing validation SQL: " + validationSQL, e);
+
+ FDialog.error(0, this, "Error", validationSQL); // TODO messaggio
+ changeIsValid = false;
+ }
+ }
+
+ if(changeIsValid)
+ {
+ // Editing a row delesects it, make sure it stays selected
+
+ ListModelTable model = contentPanel.getModel();
+ Object row = model.get(rowIndex);
+
+ // Since the row object is a collection, we can update it safely, but the hash code will be different from the one stored
+ // in the selection. So we need to remove and re-add the row after to keep the selection in sync
+
+ model.removeFromSelection(row);
+ contentPanel.setValueAt(val, rowIndex, colIndex);
+ model.addToSelection(row);
+
+ Clients.resize(contentPanel);
+ }
+ else
+ {
+ editor.setValue(event.getOldValue());
+ }
+ }
+
+ protected void restoreOriginalValues(int rowIndex)
+ {
+ Integer viewIdKey = getColumnValue(rowIndex);
+
+ if(cacheOriginalValues.containsKey(viewIdKey)) // Only cache if not cached to avoid caching subsequent modifications
+ {
+ int colCount = contentPanel.getColumnCount();
+ List row = cacheOriginalValues.get(viewIdKey);
+
+ for(int i=1; i < colCount; i++) // Skip first row (selection)
+ {
+ Object val = row.get(i-1);
+ contentPanel.setValueAt(val, rowIndex, i);
+ }
+ }
+ }
+
+ protected void cacheOriginalValues(int rowIndex)
+ {
+ Integer viewIdKey = getColumnValue(rowIndex);
+
+ if(cacheOriginalValues.containsKey(viewIdKey) == false) // Only cache if not cached to avoid caching subsequent modifications
+ {
+ int colCount = contentPanel.getColumnCount();
+ List row = new ArrayList<>();
+
+ for(int i=1; i < colCount; i++) // Skip first row (selection)
+ {
+ Object val = contentPanel.getValueAt(rowIndex, i);
+ row.add(val);
+ }
+
+ cacheOriginalValues.put(viewIdKey, row);
+ }
+ }
+
+ @Override
+ public void tableChanged(WTableModelEvent event)
+ {
+ // Manage cache of values
+
+ if(hasEditable && event.getColumn() == 0)
+ {
+ for(int row=event.getFirstRow(); row <= event.getLastRow(); row++)
+ {
+ Object col0 = contentPanel.getValueAt(row, 0);
+
+ if(col0 instanceof IDColumn)
+ {
+ IDColumn idc = (IDColumn)col0;
+
+ if(idc.isSelected())
+ {
+ cacheOriginalValues(row);
+ }
+ else
+ {
+ restoreOriginalValues(row);
+ }
+ }
+ }
+
+ Clients.resize(contentPanel);
+ }
+
+ super.tableChanged(event);
+ }
+
+ @Override
+ public void onQueryCallback(Event event)
+ {
+ super.onQueryCallback(event);
+
+ enableExportButton();
+ }
+
+
+ @Override
+ protected void updateListSelected()
+ {
+ if(hasEditable)
+ {
+ temporarySelectedData = new HashMap<>();
+
+ // The list contents (rows) will be cleared during query, so we need a backup to restore the in-edit data
+
+ ListModelTable model = contentPanel.getModel();
+
+ for(int rowIndex:contentPanel.getSelectedIndices())
+ {
+ Integer keyViewValue = getColumnValue(rowIndex);
+ @SuppressWarnings("unchecked")
+ List row = (List)model.get(rowIndex);
+
+ ArrayList clonedRow = new ArrayList<>(row);
+ temporarySelectedData.put(keyViewValue, clonedRow);
+ }
+
+ for(Entry> entry: recordSelectedData.entrySet())
+ {
+ ArrayList clonedRow = new ArrayList<>(entry.getValue());
+ temporarySelectedData.put(entry.getKey(), clonedRow);
+ }
+ }
+
+ super.updateListSelected();
+ }
+
+ @Override
+ protected void restoreSelectedInPage()
+ {
+ super.restoreSelectedInPage();
+
+ if(temporarySelectedData != null)
+ {
+ temporarySelectedData.clear();
+ temporarySelectedData = null;
+ }
+ }
+
+
+ @Override
+ public boolean onRestoreSelectedItemIndexInPage(Integer keyViewValue, int rowIndex, Object oRow)
+ {
+ if(hasEditable && temporarySelectedData != null)
+ {
+
+ cacheOriginalValues(rowIndex);
+
+ int gridFieldsOffset = 1; // First column is the id, and its not on the infoColumns
+
+ @SuppressWarnings("unchecked")
+ List row = (List)oRow;
+ List originalSelectedRow = temporarySelectedData.get(keyViewValue);
+ ListModelTable model = contentPanel.getModel();
+
+ // While restoring values we dong want to trigger listeners
+ model.removeTableModelListener(this);
+
+ for(int i=0; i < infoColumns.length; i++)
+ {
+ if(infoColumns[i].isReadOnly() == false) // Only replace editable column, in case some other data changed on db
+ {
+ int colIndex = i + gridFieldsOffset;
+ Object obj = originalSelectedRow.get(colIndex);
+ model.setValueAt( obj, rowIndex, colIndex);
+ }
+ }
+
+ // Restore isSelected status on IDColumn
+ Object id = (IDColumn)row.get(0);
+
+ if(id instanceof IDColumn)
+ {
+ IDColumn idc = (IDColumn)id;
+ idc.setSelected(true);
+ }
+
+ // Restore listners
+ model.addTableModelListener(this);
+ }
+
+ return super.onRestoreSelectedItemIndexInPage(keyViewValue, rowIndex, oRow);
+ }
+
+ // F3P: Export function
+
+ protected void initExport()
+ {
+ exportButton = ButtonFactory.createNamedButton("Export", false, true);
+ exportButton.setId("Export");
+ exportButton.setEnabled(false);
+ exportButton.addEventListener(Events.ON_CLICK, new XlsExportAction());
+
+ confirmPanel.addComponentsLeft(exportButton);
+ }
+
+ protected void enableExportButton()
+ {
+ if(exportButton == null)
+ return;
+
+ exportButton.setEnabled(contentPanel.getRowCount() > 0);
+ }
+
+ private class XlsExportAction implements EventListener
+ {
+ @Override
+ public void onEvent(Event evt) throws Exception
+ {
+ if(evt.getTarget() == exportButton)
+ {
+ XlsExporter exporter = new XlsExporter();
+
+ exporter.doExport();
+ }
+ }
+ }
+
+ private class XlsExporter extends AbstractExcelExporter
+ {
+ private ResultSet m_rs = null;
+ private int rowCount = -1;
+ private int currentRow = -1;
+
+ public void doExport() throws Exception
+ {
+ int originalCount = m_count;
+
+ String dataSql = buildDataSQL(0, 0);
+
+ File file = File.createTempFile("Export", ".xls");
+
+ testCount();
+
+ rowCount = m_count;
+ m_count = originalCount;
+
+ if(rowCount > 0)
+ {
+ PreparedStatement pstmt = null;
+ Trx trx = null;
+
+ try
+ {
+ String trxName = Trx.createTrxName("InfoPanelLoad:");
+ trx = Trx.get(trxName, true);
+ trx.setDisplayName(getClass().getName()+"_exportXls");
+ pstmt = DB.prepareStatement(dataSql, trxName);
+ setParameters (pstmt, false); // no count
+
+ pstmt.setFetchSize(100);
+ m_rs = pstmt.executeQuery();
+
+ export(file, null);
+ }
+ catch(SQLException e)
+ {
+ log.log(Level.SEVERE, dataSql, e);
+ }
+ finally
+ {
+ DB.close(m_rs, pstmt);
+ trx.close();
+
+ m_rs = null;
+ currentRow = -1;
+ }
+
+ AMedia media = null;
+ media = new AMedia(file.getName(), null, "application/vnd.ms-excel", file, true);
+ Filedownload.save(media);
+ }
+ }
+
+ @Override
+ public boolean isFunctionRow()
+ {
+ return false;
+ }
+
+ @Override
+ public int getColumnCount()
+ {
+ return columnInfos.length;
+ }
+
+ @Override
+ public int getRowCount()
+ {
+ return rowCount;
+ }
+
+ @Override
+ protected void setCurrentRow(int row)
+ {
+ if(row > currentRow)
+ {
+ try
+ {
+ m_rs.next();
+ currentRow = row;
+ }
+ catch(SQLException e)
+ {
+ throw new AdempiereException(e);
+ }
+ }
+ }
+
+ @Override
+ protected int getCurrentRow()
+ {
+ return currentRow;
+ }
+
+ @Override
+ public boolean isColumnPrinted(int col)
+ {
+ return (columnInfos[col].getGridField() != null);
+ }
+
+ @Override
+ public String getHeaderName(int col)
+ {
+ return columnInfos[col].getColHeader();
+ }
+
+ @Override
+ public int getDisplayType(int row, int col)
+ {
+ int displayType = -1;
+ GridField gridField = columnInfos[col].getGridField();
+ displayType = gridField.getDisplayType();
+
+ return displayType;
+ }
+
+ @Override
+ public Object getValueAt(int row, int col)
+ {
+ Object val = null;
+
+ try
+ {
+ val = m_rs.getObject(col + 1); // Col are zero-based, while resultset col are 1 based
+ }
+ catch(SQLException e)
+ {
+ throw new AdempiereException(e);
+ }
+
+ GridField gridField = columnInfos[col].getGridField();
+
+ Lookup lookup = gridField.getLookup();
+
+ if (lookup != null)
+ {
+ val = lookup.getDisplay(val);
+ }
+
+ return val;
+ }
+
+ @Override
+ public boolean isPageBreak(int row, int col)
+ {
+ return false;
+ }
+ }
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/RelatedInfoWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/RelatedInfoWindow.java
new file mode 100644
index 0000000000..8cdd578352
--- /dev/null
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/info/RelatedInfoWindow.java
@@ -0,0 +1,587 @@
+/******************************************************************************
+ * Project: Trek Global ERP *
+ * Copyright (C) 2009-2018 Trek Global Corporation *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.adempiere.webui.info;
+
+import java.math.BigDecimal;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+
+import org.adempiere.webui.component.ListModelTable;
+import org.adempiere.webui.component.WListItemRenderer;
+import org.adempiere.webui.component.WListbox;
+import org.adempiere.webui.editor.WEditor;
+import org.compiere.minigrid.ColumnInfo;
+import org.compiere.minigrid.EmbedWinInfo;
+import org.compiere.minigrid.IDColumn;
+import org.compiere.model.MSysConfig;
+import org.compiere.util.CLogger;
+import org.compiere.util.DB;
+import org.compiere.util.KeyNamePair;
+import org.compiere.util.Trx;
+import org.compiere.util.Util;
+import org.compiere.util.ValueNamePair;
+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.Paging;
+import org.zkoss.zul.event.PagingEvent;
+import org.zkoss.zul.event.ZulEvents;
+import org.zkoss.zul.ext.Sortable;
+
+/**
+ * @author hengsin
+ *
+ */
+public class RelatedInfoWindow implements EventListener, Sortable{
+
+ private final static int DEFAULT_PAGE_PRELOAD = 4;
+
+ private EmbedWinInfo info;
+
+ private int m_count;
+ private int pageNo;
+ private List cache;
+ private int cacheStart;
+ private int cacheEnd;
+ private Object parentId;
+ protected Paging paging;
+ protected Map editorMap = new HashMap();
+ private InfoWindow parentInfoWindow;
+
+ protected CLogger log = CLogger.getCLogger(getClass());
+
+ private ListModelTable model;
+
+ private String m_sqlUserOrder;
+ private boolean m_useDatabasePaging = false;
+
+ private String m_infoSqlCount;
+ protected int numPagePreLoad = MSysConfig.getIntValue(MSysConfig.ZK_INFO_NUM_PAGE_PRELOAD, DEFAULT_PAGE_PRELOAD);
+ protected boolean isHasNextPage = false;
+
+ private ColumnInfo[] columnsLayout;
+
+ /**
+ * @param infoWindow
+ * @param embeddedPaging
+ * @param layoutEmbedded
+ *
+ */
+ public RelatedInfoWindow(EmbedWinInfo info, InfoWindow infoWindow, Paging embeddedPaging, String infoSqlCount, ColumnInfo[] layoutEmbedded) {
+ this.info = info;
+ parentInfoWindow = infoWindow;
+ this.paging = embeddedPaging;
+ m_infoSqlCount = infoSqlCount;
+
+ columnsLayout = layoutEmbedded;
+ }
+
+ public void refresh(Object id) {
+ parentId = id;
+
+
+ cache = null;
+ cacheStart = cacheEnd = 0;
+
+ if (info.getInfowin().isLoadPageNum()) {
+ testCount();
+ } else {
+ m_count = Integer.MAX_VALUE;
+ }
+ m_useDatabasePaging = (m_count > 1000 || m_count > (parentInfoWindow.getPageSize()*4));
+
+ renderItems();
+ }
+
+ private void testCount() {
+ m_count = 0;
+ Object linkPara = null;
+ if (parentId != null && parentId instanceof IDColumn){
+ IDColumn ID = (IDColumn) parentId;
+ linkPara = ID.getRecord_ID();
+ }else if (parentId != null){
+ linkPara = parentId.toString();
+ }
+ if (linkPara != null) {
+ if (info.getTypeDataOfLink().equals(String.class)){
+ m_count = DB.getSQLValue((String)null, m_infoSqlCount, (String)linkPara);
+ }else if (info.getTypeDataOfLink().equals(int.class)){
+ m_count = DB.getSQLValue((String)null, m_infoSqlCount, Integer.parseInt(linkPara.toString()));
+ }else{
+ m_count = DB.getSQLValue((String)null, m_infoSqlCount, linkPara);
+ }
+ }
+ }
+
+ private void renderItems() {
+ int pageSize = parentInfoWindow.getPageSize();
+ WListbox contentPanel = (WListbox) info.getInfoTbl();
+ if (m_count > 0)
+ {
+ if (m_count > pageSize && paging != null)
+ {
+ paging.setVisible(true);
+ paging.setPageSize(pageSize);
+ paging.setTotalSize(m_count);
+ paging.setDetailed(false);
+ paging.addEventListener(ZulEvents.ON_PAGING, this);
+
+ List subList = readLine(0, pageSize);
+ model = new ListModelTable(subList);
+ model.setSorter(this);
+ model.setMultiple(false);
+ contentPanel.setData(model, null);
+
+ pageNo = 0;
+ }
+ else
+ {
+ if (paging != null)
+ {
+ paging.setTotalSize(m_count);
+ paging.setActivePage(0);
+ paging.setVisible(false);
+ pageNo = 0;
+ }
+ model = new ListModelTable(readLine(0, -1));
+ model.setSorter(this);
+ model.setMultiple(false);
+ contentPanel.setData(model, null);
+ }
+ }
+ else
+ {
+ if (paging != null)
+ {
+ paging.setTotalSize(m_count);
+ paging.setActivePage(0);
+ paging.setVisible(false);
+ pageNo = 0;
+ }
+ model = new ListModelTable(new ArrayList());
+ model.setMultiple(false);
+ contentPanel.setData(model, null);
+ }
+ contentPanel.getParent().invalidate();
+ }
+
+ @Override
+ public void onEvent(Event event) throws Exception {
+ if (event.getTarget() == paging)
+ {
+ WListbox contentPanel = (WListbox) info.getInfoTbl();
+ int pageSize = parentInfoWindow.getPageSize();
+ int pgNo = paging.getActivePage();
+ if (pgNo == paging.getPageCount()-1 && !info.getInfowin().isLoadPageNum()) {
+ testCount();
+ paging.setTotalSize(m_count);
+ pgNo = paging.getActivePage();
+ }
+
+ if (pageNo != pgNo)
+ {
+
+ contentPanel.clearSelection();
+
+ pageNo = pgNo;
+ int start = pageNo * pageSize;
+ int end = getOverIntValue ((long)start + pageSize, 1);
+ if (end >= m_count)
+ end = m_count;
+ List subList = readLine(start, end);
+ model = new ListModelTable(subList);
+ model.setSorter(this);
+ model.setMultiple(false);
+ contentPanel.setData(model, null);
+
+ contentPanel.setSelectedIndex(0);
+ }
+ }
+ }
+
+ /**
+ * @return the cacheStart
+ */
+ protected int getCacheStart() {
+ return cacheStart;
+ }
+
+ /**
+ * @param cacheStart the cacheStart to set
+ */
+ private void setCacheStart(int cacheStart) {
+ this.cacheStart = cacheStart;
+ }
+
+ /**
+ * @return the cacheEnd
+ */
+ protected int getCacheEnd() {
+ return cacheEnd;
+ }
+
+ private List getSubList (int fromIndex, int toIndex, List line){
+ if (toIndex > line.size())
+ toIndex = line.size();
+
+ if (fromIndex >= line.size())
+ fromIndex = line.size();
+
+ // case line.size = 0
+ if (fromIndex < 0)
+ fromIndex = 0;
+
+ return line.subList(fromIndex, toIndex);
+ }
+
+ /**
+ * when calculator value at bound, sometime value is overflow by data type
+ * this function calculator at high type for avoid it
+ * @param overValue
+ * @return
+ */
+ private int getOverIntValue (long overValue){
+ return getOverIntValue (overValue, 0);
+ }
+
+ /**
+ * see {@link #getOverIntValue(long)}. when value over max_value set it near max_value.
+ * @param overValue
+ * @param extra
+ * @return
+ */
+ private int getOverIntValue (long overValue, int extra){
+ if (overValue >= Integer.MAX_VALUE)
+ overValue = Integer.MAX_VALUE - extra;
+
+ return (int)overValue;
+ }
+
+ private List readLine(int start, int end) {
+ int pageSize = parentInfoWindow.getPageSize();
+
+ //cacheStart & cacheEnd - 1 based index, start & end - 0 based index
+ if (getCacheStart() >= 1 && cacheEnd > getCacheStart())
+ {
+ if (m_useDatabasePaging)
+ {
+ if (start+1 >= getCacheStart() && end+1 <= cacheEnd)
+ {
+ return end == -1 ? cache : getSubList(start-getCacheStart()+1, end-getCacheStart()+1, cache);
+ }
+ }
+ else
+ {
+ if (end >= cacheEnd || end <= 0)
+ {
+ end = cacheEnd;
+ }
+ return getSubList (start, end, cache);
+ }
+ }
+
+ setCacheStart(getOverIntValue((long)start + 1 - (pageSize * numPagePreLoad)));
+ if (getCacheStart() <= 0)
+ setCacheStart(1);
+
+ if (end == -1)
+ {
+ cacheEnd = m_count;
+ }
+ else
+ {
+ cacheEnd = getOverIntValue(end + 1 + (pageSize * numPagePreLoad));
+ if (cacheEnd > m_count)
+ cacheEnd = m_count;
+ }
+
+ cache = new ArrayList();
+
+ PreparedStatement m_pstmt = null;
+ ResultSet m_rs = null;
+ String dataSql = null;
+
+ long startTime = System.currentTimeMillis();
+ dataSql = info.getInfoSql();
+ if (!Util.isEmpty(m_sqlUserOrder)) {
+ dataSql = dataSql + m_sqlUserOrder;
+ }
+ isHasNextPage = false;
+ if (log.isLoggable(Level.FINER))
+ log.finer(dataSql);
+ Trx trx = null;
+ try
+ {
+ //https://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor
+ String trxName = Trx.createTrxName("RelatedInfoLoad:");
+ trx = Trx.get(trxName, true);
+ trx.setDisplayName(getClass().getName()+"_readLine");
+ m_pstmt = DB.prepareStatement(dataSql, trxName);
+ Object linkPara = null;
+ if (parentId != null && parentId instanceof IDColumn){
+ IDColumn ID = (IDColumn) parentId;
+ linkPara = ID.getRecord_ID();
+ }else if (parentId != null){
+ linkPara = parentId.toString();
+ }
+ if (info.getTypeDataOfLink().equals(String.class)){
+ m_pstmt.setString(1, (String)linkPara);
+ }else if (info.getTypeDataOfLink().equals(int.class)){
+ m_pstmt.setInt(1, Integer.parseInt(linkPara.toString()));
+
+ }else{
+ m_pstmt.setObject(1, linkPara);
+ }
+ if (log.isLoggable(Level.FINE))
+ log.fine("Start query - " + (System.currentTimeMillis()-startTime) + "ms");
+ m_pstmt.setFetchSize(100);
+ m_rs = m_pstmt.executeQuery();
+ if (log.isLoggable(Level.FINE))
+ log.fine("End query - " + (System.currentTimeMillis()-startTime) + "ms");
+ //skips the row that we dont need if we can't use native db paging
+ if (end > start && m_useDatabasePaging && !DB.getDatabase().isPagingSupported())
+ {
+ for (int i = 0; i < getCacheStart() - 1; i++)
+ {
+ if (!m_rs.next())
+ break;
+ }
+ }
+
+ int rowPointer = getCacheStart()-1;
+ while (m_rs.next())
+ {
+ rowPointer++;
+ cache.add(readData(m_rs));
+ //check now of rows loaded, break if we hit the suppose end
+ if (m_useDatabasePaging && rowPointer >= cacheEnd)
+ {
+ isHasNextPage = true;
+ break;
+ }
+ }
+ }
+
+ catch (SQLException e)
+ {
+ log.log(Level.SEVERE, dataSql, e);
+ }
+
+ finally
+ {
+ DB.close(m_rs, m_pstmt);
+ if (trx != null)
+ trx.close();
+ }
+
+ if (end > cacheEnd || end <= 0)
+ {
+ end = cacheEnd;
+ }
+ validateEndPage ();
+
+ if (end == -1)
+ {
+ return cache;
+ }
+ else
+ {
+ int fromIndex = start-getCacheStart()+1;
+ int toIndex = end-getCacheStart()+1;
+ return getSubList(fromIndex, toIndex, cache);
+ }
+ }
+
+ private ArrayList readData(ResultSet rs) throws SQLException {
+
+ int colOffset = 1; // columns start with 1
+ ArrayList data = new ArrayList();
+ for (int col = 0; col < columnsLayout.length; col++)
+ {
+ Object value = null;
+ Class> c = columnsLayout[col].getColClass();
+ int colIndex = col + colOffset;
+ if (c == IDColumn.class)
+ {
+ value = new IDColumn(rs.getInt(colIndex));
+ }
+ else if (c == Boolean.class)
+ value = new Boolean("Y".equals(rs.getString(colIndex)));
+ else if (c == Timestamp.class)
+ value = rs.getTimestamp(colIndex);
+ else if (c == BigDecimal.class)
+ value = rs.getBigDecimal(colIndex);
+ else if (c == Double.class)
+ value = new Double(rs.getDouble(colIndex));
+ else if (c == Integer.class)
+ value = new Integer(rs.getInt(colIndex));
+ else if (c == KeyNamePair.class)
+ {
+ if (columnsLayout[col].isKeyPairCol())
+ {
+ String display = rs.getString(colIndex);
+ int key = rs.getInt(colIndex+1);
+ if (! rs.wasNull()) {
+ value = new KeyNamePair(key, display);
+ }
+ colOffset++;
+ }
+ else
+ {
+ int key = rs.getInt(colIndex);
+ if (! rs.wasNull()) {
+ WEditor editor = editorMap.get(columnsLayout[col].getColSQL()); // rework this, it will fail
+ if (editor != null)
+ {
+ editor.setValue(key);
+ value = new KeyNamePair(key, editor.getDisplayTextForGridView(key));
+ }
+ else
+ {
+ value = new KeyNamePair(key, Integer.toString(key));
+ }
+ }
+ }
+ }
+ else if (c == ValueNamePair.class)
+ {
+ String key = rs.getString(colIndex);
+ WEditor editor = editorMap.get(columnsLayout[col].getColSQL());
+ if (editor != null)
+ {
+ value = new ValueNamePair(key, editor.getDisplayTextForGridView(key));
+ }
+ else
+ {
+ value = new ValueNamePair(key, key);
+ }
+ }
+ else
+ {
+ value = rs.getString(colIndex);
+ }
+ data.add(value);
+ }
+
+ return data;
+ }
+
+ @Override
+ public void sort(Comparator cmpr, boolean ascending) {
+
+ WListItemRenderer.ColumnComparator lsc = (WListItemRenderer.ColumnComparator) cmpr;
+ if (m_useDatabasePaging)
+ {
+ int col = lsc.getColumnIndex();
+ String colsql = columnsLayout[col].getColSQL().trim();
+ int lastSpaceIdx = colsql.lastIndexOf(" ");
+ if (lastSpaceIdx > 0)
+ {
+ String tmp = colsql.substring(0, lastSpaceIdx).trim();
+ char last = tmp.charAt(tmp.length() - 1);
+ if (tmp.toLowerCase().endsWith("as"))
+ {
+ colsql = colsql.substring(lastSpaceIdx).trim();
+ }
+ else if (!(last == '*' || last == '-' || last == '+' || last == '/' || last == '>' || last == '<' || last == '='))
+ {
+ tmp = colsql.substring(lastSpaceIdx).trim();
+ if (tmp.startsWith("\"") && tmp.endsWith("\""))
+ {
+ colsql = colsql.substring(lastSpaceIdx).trim();
+ }
+ else
+ {
+ boolean hasAlias = true;
+ for(int i = 0; i < tmp.length(); i++)
+ {
+ char c = tmp.charAt(i);
+ if (Character.isLetterOrDigit(c))
+ {
+ continue;
+ }
+ else
+ {
+ hasAlias = false;
+ break;
+ }
+ }
+ if (hasAlias)
+ {
+ colsql = colsql.substring(lastSpaceIdx).trim();
+ }
+ }
+ }
+ }
+ m_sqlUserOrder = " ORDER BY " + colsql;
+ if (!ascending)
+ m_sqlUserOrder += " DESC ";
+ refresh(parentId);
+ }
+ else
+ {
+ Collections.sort(cache, lsc);
+ renderItems();
+ }
+ }
+
+ @Override
+ public String getSortDirection(Comparator cmpr) {
+ return "natural";
+ }
+
+ /**
+ * after query from database, process validate.
+ * if end page include in cache, process calculate total record
+ * if current page is out of page (no record is query) process query count to detect end page
+ */
+ protected void validateEndPage (){
+ if (paging == null || info.getInfowin().isLoadPageNum())
+ return;
+
+ if (!isHasNextPage){
+ int pageSize = parentInfoWindow.getPageSize();
+ int extraPage = ((cache.size() % pageSize > 0)?1:0);
+ int pageInCache = cache.size() / pageSize + extraPage;
+
+ if (pageInCache == 0 || pageInCache <= numPagePreLoad){
+ // selected page is out of page
+ testCount();
+ extraPage = ((m_count % pageSize > 0)?1:0);
+ pageInCache = m_count / pageSize + extraPage;
+ // this one will set current page to end page
+ paging.setTotalSize(m_count);
+ if (m_count <= pageSize)
+ paging.setVisible(false);
+ Event pagingEvent = new PagingEvent("onPaging", paging, paging.getPageCount() - 1);
+ Events.postEvent(pagingEvent);
+ }else if (pageInCache > numPagePreLoad){
+ // current page isn't end page. but page in cache has end page.
+ int prePage = pageNo - numPagePreLoad;
+ int readTotalRecord = (prePage > 0?prePage:0) * pageSize + cache.size();
+ paging.setTotalSize(readTotalRecord);
+ m_count = readTotalRecord;
+ }
+ }
+ }
+}
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.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java
index 316269aea5..6bfe7fcbde 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java
@@ -383,6 +383,8 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
{
m_queryColumns.add(rs.getString(1));
String columnSql = rs.getString(4);
+ if (columnSql != null && columnSql.length() > 0 && columnSql.contains("@"))
+ columnSql = "NULL";
if (columnSql != null && columnSql.contains("@"))
columnSql = Env.parseContext(Env.getCtx(), -1, columnSql, false, true);
String qualified = p_tableName+"."+rs.getString(1);
@@ -462,11 +464,13 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
boolean isDisplayed = rs.getString(4).equals("Y");
int AD_Reference_Value_ID = rs.getInt(5);
String columnSql = rs.getString(6);
- int AD_Column_ID = rs.getInt(7);
+ if (columnSql != null && columnSql.length() > 0 && columnSql.contains("@"))
+ columnSql = "NULL";
if (columnSql != null && columnSql.contains("@"))
columnSql = Env.parseContext(Env.getCtx(), -1, columnSql, false, true);
if (columnSql == null || columnSql.length() == 0)
columnSql = tableName+"."+columnName;
+ int AD_Column_ID = rs.getInt(7);
// Default
StringBuffer colSql = new StringBuffer(columnSql);
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributePanel.java
index 83e599922b..887da69781 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributePanel.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributePanel.java
@@ -30,6 +30,7 @@ import org.adempiere.webui.component.NumberBox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window;
+import org.adempiere.webui.editor.WDateEditor;
import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.editor.WStringEditor;
import org.adempiere.webui.util.ZKUpdateUtil;
@@ -303,6 +304,10 @@ public class InfoPAttributePanel extends Window implements EventListener
{
field = new WNumberEditor(name, false, false, true, DisplayType.Number, name).getComponent();
}
+ else if(MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attributeValueType))
+ {
+ field = new WDateEditor(name, false, false, true, name).getComponent();
+ }
else
{
field = new WStringEditor(name, false, false, true, 10, 40, null, null).getComponent();
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java
index 136ffb586a..ee414959aa 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java
@@ -17,6 +17,7 @@
package org.adempiere.webui.panel;
+import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -26,8 +27,10 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -89,7 +92,6 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.KeyEvent;
-import org.zkoss.zk.ui.event.MouseEvent;
import org.zkoss.zk.ui.event.SelectEvent;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Comboitem;
@@ -129,6 +131,7 @@ public abstract class InfoPanel extends Window implements EventListener,
// attribute key of info process
protected final static String ATT_INFO_PROCESS_KEY = "INFO_PROCESS";
protected int pageSize;
+ public LinkedHashMap> m_values = null;
protected MInfoRelated[] relatedInfoList;
// for test disable load all record when num of record < 1000
protected boolean isIgnoreCacheAll = true;
@@ -391,7 +394,7 @@ public abstract class InfoPanel extends Window implements EventListener,
private boolean m_useDatabasePaging = false;
private BusyDialog progressWindow;
// in case double click to item. this store clicked item (maybe it's un-select item)
- private Listitem m_lastOnSelectItem;
+ private int m_lastSelectedIndex = -1;
protected GridField m_gridfield;
/**
@@ -1348,14 +1351,28 @@ public abstract class InfoPanel extends Window implements EventListener,
if (recordSelectedData.containsKey(keyViewValue)){
// TODO: maybe add logic to check value of current record (focus only to viewKeys value) is same as value save in lsSelectedKeyValue
// because record can change by other user
- lsSelectionRecord.add(contentPanel.getModel().get(rowIndex));
+ Object row = contentPanel.getModel().get(rowIndex);
+
+ if(onRestoreSelectedItemIndexInPage(keyViewValue, rowIndex, row)) // F3P: provide an hook for operations on restored index
+ lsSelectionRecord.add(row);
}
}
contentPanel.getModel().setSelection(lsSelectionRecord);
}
-
+ /** Hook to intercept 'restore selection' actions
+ *
+ * @param keyViewValue row view key
+ * @param rowIndex row index
+ * @param row row
+ * @return false to skip restore selection
+ */
+ public boolean onRestoreSelectedItemIndexInPage(Integer keyViewValue, int rowIndex, Object row)
+ {
+ return true;
+ }
+
protected AdempiereException getKeyNullException (){
String errorMessage = String.format("has null value at column %1$s use as key of view in info window %2$s",
keyColumnOfView == null ? p_keyColumn : keyColumnOfView, infoWindow.getName());
@@ -1697,11 +1714,14 @@ public abstract class InfoPanel extends Window implements EventListener,
else if (event.getTarget() == contentPanel && event.getName().equals(Events.ON_SELECT))
{
setStatusSelected ();
- m_lastOnSelectItem = null;
+
SelectEvent, ?> selectEvent = (SelectEvent, ?>) event;
if (selectEvent.getReference() != null && selectEvent.getReference() instanceof Listitem)
- m_lastOnSelectItem = (Listitem) selectEvent.getReference();
- }else if (event.getTarget() == contentPanel && event.getName().equals("onAfterRender")){
+ {
+ Listitem m_lastOnSelectItem = (Listitem) selectEvent.getReference();
+ m_lastSelectedIndex = m_lastOnSelectItem.getIndex();
+ }
+ }else if (event.getTarget() == contentPanel && event.getName().equals("onAfterRender")){
//IDEMPIERE-1334 at this event selected item from listBox and model is sync
enableButtons();
}
@@ -1710,18 +1730,34 @@ public abstract class InfoPanel extends Window implements EventListener,
if (event.getClass().equals(MouseEvent.class)){
return;
}
- if (contentPanel.isMultiple()) {
- //un-select all selected column
- if (m_lastOnSelectItem != null){
- contentPanel.getModel().clearSelection();
- int clickItemIndex = contentPanel.getIndexOfItem(m_lastOnSelectItem);
- Object selectedItemModle = contentPanel.getModel().get(clickItemIndex);
- contentPanel.getModel().addToSelection(selectedItemModle);
- }
- // clean selected record in cache
- recordSelectedData.clear();
+ if (contentPanel.isMultiple() && m_lastSelectedIndex >= 0) {
+
+ contentPanel.setSelectedIndex(m_lastSelectedIndex);
+
+ model.clearSelection();
+ List lsSelectedItem = new ArrayList();
+ lsSelectedItem.add(model.getElementAt(m_lastSelectedIndex));
+ model.setSelection(lsSelectedItem);
+
+ int m_keyColumnIndex = contentPanel.getKeyColumnIndex();
+ for (int i = 0; i < contentPanel.getRowCount(); i++) {
+ // Find the IDColumn Key
+ Object data = contentPanel.getModel().getValueAt(i, m_keyColumnIndex);
+ if (data instanceof IDColumn) {
+ IDColumn dataColumn = (IDColumn) data;
+
+ if (i == m_lastSelectedIndex) {
+ dataColumn.setSelected(true);
+ }
+ else {
+ dataColumn.setSelected(false);
+ }
+ }
+ }
}
onDoubleClick();
+ contentPanel.repaint();
+ m_lastSelectedIndex = -1;
}
else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_REFRESH)))
{
@@ -1903,7 +1939,13 @@ public abstract class InfoPanel extends Window implements EventListener,
/**
* Update relate info when selection in main info change
*/
- protected void updateSubcontent (){};
+ protected void updateSubcontent (){ updateSubcontent(-1);};
+
+ /**
+ * Update relate info for a specific row, if targetRow < 0 update using selected row
+ */
+ protected void updateSubcontent (int targetRow){};
+
/**
* Reset parameter to default value or to empty value? implement at
@@ -1950,8 +1992,10 @@ public abstract class InfoPanel extends Window implements EventListener,
if (DialogEvents.ON_BEFORE_RUN_PROCESS.equals(event.getName())){
updateListSelected();
// store in T_Selection table selected rows for Execute Process that retrieves from T_Selection in code.
- DB.createT_SelectionNew(pInstanceID, getSaveKeys(getInfoColumnIDFromProcess(processModalDialog.getAD_Process_ID())),
- null);
+ DB.createT_SelectionNew(pInstanceID, getSaveKeys(getInfoColumnIDFromProcess(processModalDialog.getAD_Process_ID())),
+ null);
+ saveResultSelection(getInfoColumnIDFromProcess(processModalDialog.getAD_Process_ID()));
+ createT_Selection_InfoWindow(pInstanceID);
}else if (ProcessModalDialog.ON_WINDOW_CLOSE.equals(event.getName())){
if (processModalDialog.isCancel()){
//clear back
@@ -1975,6 +2019,147 @@ public abstract class InfoPanel extends Window implements EventListener,
});
}
+
+ /**
+ * save result values
+ */
+ protected void saveResultSelection(int infoColumnId) {
+ int m_keyColumnIndex = contentPanel.getKeyColumnIndex();
+ if (m_keyColumnIndex == -1) {
+ return;
+ }
+
+ m_values = new LinkedHashMap>();
+
+ if (p_multipleSelection) {
+
+ Map > selectedRow = getSelectedRowInfo();
+
+ // for selected rows
+ for (Entry> selectedInfo : selectedRow.entrySet())
+ {
+ // get key and viewID
+ Integer keyData = selectedInfo.getKey();
+ KeyNamePair kp = null;
+
+ if (infoColumnId > 0){
+ int dataIndex = columnDataIndex.get(infoColumnId) + p_layout.length;
+ Object viewIDValue = selectedInfo.getValue().get(dataIndex);
+ kp = new KeyNamePair(keyData, viewIDValue == null ? null : viewIDValue.toString());
+ }else{
+ kp = new KeyNamePair(keyData, null);
+ }
+
+ // get Data
+ LinkedHashMap values = new LinkedHashMap();
+ for(int col = 0 ; col < p_layout.length; col ++)
+ {
+ // layout has same columns as selectedInfo
+ if (!p_layout[col].isReadOnly())
+ values.put(p_layout[col].getColumnName(), selectedInfo.getValue().get(col));
+ }
+ if(values.size() > 0)
+ m_values.put(kp, values);
+ }
+ }
+ } // saveResultSelection
+
+ /**
+ * Insert result values
+ * @param AD_PInstance_ID
+ */
+ public void createT_Selection_InfoWindow(int AD_PInstance_ID)
+ {
+ StringBuilder insert = new StringBuilder();
+ insert.append("INSERT INTO T_Selection_InfoWindow (AD_PINSTANCE_ID, T_SELECTION_ID, COLUMNNAME , VALUE_STRING, VALUE_NUMBER , VALUE_DATE ) VALUES(?,?,?,?,?,?) ");
+ for (Entry> records : m_values.entrySet()) {
+ //set Record ID
+
+ LinkedHashMap fields = records.getValue();
+ for(Entry field : fields.entrySet())
+ {
+ List parameters = new ArrayList();
+ parameters.add(AD_PInstance_ID);
+
+ Object key = records.getKey();
+
+ if(key instanceof KeyNamePair)
+ {
+ KeyNamePair knp = (KeyNamePair)key;
+ parameters.add(knp.getKey());
+ }
+ else
+ {
+ parameters.add(key);
+ }
+
+ parameters.add(field.getKey());
+
+ Object data = field.getValue();
+ // set Values
+ if (data instanceof IDColumn)
+ {
+ IDColumn id = (IDColumn) data;
+ parameters.add(null);
+ parameters.add(id.getRecord_ID());
+ parameters.add(null);
+ }
+ else if (data instanceof String)
+ {
+ parameters.add(data);
+ parameters.add(null);
+ parameters.add(null);
+ }
+ else if (data instanceof BigDecimal || data instanceof Integer || data instanceof Double)
+ {
+ parameters.add(null);
+ if(data instanceof Double)
+ {
+ BigDecimal value = BigDecimal.valueOf((Double)data);
+ parameters.add(value);
+ }
+ else
+ parameters.add(data);
+ parameters.add(null);
+ }
+ else if (data instanceof Integer)
+ {
+ parameters.add(null);
+ parameters.add((Integer)data);
+ parameters.add(null);
+ }
+ else if (data instanceof Timestamp || data instanceof Date)
+ {
+ parameters.add(null);
+ parameters.add(null);
+ if(data instanceof Date)
+ {
+ Timestamp value = new Timestamp(((Date)data).getTime());
+ parameters.add(value);
+ }
+ else
+ parameters.add(data);
+ }
+ else if(data instanceof KeyNamePair)
+ {
+ KeyNamePair knpData = (KeyNamePair)data;
+
+ parameters.add(null);
+ parameters.add(knpData.getKey());
+ parameters.add(null);
+ }
+ else
+ {
+ parameters.add(data);
+ parameters.add(null);
+ parameters.add(null);
+ }
+ DB.executeUpdateEx(insert.toString(),parameters.toArray() , null);
+
+ }
+ }
+ } // createT_Selection_InfoWindow
+
/**
* Get InfoColumnID of infoProcess have processID is processId
* @param processId
@@ -2285,5 +2470,9 @@ public abstract class InfoPanel extends Window implements EventListener,
public void setGridfield(GridField m_gridfield) {
this.m_gridfield = m_gridfield;
}
+
+ public int getPageSize() {
+ return pageSize;
+ }
} // Info
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java
index 656c3b3a9a..b92ef2e7d8 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java
@@ -52,6 +52,7 @@ import org.compiere.util.KeyNamePair;
import org.compiere.util.Language;
import org.compiere.util.Login;
import org.compiere.util.Msg;
+import org.compiere.util.TimeUtil;
import org.compiere.util.Util;
import org.zkoss.zhtml.Table;
import org.zkoss.zhtml.Td;
@@ -84,7 +85,7 @@ public class RolePanel extends Window implements EventListener, Deferrabl
/**
*
*/
- private static final long serialVersionUID = 4068073033610726196L;
+ private static final long serialVersionUID = 372661654078492488L;
protected LoginWindow wndLogin;
protected Login login;
@@ -643,6 +644,20 @@ public class RolePanel extends Window implements EventListener, Deferrabl
return;
}
+ // See if a popup should encourage user to change its password
+ if (!MUser.get(Env.getCtx()).isNoPasswordReset()) {
+ int notifyDay = MSysConfig.getIntValue(MSysConfig.USER_LOCKING_PASSWORD_NOTIFY_DAY, 0);
+ int pwdAgeDay = MSysConfig.getIntValue(MSysConfig.USER_LOCKING_MAX_PASSWORD_AGE_DAY, 0);
+ if (notifyDay > 0 && pwdAgeDay > 0) {
+ Timestamp limit = TimeUtil.addDays(MUser.get(Env.getCtx()).getDatePasswordChanged(), pwdAgeDay);
+ Timestamp notifyAfter = TimeUtil.addDays(limit, -notifyDay);
+ Timestamp now = TimeUtil.getDay(null);
+
+ if (now.after(notifyAfter))
+ FDialog.warn(0, null, "", Msg.getMsg(Env.getCtx(), "YourPasswordWillExpireInDays", new Object[] {TimeUtil.getDaysBetween(now, limit)}));
+ }
+ }
+
wndLogin.loginCompleted();
// Elaine 2009/02/06 save preference to AD_Preference
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java
index 58710d4a7c..54ae512ed2 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java
@@ -373,7 +373,7 @@ public class FDialog
* @return true, if OK
*/
- public static boolean ask(String title, int windowNo, Component comp, String adMessage, final Callback callback)
+ public static boolean ask(String title, int windowNo, Component comp, String adMessage, final Callback callback, Object ... args)
{
Callback msgCallback = null;
if (callback != null)
@@ -386,7 +386,12 @@ public class FDialog
}
};
}
- String s = Msg.getMsg(Env.getCtx(), adMessage).replace("\n", "
");
+ String s;
+ if (args != null && args.length > 0)
+ s = Msg.getMsg(Env.getCtx(), adMessage, args);
+ else
+ s = Msg.getMsg(Env.getCtx(), adMessage);
+ s = s.replace("\n", "
");
int response = Messagebox.showDialog(s, title,
Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION, msgCallback, (msgCallback == null));
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java
index 53c8f370ec..f5f558cf30 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java
@@ -71,6 +71,7 @@ import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.factory.ButtonFactory;
+import org.adempiere.webui.panel.StatusBarPanel;
import org.adempiere.webui.part.MultiTabPart;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil;
@@ -93,7 +94,6 @@ import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
-import org.compiere.util.SecureEngine;
import org.compiere.util.Util;
import org.compiere.util.ValueNamePair;
import org.zkoss.zk.au.out.AuFocus;
@@ -112,6 +112,7 @@ import org.zkoss.zul.Datebox;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.North;
+import org.zkoss.zul.Separator;
import org.zkoss.zul.South;
import org.zkoss.zul.Space;
import org.zkoss.zul.Tab;
@@ -232,8 +233,14 @@ public class FindWindow extends Window implements EventListener, ValueCha
private Properties m_simpleCtx;
private Properties m_advanceCtx;
+ private int rowCount;
+
private static final String ON_POST_VISIBLE_ATTR = "onPostVisible.Event.Posted";
+ /** START DEVCOFFEE **/
+ private StatusBarPanel statusBar = new StatusBarPanel();
+ /** END DEVCOFFEE **/
+
/**
* FindPanel Constructor
* @param targetWindowNo targetWindowNo
@@ -344,6 +351,10 @@ public class FindWindow extends Window implements EventListener, ValueCha
btnNew.setId("btnNew");
btnNew.addEventListener(Events.ON_CLICK,this);
+ Button btnClear = ButtonFactory.createNamedButton(ConfirmPanel.A_RESET);
+ btnClear.setId("btnReset");
+ btnClear.addEventListener(Events.ON_CLICK,this);
+
Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
btnOk.setName("btnOkSimple");
btnOk.setId("btnOk");
@@ -362,6 +373,10 @@ public class FindWindow extends Window implements EventListener, ValueCha
Panel pnlButtonLeft = new Panel();
pnlButtonLeft.appendChild(btnNew);
+ Separator sep = new Separator("vertical");
+ sep.setWidth("2px");
+ pnlButtonLeft.appendChild(sep);
+ pnlButtonLeft.appendChild(btnClear);
ZKUpdateUtil.setHflex(pnlButtonLeft, "1");
Hbox hboxButton = new Hbox();
@@ -631,6 +646,9 @@ public class FindWindow extends Window implements EventListener, ValueCha
winMain.addTab(tabPanel, Msg.getMsg(Env.getCtx(), "Advanced").replaceAll("&", ""), false, false);
initSimple();
initAdvanced();
+ /** START DEVCOFFEE **/
+ layout.appendChild(statusBar);
+ /** START DEVCOFFEE **/
} // initPanel
@@ -672,7 +690,7 @@ public class FindWindow extends Window implements EventListener, ValueCha
mField.getVO().FieldLength = 32767; // a conservative max literal string - like oracle extended
mField.getVO().DisplayLength = mField.getVO().FieldLength;
}
- if (mField.getVO().displayType == DisplayType.YesNo) {
+ if (mField.getVO().displayType == DisplayType.YesNo || mField.isEncrypted() || mField.isEncryptedColumn()) {
// Make Yes-No searchable as list
GridFieldVO vo = mField.getVO();
GridFieldVO ynvo = vo.clone(m_simpleCtx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly);
@@ -771,6 +789,8 @@ public class FindWindow extends Window implements EventListener, ValueCha
List excludes = new ArrayList();
// adding sorted columns
for(GridField field:gridFieldList){
+ if (field.isVirtualUIColumn())
+ continue;
if (!addSelectionColumn (field))
excludes.add(field);
}
@@ -784,6 +804,8 @@ public class FindWindow extends Window implements EventListener, ValueCha
cell.setColspan(3);
cell.setAlign("left");
for(GridField field:moreFieldList){
+ if (field.isVirtualUIColumn())
+ continue;
if (!addSelectionColumn (field, rowg))
excludes.add(field);
}
@@ -810,6 +832,11 @@ public class FindWindow extends Window implements EventListener, ValueCha
gridFieldList = null;
m_total = getNoOfRecords(null, false);
+ /** START DEVCOFFEE **/
+ // Get Total
+ setStatusDB (m_total);
+ statusBar.setStatusLine("");
+ /** END DEVCOFFEE **/
} // initFind
/**
@@ -842,7 +869,7 @@ public class FindWindow extends Window implements EventListener, ValueCha
if (null!=fields && fields.length>=1 && fields[0].contains(HISTORY_SEPARATOR))
return;
ListItem listItem = new ListItem();
- listItem.setId("Row"+advancedPanel.getItemCount());
+ listItem.setId("Row"+ rowCount++);
Listbox listColumn = new Listbox();
listColumn.setId("listColumn"+listItem.getId());
@@ -1030,7 +1057,8 @@ public class FindWindow extends Window implements EventListener, ValueCha
for (int c = 0; c < m_findFields.length; c++)
{
GridField field = m_findFields[c];
- if (field == null) continue;
+ if (field == null || field.isVirtualUIColumn())
+ continue;
String columnName = field.getColumnName();
String header = field.getHeader();
@@ -1132,7 +1160,8 @@ public class FindWindow extends Window implements EventListener, ValueCha
editor.addValueChangeListener(this);
Label label = editor.getLabel();
Component fieldEditor = editor.getComponent();
-
+ //Fix miss lable of checkbox
+ label.setValue(mField.getHeader());
//
if (displayLength > 0) // set it back
mField.setDisplayLength(displayLength);
@@ -1355,6 +1384,21 @@ public class FindWindow extends Window implements EventListener, ValueCha
m_isCancel = false;
dispose();
}
+ else if ("btnReset".equals(btn.getName())){
+ for (WEditor clearField : m_sEditors){
+ clearField.setValue(null);
+ }
+
+ for (WEditor clearField : m_sEditorsTo){
+ if (clearField != null){
+ clearField.setValue(null);
+ clearField.setVisible(false);
+
+ ToolBarButton moreButtor = m_sEditorsFlag.get(m_sEditorsTo.indexOf(clearField));
+ moreButtor.setChecked(false);
+ }
+ }
+ }
}
}
else if (Events.ON_OK.equals(event.getName()))
@@ -1550,7 +1594,8 @@ public class FindWindow extends Window implements EventListener, ValueCha
String infoName = column.toString();
//
GridField field = getTargetMField(ColumnName);
- if(field == null) continue; // Elaine 2008/07/29
+ if (field == null || field.isVirtualUIColumn())
+ continue;
boolean isProductCategoryField = isProductCategoryField(field.getColumnName());
String ColumnSQL = field.getColumnSQL(false);
// Left brackets
@@ -1772,6 +1817,8 @@ public class FindWindow extends Window implements EventListener, ValueCha
}
GridField field = getTargetMField(ColumnName);
+ if (field.isVirtualUIColumn())
+ continue;
StringBuilder ColumnSQL = new StringBuilder(field.getColumnSQL(false));
m_query.addRangeRestriction(ColumnSQL.toString(), value, valueTo,
ColumnName, wed.getDisplay(), wedTo.getDisplay(), true, 0);
@@ -1785,18 +1832,27 @@ public class FindWindow extends Window implements EventListener, ValueCha
// globalqss - Carlos Ruiz - 20060711
// fix a bug with virtualColumn + isSelectionColumn not yielding results
GridField field = getTargetMField(ColumnName);
- // add encryption here if the field is encrypted.
- if (field.isEncryptedColumn()) {
- value = SecureEngine.encrypt(value, Env.getAD_Client_ID(Env.getCtx()));
- }
boolean isProductCategoryField = isProductCategoryField(field.getColumnName());
StringBuilder ColumnSQL = new StringBuilder(field.getColumnSQL(false));
+
+ // add encryption here if the field is encrypted.
+ if (field.isEncrypted()) {
+ String Operator = MQuery.NULL;
+ if ("Y".equals(value)){
+ Operator = MQuery.NOT_NULL;
+ }
+ m_query.addRestriction(ColumnSQL.toString(), Operator, null,
+ ColumnName, wed.getDisplay());
+ appendCode(code, ColumnName, Operator, "", "", "AND", "", "");
+ continue;
+ }
+
//
// Be more permissive for String columns
if (isSearchLike(field))
{
- StringBuilder valueStr = new StringBuilder(value.toString().toUpperCase());
+ StringBuilder valueStr = new StringBuilder(value.toString());
if (!valueStr.toString().endsWith("%"))
valueStr.append("%");
//
@@ -1932,12 +1988,19 @@ public class FindWindow extends Window implements EventListener, ValueCha
{
String columnName = column.getValue().toString();
int referenceType = -1;
+ boolean isEncrypted = false;
if (columnName != null) {
MTable table = MTable.get(Env.getCtx(), m_tableName);
MColumn col = table.getColumn(columnName);
referenceType = col.getAD_Reference_ID();
+ GridField field = getTargetMField(columnName);
+ isEncrypted = (col.isEncrypted() || field.isEncrypted());
}
- if (DisplayType.isLookup(referenceType)
+ if (isEncrypted)
+ {
+ addOperators(MQuery.OPERATORS_ENCRYPTED, listOperator);
+ }
+ else if (DisplayType.isLookup(referenceType)
|| DisplayType.YesNo == referenceType
|| DisplayType.Button == referenceType)
{
@@ -2577,6 +2640,18 @@ public class FindWindow extends Window implements EventListener, ValueCha
public boolean isValid()
{
return isvalid;
- }
-
+ }
+
+ /** START DEVCOFFEE **/
+ /**
+ * Display current count
+ * @param currentCount String representation of current/total
+ */
+ private void setStatusDB (int currentCount)
+ {
+ StringBuilder text = new StringBuilder(" ").append(Msg.getMsg(Env.getCtx(), "Records")).append(" = ").append(m_total).append(" ");
+ statusBar.setStatusDB(text.toString());
+ } // setDtatusDB
+ /** END DEVCOFFEE **/
+
} // FindPanel
\ No newline at end of file
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java
index a72593a980..57635b70c4 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WEMailDialog.java
@@ -530,7 +530,7 @@ public class WEMailDialog extends Window implements EventListener, ValueC
return;
}
- StringTokenizer st = new StringTokenizer(getTo(), " ,;", false);
+ StringTokenizer st = new StringTokenizer(getTo(), ",;", false);
String to = st.nextToken();
EMail email = m_client.createEMail(getFrom(), to, getSubject(), replaceBASE64Img(getMessage()), true);
String status = "Check Setup";
@@ -539,7 +539,7 @@ public class WEMailDialog extends Window implements EventListener, ValueC
while (st.hasMoreTokens())
email.addTo(st.nextToken());
// cc
- StringTokenizer stcc = new StringTokenizer(getCc(), " ,;", false);
+ StringTokenizer stcc = new StringTokenizer(getCc(), ",;", false);
while (stcc.hasMoreTokens())
{
String cc = stcc.nextToken();
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java
index f65c35159d..eeb220be64 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java
@@ -65,6 +65,7 @@ import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
+import org.compiere.util.Trx;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
@@ -497,12 +498,14 @@ public class WPAttributeDialog extends Window implements EventListener
for (int i = 0; i < m_editors.size(); i++)
{
HtmlBasedComponent editor = m_editors.get(i);
- if (editor instanceof InputElement)
+ if (editor instanceof Listbox)
+ ((Listbox)editor).setEnabled(rw);
+ else if (editor instanceof NumberBox)
+ ((NumberBox)editor).setEnabled(rw);
+ else if (editor instanceof Datebox)
+ ((Datebox)editor).setEnabled(rw);
+ else if (editor instanceof InputElement)
((InputElement)editor).setReadonly(!rw);
- else if (editor instanceof Listbox)
- ((Listbox)editor).setEnabled(rw);
- else if (editor instanceof NumberBox)
- ((NumberBox)editor).setEnabled(rw);
}
}
@@ -571,6 +574,17 @@ public class WPAttributeDialog extends Window implements EventListener
else
m_editors.add (editor);
}
+ else if(MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attribute.getAttributeValueType()))
+ {
+ Datebox editor = new Datebox();
+ setDateAttribute(attribute, editor);
+ row.appendChild(editor);
+ if(readOnly)
+ editor.setEnabled(false);
+ else
+ m_editors.add(editor);
+
+ }
else // Text Field
{
Textbox editor = new Textbox();
@@ -596,6 +610,11 @@ public class WPAttributeDialog extends Window implements EventListener
NumberBox editor = (NumberBox) m_editors.get(index);
setNumberAttribute(attribute, editor);
}
+ else if(MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attribute.getAttributeValueType()))
+ {
+ Datebox editor = (Datebox)m_editors.get(index);
+ setDateAttribute(attribute, editor);
+ }
else // Text Field
{
Textbox editor = (Textbox) m_editors.get(index);
@@ -616,6 +635,15 @@ public class WPAttributeDialog extends Window implements EventListener
else
editor.setValue(Env.ZERO);
}
+
+ private void setDateAttribute(MAttribute attribute,Datebox editor)
+ {
+ MAttributeInstance instance = attribute.getMAttributeInstance(m_M_AttributeSetInstance_ID);
+ if(instance != null)
+ editor.setValue(instance.getValueDate());
+ else
+ editor.setValue(null);
+ }
private void setListAttribute(MAttribute attribute, Listbox editor) {
boolean found = false;
@@ -774,12 +802,7 @@ public class WPAttributeDialog extends Window implements EventListener
for (int i = 0; i < m_editors.size(); i++)
{
HtmlBasedComponent editor = m_editors.get(i);
- if (editor instanceof InputElement)
- {
- ((InputElement)editor).setReadonly(false);
- ((InputElement)editor).setText(null);
- }
- else if (editor instanceof Listbox)
+ if (editor instanceof Listbox)
{
((Listbox)editor).setEnabled(true);
((Listbox)editor).setSelectedItem(null);
@@ -789,6 +812,16 @@ public class WPAttributeDialog extends Window implements EventListener
((NumberBox)editor).setEnabled(true);
((NumberBox)editor).setValue(null);
}
+ else if (editor instanceof Datebox)
+ {
+ ((Datebox)editor).setEnabled(true);
+ ((Datebox)editor).setValue(null);
+ }
+ else if (editor instanceof InputElement)
+ {
+ ((InputElement)editor).setReadonly(false);
+ ((InputElement)editor).setText(null);
+ }
}
fieldDescription.setText("");
}
@@ -798,12 +831,15 @@ public class WPAttributeDialog extends Window implements EventListener
for (int i = 0; i < m_editors.size(); i++)
{
HtmlBasedComponent editor = m_editors.get(i);
- if (editor instanceof InputElement)
- ((InputElement)editor).setReadonly(!check);
+ if (editor instanceof Datebox)
+ ((Datebox) editor).setEnabled(check);
else if (editor instanceof Listbox)
- ((Listbox)editor).setEnabled(check);
+ ((Listbox) editor).setEnabled(check);
else if (editor instanceof NumberBox)
- ((NumberBox)editor).setEnabled(check);
+ ((NumberBox) editor).setEnabled(check);
+ else if (editor instanceof InputElement)
+ ((InputElement) editor).setReadonly(!check);
+
}
}
@@ -897,12 +933,15 @@ public class WPAttributeDialog extends Window implements EventListener
for (int i = 0; i < m_editors.size(); i++)
{
HtmlBasedComponent editor = m_editors.get(i);
- if (editor instanceof InputElement)
- ((InputElement)editor).setReadonly(!rw);
- else if (editor instanceof Listbox)
- ((Listbox)editor).setEnabled(rw);
+ if (editor instanceof Listbox)
+ ((Listbox) editor).setEnabled(rw);
else if (editor instanceof NumberBox)
- ((NumberBox)editor).setEnabled(rw);
+ ((NumberBox) editor).setEnabled(rw);
+ else if (editor instanceof Datebox)
+ ((Datebox) editor).setEnabled(rw);
+ else if (editor instanceof InputElement)
+ ((InputElement) editor).setReadonly(!rw);
+
}
} // cmd_newEdit
@@ -940,12 +979,24 @@ public class WPAttributeDialog extends Window implements EventListener
private boolean saveSelection()
{
log.info("");
+
MAttributeSet as = m_masi.getMAttributeSet();
+
if (as == null)
+ {
return true;
+ }
+ Trx trx = null;
+ String mandatory = "";
+ try {
+ String trxName = Trx.createTrxName("WPAD");
+ trx = Trx.get(trxName, false);
+ trx.setDisplayName(getClass().getName()+"_saveSelection");
+ m_masi.set_TrxName(trxName);
+ as.set_TrxName(trxName);
+
//
m_changed = false;
- String mandatory = "";
if (!m_productWindow && as.isLot())
{
if (log.isLoggable(Level.FINE)) log.fine("Lot=" + fieldLotString.getText ());
@@ -975,6 +1026,7 @@ public class WPAttributeDialog extends Window implements EventListener
m_changed = true;
} // GuaranteeDate
+
// *** Save Attributes ***
// New Instance
if (mandatory.isEmpty() && (m_changed || m_masi.getM_AttributeSetInstance_ID() == 0))
@@ -985,7 +1037,9 @@ public class WPAttributeDialog extends Window implements EventListener
}
// Save Instance Attributes
+
MAttribute[] attributes = as.getMAttributes(!m_productWindow);
+ MAttribute.set_TrxName(attributes, trxName);
for (int i = 0; i < attributes.length; i++)
{
if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attributes[i].getAttributeValueType()))
@@ -1010,6 +1064,15 @@ public class WPAttributeDialog extends Window implements EventListener
value = value.setScale(1, BigDecimal.ROUND_HALF_UP);
attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, value);
}
+ else if (MAttribute.ATTRIBUTEVALUETYPE_Date.equals(attributes[i].getAttributeValueType()))
+ {
+ Datebox editor = (Datebox) m_editors.get(i);
+ Date value = editor.getValue();
+ Timestamp ts = value != null ? new Timestamp(value.getTime()) : null;
+ if (attributes[i].isMandatory() && value == null)
+ mandatory += " - " + attributes[i].getName();
+ attributes[i].setMAttributeInstance(m_M_AttributeSetInstance_ID, ts);
+ }
else
{
Textbox editor = (Textbox)m_editors.get(i);
@@ -1035,6 +1098,23 @@ public class WPAttributeDialog extends Window implements EventListener
m_masi.setDescription ();
m_masi.saveEx();
}
+ }
+ finally {
+ if (trx != null) {
+ if (!m_changed || mandatory.length() > 0)
+ {
+ // Rollback
+ trx.rollback();
+ }
+ else
+ {
+ // Commit
+ trx.commit();
+ }
+ trx.close();
+ trx = null;
+ }
+ }
return true;
} // saveSelection
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java
index f0452474c7..89c9fc55ec 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WRecordInfo.java
@@ -35,6 +35,7 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.model.DataStatusEvent;
+import org.compiere.model.GridField;
import org.compiere.model.GridTab;
import org.compiere.model.GridTable;
import org.compiere.model.MChangeLog;
@@ -248,21 +249,51 @@ public class WRecordInfo extends Window implements EventListener
//get uuid
GridTable gridTable = null;
+ String tabName = null;
if (dse.getSource() instanceof GridTab)
{
GridTab gridTab = (GridTab) dse.getSource();
gridTable = gridTab.getTableModel();
+ tabName = gridTab.getName();
}
else if (dse.getSource() instanceof GridTable)
{
- gridTable = (GridTable) dse.getSource();
+ gridTable = (GridTable) dse.getSource();
+ GridField firstField = gridTable.getField(0);
+ if (firstField != null && firstField.getGridTab() != null)
+ tabName = firstField.getGridTab().getName();
}
+
+ int Record_ID = -1;
+ if (dse.Record_ID instanceof Integer)
+ Record_ID = ((Integer)dse.Record_ID).intValue();
+ else
+ log.info("dynInit - Invalid Record_ID=" + dse.Record_ID);
+
+ MTable dbtable = null;
+ if (dse.AD_Table_ID != 0)
+ dbtable = MTable.get(Env.getCtx(), dse.AD_Table_ID);
+
if (gridTable != null && dse.getCurrentRow() >= 0 && dse.getCurrentRow() < gridTable.getRowCount())
{
PO po = gridTable.getPO(dse.getCurrentRow());
if (po != null) {
String uuidcol = po.getUUIDColumnName();
- String uuid = po.get_ValueAsString(uuidcol);
+ String uuid = null;
+ if (po.is_new()) {
+ if (Record_ID == 0 && MTable.isZeroIDTable(dbtable.getTableName())) {
+ StringBuilder sql = new StringBuilder("SELECT ")
+ .append(uuidcol)
+ .append(" FROM ")
+ .append(dbtable.getTableName())
+ .append(" WHERE ")
+ .append(dbtable.getTableName())
+ .append("_ID=0");
+ uuid = DB.getSQLValueString(null, sql.toString());
+ }
+ } else {
+ uuid = po.get_ValueAsString(uuidcol);
+ }
if (!Util.isEmpty(uuid))
m_info.append("\n ").append(uuidcol).append("=").append(uuid);
m_permalink.setHref(AEnv.getZoomUrlTableID(po));
@@ -271,22 +302,17 @@ public class WRecordInfo extends Window implements EventListener
}
// Title
- if (dse.AD_Table_ID != 0)
+ if (tabName == null && dse.AD_Table_ID != 0)
{
- MTable table1 = MTable.get (Env.getCtx(), dse.AD_Table_ID);
- setTitle(title + " - " + table1.getName());
+ tabName = dbtable.getName();
}
+ setTitle(title + " - " + tabName);
// Only Client Preference can view Change Log
if (!MRole.PREFERENCETYPE_Client.equals(MRole.getDefault().getPreferenceType()))
return false;
- int Record_ID = 0;
- if (dse.Record_ID instanceof Integer)
- Record_ID = ((Integer)dse.Record_ID).intValue();
- else
- log.info("dynInit - Invalid Record_ID=" + dse.Record_ID);
- if (Record_ID == 0)
+ if (Record_ID <= 0)
return false;
// Data
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WTextEditorDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WTextEditorDialog.java
index f8f4e7ef7c..3ee0513e6c 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WTextEditorDialog.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WTextEditorDialog.java
@@ -211,7 +211,8 @@ public class WTextEditorDialog extends Window implements EventListener{
}
} else if (event.getTarget().getId().equals(ConfirmPanel.A_RESET)) {
textBox.setText(text);
- editor.setValue(text);
+ if (editor != null)
+ editor.setValue(text);
} else if (event.getName().equals(Events.ON_SELECT)) {
if (editable) {
if (tabbox.getSelectedIndex() == 0) {
diff --git a/org.adempiere.ui.zk/js/ckeditor/config-min.js b/org.adempiere.ui.zk/js/ckeditor/config-min.js
index 43eba578da..2f3b8f3a35 100644
--- a/org.adempiere.ui.zk/js/ckeditor/config-min.js
+++ b/org.adempiere.ui.zk/js/ckeditor/config-min.js
@@ -2,6 +2,9 @@ CKEDITOR.editorConfig = function(config) {
config.resize_enabled = false;
config.toolbarCanCollapse = true;
config.toolbar = 'MyToolbar';
+ config.coreStyles_bold = { element: 'b', overrides: 'strong' };
+ config.coreStyles_italic = { element: 'i', overrides: 'em' };
+ config.coreStyles_strike = { element: 'strike', overrides: 's' };
config.toolbar_MyToolbar =
[
{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
diff --git a/org.adempiere.ui.zk/js/ckeditor/config.js b/org.adempiere.ui.zk/js/ckeditor/config.js
index 4df386cf60..b58eb628f6 100644
--- a/org.adempiere.ui.zk/js/ckeditor/config.js
+++ b/org.adempiere.ui.zk/js/ckeditor/config.js
@@ -2,6 +2,9 @@ CKEDITOR.editorConfig = function(config) {
config.resize_enabled = false;
config.toolbarCanCollapse = true;
config.toolbar = 'MyToolbar';
+ config.coreStyles_bold = { element: 'b', overrides: 'strong' };
+ config.coreStyles_italic = { element: 'i', overrides: 'em' };
+ config.coreStyles_strike = { element: 'strike', overrides: 's' };
config.toolbar_MyToolbar =
[
{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
diff --git a/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp b/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp
index 0b7a156792..dd73029fce 100644
--- a/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp
+++ b/org.adempiere.ui.zk/theme/default/css/fragment/field-editor.css.dsp
@@ -191,6 +191,12 @@ span.grid-combobox-editor {
border: none;
}
+.html-field {
+ cursor: pointer;
+ border: 1px solid #C5C5C5;
+ overflow: auto;
+}
+
.dashboard-field-panel.z-panel, .dashboard-field-panel.z-panel > .z-panel-body, .dashboard-field-panel.z-panel > .z-panel-body > .z-panelchildren {
overflow: visible;
}
diff --git a/org.adempiere.ui/src/org/compiere/apps/AbstractProcessCtl.java b/org.adempiere.ui/src/org/compiere/apps/AbstractProcessCtl.java
index 0ccdb99872..1646848d30 100644
--- a/org.adempiere.ui/src/org/compiere/apps/AbstractProcessCtl.java
+++ b/org.adempiere.ui/src/org/compiere/apps/AbstractProcessCtl.java
@@ -127,8 +127,8 @@ public abstract class AbstractProcessCtl implements Runnable
//
String sql = "SELECT p.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4
+ " p.isReport,p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8
- + " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE,"
- + " p.IsServerProcess, p.JasperReport "
+ + " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," // 9
+ + " p.IsServerProcess, p.JasperReport, p.AD_Process_UU " // 10..12
+ "FROM AD_Process p"
+ " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) "
+ "WHERE p.IsActive='Y'"
@@ -136,8 +136,8 @@ public abstract class AbstractProcessCtl implements Runnable
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Process"))
sql = "SELECT t.Name, p.ProcedureName,p.ClassName, p.AD_Process_ID," // 1..4
+ " p.isReport, p.IsDirectPrint,p.AD_ReportView_ID,p.AD_Workflow_ID," // 5..8
- + " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE,"
- + " p.IsServerProcess, p.JasperReport "
+ + " CASE WHEN COALESCE(p.Statistic_Count,0)=0 THEN 0 ELSE p.Statistic_Seconds/p.Statistic_Count END CASE," // 9
+ + " p.IsServerProcess, p.JasperReport, p.AD_Process_UU " // 10..12
+ "FROM AD_Process p"
+ " INNER JOIN AD_PInstance i ON (p.AD_Process_ID=i.AD_Process_ID) "
+ " INNER JOIN AD_Process_Trl t ON (p.AD_Process_ID=t.AD_Process_ID"
@@ -160,6 +160,7 @@ public abstract class AbstractProcessCtl implements Runnable
ProcedureName = rs.getString(2);
m_pi.setClassName (rs.getString(3));
m_pi.setAD_Process_ID (rs.getInt(4));
+ m_pi.setAD_Process_UU(rs.getString(12));
// Report
if ("Y".equals(rs.getString(5)))
{
diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFrom.java b/org.adempiere.ui/src/org/compiere/grid/CreateFrom.java
index 455f886440..0b951fe694 100644
--- a/org.adempiere.ui/src/org/compiere/grid/CreateFrom.java
+++ b/org.adempiere.ui/src/org/compiere/grid/CreateFrom.java
@@ -99,14 +99,19 @@ public abstract class CreateFrom implements ICreateFrom
.append(DB.TO_CHAR("o.GrandTotal", DisplayType.Amount, Env.getAD_Language(Env.getCtx())));
//
String column = "ol.QtyDelivered";
+ String colBP = "o.C_BPartner_ID";
if (forInvoice)
+ {
column = "ol.QtyInvoiced";
- StringBuffer sql = new StringBuffer("SELECT o.C_Order_ID,").append(display)
- .append(" FROM C_Order o "
- + "WHERE o.C_BPartner_ID=? AND o.IsSOTrx=? AND o.DocStatus IN ('CL','CO')"
- + " AND o.C_Order_ID IN "
- + "(SELECT ol.C_Order_ID FROM C_OrderLine ol"
- + " WHERE ol.QtyOrdered - ").append(column).append(" != 0) ");
+ colBP = "o.Bill_BPartner_ID";
+ }
+ StringBuffer sql = new StringBuffer("SELECT o.C_Order_ID,")
+ .append(display)
+ .append(" FROM C_Order o WHERE ")
+ .append(colBP)
+ .append("=? AND o.IsSOTrx=? AND o.DocStatus IN ('CL','CO') AND o.C_Order_ID IN (SELECT ol.C_Order_ID FROM C_OrderLine ol WHERE ol.QtyOrdered-")
+ .append(column)
+ .append("!=0) ");
if(sameWarehouseOnly)
{
sql = sql.append(" AND o.M_Warehouse_ID=? ");
diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromShipment.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromShipment.java
index 831be2e482..f359325e89 100644
--- a/org.adempiere.ui/src/org/compiere/grid/CreateFromShipment.java
+++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromShipment.java
@@ -55,9 +55,9 @@ import org.compiere.util.Msg;
public abstract class CreateFromShipment extends CreateFrom
{
/** Loaded Invoice */
- private MInvoice m_invoice = null;
+ protected MInvoice m_invoice = null;
/** Loaded RMA */
- private MRMA m_rma = null;
+ protected MRMA m_rma = null;
private int defaultLocator_ID=0;
/**
diff --git a/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java b/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java
index ec416b191d..fc69e23db9 100644
--- a/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java
+++ b/org.adempiere.ui/src/org/compiere/minigrid/ColumnInfo.java
@@ -38,6 +38,19 @@ public class ColumnInfo
this(colHeader, colSQL, colClass, true, false, null);
} // ColumnInfo
+ /**
+ * Create Info Column (r/o and not color column)
+ *
+ * @param colHeader Column Header
+ * @param colSQL SQL select code for column
+ * @param colClass class of column - determines display
+ * @param readOnly column is read only
+ */
+ public ColumnInfo (String colHeader, String colSQL, Class> colClass, boolean readOnly)
+ {
+ this(colHeader, colSQL, colClass, readOnly, false, null);
+ } // ColumnInfo
+
/**
* Create Info Column (r/o and not color column)
*
@@ -51,6 +64,20 @@ public class ColumnInfo
this(colHeader, colSQL, colClass, true, false, keyPairColSQL);
} // ColumnInfo
+ /**
+ * Create Info Column (r/o and not color column)
+ *
+ * @param colHeader Column Header
+ * @param colSQL SQL select code for column
+ * @param colClass class of column - determines display
+ * @param keyPairColSQL SQL select for the ID of the for the displayed column
+ * @param readOnly column is read only
+ */
+ public ColumnInfo (String colHeader, String colSQL, Class> colClass, String keyPairColSQL, boolean readOnly)
+ {
+ this(colHeader, colSQL, colClass, readOnly, false, keyPairColSQL);
+ } // ColumnInfo
+
/**
* Create Info Column
*
@@ -63,17 +90,36 @@ public class ColumnInfo
*/
public ColumnInfo (String colHeader, String colSQL, Class> colClass,
boolean readOnly, boolean colorColumn, String keyPairColSQL)
+ {
+ this(colHeader, colSQL, colClass, readOnly, false, keyPairColSQL, null);
+ }
+
+ /**
+ * Create Info Column
+ *
+ * @param colHeader Column Header
+ * @param colSQL SQL select code for column
+ * @param colClass class of column - determines display
+ * @param readOnly column is read only
+ * @param colorColumn if true, value of column determines foreground color
+ * @param keyPairColSQL SQL select for the ID of the for the displayed column
+ * @param columnName Column Name
+ */
+ public ColumnInfo (String colHeader, String colSQL, Class> colClass,
+ boolean readOnly, boolean colorColumn, String keyPairColSQL, String columnName)
{
setColHeader(colHeader);
setColSQL(colSQL);
setColClass(colClass);
setReadOnly(readOnly);
setColorColumn(colorColumn);
+ setColumnName(columnName);
setKeyPairColSQL(keyPairColSQL);
} // ColumnInfo
private String m_colHeader;
+ private String m_columnName;
private String m_colSQL;
private Class> m_colClass;
private boolean m_readOnly;
@@ -82,6 +128,7 @@ public class ColumnInfo
private GridField m_gridField;
private String colDescription;
+ private int AD_Reference_ID;
/**
* Get Col Class
@@ -99,6 +146,14 @@ public class ColumnInfo
{
return m_colHeader;
}
+ /**
+ * Get Column Name
+ * @return Column Name
+ */
+ public String getColumnName()
+ {
+ return m_columnName;
+ }
/**
* Get Col SQL
* @return sql
@@ -137,6 +192,14 @@ public class ColumnInfo
m_colHeader = colHeader.substring(0, index) + colHeader.substring(index+1);
}
}
+ /**
+ * Set Column Name
+ * @param columnName Column Name
+ */
+ public void setColumnName(String columnName)
+ {
+ m_columnName = columnName;
+ }
/**
* Set Col SQL
* @param colSQL sql
@@ -214,4 +277,12 @@ public class ColumnInfo
public void setColDescription(String colDescription) {
this.colDescription = colDescription;
}
+
+ public int getAD_Reference_ID() {
+ return AD_Reference_ID;
+ }
+
+ public void setAD_Reference_ID(int AD_Reference_ID) {
+ this.AD_Reference_ID = AD_Reference_ID;
+ }
} // infoColumn
diff --git a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java
index 8da0b11fc1..b589e1ebb0 100644
--- a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java
+++ b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java
@@ -925,7 +925,6 @@ public class DB_Oracle implements AdempiereDatabase
// IDs
case DisplayType.Account:
case DisplayType.Assignment:
- case DisplayType.Color:
case DisplayType.ID:
case DisplayType.Location:
case DisplayType.Locator:
@@ -979,6 +978,7 @@ public class DB_Oracle implements AdempiereDatabase
break;
// NVARCHAR
+ case DisplayType.Color:
case DisplayType.Memo:
case DisplayType.String:
case DisplayType.Text:
diff --git a/org.idempiere.equinox.p2.director-feature/director/configuration/config.ini b/org.idempiere.equinox.p2.director-feature/director/configuration/config.ini
index 7af8d700b0..74ef193739 100644
--- a/org.idempiere.equinox.p2.director-feature/director/configuration/config.ini
+++ b/org.idempiere.equinox.p2.director-feature/director/configuration/config.ini
@@ -1,4 +1,4 @@
-osgi.framework=file\:../plugins/org.eclipse.osgi_3.12.50.v20170928-1321.jar
+osgi.framework=file\:../plugins/org.eclipse.osgi_3.12.100.v20180210-1608.jar
osgi.install.area=director
equinox.use.ds=true
osgi.bundles=org.eclipse.core.net@start,\
diff --git a/org.idempiere.equinox.p2.director-feature/update-prd.bat b/org.idempiere.equinox.p2.director-feature/update-prd.bat
index a4fbd288ae..dfdcffea4c 100644
--- a/org.idempiere.equinox.p2.director-feature/update-prd.bat
+++ b/org.idempiere.equinox.p2.director-feature/update-prd.bat
@@ -2,10 +2,14 @@
@Echo on
cd %~dp0
-set DESTINATION=%cd%
-@echo %DESTINATION%
-@echo %1%
+@set DESTINATION=%cd%
+@echo DESTINATION = %DESTINATION%
+@set REPO=%1%
+@echo REPOSITORY = %REPO%
+@set PACK=%2%
+@echo PACKAGES = %PACK%
-FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c
-java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -u %2%
-java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -i %2%
+@FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c
+@echo JARFILE = %JARFILE%
+java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %REPO% -u %PACK%
+java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %REPO% -i %PACK%
diff --git a/org.idempiere.equinox.p2.director-feature/update.bat b/org.idempiere.equinox.p2.director-feature/update.bat
index 5df1c0c35c..5d66124af1 100644
--- a/org.idempiere.equinox.p2.director-feature/update.bat
+++ b/org.idempiere.equinox.p2.director-feature/update.bat
@@ -23,7 +23,7 @@ if exist jettyhome\etc\jetty-selector.xml (
copy jettyhome\etc\jetty-selector.xml jetty-selector.xml.sav
)
-@call %DESTINATION%\update-prd %1% org.adempiere.server.product,org.idempiere.fitnesse.feature.feature.group
+@call %DESTINATION%\update-prd %1% "org.adempiere.server.product,org.idempiere.fitnesse.feature.feature.group"
copy idempiere.ini.sav idempiere.ini
diff --git a/org.idempiere.hazelcast.service/copyjars.xml b/org.idempiere.hazelcast.service/copyjars.xml
index 47e85a632a..7cd20febc2 100644
--- a/org.idempiere.hazelcast.service/copyjars.xml
+++ b/org.idempiere.hazelcast.service/copyjars.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/org.idempiere.hazelcast.service/pom.xml b/org.idempiere.hazelcast.service/pom.xml
index ba96e4bdac..acf9aa286a 100644
--- a/org.idempiere.hazelcast.service/pom.xml
+++ b/org.idempiere.hazelcast.service/pom.xml
@@ -26,7 +26,7 @@
com.hazelcast
hazelcast
- 3.5.3
+ 3.9.3
com.hazelcast
@@ -44,4 +44,4 @@
-
\ No newline at end of file
+
diff --git a/org.idempiere.maven.to.p2/pom.xml b/org.idempiere.maven.to.p2/pom.xml
index c2d76cf873..81b3655939 100644
--- a/org.idempiere.maven.to.p2/pom.xml
+++ b/org.idempiere.maven.to.p2/pom.xml
@@ -11,6 +11,14 @@
pom
https://www.zkoss.org/zkdownload/downloadEvalFile?id=1245081552
+
+ 1.1.3.v20160715
+ 8.5.24.2
+ 8.1.12.v20180117
+ 3.1.0.M3
+ 1.1.0
+
+
@@ -46,18 +54,18 @@
false
- org.mortbay.jasper:apache-jsp:jar:8.5.23
+ org.mortbay.jasper:apache-jsp:jar:${jetty.jsp.version}
false
- org.mortbay.jasper:apache-el:jar:8.5.23
+ org.mortbay.jasper:apache-el:jar:${jetty.jsp.version}
false
- org.eclipse.jetty.toolchain:jetty-osgi-servlet-api:jar:3.1.0.M3
+ org.eclipse.jetty.toolchain:jetty-osgi-servlet-api:jar:${jetty.osgi.servlet.api.version}
false
@@ -187,7 +195,7 @@
false
- org.apache.commons:commons-digester3:jar:3.2
+ commons-digester:commons-digester:jar:2.1
false
@@ -211,11 +219,6 @@
false
-
- org.eclipse.jetty:jetty-alpn-server:jar:${jetty.version}
-
- false
-
org.eclipse.jetty.alpn:alpn-api:jar:1.1.3.v20160715
@@ -242,10 +245,30 @@
false
- org.apache.commons:commons-collections4:jar:4.1
+ org.apache.commons:commons-collections4:jar:4.2
false
+
+ org.eclipse.jetty:jetty-alpn-conscrypt-server:jar:${jetty.version}
+
+ false
+
+
+ org.eclipse.jetty:jetty-alpn-openjdk8-server:jar:${jetty.version}
+
+ false
+
+
+ org.conscrypt:conscrypt-openjdk-uber:jar:${jetty.conscrypt.openjdk.uber.version}
+
+ false
+
+ org.conscrypt;version="${jetty.conscrypt.openjdk.uber.version}"
+ org.idempiere.org.conscrypt.openjdk-uber
+ org.idempiere.org.conscrypt.openjdk-uber
+
+
+ 8.1.12.v20180117
org.idempiere.p2.targetplatform
@@ -464,6 +468,80 @@
x86_64
+
+
+
+ eclipse-plugin
+ org.eclipse.jetty.http
+
+ ${jetty.version}
+
+
+
+ eclipse-plugin
+ org.eclipse.jetty.io
+
+ ${jetty.version}
+
+
+
+ eclipse-plugin
+ org.eclipse.jetty.security
+
+ ${jetty.version}
+
+
+
+ eclipse-plugin
+ org.eclipse.jetty.server
+
+ ${jetty.version}
+
+
+
+ eclipse-plugin
+ org.eclipse.jetty.servlet
+
+ ${jetty.version}
+
+
+
+ eclipse-plugin
+ org.eclipse.jetty.util
+
+ ${jetty.version}
+
+
+
+ eclipse-plugin
+ org.objectweb.asm.tree
+
+ ${asm.version}
+
+
+
+ eclipse-plugin
+ org.objectweb.asm
+
+ ${asm.version}
+
+
+
+ eclipse-plugin
+ org.objectweb.asm.commons
+
+ ${asm.version}
+
+
+
+ eclipse-plugin
+ org.objectweb.asm.commons
+
+ ${asm.version}
+
+
+
diff --git a/org.idempiere.webservices/META-INF/MANIFEST.MF b/org.idempiere.webservices/META-INF/MANIFEST.MF
index 7948bb1196..0353eafd50 100644
--- a/org.idempiere.webservices/META-INF/MANIFEST.MF
+++ b/org.idempiere.webservices/META-INF/MANIFEST.MF
@@ -180,9 +180,6 @@ Export-Package: javax.ws.rs,
org.apache.xmlbeans.impl.jam.provider,
org.apache.xmlbeans.impl.jam.visitor,
org.apache.xmlbeans.impl.jam.xml,
- org.apache.xmlbeans.impl.piccolo.io,
- org.apache.xmlbeans.impl.piccolo.util,
- org.apache.xmlbeans.impl.piccolo.xml,
org.apache.xmlbeans.impl.regex,
org.apache.xmlbeans.impl.richParser,
org.apache.xmlbeans.impl.schema,
diff --git a/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeServiceImpl.java b/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeServiceImpl.java
index c4fc137139..8fce4c19f5 100644
--- a/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeServiceImpl.java
+++ b/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeServiceImpl.java
@@ -65,11 +65,8 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
*/
@Override
public CompositeResponsesDocument compositeOperation(CompositeRequestDocument reqs) {
- boolean connected = getCompiereService().isConnected();
-
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
CompositeResponsesDocument ret = CompositeResponsesDocument.Factory.newInstance();
CompositeResponses resps = ret.addNewCompositeResponses();
@@ -124,8 +121,7 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
return ret;
} finally {
- if (!connected)
- getCompiereService().disconnect();
+ getCompiereService().disconnect();
}
}
diff --git a/org.idempiere.webservices/WEB-INF/src/org/compiere/model/MWebService.java b/org.idempiere.webservices/WEB-INF/src/org/compiere/model/MWebService.java
index 2c40dfbc0a..f50feaa996 100644
--- a/org.idempiere.webservices/WEB-INF/src/org/compiere/model/MWebService.java
+++ b/org.idempiere.webservices/WEB-INF/src/org/compiere/model/MWebService.java
@@ -76,7 +76,7 @@ public class MWebService extends X_WS_WebService
* @param webServiceValue
* @return Table
*/
- public static MWebService get (Properties ctx, String webServiceValue)
+ public static synchronized MWebService get (Properties ctx, String webServiceValue)
{
if (webServiceValue == null)
return null;
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..abf161d2c1 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;
@@ -78,13 +79,13 @@ public class CompiereService {
public final String dateFormatOnlyForCtx = "yyyy-MM-dd";
- private boolean m_connected;
+ private int m_connectCount;
/**
*
* @return AD_Client_ID of current request
*/
- public int getAD_Client_ID() {
+ public synchronized int getAD_Client_ID() {
return m_AD_Client_ID;
}
@@ -92,7 +93,7 @@ public class CompiereService {
*
* @return AD_Org_ID of current request
*/
- public int getAD_Org_ID() {
+ public synchronized int getAD_Org_ID() {
return m_AD_Org_ID;
}
@@ -100,7 +101,7 @@ public class CompiereService {
*
* @return context of current request
*/
- public Properties getCtx() {
+ public synchronized Properties getCtx() {
return Env.getCtx();
}
@@ -110,7 +111,7 @@ public class CompiereService {
public CompiereService()
{
m_loggedin = false;
- m_connected = false;
+ m_connectCount = 0;
}
/**
@@ -118,69 +119,51 @@ public class CompiereService {
*/
public void connect()
{
- if (!m_connected)
- {
- CompiereUtil.initWeb();
-
- m_connected = true;
-
- ServerContext.setCurrentInstance(new Properties());
- Env.setContext(getCtx(), "#AD_Language", "en_US" );
- m_language = Language.getLanguage("en_US");
-
- dateFormat = DisplayType.getDateFormat(DisplayType.Date, m_language);
- dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, m_language);
- timeFormat = DisplayType.getDateFormat(DisplayType.Time, m_language);
- dateFormatJDBC = DisplayType.getDateFormat_JDBC();
- dateTimeFormatJDBC = DisplayType.getTimestampFormat_Default();
- timeFormatJDBC = DisplayType.getTimeFormat_Default();
- }
+ CompiereUtil.initWeb();
+
+ ServerContext.setCurrentInstance(new Properties());
+ Env.setContext(getCtx(), "#AD_Language", "en_US" );
+ m_language = Language.getLanguage("en_US");
+
+ dateFormat = DisplayType.getDateFormat(DisplayType.Date, m_language);
+ dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, m_language);
+ timeFormat = DisplayType.getDateFormat(DisplayType.Time, m_language);
+ dateFormatJDBC = DisplayType.getDateFormat_JDBC();
+ dateTimeFormatJDBC = DisplayType.getTimestampFormat_Default();
+ timeFormatJDBC = DisplayType.getTimeFormat_Default();
+
+ m_connectCount++;
+ }
+
+ /**
+ * Increase connect count
+ */
+ public synchronized void connectCacheInstance()
+ {
+ m_connectCount++;
}
/**
* cleanup request
*/
- public void disconnect()
+ public synchronized void disconnect()
{
+ m_connectCount--;
// TODO: create a thread that checks expired connected compiereservices and log them out
- if (! isExpired()) {
- // do not close, save session in cache
- if (! csMap.containsValue(this)) {
- String key = getKey(m_AD_Client_ID,
- m_AD_Org_ID,
- m_userName,
- m_AD_Role_ID,
- m_M_Warehouse_ID,
- m_locale,
- m_password,
- m_IPAddress);
- csMap.put(key.toString(), this);
- Properties savedCache = new Properties();
- savedCache.putAll(Env.getCtx());
- ctxMap.put(key.toString(), savedCache);
- }
- }
- }
-
- /**
- * @return true if started
- */
- public boolean isConnected()
- {
- return m_connected;
+ expungeIfExpire();
}
/**
* @return Language of current request
*/
- public Language getLanguage() {
+ public synchronized Language getLanguage() {
return m_language;
}
/**
* @return true if already logged in
*/
- public boolean isLoggedIn() {
+ public synchronized boolean isLoggedIn() {
return m_loggedin;
}
@@ -194,21 +177,22 @@ public class CompiereService {
* @param AD_Org_ID org
* @param M_Warehouse_ID warehouse
*/
- private String checkLogin (Properties ctx, int AD_User_ID, int AD_Role_ID, int AD_Client_ID, int AD_Org_ID, int M_Warehouse_ID)
+ private synchronized String checkLogin (Properties ctx, int AD_User_ID, int AD_Role_ID, int AD_Client_ID, int AD_Org_ID, int M_Warehouse_ID)
{
// Get Login Info
String loginInfo = null;
// Verify existence of User/Client/Org/Role and User's acces to Client & Org
String sql = "SELECT u.Name || '@' || c.Name || '.' || o.Name AS Text "
- + "FROM AD_User u, AD_Client c, AD_Org o, AD_User_Roles ur "
+ + "FROM AD_User u, AD_Client c, AD_Org o, AD_User_Roles ur, AD_Role r "
+ "WHERE u.AD_User_ID=?" // #1
+ " AND c.AD_Client_ID=?" // #2
+ " AND o.AD_Org_ID=?" // #3
+ " AND ur.AD_Role_ID=?" // #4
+ " AND ur.AD_User_ID=u.AD_User_ID"
+ + " AND ur.AD_Role_ID=r.AD_Role_ID"
+ " AND (o.AD_Client_ID = 0 OR o.AD_Client_ID=c.AD_Client_ID)"
- + " AND c.AD_Client_ID IN (SELECT AD_Client_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)"
- + " AND o.AD_Org_ID IN (SELECT AD_Org_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)";
+ + " AND (r.IsAccessAllOrgs='Y' OR (c.AD_Client_ID IN (SELECT AD_Client_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)"
+ + " AND o.AD_Org_ID IN (SELECT AD_Org_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)))";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
@@ -259,7 +243,7 @@ public class CompiereService {
* @param Lang
* @return true if login is successful
*/
- public boolean login( int AD_User_ID, int AD_Role_ID, int AD_Client_ID, int AD_Org_ID, int M_Warehouse_ID, String Lang ) {
+ public synchronized boolean login( int AD_User_ID, int AD_Role_ID, int AD_Client_ID, int AD_Org_ID, int M_Warehouse_ID, String Lang ) {
m_loggedin = false;
String loginInfo = checkLogin (getCtx(), AD_User_ID, AD_Role_ID, AD_Client_ID, AD_Org_ID, M_Warehouse_ID );
if (loginInfo == null)
@@ -271,7 +255,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);
@@ -307,6 +296,26 @@ public class CompiereService {
session.saveEx();
m_loggedin = true;
+
+ synchronized (csMap) {
+ //save session in cache
+ String key = getKey(m_AD_Client_ID,
+ m_AD_Org_ID,
+ m_userName,
+ m_AD_Role_ID,
+ m_M_Warehouse_ID,
+ m_locale,
+ m_password,
+ m_IPAddress);
+ if (! csMap.containsKey(key)) {
+ csMap.put(key.toString(), this);
+ Properties savedCache = new Properties();
+ savedCache.putAll(Env.getCtx());
+ ctxMap.put(key.toString(), savedCache);
+ if (log.isLoggable(Level.INFO)) log.info("Saving " + this + " in cache");
+ }
+ }
+
return true;
}
@@ -314,7 +323,7 @@ public class CompiereService {
*
* @return AD_User_ID of current request
*/
- public int getAD_User_ID() {
+ public synchronized int getAD_User_ID() {
return m_AD_User_ID;
}
@@ -322,7 +331,7 @@ public class CompiereService {
*
* @return AD_Role_ID of current request
*/
- public int getAD_Role_ID() {
+ public synchronized int getAD_Role_ID() {
return m_AD_Role_ID;
}
@@ -330,7 +339,7 @@ public class CompiereService {
*
* @return locale code of current request
*/
- public String getLocale() {
+ public synchronized String getLocale() {
return m_locale;
}
@@ -338,7 +347,7 @@ public class CompiereService {
*
* @return M_Warehouse_ID of current request
*/
- public int getM_Warehouse_ID() {
+ public synchronized int getM_Warehouse_ID() {
return m_M_Warehouse_ID;
}
@@ -346,43 +355,43 @@ public class CompiereService {
*
* @return logged in user name of current request
*/
- public String getUserName() {
+ public synchronized String getUserName() {
return m_userName;
}
/**
* @return set password
*/
- public void setPassword(String pass) {
+ public synchronized void setPassword(String pass) {
m_password = pass;
}
/**
* @return logged in password of current request
*/
- public String getPassword() {
+ public synchronized String getPassword() {
return m_password;
}
/**
* @return set expiry minutes
*/
- public void setExpiryMinutes(int expiryMinutes) {
+ public synchronized void setExpiryMinutes(int expiryMinutes) {
m_expiryMinutes = expiryMinutes;
}
/**
* @return logged in expiry minutes of current request
*/
- public int getExpiryMinutes() {
+ public synchronized int getExpiryMinutes() {
return m_expiryMinutes;
}
- public void refreshLastAuthorizationTime() {
+ public synchronized void refreshLastAuthorizationTime() {
m_lastAuthorizationTime = System.currentTimeMillis();
}
- public void setIPAddress(String remoteAddr) {
+ public synchronized void setIPAddress(String remoteAddr) {
m_IPAddress = remoteAddr;
}
@@ -396,14 +405,17 @@ public class CompiereService {
loginRequest.getPass(),
req.getRemoteAddr());
CompiereService l_cs = null;
- if (csMap.containsKey(key)) {
- l_cs = csMap.get(key);
- if (l_cs != null) {
- if (l_cs.isExpired()) {
- l_cs = null;
- } else {
- Properties cachedCtx = ctxMap.get(key);
- Env.getCtx().putAll(cachedCtx);
+ synchronized (csMap) {
+ if (csMap.containsKey(key)) {
+ l_cs = csMap.get(key);
+ if (l_cs != null) {
+ if (l_cs.expungeIfExpire()) {
+ l_cs = null;
+ } else {
+ Properties cachedCtx = ctxMap.get(key);
+ Env.getCtx().putAll(cachedCtx);
+ if (log.isLoggable(Level.INFO)) log.info("Reusing " + l_cs);
+ }
}
}
}
@@ -431,18 +443,43 @@ public class CompiereService {
return key.toString();
}
- private boolean isExpired() {
+ private synchronized boolean expungeIfExpire() {
boolean expired =
(
(getExpiryMinutes() <= 0)
|| (m_lastAuthorizationTime + (getExpiryMinutes() * 60000) <= System.currentTimeMillis())
);
- if (m_connected && expired)
+ if (m_connectCount==0 && expired)
{
- Env.logout();
- ServerContext.dispose();
- m_loggedin = false;
- m_connected = false;
+ synchronized (csMap) {
+ String key = getKey(m_AD_Client_ID,
+ m_AD_Org_ID,
+ m_userName,
+ m_AD_Role_ID,
+ m_M_Warehouse_ID,
+ m_locale,
+ m_password,
+ m_IPAddress);
+ if (csMap.containsKey(key)) {
+ csMap.remove(key);
+ }
+ if (ctxMap.containsKey(key)) {
+ Properties cachedCtx = ctxMap.remove(key);
+ Properties currentCtx = ServerContext.getCurrentInstance();
+ try {
+ ServerContext.setCurrentInstance(cachedCtx);
+ if (log.isLoggable(Level.INFO)) log.info("Closing expired/invalid " + this);
+ Env.logout();
+ } finally {
+ if (currentCtx == cachedCtx) {
+ ServerContext.dispose();
+ } else {
+ ServerContext.setCurrentInstance(currentCtx);
+ }
+ }
+ }
+ m_loggedin = false;
+ }
}
return expired;
}
diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereUtil.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereUtil.java
index a08d624ea2..f99cdd2a9e 100644
--- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereUtil.java
+++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/CompiereUtil.java
@@ -35,6 +35,7 @@ public class CompiereUtil {
try
{
+ if (log.isLoggable(Level.INFO)) log.info("Starting webservices iDempiere session");
s_initOK = Adempiere.startup(false);
}
catch (Exception ex)
diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java
index f672b8ba90..4cbee03b6b 100644
--- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java
+++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java
@@ -168,13 +168,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
* use the runProcess web service
*/
public StandardResponseDocument setDocAction(ModelSetDocActionRequestDocument req) {
- boolean connected = getCompiereService().isConnected();
-
- boolean manageTrx = this.manageTrx;
Trx trx=null;
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = ret.addNewStandardResponse();
@@ -289,9 +285,6 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
if (manageTrx && !trx.commit())
return rollbackAndSetError(trx, resp, ret, true, "Cannot commit after docAction");
- if (manageTrx)
- trx.close();
-
// resp.setError("");
resp.setIsError(false);
@@ -304,9 +297,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
} finally {
if (manageTrx && trx != null)
trx.close();
-
- if (!connected)
- getCompiereService().disconnect();
+
+ getCompiereService().disconnect();
}
}
@@ -390,11 +382,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
public RunProcessResponseDocument runProcess(ModelRunProcessRequestDocument req) {
- boolean connected = getCompiereService().isConnected();
-
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
RunProcessResponseDocument resbadlogin = RunProcessResponseDocument.Factory.newInstance();
RunProcessResponse rbadlogin = resbadlogin.addNewRunProcessResponse();
@@ -430,17 +419,13 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
requestCtx.put(serviceType+"_Summary", response.getRunProcessResponse().getSummary());
return response;
} finally {
- if (!connected)
- getCompiereService().disconnect();
+ getCompiereService().disconnect();
}
}
public WindowTabDataDocument getList(ModelGetListRequestDocument req) {
- boolean connected = getCompiereService().isConnected();
-
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
WindowTabDataDocument resdoc = WindowTabDataDocument.Factory.newInstance();
WindowTabData res = resdoc.addNewWindowTabData();
@@ -649,20 +634,14 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
return resdoc;
} finally {
- if (!connected)
- getCompiereService().disconnect();
+ getCompiereService().disconnect();
}
} // getList
public StandardResponseDocument deleteData(ModelCRUDRequestDocument req) {
- boolean connected = getCompiereService().isConnected();
-
Trx trx = null;
- boolean manageTrx = this.manageTrx;
-
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = ret.addNewStandardResponse();
@@ -727,8 +706,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
if (manageTrx && trx != null)
trx.close();
- if (!connected)
- getCompiereService().disconnect();
+ getCompiereService().disconnect();
}
}
@@ -740,15 +718,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
}
public StandardResponseDocument createData(ModelCRUDRequestDocument req) {
-
- boolean connected = getCompiereService().isConnected();
-
Trx trx = null;
- boolean manageTrx = this.manageTrx;
-
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = ret.addNewStandardResponse();
@@ -849,21 +821,15 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
if (manageTrx && trx != null)
trx.close();
- if (!connected)
- getCompiereService().disconnect();
+ getCompiereService().disconnect();
}
} // createData
public StandardResponseDocument createUpdateData(ModelCRUDRequestDocument req) {
- boolean connected = getCompiereService().isConnected();
-
Trx trx = null;
- boolean manageTrx = this.manageTrx;
-
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = ret.addNewStandardResponse();
@@ -1058,8 +1024,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
if (manageTrx && trx != null)
trx.close();
- if (!connected)
- getCompiereService().disconnect();
+ getCompiereService().disconnect();
}
} // createUpdateData
@@ -1234,14 +1199,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
}
public StandardResponseDocument updateData(ModelCRUDRequestDocument req){
- boolean connected = getCompiereService().isConnected();
-
Trx trx = null;
- boolean manageTrx = this.manageTrx;
-
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = ret.addNewStandardResponse();
@@ -1323,17 +1283,13 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
if (manageTrx && trx != null)
trx.close();
- if (!connected)
- getCompiereService().disconnect();
+ getCompiereService().disconnect();
}
} // updateData
public WindowTabDataDocument readData(ModelCRUDRequestDocument req) {
- boolean connected = getCompiereService().isConnected();
-
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
WindowTabData resp = ret.addNewWindowTabData();
@@ -1423,19 +1379,14 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
return ret;
} finally {
- if (!connected)
- getCompiereService().disconnect();
+ getCompiereService().disconnect();
}
}
public WindowTabDataDocument queryData(ModelCRUDRequestDocument req) {
- boolean connected = getCompiereService().isConnected();
-
- boolean manageTrx = this.manageTrx;
Trx trx=null;
try {
- if (!connected)
- getCompiereService().connect();
+ getCompiereService().connect();
CompiereService m_cs = getCompiereService();
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
@@ -1589,8 +1540,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
if (manageTrx && trx != null)
trx.close();
- if (!connected)
- getCompiereService().disconnect();
+ getCompiereService().disconnect();
}
}
}
\ No newline at end of file
diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java
index d3ba783cff..c4736a974b 100644
--- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java
+++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java
@@ -14,6 +14,8 @@
package org.idempiere.webservices;
import java.math.BigDecimal;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
@@ -38,8 +40,9 @@ import org.compiere.model.MWebService;
import org.compiere.model.MWebServiceType;
import org.compiere.model.PO;
import org.compiere.model.POInfo;
-import org.compiere.model.Query;
import org.compiere.model.X_WS_WebServiceMethod;
+import org.compiere.model.X_WS_WebServiceTypeAccess;
+import org.compiere.util.CCache;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
@@ -64,7 +67,9 @@ import org.idempiere.webservices.fault.IdempiereServiceFault;
*/
public class AbstractService {
- private static final String ROLE_ACCESS_SQL = "SELECT IsActive FROM WS_WebServiceTypeAccess WHERE AD_Role_ID=? "
+ private static final String ROLE_ACCESS_SQL = "SELECT IsActive FROM WS_WebServiceTypeAccess WHERE AD_Role_ID IN ("
+ + "SELECT AD_Role_ID FROM AD_Role WHERE AD_Role_ID=? UNION "
+ + "SELECT Included_Role_ID as AD_Role_ID FROM AD_Role_Included WHERE AD_Role_ID=?) "
+ "AND WS_WebServiceType_ID=?";
private static final String COMPIERE_SERVICE = "CompiereService";
@Resource
@@ -91,6 +96,7 @@ public class AbstractService {
if (cachedCs != null) {
m_cs = cachedCs;
req.setAttribute(COMPIERE_SERVICE, cachedCs);
+ m_cs.connectCacheInstance();
return authenticate(webService, method, serviceType, cachedCs); // already logged with same data
}
}
@@ -201,6 +207,9 @@ public class AbstractService {
return authenticate(webService, method, serviceType, m_cs);
}
+ private static CCache s_WebServiceTypeCache = new CCache(MWebServiceType.Table_Name, 10, 60); //60 minutes
+ private static CCache s_RoleAccessCache = new CCache<>(X_WS_WebServiceTypeAccess.Table_Name, 60, 60);
+
/**
* Authenticate user for requested service type
* @param webServiceValue
@@ -219,28 +228,59 @@ public class AbstractService {
if (m_webservicemethod == null || !m_webservicemethod.isActive())
return "Method " + methodValue + " not registered";
- MWebServiceType m_webservicetype = new Query(m_cs.getCtx(), MWebServiceType.Table_Name,
- "AD_Client_ID IN (0,?) AND WS_WebService_ID=? AND WS_WebServiceMethod_ID=? AND Value=?",
- null)
- .setOnlyActiveRecords(true)
- .setParameters(m_cs.getAD_Client_ID(), m_webservice.getWS_WebService_ID(), m_webservicemethod.getWS_WebServiceMethod_ID(), serviceTypeValue)
- .setOrderBy("AD_Client_ID DESC") // IDEMPIERE-3394 give precedence to tenant defined if there are system+tenant
- .first();
+ MWebServiceType m_webservicetype = null;
+ String key = m_cs.getAD_Client_ID() + "|" + m_webservice.getWS_WebService_ID() + "|"
+ + m_webservicemethod.getWS_WebServiceMethod_ID() + "|" + serviceTypeValue;
+ synchronized (s_WebServiceTypeCache) {
+ m_webservicetype = s_WebServiceTypeCache.get(key);
+ if (m_webservicetype == null) {
+ final String sql = "SELECT * FROM WS_WebServiceType " + "WHERE AD_Client_ID=? " + "AND WS_WebService_ID=? "
+ + "AND WS_WebServiceMethod_ID=? " + "AND Value=? " + "AND IsActive='Y'";
+ PreparedStatement pstmt = null;
+ ResultSet rs = null;
+ try {
+ pstmt = DB.prepareStatement(sql, null);
+ pstmt.setInt(1, m_cs.getAD_Client_ID());
+ pstmt.setInt(2, m_webservice.getWS_WebService_ID());
+ pstmt.setInt(3, m_webservicemethod.getWS_WebServiceMethod_ID());
+ pstmt.setString(4, serviceTypeValue);
+ rs = pstmt.executeQuery();
+ if (rs.next()) {
+ m_webservicetype = new MWebServiceType(m_cs.getCtx(), rs, null);
+ s_WebServiceTypeCache.put(key, m_webservicetype);
+ }
+ } catch (Exception e) {
+ throw new IdempiereServiceFault(e.getClass().toString() + " " + e.getMessage() + " sql=" + sql, e.getCause(), new QName(
+ "authenticate"));
+ } finally {
+ DB.close(rs, pstmt);
+ rs = null;
+ pstmt = null;
+ }
+ }
+ }
if (m_webservicetype == null)
return "Service type " + serviceTypeValue + " not configured";
getHttpServletRequest().setAttribute("MWebServiceType", m_webservicetype);
- // Check if role has access on web-service
- String hasAccess = DB.getSQLValueStringEx(null, ROLE_ACCESS_SQL,
- Env.getAD_Role_ID( m_cs.getCtx()),
- m_webservicetype.get_ID());
-
- if (!"Y".equals(hasAccess))
- {
- return "Web Service Error: Login role does not have access to the service type";
- }
+ int AD_Role_ID = Env.getAD_Role_ID( m_cs.getCtx());
+ key = AD_Role_ID + "|" + m_webservicetype.get_ID();
+ synchronized (s_RoleAccessCache) {
+ Boolean bAccess = s_RoleAccessCache.get(key);
+ if (bAccess == null) {
+ // Check if role has access on web-service
+ String hasAccess = DB.getSQLValueStringEx(null, ROLE_ACCESS_SQL,
+ AD_Role_ID, AD_Role_ID, m_webservicetype.get_ID());
+ bAccess = "Y".equals(hasAccess);
+ s_RoleAccessCache.put(key, bAccess);
+ }
+ if (!bAccess.booleanValue())
+ {
+ return "Web Service Error: Login role does not have access to the service type";
+ }
+ }
String ret=invokeLoginValidator(null, m_cs.getCtx(), m_webservicetype, IWSValidator.TIMING_ON_AUTHORIZATION);
if(ret!=null && ret.length()>0)
diff --git a/org.idempiere.webservices/copyjars.xml b/org.idempiere.webservices/copyjars.xml
index dce1c7157b..bde8ddd2a0 100644
--- a/org.idempiere.webservices/copyjars.xml
+++ b/org.idempiere.webservices/copyjars.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/org.idempiere.webservices/pom.xml b/org.idempiere.webservices/pom.xml
index a5ac92ffe8..76502d4c97 100644
--- a/org.idempiere.webservices/pom.xml
+++ b/org.idempiere.webservices/pom.xml
@@ -96,7 +96,7 @@
org.apache.xmlbeans
xmlbeans
- 2.5.0
+ 3.0.0
aopalliance
@@ -148,4 +148,4 @@
-
\ No newline at end of file
+