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 valuesInv = DB.getSQLValueObjectsEx(getTrxName(), sql.toString(), + MInvoice.Table_ID, invoice.getC_Invoice_ID(), as.getC_AcctSchema_ID()); + if (valuesInv != null) { + if (invoice.isSOTrx()) { + invoiceSource = (BigDecimal) valuesInv.get(0); // AmtSourceDr + invoiceAccounted = (BigDecimal) valuesInv.get(1); // AmtAcctDr + } else { + invoiceSource = (BigDecimal) valuesInv.get(2); // AmtSourceCr + invoiceAccounted = (BigDecimal) valuesInv.get(3); // AmtAcctCr + } } // Requires that Invoice is Posted if (invoiceSource == null || invoiceAccounted == null) return "Gain/Loss - Invoice not posted yet"; - // - StringBuilder description = new StringBuilder("Invoice=(").append(invoice.getC_Currency_ID()).append(")").append(invoiceSource).append("/").append(invoiceAccounted) - .append(" - Allocation=(").append(getC_Currency_ID()).append(")").append(allocationSource).append("/").append(allocationAccounted); - if (log.isLoggable(Level.FINE)) log.fine(description.toString()); - // Allocation not Invoice Currency + // + String invoiceCur = MCurrency.get(getCtx(), invoice.getC_Currency_ID()).getISO_Code(); + String allocCur = MCurrency.get(getCtx(), getC_Currency_ID()).getISO_Code(); + StringBuilder descriptionInv = new StringBuilder("Invoice=(").append(invoiceCur).append(")").append(invoiceSource).append("/").append(invoiceAccounted) + .append(" - Allocation=(").append(allocCur).append(")").append(allocationSource).append("/").append(allocationAccounted); + if (log.isLoggable(Level.FINE)) log.fine(descriptionInv.toString()); + // Allocation not Invoice Currency + BigDecimal allocationInvoiceSource = allocationSource; if (getC_Currency_ID() != invoice.getC_Currency_ID()) { - BigDecimal allocationSourceNew = MConversionRate.convert(getCtx(), + allocationInvoiceSource = MConversionRate.convert(getCtx(), allocationSource, getC_Currency_ID(), invoice.getC_Currency_ID(), getDateAcct(), invoice.getC_ConversionType_ID(), invoice.getAD_Client_ID(), invoice.getAD_Org_ID()); - if (allocationSourceNew == null) + if (allocationInvoiceSource == null) return "Gain/Loss - No Conversion from Allocation->Invoice"; - StringBuilder d2 = new StringBuilder("Allocation=(").append(getC_Currency_ID()).append(")").append(allocationSource) - .append("->(").append(invoice.getC_Currency_ID()).append(")").append(allocationSourceNew); + StringBuilder d2 = new StringBuilder("Allocation=(").append(allocCur).append(")").append(allocationSource) + .append("->(").append(invoiceCur).append(")").append(allocationInvoiceSource); if (log.isLoggable(Level.FINE)) log.fine(d2.toString()); - description.append(" - ").append(d2); - allocationSource = allocationSourceNew; + descriptionInv.append(" - ").append(d2); } - BigDecimal acctDifference = null; // gain is negative - // Full Payment in currency - if (allocationSource.compareTo(invoiceSource) == 0) - { - acctDifference = invoiceAccounted.subtract(allocationAccounted); // gain is negative - StringBuilder d2 = new StringBuilder("(full) = ").append(acctDifference); - if (log.isLoggable(Level.FINE)) log.fine(d2.toString()); - description.append(" - ").append(d2); - } - else // partial or MC - { - // percent of total payment - double multiplier = allocationSource.doubleValue() / invoiceSource.doubleValue(); - // Reduce Orig Invoice Accounted - invoiceAccounted = invoiceAccounted.multiply(BigDecimal.valueOf(multiplier)); - // Difference based on percentage of Orig Invoice - acctDifference = invoiceAccounted.subtract(allocationAccounted); // gain is negative - // ignore Tolerance - if (acctDifference.abs().compareTo(TOLERANCE) < 0) - acctDifference = Env.ZERO; - // Round - int precision = as.getStdPrecision(); - if (acctDifference.scale() > precision) - acctDifference = acctDifference.setScale(precision, BigDecimal.ROUND_HALF_UP); - StringBuilder d2 = new StringBuilder("(partial) = ").append(acctDifference).append(" - Multiplier=").append(multiplier); - if (log.isLoggable(Level.FINE)) log.fine(d2.toString()); - description.append(" - ").append(d2); - } - - if (acctDifference.signum() == 0) + BigDecimal invoiceDifference = null; // gain is negative + // Full Invoice in currency + if (allocationInvoiceSource.compareTo(invoiceSource) == 0) + { + invoiceDifference = invoiceAccounted.subtract(allocationAccounted); // gain is negative + StringBuilder d2 = new StringBuilder("(full) = ").append(invoiceDifference); + if (log.isLoggable(Level.FINE)) log.fine(d2.toString()); + descriptionInv.append(" - ").append(d2); + } + else // partial or MC + { + // percent of total payment + double multiplier = allocationInvoiceSource.doubleValue() / invoiceSource.doubleValue(); + // Reduce Orig Invoice Accounted + invoiceAccounted = invoiceAccounted.multiply(BigDecimal.valueOf(multiplier)); + // Difference based on percentage of Orig Invoice + invoiceDifference = invoiceAccounted.subtract(allocationAccounted); // gain is negative + // ignore Tolerance + if (invoiceDifference.abs().compareTo(TOLERANCE) < 0) + invoiceDifference = Env.ZERO; + // Round + int precision = as.getStdPrecision(); + if (invoiceDifference.scale() > precision) + invoiceDifference = invoiceDifference.setScale(precision, BigDecimal.ROUND_HALF_UP); + StringBuilder d2 = new StringBuilder("(partial) = ").append(invoiceDifference).append(" - Multiplier=").append(multiplier); + if (log.isLoggable(Level.FINE)) log.fine(d2.toString()); + descriptionInv.append(" - ").append(d2); + } + + // For Payment + BigDecimal paymentDifference = Env.ZERO; + StringBuilder descriptionPay = null; + if (payment != null && payment.getC_Payment_ID() > 0) { + List valuesPay = DB.getSQLValueObjectsEx(getTrxName(), sql.toString(), + MPayment.Table_ID, payment.getC_Payment_ID(), as.getC_AcctSchema_ID()); + if (valuesPay != null) { + if (invoice.isSOTrx()) { + paymentSource = (BigDecimal) valuesPay.get(2); // AmtSourceCr + paymentAccounted = (BigDecimal) valuesPay.get(3); // AmtAcctCr + } else { + paymentSource = (BigDecimal) valuesPay.get(0); // AmtSourceDr + paymentAccounted = (BigDecimal) valuesPay.get(1); // AmtAcctDr + } + } + // Requires that Payment is Posted + if (paymentSource == null || paymentAccounted == null) + return "Gain/Loss - Payment not posted yet"; + // + String paymentCur = MCurrency.get(getCtx(), payment.getC_Currency_ID()).getISO_Code(); + descriptionPay = new StringBuilder("Payment=(").append(paymentCur).append(")").append(paymentSource).append("/").append(paymentAccounted) + .append(" - Allocation=(").append(allocCur).append(")").append(allocationSource).append("/").append(allocationAccounted); + if (log.isLoggable(Level.FINE)) log.fine(descriptionPay.toString()); + // Allocation not Payment Currency + BigDecimal allocationPaymentSource = allocationSource; + if (getC_Currency_ID() != payment.getC_Currency_ID()) + { + allocationPaymentSource = MConversionRate.convert(getCtx(), + allocationSource, getC_Currency_ID(), + payment.getC_Currency_ID(), getDateAcct(), + payment.getC_ConversionType_ID(), payment.getAD_Client_ID(), payment.getAD_Org_ID()); + if (allocationPaymentSource == null) + return "Gain/Loss - No Conversion from Allocation->Payment"; + StringBuilder d2 = new StringBuilder("Allocation=(").append(allocCur).append(")").append(allocationSource) + .append("->(").append(paymentCur).append(")").append(allocationPaymentSource); + if (log.isLoggable(Level.FINE)) log.fine(d2.toString()); + descriptionPay.append(" - ").append(d2); + } + + // Full Payment in currency + if (allocationPaymentSource.compareTo(paymentSource) == 0) + { + paymentDifference = paymentAccounted.subtract(allocationAccounted); // gain is negative + StringBuilder d2 = new StringBuilder("(full) = ").append(paymentDifference); + if (log.isLoggable(Level.FINE)) log.fine(d2.toString()); + descriptionPay.append(" - ").append(d2); + } + else // partial or MC + { + // percent of total payment + double multiplier = allocationPaymentSource.doubleValue() / paymentSource.doubleValue(); + // Reduce Orig Payment Accounted + paymentAccounted = paymentAccounted.multiply(BigDecimal.valueOf(multiplier)); + // Difference based on percentage of Orig Payment + paymentDifference = paymentAccounted.subtract(allocationAccounted); // gain is negative + // ignore Tolerance + if (paymentDifference.abs().compareTo(TOLERANCE) < 0) + paymentDifference = Env.ZERO; + // Round + int precision = as.getStdPrecision(); + if (paymentDifference.scale() > precision) + paymentDifference = paymentDifference.setScale(precision, BigDecimal.ROUND_HALF_UP); + StringBuilder d2 = new StringBuilder("(partial) = ").append(paymentDifference).append(" - Multiplier=").append(multiplier); + if (log.isLoggable(Level.FINE)) log.fine(d2.toString()); + descriptionPay.append(" - ").append(d2); + } + } + + if (invoiceDifference.signum() == 0 && paymentDifference.signum() == 0) { log.fine("No Difference"); return null; @@ -795,23 +862,45 @@ public class Doc_AllocationHdr extends Doc MAccount gain = MAccount.get (as.getCtx(), as.getAcctSchemaDefault().getRealizedGain_Acct()); MAccount loss = MAccount.get (as.getCtx(), as.getAcctSchemaDefault().getRealizedLoss_Acct()); - // + // + BigDecimal acctDifference = invoiceDifference.subtract(paymentDifference); if (invoice.isSOTrx()) - { - FactLine fl = fact.createLine (line, loss, gain, - as.getC_Currency_ID(), acctDifference); - fl.setDescription(description.toString()); - fact.createLine (line, acct, - as.getC_Currency_ID(), acctDifference.negate()); - fl.setDescription(description.toString()); + { + if (acctDifference.signum() != 0) { + FactLine fl = fact.createLine (line, loss, gain, as.getC_Currency_ID(), acctDifference); + StringBuilder description = new StringBuilder(descriptionInv); + if (paymentDifference.signum() != 0 && descriptionPay != null) { + description.append(" / ").append(descriptionPay); + } + fl.setDescription(description.toString()); + } + if (invoiceDifference.signum() != 0) { + FactLine fl = fact.createLine (line, invAcct, as.getC_Currency_ID(), invoiceDifference.negate()); + fl.setDescription(descriptionInv.toString()); + } + if (paymentDifference.signum() != 0) { + FactLine fl = fact.createLine (line, payAcct, as.getC_Currency_ID(), paymentDifference); + fl.setDescription(descriptionPay.toString()); + } } else { - fact.createLine (line, acct, - as.getC_Currency_ID(), acctDifference); - @SuppressWarnings("unused") - FactLine fl = fact.createLine (line, loss, gain, - as.getC_Currency_ID(), acctDifference.negate()); + if (invoiceDifference.signum() != 0) { + FactLine fl = fact.createLine (line, invAcct, as.getC_Currency_ID(), invoiceDifference); + fl.setDescription(descriptionInv.toString()); + } + if (paymentDifference.signum() != 0) { + FactLine fl = fact.createLine (line, payAcct, as.getC_Currency_ID(), paymentDifference.negate()); + fl.setDescription(descriptionPay.toString()); + } + if (acctDifference.signum() != 0) { + FactLine fl = fact.createLine (line, loss, gain, as.getC_Currency_ID(), acctDifference.negate()); + StringBuilder description = new StringBuilder(descriptionInv); + if (paymentDifference.signum() != 0 && descriptionPay != null) { + description.append(" / ").append(descriptionPay); + } + fl.setDescription(description.toString()); + } } return null; } // createRealizedGainLoss @@ -1040,49 +1129,49 @@ class Doc_AllocationTax } // Discount // WriteOff Amount - if (m_WriteOffAmt.signum() != 0) - { - // Original Tax is DR - need to correct it CR - if (Env.ZERO.compareTo(factAcct.getAmtSourceDr()) != 0) - { - BigDecimal amount = calcAmount(factAcct.getAmtSourceDr(), - total, m_WriteOffAmt, precision); - if (amount.signum() != 0) - { - if (m_IsSOTrx) { - fact.createLine (line, m_WriteOffAccount, - as.getC_Currency_ID(), amount, null); - fact.createLine (line, taxAcct, - as.getC_Currency_ID(), null, amount); - } else { - fact.createLine (line, m_WriteOffAccount, - as.getC_Currency_ID(), amount.negate(), null); - fact.createLine (line, taxAcct, - as.getC_Currency_ID(), null, amount.negate()); - } - } - } - // Original Tax is CR - need to correct it DR - else - { - BigDecimal amount = calcAmount(factAcct.getAmtSourceCr(), - total, m_WriteOffAmt, precision); - if (amount.signum() != 0) - { - if(m_IsSOTrx) { - fact.createLine (line, taxAcct, - as.getC_Currency_ID(), amount, null); - fact.createLine (line, m_WriteOffAccount, - as.getC_Currency_ID(), null, amount); - } else { - fact.createLine (line, taxAcct, - as.getC_Currency_ID(), amount.negate(), null); - fact.createLine (line, m_WriteOffAccount, - as.getC_Currency_ID(), null, amount.negate()); - } - } - } - } // WriteOff + if (m_WriteOffAmt.signum() != 0) + { + // Original Tax is DR - need to correct it CR + if (Env.ZERO.compareTo(factAcct.getAmtSourceDr()) != 0) + { + BigDecimal amount = calcAmount(factAcct.getAmtSourceDr(), + total, m_WriteOffAmt, precision); + if (amount.signum() != 0) + { + if (m_IsSOTrx) { + fact.createLine (line, m_WriteOffAccount, + as.getC_Currency_ID(), amount, null); + fact.createLine (line, taxAcct, + as.getC_Currency_ID(), null, amount); + } else { + fact.createLine (line, m_WriteOffAccount, + as.getC_Currency_ID(), amount.negate(), null); + fact.createLine (line, taxAcct, + as.getC_Currency_ID(), null, amount.negate()); + } + } + } + // Original Tax is CR - need to correct it DR + else + { + BigDecimal amount = calcAmount(factAcct.getAmtSourceCr(), + total, m_WriteOffAmt, precision); + if (amount.signum() != 0) + { + if(m_IsSOTrx) { + fact.createLine (line, taxAcct, + as.getC_Currency_ID(), amount, null); + fact.createLine (line, m_WriteOffAccount, + as.getC_Currency_ID(), null, amount); + } else { + fact.createLine (line, taxAcct, + as.getC_Currency_ID(), amount.negate(), null); + fact.createLine (line, m_WriteOffAccount, + as.getC_Currency_ID(), null, amount.negate()); + } + } + } + } // WriteOff } // for all lines return true; diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_GLJournal.java b/org.adempiere.base/src/org/compiere/acct/Doc_GLJournal.java index 176aad9013..4400b5e625 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_GLJournal.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_GLJournal.java @@ -93,7 +93,10 @@ public class Doc_GLJournal extends Doc MAccount account = line.getAccount_Combi(); docLine.setAccount (account); // -- Organization of Line was set to Org of Account - list.add(docLine); + list.add(docLine); + + if (docLine.getC_Currency_ID() != getC_Currency_ID()) + setIsMultiCurrency(true); } // Return Array int size = list.size(); @@ -154,7 +157,7 @@ public class Doc_GLJournal extends Doc @SuppressWarnings("unused") FactLine line = fact.createLine (p_lines[i], p_lines[i].getAccount (), - getC_Currency_ID(), + p_lines[i].getC_Currency_ID(), p_lines[i].getAmtSourceDr (), p_lines[i].getAmtSourceCr ()); } diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java index 87a48da28b..7580ec3e1c 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java @@ -444,12 +444,42 @@ public class Doc_MatchPO extends Doc if (mPO[i].getM_AttributeSetInstance_ID() == mMatchPO.getM_AttributeSetInstance_ID() && mPO[i].getM_MatchPO_ID() != mMatchPO.getM_MatchPO_ID()) { - BigDecimal qty = (isReturnTrx ? mPO[i].getQty().negate() : mPO[i].getQty()); - tQty = tQty.add(qty); - tAmt = tAmt.add(poCost.multiply(qty)); + BigDecimal qty = (isReturnTrx ? mPO[i].getQty().negate() : mPO[i].getQty()); + BigDecimal orderCost = BigDecimal.ZERO; + if (mPO[i].getM_InOutLine_ID() > 0) + { + tQty = tQty.add(qty); + //IDEMPIERE-3742 Wrong product cost for partial MR + if (m_oLine.getC_Currency_ID() != as.getC_Currency_ID()) + { + MOrder order = m_oLine.getParent(); + if(MAcctSchema.COSTINGMETHOD_AveragePO.equals(as.getCostingMethod())) + { + orderCost = mPO[i].getM_InOutLine().getC_OrderLine().getPriceActual(); + Timestamp dateAcct = mPO[i].getM_InOutLine().getM_InOut().getDateAcct(); + BigDecimal rate = MConversionRate.getRate( + order.getC_Currency_ID(), as.getC_Currency_ID(), + dateAcct, order.getC_ConversionType_ID(), + m_oLine.getAD_Client_ID(), m_oLine.getAD_Org_ID()); + + if (rate == null) + { + p_Error = "Purchase Order not convertible - " + as.getName(); + return null; + } + orderCost = orderCost.multiply(rate); + tAmt = tAmt.add(orderCost.multiply(qty)); + + } else { + tAmt = tAmt.add(poCost.multiply(qty)); + } + } //IDEMPIERE-3742 Wrong product cost for partial MR + else { + tAmt = tAmt.add(poCost.multiply(qty)); + } + } } - } - + } poCost = poCost.multiply(getQty()); // Delivered so far tAmt = tAmt.add(isReturnTrx ? poCost.negate() : poCost); tQty = tQty.add(isReturnTrx ? getQty().negate() : getQty()); diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Order.java b/org.adempiere.base/src/org/compiere/acct/Doc_Order.java index 63ad382edb..e62ecb3521 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Order.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Order.java @@ -734,7 +734,7 @@ public class Doc_Order extends Doc * @param multiplier 1 for accrual * @return Fact */ - protected static Fact getCommitmentSalesRelease(MAcctSchema as, Doc doc, + public static Fact getCommitmentSalesRelease(MAcctSchema as, Doc doc, BigDecimal Qty, int M_InOutLine_ID, BigDecimal multiplier) { Fact fact = new Fact(doc, as, Fact.POST_Commitment); diff --git a/org.adempiere.base/src/org/compiere/acct/FactLine.java b/org.adempiere.base/src/org/compiere/acct/FactLine.java index 45c2bc6318..45b92d7a51 100644 --- a/org.adempiere.base/src/org/compiere/acct/FactLine.java +++ b/org.adempiere.base/src/org/compiere/acct/FactLine.java @@ -728,7 +728,7 @@ public final class FactLine extends X_Fact_Acct Timestamp convDate = getDateAcct(); - if ( m_docLine != null && ( m_doc instanceof Doc_BankStatement || m_doc instanceof Doc_AllocationHdr ) ) + if (m_docLine != null && m_doc instanceof Doc_BankStatement) convDate = m_docLine.getDateConv(); diff --git a/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java b/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java index 9fdd19966f..513f2ba67f 100644 --- a/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java +++ b/org.adempiere.base/src/org/compiere/impexp/OFXBankStatementHandler.java @@ -23,7 +23,11 @@ import java.io.InputStreamReader; import java.math.BigDecimal; import java.sql.Timestamp; import java.text.ParseException; -import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.StringTokenizer; +import java.util.TimeZone; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; @@ -198,6 +202,10 @@ public abstract class OFXBankStatementHandler extends DefaultHandler m_errorMessage = new StringBuffer("ErrorInitializingParser"); m_errorDescription = new StringBuffer("Unable to initialize SAX parser: ").append(e.getMessage()); } + + if (!result) + closeBufferedReader(); + return result; } // init @@ -216,7 +224,7 @@ public abstract class OFXBankStatementHandler extends DefaultHandler try { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - reader.mark(HEADER_SIZE + 100); + reader.mark(HEADER_SIZE + 20000); StringBuilder header = new StringBuilder(); for (int i = 0; i < HEADER_SIZE; i++) { @@ -252,6 +260,7 @@ public abstract class OFXBankStatementHandler extends DefaultHandler { m_errorMessage = new StringBuffer("ErrorReadingData"); m_errorDescription = new StringBuffer(e.getMessage()); + closeBufferedReader(); return result; } @@ -318,11 +327,22 @@ public abstract class OFXBankStatementHandler extends DefaultHandler { m_errorMessage = new StringBuffer("ErrorReadingData"); m_errorDescription = new StringBuffer(e.getMessage()); + } finally { + closeBufferedReader(); } return result; } // loadLines + private void closeBufferedReader() { + if (m_reader != null) + try { + m_reader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + /** * Method getDateLastRun * @return Timestamp @@ -748,6 +768,87 @@ public abstract class OFXBankStatementHandler extends DefaultHandler } // endElement + /* + * Copyright 2008 Web Cohesion + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * source: https://github.com/stoicflame/ofx4j/blob/a604e4f6ffefea61403434cf853bbd1b20740386/src/main/java/com/webcohesion/ofx4j/io/DefaultStringConversion.java + * + */ + /** + * Parse the timezone offset of the form [HOURS_OFF_GMT:TZ_ID] + * + * @param tzoffset The offset pattern. + * @return The timezone. + */ + protected TimeZone parseTimeZone(String tzoffset) { + StringTokenizer tokenizer = new StringTokenizer(tzoffset, "[]:"); + TimeZone tz = GMT_TIME_ZONE; + if (tokenizer.hasMoreTokens()) { + String hoursOff = tokenizer.nextToken(); + tz = TimeZone.getTimeZone("GMT" + hoursOff); + } + + return tz; + } + + public static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone("GMT"); + public static final int DATE_FORMAT_LENGTH = "yyyyMMddHHmmss.SSS".length(); + public static final int TIME_FORMAT_LENGTH = "HHmmss.SSS".length(); + + /** + * Parses a date according to OFX. + * + * @param value The value of the date. + * @return The date value. + */ + protected Date parseDate(String value) { + char[] parseableDate = new char[DATE_FORMAT_LENGTH]; + Arrays.fill(parseableDate, '0'); + parseableDate[parseableDate.length - 4] = '.'; + char[] valueChars = value.toCharArray(); + int index = 0; + while (index < valueChars.length && valueChars[index] != '[') { + if (index < DATE_FORMAT_LENGTH) { + parseableDate[index] = valueChars[index]; + } + + index++; + } + + int year = Integer.parseInt(new String(parseableDate, 0, 4)); + int month = Integer.parseInt(new String(parseableDate, 4, 2)) - 1; //java month numberss are zero-based + int day = Integer.parseInt(new String(parseableDate, 6, 2)); + int hour = Integer.parseInt(new String(parseableDate, 8, 2)); + int minute = Integer.parseInt(new String(parseableDate, 10, 2)); + int second = Integer.parseInt(new String(parseableDate, 12, 2)); + int milli = Integer.parseInt(new String(parseableDate, 15, 3)); + + //set up a new calendar at zero, then set all the fields. + GregorianCalendar calendar = new GregorianCalendar(year, month, day, hour, minute, second); + if (index < valueChars.length && valueChars[index] == '[') { + String tzoffset = value.substring(index); + calendar.setTimeZone(parseTimeZone(tzoffset)); + } + else { + calendar.setTimeZone(GMT_TIME_ZONE); + } + calendar.add(GregorianCalendar.MILLISECOND, milli); + + return calendar.getTime(); + } + /** * Method parseOfxDate * @param value String @@ -758,9 +859,7 @@ public abstract class OFXBankStatementHandler extends DefaultHandler { try { - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); - sdf.setLenient(false); - return new Timestamp (sdf.parse(value).getTime()); + return new Timestamp (parseDate(value).getTime()); } catch(Exception e) { diff --git a/org.adempiere.base/src/org/compiere/impexp/OFXFileBankStatementLoader.java b/org.adempiere.base/src/org/compiere/impexp/OFXFileBankStatementLoader.java index 7f2b1aedf4..96e3221e9e 100644 --- a/org.adempiere.base/src/org/compiere/impexp/OFXFileBankStatementLoader.java +++ b/org.adempiere.base/src/org/compiere/impexp/OFXFileBankStatementLoader.java @@ -17,7 +17,6 @@ package org.compiere.impexp; import java.io.FileInputStream; -import java.io.IOException; import org.compiere.model.MBankStatementLoader; import org.xml.sax.SAXException; @@ -38,6 +37,9 @@ public final class OFXFileBankStatementLoader extends OFXBankStatementHandler im * @return boolean * @see org.compiere.impexp.BankStatementLoaderInterface#init(MBankStatementLoader) */ + //m_stream is not closed because the BufferedReader in the parent class is closed and according to the Java docs: + //Calling close() on the BufferedReader closes the underlying stream by default implementation + @SuppressWarnings("resource") public boolean init(MBankStatementLoader controller) { boolean result = false; @@ -72,13 +74,6 @@ public final class OFXFileBankStatementLoader extends OFXBankStatementHandler im { m_errorMessage = new StringBuffer("ErrorReadingData"); m_errorDescription = new StringBuffer(); - }finally{ - if (m_stream != null) - try { - m_stream.close(); - } catch (IOException e) { - e.printStackTrace(); - } } return result; diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 06242bd0a1..12618898a2 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -85,7 +85,7 @@ public class GridField /** * */ - private static final long serialVersionUID = -5866251928705632328L; + private static final long serialVersionUID = -1871840570764036802L; /** * Field Constructor. @@ -307,6 +307,9 @@ public class GridField Evaluator.parseDepends(list, m_vo.DisplayLogic); Evaluator.parseDepends(list, m_vo.ReadOnlyLogic); Evaluator.parseDepends(list, m_vo.MandatoryLogic); + // Virtual UI Column + if (m_vo.ColumnSQL != null && m_vo.ColumnSQL.length() > 0 && m_vo.ColumnSQL.startsWith("@SQL=")) + Evaluator.parseDepends(list, m_vo.ColumnSQL.substring(5)); // Lookup if (m_lookup != null) Evaluator.parseDepends(list, m_lookup.getValidation()); @@ -1365,10 +1368,15 @@ public class GridField { if (m_vo.ColumnSQL != null && m_vo.ColumnSQL.length() > 0) { - if (withAS) - return m_vo.ColumnSQL + " AS " + m_vo.ColumnName; + String query; + if (m_vo.ColumnSQL.startsWith("@SQL=")) + query = "NULL"; else - return m_vo.ColumnSQL; + query = m_vo.ColumnSQL; + if (withAS) + return query + " AS " + m_vo.ColumnName; + else + return query; } return m_vo.ColumnName; } // getColumnSQL @@ -1379,10 +1387,26 @@ public class GridField */ public boolean isVirtualColumn() { - if (m_vo.ColumnSQL != null && m_vo.ColumnSQL.length() > 0) - return true; - return false; - } // isColumnVirtual + return (m_vo.ColumnSQL != null && m_vo.ColumnSQL.length() > 0); + } // isVirtualColumn + + /** + * Is Virtual DB Column + * @return column is virtual DB + */ + public boolean isVirtualDBColumn() + { + return (m_vo.ColumnSQL != null && m_vo.ColumnSQL.length() > 0 && !m_vo.ColumnSQL.startsWith("@SQL=")); + } // isVirtualDBColumn + + /** + * Is Virtual UI Column + * @return column is virtual UI + */ + public boolean isVirtualUIColumn() + { + return (m_vo.ColumnSQL != null && m_vo.ColumnSQL.length() > 0 && m_vo.ColumnSQL.startsWith("@SQL=")); + } // isVirtualUIColumn /** * Get Header @@ -1646,6 +1670,14 @@ public class GridField { return m_vo.IsSelectionColumn; } + /** + * Is HTML Field (display) + * @return html field + */ + public boolean isHtml() + { + return m_vo.IsHtml; + } /** * Selection column sequence * @return SeqNoSelection @@ -2579,4 +2611,26 @@ public class GridField long timestamp; boolean value; } + + public void processUIVirtualColumn() { + String sql = m_vo.ColumnSQL.substring(5); + sql = Env.parseContext(Env.getCtx(), getWindowNo(), sql, false); + if (Util.isEmpty(sql)) { + setValue(null, false); + } else { + if (DisplayType.isDate(m_vo.displayType)) { + Timestamp valueTS = DB.getSQLValueTSEx(null, sql, new Object[] {}); + setValue(valueTS, false); + } else if (DisplayType.isNumeric(m_vo.displayType)) { + BigDecimal valueBD = DB.getSQLValueBDEx(null, sql, new Object[] {}); + setValue(valueBD, false); + } else if (DisplayType.isID(m_vo.displayType)) { + int valueInt = DB.getSQLValueEx(null, sql, new Object[] {}); + setValue(valueInt, false); + } else { // default to String + String valueStr = DB.getSQLValueStringEx(null, sql); + setValue(valueStr, false); + } + } + } } // GridField diff --git a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java index 5fd89cb0e3..f2c08f4e79 100644 --- a/org.adempiere.base/src/org/compiere/model/GridFieldVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridFieldVO.java @@ -47,7 +47,7 @@ public class GridFieldVO implements Serializable /** * */ - private static final long serialVersionUID = -3894697577296104861L; + private static final long serialVersionUID = -1752172363171842152L; /** * Return the SQL statement used for the MFieldVO.create @@ -202,7 +202,7 @@ public class GridFieldVO implements Serializable vo.ValidationCode = rs.getString(i); else if (columnName.equalsIgnoreCase("ColumnSQL")) { vo.ColumnSQL = rs.getString(i); - if (vo.ColumnSQL != null && vo.ColumnSQL.contains("@")) { + if (vo.ColumnSQL != null && !vo.ColumnSQL.startsWith("@SQL=") && vo.ColumnSQL.contains("@")) { // NOTE: cannot use window context because this is set globally on the query, not per record vo.ColumnSQL = Env.parseContext(ctx, -1, vo.ColumnSQL, false, true); } @@ -238,6 +238,8 @@ public class GridFieldVO implements Serializable vo.PA_DashboardContent_ID = rs.getInt (i); else if (columnName.equalsIgnoreCase("placeholder")) vo.Placeholder = rs.getString(i); + else if (columnName.equalsIgnoreCase("IsHtml")) + vo.IsHtml = "Y".equals(rs.getString(i)); } if (vo.Header == null) vo.Header = vo.ColumnName; @@ -692,6 +694,8 @@ public class GridFieldVO implements Serializable public String Placeholder = ""; public String Placeholder2 = ""; + /* Is HTML String */ + public boolean IsHtml = false; /** * Set Context including contained elements @@ -828,6 +832,7 @@ public class GridFieldVO implements Serializable clone.AD_LabelStyle_ID = AD_LabelStyle_ID; clone.PA_DashboardContent_ID = PA_DashboardContent_ID; clone.Placeholder = Placeholder; + clone.IsHtml = IsHtml; // Lookup clone.ValidationCode = ValidationCode; diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index a825f2f3ce..86891042f4 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -111,7 +111,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable /** * */ - private static final long serialVersionUID = -2946624717834888117L; + private static final long serialVersionUID = -3115353522698098211L; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; @@ -2116,6 +2116,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable fFax.setVFormat(phone_frm); } + // Load virtual UI columns + for (GridField field : getFields()) { + if (field.isVirtualUIColumn()) + field.processUIVirtualColumn(); + } } // loadDependentInfo /** @@ -2782,6 +2787,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable setValue(dependentField, null); } } + // if the field is a Virtual UI Column + if (dependentField.isVirtualUIColumn()) { + dependentField.processUIVirtualColumn(); + } } // for all dependent fields } // processDependencies @@ -3300,7 +3309,16 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable public boolean isNew() { return isOpen() && getCurrentRow() >= 0 && getCurrentRow() == m_mTable.getNewRow(); } - + + public String getAD_Tab_UU() { + return m_vo.AD_Tab_UU; + } + + public String getAD_Process_UU() + { + return m_vo.AD_Process_UU; + } + public boolean isUpdateWindowContext() { return m_updateWindowContext ; diff --git a/org.adempiere.base/src/org/compiere/model/GridTabVO.java b/org.adempiere.base/src/org/compiere/model/GridTabVO.java index bfcb216252..fae6f358d1 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTabVO.java +++ b/org.adempiere.base/src/org/compiere/model/GridTabVO.java @@ -41,7 +41,7 @@ public class GridTabVO implements Evaluatee, Serializable /** * */ - private static final long serialVersionUID = -7973388282943436222L; + private static final long serialVersionUID = -1353087123788176368L; /************************************************************************** * Create MTab VO @@ -458,7 +458,9 @@ public class GridTabVO implements Evaluatee, Serializable public boolean IsHighVolume = false; /** Process */ public int AD_Process_ID = 0; - /** Commot Warning */ + /** Process UUID */ + public String AD_Process_UU; + /** Commit Warning */ public String CommitWarning; /** Where */ public String WhereClause; diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index f5a69abd89..144304b5ac 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -104,11 +104,12 @@ public class GridTable extends AbstractTableModel /** * */ - private static final long serialVersionUID = -4651516342985623070L; + private static final long serialVersionUID = -2741647620577906242L; public static final String DATA_REFRESH_MESSAGE = "Refreshed"; public static final String DATA_UPDATE_COPIED_MESSAGE = "UpdateCopied"; public static final String DATA_INSERTED_MESSAGE = "Inserted"; + public static final String DATA_IGNORED_MESSAGE = "Ignored"; /** * JDBC Based Buffered Table @@ -549,7 +550,7 @@ public class GridTable extends AbstractTableModel * @param index index * @return GridField */ - protected GridField getField (int index) + public GridField getField (int index) { if (index < 0 || index >= m_fields.size()) return null; @@ -2858,7 +2859,7 @@ public class GridTable extends AbstractTableModel // fireTableRowsUpdated(m_rowChanged, m_rowChanged); >> messes up display?? (clearSelection) } m_newRow = -1; - fireDataStatusIEvent("Ignored", ""); + fireDataStatusIEvent(DATA_IGNORED_MESSAGE, ""); } // dataIgnore diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Column.java b/org.adempiere.base/src/org/compiere/model/I_AD_Column.java index 72a837b14c..259e323822 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Column.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Column.java @@ -418,6 +418,19 @@ public interface I_AD_Column */ public String getIsEncrypted(); + /** Column name IsHtml */ + public static final String COLUMNNAME_IsHtml = "IsHtml"; + + /** Set HTML. + * Text has HTML tags + */ + public void setIsHtml (boolean IsHtml); + + /** Get HTML. + * Text has HTML tags + */ + public boolean isHtml(); + /** Column name IsIdentifier */ public static final String COLUMNNAME_IsIdentifier = "IsIdentifier"; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_InfoColumn.java b/org.adempiere.base/src/org/compiere/model/I_AD_InfoColumn.java index 9db00522d1..f43d114dca 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_InfoColumn.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_InfoColumn.java @@ -257,6 +257,19 @@ public interface I_AD_InfoColumn */ public String getHelp(); + /** Column name InputFieldValidation */ + public static final String COLUMNNAME_InputFieldValidation = "InputFieldValidation"; + + /** Set Input field validation. + * Input field validaton query + */ + public void setInputFieldValidation (String InputFieldValidation); + + /** Get Input field validation. + * Input field validaton query + */ + public String getInputFieldValidation(); + /** Column name IsActive */ public static final String COLUMNNAME_IsActive = "IsActive"; @@ -348,6 +361,19 @@ public interface I_AD_InfoColumn */ public boolean isQueryCriteria(); + /** Column name IsReadOnly */ + public static final String COLUMNNAME_IsReadOnly = "IsReadOnly"; + + /** Set Read Only. + * Field is read only + */ + public void setIsReadOnly (boolean IsReadOnly); + + /** Get Read Only. + * Field is read only + */ + public boolean isReadOnly(); + /** Column name Name */ public static final String COLUMNNAME_Name = "Name"; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_UserPreference.java b/org.adempiere.base/src/org/compiere/model/I_AD_UserPreference.java index 482759b96b..f1d278eae9 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_UserPreference.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_UserPreference.java @@ -164,6 +164,15 @@ public interface I_AD_UserPreference /** Get Detailed Zoom Across */ public boolean isDetailedZoomAcross(); + /** Column name IsUseSimilarTo */ + public static final String COLUMNNAME_IsUseSimilarTo = "IsUseSimilarTo"; + + /** Set Use Similar To */ + public void setIsUseSimilarTo (boolean IsUseSimilarTo); + + /** Get Use Similar To */ + public boolean isUseSimilarTo(); + /** Column name ToggleOnDoubleClick */ public static final String COLUMNNAME_ToggleOnDoubleClick = "ToggleOnDoubleClick"; diff --git a/org.adempiere.base/src/org/compiere/model/I_M_Attribute.java b/org.adempiere.base/src/org/compiere/model/I_M_Attribute.java index 8fcce2125c..46dceb22af 100644 --- a/org.adempiere.base/src/org/compiere/model/I_M_Attribute.java +++ b/org.adempiere.base/src/org/compiere/model/I_M_Attribute.java @@ -91,6 +91,19 @@ public interface I_M_Attribute */ public int getCreatedBy(); + /** Column name DateFormat */ + public static final String COLUMNNAME_DateFormat = "DateFormat"; + + /** Set Date Format. + * Date format used in the input format + */ + public void setDateFormat (String DateFormat); + + /** Get Date Format. + * Date format used in the input format + */ + public String getDateFormat(); + /** Column name Description */ public static final String COLUMNNAME_Description = "Description"; diff --git a/org.adempiere.base/src/org/compiere/model/I_M_AttributeInstance.java b/org.adempiere.base/src/org/compiere/model/I_M_AttributeInstance.java index 0bb37973d9..b67a330a2b 100644 --- a/org.adempiere.base/src/org/compiere/model/I_M_AttributeInstance.java +++ b/org.adempiere.base/src/org/compiere/model/I_M_AttributeInstance.java @@ -174,6 +174,15 @@ public interface I_M_AttributeInstance */ public String getValue(); + /** Column name ValueDate */ + public static final String COLUMNNAME_ValueDate = "ValueDate"; + + /** Set Value Date */ + public void setValueDate (Timestamp ValueDate); + + /** Get Value Date */ + public Timestamp getValueDate(); + /** Column name ValueNumber */ public static final String COLUMNNAME_ValueNumber = "ValueNumber"; diff --git a/org.adempiere.base/src/org/compiere/model/LookupDisplayColumn.java b/org.adempiere.base/src/org/compiere/model/LookupDisplayColumn.java index 1907fff90e..774115b854 100644 --- a/org.adempiere.base/src/org/compiere/model/LookupDisplayColumn.java +++ b/org.adempiere.base/src/org/compiere/model/LookupDisplayColumn.java @@ -67,7 +67,10 @@ public class LookupDisplayColumn implements Serializable IsTranslated = isTranslated; DisplayType = ad_Reference_ID; AD_Reference_ID = ad_Reference_Value_ID; - ColumnSQL = columnSQL; + if (columnSQL != null && columnSQL.length() > 0 && columnSQL.startsWith("@SQL=")) + ColumnSQL = "NULL"; + else + ColumnSQL = columnSQL; IsVirtual = !Util.isEmpty(ColumnSQL, true); } // diff --git a/org.adempiere.base/src/org/compiere/model/MAttribute.java b/org.adempiere.base/src/org/compiere/model/MAttribute.java index e2a38ac83c..7b56e68840 100644 --- a/org.adempiere.base/src/org/compiere/model/MAttribute.java +++ b/org.adempiere.base/src/org/compiere/model/MAttribute.java @@ -18,6 +18,7 @@ package org.compiere.model; import java.math.BigDecimal; import java.sql.ResultSet; +import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -219,6 +220,17 @@ public class MAttribute extends X_M_Attribute } // setAttributeInstance + public void setMAttributeInstance(int M_AttributeSetInstance_ID, Timestamp value) + { + MAttributeInstance instance = getMAttributeInstance(M_AttributeSetInstance_ID); + if (instance == null) + instance = new MAttributeInstance(getCtx(), getM_Attribute_ID(), M_AttributeSetInstance_ID, value, + get_TrxName()); + else + instance.setValueDate(value); + instance.saveEx(); + }// setAttributeInstance + /** * String Representation * @return info diff --git a/org.adempiere.base/src/org/compiere/model/MAttributeInstance.java b/org.adempiere.base/src/org/compiere/model/MAttributeInstance.java index 9b22be74ba..73b24e8e96 100644 --- a/org.adempiere.base/src/org/compiere/model/MAttributeInstance.java +++ b/org.adempiere.base/src/org/compiere/model/MAttributeInstance.java @@ -18,6 +18,8 @@ package org.compiere.model; import java.math.BigDecimal; import java.sql.ResultSet; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.util.Properties; /** @@ -101,15 +103,24 @@ public class MAttributeInstance extends X_M_AttributeInstance * @param Value String representation for fast display * @param trxName transaction */ - public MAttributeInstance (Properties ctx, int M_Attribute_ID, - int M_AttributeSetInstance_ID, int M_AttributeValue_ID, String Value, String trxName) + public MAttributeInstance(Properties ctx, int M_Attribute_ID, int M_AttributeSetInstance_ID, + int M_AttributeValue_ID, String Value, String trxName) { super(ctx, 0, trxName); - setM_Attribute_ID (M_Attribute_ID); - setM_AttributeSetInstance_ID (M_AttributeSetInstance_ID); - setM_AttributeValue_ID (M_AttributeValue_ID); - setValue (Value); - } // MAttributeInstance + setM_Attribute_ID(M_Attribute_ID); + setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID); + setM_AttributeValue_ID(M_AttributeValue_ID); + setValue(Value); + } // MAttributeInstance + + public MAttributeInstance(Properties ctx, int m_Attribute_ID, int m_AttributeSetInstance_ID, Timestamp value, + String trxName) + { + super(ctx, 0, trxName); + setM_Attribute_ID(m_Attribute_ID); + setM_AttributeSetInstance_ID(m_AttributeSetInstance_ID); + setValueDate(value); + } /** @@ -152,9 +163,23 @@ public class MAttributeInstance extends X_M_AttributeInstance } } setValue(display.toString()); - } // setValueNumber - - + } // setValueNumber + + public void setValueDate(Timestamp valueDate) + { + super.setValueDate(valueDate); + if (valueDate != null) + { + SimpleDateFormat sdf = new SimpleDateFormat( + new MAttribute(getCtx(), getM_Attribute_ID(), get_TrxName()).getDateFormat()); + setValue(sdf.format(valueDate)); + } + else + { + setValue(null); + } + } + /** * String Representation * @return info diff --git a/org.adempiere.base/src/org/compiere/model/MBPBankAccount.java b/org.adempiere.base/src/org/compiere/model/MBPBankAccount.java index 5d7cbcb9e8..4a5ea08b21 100644 --- a/org.adempiere.base/src/org/compiere/model/MBPBankAccount.java +++ b/org.adempiere.base/src/org/compiere/model/MBPBankAccount.java @@ -24,6 +24,7 @@ import org.adempiere.util.PaymentUtil; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.IBAN; +import org.compiere.util.Msg; import org.compiere.util.Util; /** @@ -214,7 +215,7 @@ public class MBPBankAccount extends X_C_BP_BankAccount if (!Util.isEmpty(getIBAN())) { setIBAN(IBAN.normalizeIBAN(getIBAN())); if (!IBAN.isValid(getIBAN())) { - log.saveError("Error", "IBAN is invalid"); + log.saveError("Error", Msg.getMsg(getCtx(), "InvalidIBAN")); return false; } } diff --git a/org.adempiere.base/src/org/compiere/model/MBPartner.java b/org.adempiere.base/src/org/compiere/model/MBPartner.java index 4e41f09be8..9a9f7b2ffd 100644 --- a/org.adempiere.base/src/org/compiere/model/MBPartner.java +++ b/org.adempiere.base/src/org/compiere/model/MBPartner.java @@ -65,6 +65,8 @@ public class MBPartner extends X_C_BPartner { template.set_ValueNoCheck ("C_BPartner_ID", new Integer(0)); template.set_ValueNoCheck ("C_BPartner_UU", (String)null); + template.setAD_OrgBP_ID(0); + template.setLogo_ID(0); template.setValue (""); template.setName (""); template.setName2 (null); diff --git a/org.adempiere.base/src/org/compiere/model/MBankAccount.java b/org.adempiere.base/src/org/compiere/model/MBankAccount.java index eac26ff408..9bb98fca78 100644 --- a/org.adempiere.base/src/org/compiere/model/MBankAccount.java +++ b/org.adempiere.base/src/org/compiere/model/MBankAccount.java @@ -22,6 +22,7 @@ import java.util.Properties; import org.compiere.util.CCache; import org.compiere.util.Env; import org.compiere.util.IBAN; +import org.compiere.util.Msg; import org.compiere.util.Util; @@ -136,7 +137,7 @@ public class MBankAccount extends X_C_BankAccount if (!Util.isEmpty(getIBAN())) { setIBAN(IBAN.normalizeIBAN(getIBAN())); if (!IBAN.isValid(getIBAN())) { - log.saveError("Error", "IBAN is invalid"); + log.saveError("Error", Msg.getMsg(getCtx(), "InvalidIBAN")); return false; } } diff --git a/org.adempiere.base/src/org/compiere/model/MBankStatement.java b/org.adempiere.base/src/org/compiere/model/MBankStatement.java index 13776817ff..7f1bf5e5e9 100644 --- a/org.adempiere.base/src/org/compiere/model/MBankStatement.java +++ b/org.adempiere.base/src/org/compiere/model/MBankStatement.java @@ -312,23 +312,25 @@ public class MBankStatement extends X_C_BankStatement implements DocAction } // Lines BigDecimal total = Env.ZERO; - Timestamp minDate = getStatementDate(); - Timestamp maxDate = minDate; + // IDEMPIERE-480 changed the way accounting is posted, now lines post just with the accounting date of the statement header + // so, it is unnecessary to validate the period of lines + // Timestamp minDate = getStatementDate(); + // Timestamp maxDate = minDate; for (int i = 0; i < lines.length; i++) { MBankStatementLine line = lines[i]; if (!line.isActive()) continue; total = total.add(line.getStmtAmt()); - if (line.getDateAcct().before(minDate)) - minDate = line.getDateAcct(); - if (line.getDateAcct().after(maxDate)) - maxDate = line.getDateAcct(); + // if (line.getDateAcct().before(minDate)) + // minDate = line.getDateAcct(); + // if (line.getDateAcct().after(maxDate)) + // maxDate = line.getDateAcct(); } setStatementDifference(total); setEndingBalance(getBeginningBalance().add(total)); - MPeriod.testPeriodOpen(getCtx(), minDate, MDocType.DOCBASETYPE_BankStatement, 0); - MPeriod.testPeriodOpen(getCtx(), maxDate, MDocType.DOCBASETYPE_BankStatement, 0); + // MPeriod.testPeriodOpen(getCtx(), minDate, MDocType.DOCBASETYPE_BankStatement, getAD_Org_ID()); + // MPeriod.testPeriodOpen(getCtx(), maxDate, MDocType.DOCBASETYPE_BankStatement, getAD_Org_ID()); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE); if (m_processMsg != null) diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index 9e848670ee..54b99947d4 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -51,7 +51,7 @@ public class MColumn extends X_AD_Column /** * */ - private static final long serialVersionUID = -6914331394933196295L; + private static final long serialVersionUID = 7215660422231054443L; public static MColumn get (Properties ctx, int AD_Column_ID) { @@ -207,7 +207,27 @@ public class MColumn extends X_AD_Column String s = getColumnSQL(); return s != null && s.length() > 0; } // isVirtualColumn - + + /** + * Is Virtual DB Column + * @return true if virtual DB column + */ + public boolean isVirtualDBColumn() + { + String s = getColumnSQL(); + return s != null && s.length() > 0 && !s.startsWith("@SQL="); + } // isVirtualDBColumn + + /** + * Is Virtual UI Column + * @return true if virtual UI column + */ + public boolean isVirtualUIColumn() + { + String s = getColumnSQL(); + return s != null && s.length() > 0 && s.startsWith("@SQL="); + } // isVirtualUIColumn + /** * Is the Column Encrypted? * @return true if encrypted @@ -305,6 +325,8 @@ public class MColumn extends X_AD_Column setIsMandatory(false); if (isUpdateable()) setIsUpdateable(false); + if (isVirtualUIColumn() && isIdentifier()) + setIsIdentifier(false); } // Updateable if (isParent() || isKey()) @@ -743,8 +765,6 @@ public class MColumn extends X_AD_Column foreignTable = "S_ResourceAssignment"; } else if (DisplayType.Image == refid) { foreignTable = "AD_Image"; - } else if (DisplayType.Color == refid) { - foreignTable = "AD_Color"; } else if (DisplayType.Chart == refid) { foreignTable = "AD_Chart"; } @@ -1148,4 +1168,13 @@ public class MColumn extends X_AD_Column return cnt > 0; } + public String getColumnSQL(boolean nullForUI) { + String query = getColumnSQL(); + if (query != null && query.length() > 0) { + if (query.startsWith("@SQL=") && nullForUI) + query = "NULL"; + } + return query; + } + } // MColumn diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 35768187e1..d02e7ea254 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -38,6 +38,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * Shipment Model @@ -1154,13 +1155,17 @@ public class MInOut extends X_M_InOut implements DocAction + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit(); return DocAction.STATUS_Invalid; } - BigDecimal notInvoicedAmt = MBPartner.getNotInvoicedAmt(getC_BPartner_ID()); - if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(notInvoicedAmt))) + if (!MBPartner.SOCREDITSTATUS_NoCreditCheck.equals(bp.getSOCreditStatus()) + && Env.ZERO.compareTo(bp.getSO_CreditLimit()) != 0) { - m_processMsg = "@BPartnerOverSCreditHold@ - @TotalOpenBalance@=" - + bp.getTotalOpenBalance() + ", @NotInvoicedAmt@=" + notInvoicedAmt - + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit(); - return DocAction.STATUS_Invalid; + BigDecimal notInvoicedAmt = MBPartner.getNotInvoicedAmt(getC_BPartner_ID()); + if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(notInvoicedAmt))) + { + m_processMsg = "@BPartnerOverSCreditHold@ - @TotalOpenBalance@=" + + bp.getTotalOpenBalance() + ", @NotInvoicedAmt@=" + notInvoicedAmt + + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit(); + return DocAction.STATUS_Invalid; + } } } } @@ -1190,12 +1195,7 @@ public class MInOut extends X_M_InOut implements DocAction continue; if (product != null && product.isASIMandatory(isSOTrx())) { - if(product.getAttributeSet()==null){ - m_processMsg = "@NoAttributeSet@=" + product.getValue(); - return DocAction.STATUS_Invalid; - - } - if (! product.getAttributeSet().excludeTableEntry(MInOutLine.Table_ID, isSOTrx())) { + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MInOutLine.Table_ID, isSOTrx())) { m_processMsg = "@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #" + lines[i].getLine() + ", @M_Product_ID@=" + product.getValue() + ")"; return DocAction.STATUS_Invalid; @@ -1781,7 +1781,7 @@ public class MInOut extends X_M_InOut implements DocAction protected void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setMovementDate(new Timestamp (System.currentTimeMillis())); + setMovementDate(TimeUtil.getDay(0)); if (getDateAcct().before(getMovementDate())) { setDateAcct(getMovementDate()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MInOutLine.java b/org.adempiere.base/src/org/compiere/model/MInOutLine.java index 7c97b18f4e..b79c2a8d5b 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOutLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInOutLine.java @@ -578,7 +578,9 @@ public class MInOutLine extends X_M_InOutLine } } - I_M_AttributeSet attributeset = getM_Product().getM_AttributeSet(); + I_M_AttributeSet attributeset = null; + if (getM_Product_ID() > 0) + attributeset = MProduct.get(getCtx(), getM_Product_ID()).getM_AttributeSet(); boolean isAutoGenerateLot = false; if (attributeset != null) isAutoGenerateLot = attributeset.isAutoGenerateLot(); diff --git a/org.adempiere.base/src/org/compiere/model/MInventory.java b/org.adempiere.base/src/org/compiere/model/MInventory.java index 86d192bd33..9260da7dd7 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventory.java +++ b/org.adempiere.base/src/org/compiere/model/MInventory.java @@ -33,6 +33,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; import org.compiere.util.Util; /** @@ -343,7 +344,7 @@ public class MInventory extends X_M_Inventory implements DocAction MProduct product = MProduct.get(getCtx(), line.getM_Product_ID()); if (product != null && product.isASIMandatory(line.isSOTrx())) { - if (! product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, line.isSOTrx())) { + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, line.isSOTrx())) { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); String docSubTypeInv = dt.getDocSubTypeInv(); BigDecimal qtyDiff = line.getQtyInternalUse(); @@ -658,7 +659,7 @@ public class MInventory extends X_M_Inventory implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setMovementDate(new Timestamp (System.currentTimeMillis())); + setMovementDate(TimeUtil.getDay(0)); MPeriod.testPeriodOpen(getCtx(), getMovementDate(), MDocType.DOCBASETYPE_MaterialPhysicalInventory, getAD_Org_ID()); } if (dt.isOverwriteSeqOnComplete()) { diff --git a/org.adempiere.base/src/org/compiere/model/MInventoryLine.java b/org.adempiere.base/src/org/compiere/model/MInventoryLine.java index fe3ec77e96..c56dd88947 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventoryLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInventoryLine.java @@ -261,27 +261,6 @@ public class MInventoryLine extends X_M_InventoryLine log.saveError("ParentComplete", Msg.translate(getCtx(), "M_InventoryLine")); return false; } - /* IDEMPIERE-1770 - ASI validation must be moved to MInventory.prepareIt, saving a line without ASI is ok on draft - if (m_isManualEntry) - { - // Product requires ASI - if (getM_AttributeSetInstance_ID() == 0) - { - MProduct product = MProduct.get(getCtx(), getM_Product_ID()); - if (product != null && product.isASIMandatory(isSOTrx())) - { - if(product.getAttributeSet()==null){ - log.saveError("NoAttributeSet", product.getValue()); - return false; - } - if (! product.getAttributeSet().excludeTableEntry(MInventoryLine.Table_ID, isSOTrx())) { - log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID)); - return false; - } - } - } // No ASI - } // manual - */ // Set Line No if (getLine() == 0) diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 8fe61c279f..aa53bdc5a5 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -45,6 +45,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** @@ -2152,7 +2153,7 @@ public class MInvoice extends X_C_Invoice implements DocAction return; MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateInvoiced(new Timestamp (System.currentTimeMillis())); + setDateInvoiced(TimeUtil.getDay(0)); if (getDateAcct().before(getDateInvoiced())) { setDateAcct(getDateInvoiced()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index 62b5ccff73..eddde90d68 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -44,10 +44,6 @@ import org.compiere.util.Msg; * @author Teo Sarca, www.arhipac.ro *
  • BF [ 2804142 ] MInvoice.setRMALine should work only for CreditMemo invoices * https://sourceforge.net/tracker/?func=detail&aid=2804142&group_id=176962&atid=879332 - * @author Michael Judd, www.akunagroup.com - *
  • BF [ 1733602 ] Price List including Tax Error - when a user changes the orderline or - * invoice line for a product on a price list that includes tax, the net amount is - * incorrectly calculated. * @author red1 FR: [ 2214883 ] Remove SQL code and Replace for Query */ public class MInvoiceLine extends X_C_InvoiceLine @@ -478,47 +474,6 @@ public class MInvoiceLine extends X_C_InvoiceLine { // Calculations & Rounding BigDecimal bd = getPriceActual().multiply(getQtyInvoiced()); - - boolean documentLevel = getTax().isDocumentLevel(); - - // juddm: Tax Exempt & Tax Included in Price List & not Document Level - Adjust Line Amount - // http://sourceforge.net/tracker/index.php?func=detail&aid=1733602&group_id=176962&atid=879332 - if (isTaxIncluded() && !documentLevel) { - BigDecimal taxStdAmt = Env.ZERO, taxThisAmt = Env.ZERO; - - MTax invoiceTax = getTax(); - MTax stdTax = null; - - if (getProduct() == null) - { - if (getCharge() != null) // Charge - { - stdTax = new MTax (getCtx(), - ((MTaxCategory) getCharge().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(), - get_TrxName()); - } - - } - else // Product - stdTax = new MTax (getCtx(), - ((MTaxCategory) getProduct().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(), - get_TrxName()); - - if (stdTax != null) - { - - if (log.isLoggable(Level.FINE)) log.fine("stdTax rate is " + stdTax.getRate()); - if (log.isLoggable(Level.FINE)) log.fine("invoiceTax rate is " + invoiceTax.getRate()); - - taxThisAmt = taxThisAmt.add(invoiceTax.calculateTax(bd, isTaxIncluded(), getPrecision())); - taxStdAmt = taxStdAmt.add(stdTax.calculateTax(bd, isTaxIncluded(), getPrecision())); - - bd = bd.subtract(taxStdAmt).add(taxThisAmt); - - if (log.isLoggable(Level.FINE)) log.fine("Price List includes Tax and Tax Changed on Invoice Line: New Tax Amt: " - + taxThisAmt + " Standard Tax Amt: " + taxStdAmt + " Line Net Amt: " + bd); - } - } int precision = getPrecision(); if (bd.scale() > precision) bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP); @@ -1080,7 +1035,7 @@ public class MInvoiceLine extends X_C_InvoiceLine { double result = getLineNetAmt().multiply(base).doubleValue(); result /= total.doubleValue(); - lca.setAmt(result, getParent().getC_Currency().getCostingPrecision()); + lca.setAmt(result, getParent().getC_Currency().getStdPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); @@ -1215,7 +1170,7 @@ public class MInvoiceLine extends X_C_InvoiceLine { double result = getLineNetAmt().multiply(base).doubleValue(); result /= total.doubleValue(); - lca.setAmt(result, getParent().getC_Currency().getCostingPrecision()); + lca.setAmt(result, getParent().getC_Currency().getStdPrecision()); } if (!lca.save()){ msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca); diff --git a/org.adempiere.base/src/org/compiere/model/MJournal.java b/org.adempiere.base/src/org/compiere/model/MJournal.java index 8b098ff85c..36d16eeedd 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournal.java +++ b/org.adempiere.base/src/org/compiere/model/MJournal.java @@ -29,6 +29,7 @@ import org.compiere.process.DocumentEngine; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * GL Journal Model @@ -526,8 +527,8 @@ public class MJournal extends X_GL_Journal implements DocAction } // end BF [2789319] No check of Actual, Budget, Statistical attribute - AmtSourceDr = AmtSourceDr.add(line.getAmtSourceDr()); - AmtSourceCr = AmtSourceCr.add(line.getAmtSourceCr()); + AmtSourceDr = AmtSourceDr.add(line.getAmtAcctDr()); // multi-currency + AmtSourceCr = AmtSourceCr.add(line.getAmtAcctCr()); } setTotalDr(AmtSourceDr); setTotalCr(AmtSourceCr); @@ -631,7 +632,7 @@ public class MJournal extends X_GL_Journal implements DocAction MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { if (this.getProcessedOn().signum() == 0) { - setDateDoc(new Timestamp (System.currentTimeMillis())); + setDateDoc(TimeUtil.getDay(0)); if (getDateAcct().before(getDateDoc())) { setDateAcct(getDateDoc()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java index 03f76d1923..493a4167c9 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java +++ b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java @@ -32,6 +32,7 @@ import org.compiere.process.DocumentEngine; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * Journal Batch Model @@ -509,7 +510,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateDoc(new Timestamp (System.currentTimeMillis())); + setDateDoc(TimeUtil.getDay(0)); if (getDateAcct().before(getDateDoc())) { setDateAcct(getDateDoc()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MLanguage.java b/org.adempiere.base/src/org/compiere/model/MLanguage.java index c801c7f700..e5ef74332f 100644 --- a/org.adempiere.base/src/org/compiere/model/MLanguage.java +++ b/org.adempiere.base/src/org/compiere/model/MLanguage.java @@ -305,6 +305,38 @@ public class MLanguage extends X_AD_Language return false; } } + String tp = getTimePattern(); + if (is_ValueChanged("TimePattern") && tp != null && tp.length() > 0) + { + if (tp.indexOf("HH") == -1 && tp.indexOf("hh") == -1) + { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@Error@ @TimePattern@ - No Hour (HH/hh)")); + return false; + } + if (tp.indexOf("mm") == -1) + { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@Error@ @TimePattern@ - No Minute (mm)")); + return false; + } + if (tp.indexOf("ss") == -1) + { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@Error@ @TimePattern@ - No Second (ss)")); + return false; + } + + m_dateFormat = (SimpleDateFormat)DateFormat.getTimeInstance + (DateFormat.SHORT, getLocale()); + try + { + m_dateFormat.applyPattern(tp); + } + catch (Exception e) + { + log.saveError("Error", Msg.parseTranslation(getCtx(), "@Error@ @TimePattern@ - " + e.getMessage())); + m_dateFormat = null; + return false; + } + } if (newRecord) setAD_Language_ID(); return true; diff --git a/org.adempiere.base/src/org/compiere/model/MLookupFactory.java b/org.adempiere.base/src/org/compiere/model/MLookupFactory.java index d1ed854738..c6aec42d55 100644 --- a/org.adempiere.base/src/org/compiere/model/MLookupFactory.java +++ b/org.adempiere.base/src/org/compiere/model/MLookupFactory.java @@ -434,7 +434,9 @@ public class MLookupFactory ZoomWindowPO = rs.getInt(9); //AD_Table_ID = rs.getInt(10); displayColumnSQL = rs.getString(11); - if (displayColumnSQL != null && displayColumnSQL.contains("@")) + if (displayColumnSQL != null && displayColumnSQL.length() > 0 && displayColumnSQL.startsWith("@SQL=")) + displayColumnSQL = "NULL"; + if (displayColumnSQL != null && displayColumnSQL.contains("@") && displayColumnSQL.startsWith("@SQL=")) displayColumnSQL = Env.parseContext(Env.getCtx(), -1, displayColumnSQL, false, true); overrideZoomWindow = rs.getInt(12); infoWindowId = rs.getInt(13); @@ -665,6 +667,11 @@ public class MLookupFactory embedSQL.append(TableNameAlias).append(".Value||'-'||"); MColumn columnDisplay = new MColumn(Env.getCtx(), columnDisplay_ID, null); + if (columnDisplay.isVirtualUIColumn()) + { + s_log.warning("Virtual UI Column must not be used as display"); + return null; + } boolean translated = false; // Translated @@ -678,7 +685,7 @@ public class MLookupFactory return null; } else - embedSQL.append(TableName).append("_Trl.").append(DisplayColumn); + embedSQL.append(TableName).append("_Trl.").append(DisplayColumn); embedSQL.append(" FROM ").append(TableName).append(" ").append(TableNameAlias) .append(" INNER JOIN ").append(TableName).append("_TRL ON (") @@ -691,9 +698,9 @@ public class MLookupFactory else { if (columnDisplay.isVirtualColumn()) - embedSQL.append(columnDisplay.getColumnSQL()).append(" AS ").append(KeyColumn); + embedSQL.append(columnDisplay.getColumnSQL(true)).append(" AS ").append(KeyColumn); else - embedSQL.append(TableNameAlias).append(".").append(DisplayColumn); + embedSQL.append(TableNameAlias).append(".").append(DisplayColumn); embedSQL.append(" FROM ").append(TableName).append(" ").append(TableNameAlias); } @@ -708,9 +715,9 @@ public class MLookupFactory embedSQL.append(BaseTable).append(".").append(BaseColumn); embedSQL.append("=").append(TableNameAlias).append(".").append(KeyColumn); } else if (translated) { - embedSQL.append(TableNameAlias).append(".").append(KeyColumn).append("=").append(column.getColumnSQL()); + embedSQL.append(TableNameAlias).append(".").append(KeyColumn).append("=").append(column.getColumnSQL(true)); } else { - embedSQL.append(KeyColumn).append("=").append(column.getColumnSQL()); + embedSQL.append(KeyColumn).append("=").append(column.getColumnSQL(true)); } return embedSQL.toString(); @@ -973,7 +980,7 @@ public class MLookupFactory MTable table = MTable.get(Env.getCtx(), TableName); for (String idColumnName : table.getIdentifierColumns()) { MColumn column = table.getColumn(idColumnName); - LookupDisplayColumn ldc = new LookupDisplayColumn(column.getColumnName(), column.getColumnSQL(), column.isTranslated(), column.getAD_Reference_ID(), column.getAD_Reference_Value_ID()); + LookupDisplayColumn ldc = new LookupDisplayColumn(column.getColumnName(), column.getColumnSQL(true), column.isTranslated(), column.getAD_Reference_ID(), column.getAD_Reference_Value_ID()); list.add (ldc); } return list; diff --git a/org.adempiere.base/src/org/compiere/model/MMatchPO.java b/org.adempiere.base/src/org/compiere/model/MMatchPO.java index 44a4e8977c..167c843f76 100644 --- a/org.adempiere.base/src/org/compiere/model/MMatchPO.java +++ b/org.adempiere.base/src/org/compiere/model/MMatchPO.java @@ -515,8 +515,87 @@ public class MMatchPO extends X_M_MatchPO { retValue = new MMatchPO (sLine, dateTrx, qty); retValue.setC_OrderLine_ID(C_OrderLine_ID); - if (iLine != null) - retValue.setC_InvoiceLine_ID(iLine); + MMatchPO otherMatchPO = null; + if (iLine == null) { + MMatchPO[] matchPOs = MMatchPO.getOrderLine(retValue.getCtx(), sLine.getC_OrderLine_ID(), retValue.get_TrxName()); + for (MMatchPO matchPO : matchPOs) + { + if (matchPO.getC_InvoiceLine_ID() > 0 && matchPO.getM_InOutLine_ID() == 0) + { + //m_matchinv not created yet + int cnt = DB.getSQLValueEx(sLine.get_TrxName(), "SELECT Count(*) FROM M_MatchInv WHERE M_InOutLine_ID="+sLine.getM_InOutLine_ID() + +" AND C_InvoiceLine_ID="+ matchPO.getC_InvoiceLine_ID()); + if (cnt <= 0) { + if (!matchPO.isPosted() && matchPO.getQty().compareTo(retValue.getQty()) >=0 ) // greater than or equal quantity + { + otherMatchPO = matchPO; + iLine = new MInvoiceLine(retValue.getCtx(), matchPO.getC_InvoiceLine_ID(), retValue.get_TrxName()); + matchPO.setQty(matchPO.getQty().subtract(retValue.getQty())); + if (matchPO.getQty().signum() == 0 ) + matchPO.deleteEx(true); + else + matchPO.saveEx(); + break; + } + + } + } + } + } + if (iLine != null) { + if (otherMatchPO == null) + retValue.setC_InvoiceLine_ID(iLine); + //auto create matchinv + if (otherMatchPO != null) + { + Savepoint savepoint = null; + Trx trx = null; + try + { + trx = trxName != null ? Trx.get(trxName, false) : null; + savepoint = trx != null ? trx.getConnection().setSavepoint() : null; + MMatchInv matchInv = new MMatchInv(retValue.getCtx(), 0, retValue.get_TrxName()); + matchInv.setC_InvoiceLine_ID(otherMatchPO.getC_InvoiceLine_ID()); + matchInv.setM_Product_ID(retValue.getM_Product_ID()); + matchInv.setM_InOutLine_ID(retValue.getM_InOutLine_ID()); + matchInv.setAD_Client_ID(retValue.getAD_Client_ID()); + matchInv.setAD_Org_ID(retValue.getAD_Org_ID()); + matchInv.setM_AttributeSetInstance_ID(retValue.getM_AttributeSetInstance_ID()); + matchInv.setQty(retValue.getQty()); + matchInv.setDateTrx(dateTrx); + matchInv.setProcessed(true); + if (!matchInv.save()) + { + if (savepoint != null) + { + trx.getConnection().rollback(savepoint); + savepoint = null; + } + else + { + matchInv.delete(true); + } + String msg = "Failed to auto match invoice."; + ValueNamePair error = CLogger.retrieveError(); + if (error != null) + { + msg = msg + " " + error.getName(); + } + s_log.severe(msg); + } + retValue.setMatchInvCreated(matchInv); + } catch (Exception e) { + s_log.log(Level.SEVERE, "Failed to auto match Invoice.", e); + } finally { + if (savepoint != null) + { + try { + trx.getConnection().releaseSavepoint(savepoint); + } catch (Exception e) {} + } + } + } + } if (!retValue.save()) { String msg = "Failed to update match po."; @@ -972,6 +1051,11 @@ public class MMatchPO extends X_M_MatchPO orderLine.setQtyInvoiced(orderLine.getQtyInvoiced().subtract(getQty())); orderLine.setDateInvoiced(getDateTrx()); // overwrite=last } + else if (!newRecord && getC_InvoiceLine_ID() > 0 && is_ValueChanged(COLUMNNAME_Qty)) + { + BigDecimal oldQty = (BigDecimal)(get_ValueOld(COLUMNNAME_Qty)); + orderLine.setQtyInvoiced(orderLine.getQtyInvoiced().subtract(oldQty.subtract(getQty()))); + } // Update Order ASI if full match if (orderLine.getM_AttributeSetInstance_ID() == 0 @@ -1183,6 +1267,36 @@ public class MMatchPO extends X_M_MatchPO this.setDescription("(" + reversal.getDocumentNo() + "<-)"); this.setReversal_ID(reversal.getM_MatchPO_ID()); this.saveEx(); + + // reversal of mr if have both shipment and invoice line + if ( reversal.getM_InOutLine_ID() > 0 && reversal.getC_InvoiceLine_ID() > 0) + { + MMatchPO[] matchPOs = MMatchPO.getOrderLine(reversal.getCtx(), reversal.getC_OrderLine_ID(), reversal.get_TrxName()); + BigDecimal matchQty = getQty(); + for (MMatchPO matchPO : matchPOs) + { + if (matchPO.getReversal_ID() == 0 && !matchPO.isPosted() + && matchPO.getC_InvoiceLine_ID() == reversal.getC_InvoiceLine_ID() + && matchPO.getM_InOutLine_ID() == 0 ) + { + matchPO.setQty(matchPO.getQty().add(matchQty)); + matchPO.saveEx(); + matchQty = BigDecimal.ZERO; + break; + } + } + + if (matchQty.signum() != 0) + { + MMatchPO matchPO = new MMatchPO (getCtx(), 0, get_TrxName()); + PO.copyValues(this, matchPO); + matchPO.setC_InvoiceLine_ID(getC_InvoiceLine_ID()); + matchPO.setM_InOutLine_ID(0); + matchPO.setDescription(null); + matchPO.setPosted (false); + matchPO.saveEx(); + } + } return true; } return false; diff --git a/org.adempiere.base/src/org/compiere/model/MMovement.java b/org.adempiere.base/src/org/compiere/model/MMovement.java index d84c0d717f..297c9ec714 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovement.java +++ b/org.adempiere.base/src/org/compiere/model/MMovement.java @@ -32,6 +32,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * Inventory Movement Model @@ -298,7 +299,7 @@ public class MMovement extends X_M_Movement implements DocAction MProduct product = line.getProduct(); if (line.getM_AttributeSetInstance_ID() == 0) { if (product != null && product.isASIMandatory(true)) { - if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing BigDecimal qtyDiff = line.getMovementQty(); // verify if the ASIs are captured on lineMA MMovementLineMA mas[] = MMovementLineMA.get(getCtx(), @@ -320,7 +321,7 @@ public class MMovement extends X_M_Movement implements DocAction { if (product != null && product.isASIMandatory(false) && line.getM_AttributeSetInstanceTo_ID() == 0) { - if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming m_processMsg = "@Line@ " + line.getLine() + ": @FillMandatory@ @M_AttributeSetInstanceTo_ID@"; return DocAction.STATUS_Invalid; } @@ -631,7 +632,7 @@ public class MMovement extends X_M_Movement implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setMovementDate(new Timestamp (System.currentTimeMillis())); + setMovementDate(TimeUtil.getDay(0)); MPeriod.testPeriodOpen(getCtx(), getMovementDate(), getC_DocType_ID(), getAD_Org_ID()); } if (dt.isOverwriteSeqOnComplete()) { diff --git a/org.adempiere.base/src/org/compiere/model/MMovementLine.java b/org.adempiere.base/src/org/compiere/model/MMovementLine.java index 5c54a07052..ac2c73e162 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovementLine.java +++ b/org.adempiere.base/src/org/compiere/model/MMovementLine.java @@ -208,22 +208,6 @@ public class MMovementLine extends X_M_MovementLine if (newRecord || is_ValueChanged(COLUMNNAME_MovementQty)) setMovementQty(getMovementQty()); - // Mandatory Instance - /* IDEMPIERE-1770 - ASI validation must be moved to MMovement.prepareIt, saving a line without ASI is ok on draft - MProduct product = getProduct(); - if (getM_AttributeSetInstance_ID() == 0) { - if (product != null && product.isASIMandatory(true)) { - if (product.getAttributeSet()==null) { - log.saveError("NoAttributeSet", product.getValue()); - return false; - } - if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, true)) { // outgoing - log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstance_ID)); - return false; - } - } - } - */ if (getM_AttributeSetInstanceTo_ID() == 0) { //instance id default to same for movement between locator @@ -233,19 +217,6 @@ public class MMovementLine extends X_M_MovementLine setM_AttributeSetInstanceTo_ID(getM_AttributeSetInstance_ID()); } - /* IDEMPIERE-1770 - ASI validation must be moved to MMovement.prepareIt, saving a line without ASI is ok on draft - if (product != null && product.isASIMandatory(false) && getM_AttributeSetInstanceTo_ID() == 0) - { - if (product.getAttributeSet()==null) { - log.saveError("NoAttributeSet", product.getValue()); - return false; - } - if (! product.getAttributeSet().excludeTableEntry(MMovementLine.Table_ID, false)) { // incoming - log.saveError("FillMandatory", Msg.getElement(getCtx(), COLUMNNAME_M_AttributeSetInstanceTo_ID)); - return false; - } - } - */ } // ASI return true; diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index afb98078fa..cfa0507cae 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -43,6 +43,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; import org.compiere.util.Util; @@ -1347,12 +1348,7 @@ public class MOrder extends X_C_Order implements DocAction if (line.getM_Product_ID() > 0 && line.getM_AttributeSetInstance_ID() == 0) { MProduct product = line.getProduct(); if (product.isASIMandatory(isSOTrx())) { - if(product.getAttributeSet()==null){ - m_processMsg = "@NoAttributeSet@=" + product.getValue(); - return DocAction.STATUS_Invalid; - - } - if (! product.getAttributeSet().excludeTableEntry(MOrderLine.Table_ID, isSOTrx())) { + if (product.getAttributeSet() != null && !product.getAttributeSet().excludeTableEntry(MOrderLine.Table_ID, isSOTrx())) { StringBuilder msg = new StringBuilder("@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #") .append(line.getLine()) .append(", @M_Product_ID@=") @@ -2130,7 +2126,7 @@ public class MOrder extends X_C_Order implements DocAction if (dt.isOverwriteDateOnComplete()) { /* a42niem - BF IDEMPIERE-63 - check if document has been completed before */ if (this.getProcessedOn().signum() == 0) { - setDateOrdered(new Timestamp (System.currentTimeMillis())); + setDateOrdered(TimeUtil.getDay(0)); if (getDateAcct().before(getDateOrdered())) { setDateAcct(getDateOrdered()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MOrderLine.java b/org.adempiere.base/src/org/compiere/model/MOrderLine.java index c4858e018a..f92d1deb5c 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrderLine.java +++ b/org.adempiere.base/src/org/compiere/model/MOrderLine.java @@ -49,10 +49,6 @@ import org.compiere.util.Msg; * * @author Teo Sarca, SC ARHIPAC SERVICE SRL *
  • BF [ 2588043 ] Insufficient message ProductNotOnPriceList - * @author Michael Judd, www.akunagroup.com - *
  • BF [ 1733602 ] Price List including Tax Error - when a user changes the orderline or - * invoice line for a product on a price list that includes tax, the net amount is - * incorrectly calculated. */ public class MOrderLine extends X_C_OrderLine { @@ -358,50 +354,6 @@ public class MOrderLine extends X_C_OrderLine public void setLineNetAmt () { BigDecimal bd = getPriceActual().multiply(getQtyOrdered()); - - boolean documentLevel = getTax().isDocumentLevel(); - - // juddm: Tax Exempt & Tax Included in Price List & not Document Level - Adjust Line Amount - // http://sourceforge.net/tracker/index.php?func=detail&aid=1733602&group_id=176962&atid=879332 - if (isTaxIncluded() && !documentLevel) { - BigDecimal taxStdAmt = Env.ZERO, taxThisAmt = Env.ZERO; - - MTax orderTax = getTax(); - MTax stdTax = null; - - // get the standard tax - if (getProduct() == null) - { - if (getCharge() != null) // Charge - { - stdTax = new MTax (getCtx(), - ((MTaxCategory) getCharge().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(), - get_TrxName()); - } - - } - else // Product - stdTax = new MTax (getCtx(), - ((MTaxCategory) getProduct().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(), - get_TrxName()); - - if (stdTax != null) - { - if (log.isLoggable(Level.FINE)){ - log.fine("stdTax rate is " + stdTax.getRate()); - log.fine("orderTax rate is " + orderTax.getRate()); - } - - taxThisAmt = taxThisAmt.add(orderTax.calculateTax(bd, isTaxIncluded(), getPrecision())); - taxStdAmt = taxStdAmt.add(stdTax.calculateTax(bd, isTaxIncluded(), getPrecision())); - - bd = bd.subtract(taxStdAmt).add(taxThisAmt); - - if (log.isLoggable(Level.FINE)) log.fine("Price List includes Tax and Tax Changed on Order Line: New Tax Amt: " - + taxThisAmt + " Standard Tax Amt: " + taxStdAmt + " Line Net Amt: " + bd); - } - - } int precision = getPrecision(); if (bd.scale() > precision) bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP); diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 53e730442d..33f16025b5 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -40,6 +40,7 @@ import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.IBAN; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; import org.compiere.util.Trx; import org.compiere.util.Util; import org.compiere.util.ValueNamePair; @@ -803,7 +804,7 @@ public class MPayment extends X_C_Payment if (!Util.isEmpty(getIBAN())) { setIBAN(IBAN.normalizeIBAN(getIBAN())); if (!IBAN.isValid(getIBAN())) { - log.saveError("Error", "IBAN is invalid"); + log.saveError("Error", Msg.getMsg(getCtx(), "InvalidIBAN")); return false; } } @@ -2117,7 +2118,7 @@ public class MPayment extends X_C_Payment private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateTrx(new Timestamp (System.currentTimeMillis())); + setDateTrx(TimeUtil.getDay(0)); if (getDateAcct().before(getDateTrx())) { setDateAcct(getDateTrx()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MPaymentTransaction.java b/org.adempiere.base/src/org/compiere/model/MPaymentTransaction.java index c367709afa..1cd3bb7a6e 100644 --- a/org.adempiere.base/src/org/compiere/model/MPaymentTransaction.java +++ b/org.adempiere.base/src/org/compiere/model/MPaymentTransaction.java @@ -87,7 +87,7 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce if (!Util.isEmpty(getIBAN())) { setIBAN(IBAN.normalizeIBAN(getIBAN())); if (!IBAN.isValid(getIBAN())) { - log.saveError("Error", "IBAN is invalid"); + log.saveError("Error", Msg.getMsg(getCtx(), "InvalidIBAN")); return false; } } diff --git a/org.adempiere.base/src/org/compiere/model/MPeriod.java b/org.adempiere.base/src/org/compiere/model/MPeriod.java index 4119c20286..b518226da9 100644 --- a/org.adempiere.base/src/org/compiere/model/MPeriod.java +++ b/org.adempiere.base/src/org/compiere/model/MPeriod.java @@ -282,7 +282,8 @@ public class MPeriod extends X_C_Period int idxdate = -1; if ( tableID == MInventory.Table_ID || tableID == MMovement.Table_ID - || tableID == MProduction.Table_ID) { + || tableID == MProduction.Table_ID + || tableID == MProjectIssue.Table_ID) { idxdate = po.get_ColumnIndex("MovementDate"); } else if ( tableID == MRequisition.Table_ID) { idxdate = po.get_ColumnIndex("DateDoc"); @@ -333,6 +334,8 @@ public class MPeriod extends X_C_Period } else if ( tableID == MAssetDisposed.Table_ID || tableID == MDepreciationExp.Table_ID) { docBaseType = MDocType.DOCBASETYPE_GLDocument; // seems like a bug of fixed assets - must use GLJournal instead of GLDocument? + } else if (tableID == MProjectIssue.Table_ID) { + docBaseType = MDocType.DOCBASETYPE_ProjectIssue; } else { s_log.warning("Could not find C_DocType_ID for " + table.getTableName()); return true; diff --git a/org.adempiere.base/src/org/compiere/model/MPriceList.java b/org.adempiere.base/src/org/compiere/model/MPriceList.java index f569d2b6f9..b06188c463 100644 --- a/org.adempiere.base/src/org/compiere/model/MPriceList.java +++ b/org.adempiere.base/src/org/compiere/model/MPriceList.java @@ -248,7 +248,7 @@ public class MPriceList extends X_M_PriceList .setOrderBy("ValidFrom DESC") .first(); if (m_plv == null) - log.warning("None found M_PriceList_ID=" + getM_PriceList_ID() + " - " + valid); + if (log.isLoggable(Level.INFO)) log.info("None found M_PriceList_ID=" + getM_PriceList_ID() + " - " + valid); else if (log.isLoggable(Level.FINE)) log.fine(m_plv.toString()); return m_plv; diff --git a/org.adempiere.base/src/org/compiere/model/MProcess.java b/org.adempiere.base/src/org/compiere/model/MProcess.java index cad10b3dad..724c27c790 100644 --- a/org.adempiere.base/src/org/compiere/model/MProcess.java +++ b/org.adempiere.base/src/org/compiere/model/MProcess.java @@ -26,6 +26,7 @@ import org.compiere.process.ProcessInfo; import org.compiere.util.CCache; import org.compiere.util.DB; import org.compiere.util.Trx; +import org.compiere.util.Util; import org.compiere.wf.MWFNode; /** @@ -43,8 +44,7 @@ public class MProcess extends X_AD_Process /** * */ - private static final long serialVersionUID = 6665942554198058466L; - + private static final long serialVersionUID = -7234986583327689692L; /** * Get MProcess from Cache @@ -64,6 +64,24 @@ public class MProcess extends X_AD_Process return retValue; } // get + /** + * Get MProcess from Cache based on UUID + * @param ctx context + * @param AD_Process_UU UUID + * @return MProcess + */ + public static MProcess get (Properties ctx, String AD_Process_UU) + { + MProcess retValue = s_cacheUU.get(AD_Process_UU); + if (retValue != null) + return retValue; + int id = DB.getSQLValueEx(null, "SELECT AD_Process_ID FROM AD_Process WHERE AD_Process_UU = ? ", AD_Process_UU); + retValue = new MProcess (ctx, id, null); + if (!Util.isEmpty(retValue.getAD_Process_UU())) + s_cacheUU.put (retValue.getAD_Process_UU(), retValue); + return retValue; + } // get + /** * Get MProcess from Menu * @param ctx context @@ -85,8 +103,10 @@ public class MProcess extends X_AD_Process } // getFromMenu - /** Cache */ + /** Cache ID */ private static CCache s_cache = new CCache(Table_Name, 20); + /** Cache UUID */ + private static CCache s_cacheUU = new CCache(Table_Name, 20); /************************************************************************** diff --git a/org.adempiere.base/src/org/compiere/model/MQuery.java b/org.adempiere.base/src/org/compiere/model/MQuery.java index 942a464406..9b27c76616 100644 --- a/org.adempiere.base/src/org/compiere/model/MQuery.java +++ b/org.adempiere.base/src/org/compiere/model/MQuery.java @@ -45,6 +45,11 @@ import org.compiere.util.ValueNamePair; */ public class MQuery implements Serializable { + /** + * + */ + private static final long serialVersionUID = 481623650333512326L; + /** * Get Query from Parameter * @param ctx context (to determine language) @@ -357,9 +362,6 @@ public class MQuery implements Serializable m_TableName = MTable.getTableName (Env.getCtx(), AD_Table_ID); } // MQuery - /** Serialization Info **/ - private static final long serialVersionUID = 4883859385509199306L; - /** Table Name */ private String m_TableName = ""; /** PInstance */ @@ -448,6 +450,11 @@ public class MQuery implements Serializable new ValueNamePair (NULL, " NULL "), new ValueNamePair (NOT_NULL, " !NULL ") }; + /** Operators for encrypted fields */ + public static final ValueNamePair[] OPERATORS_ENCRYPTED = new ValueNamePair[] { + new ValueNamePair (NULL, " NULL "), + new ValueNamePair (NOT_NULL, " !NULL ") + }; /** Operators for Numbers, Dates, Integers */ public static final ValueNamePair[] OPERATORS_NUMBERS = new ValueNamePair[] { @@ -1114,7 +1121,7 @@ class Restriction implements Serializable MTable table = MTable.get(Env.getCtx(), tableName); if (table != null) { for (MColumn col : table.getColumns(false)) { - String colSQL = col.getColumnSQL(); + String colSQL = col.getColumnSQL(true); if (colSQL != null && colSQL.contains("@")) colSQL = Env.parseContext(Env.getCtx(), -1, colSQL, false, true); if (ColumnName.equals(colSQL)) { @@ -1156,8 +1163,13 @@ class Restriction implements Serializable sb.append(Operator); if ( ! (Operator.equals(MQuery.NULL) || Operator.equals(MQuery.NOT_NULL))) { - if (Code instanceof String) - sb.append(DB.TO_STRING(Code.toString())); + if (Code instanceof String) { + if (ColumnName.toUpperCase().startsWith("UPPER(")) { + sb.append("UPPER("+DB.TO_STRING(Code.toString())+")"); + } else { + sb.append(DB.TO_STRING(Code.toString())); + } + } else if (Code instanceof Timestamp) sb.append(DB.TO_DATE((Timestamp)Code, false)); else diff --git a/org.adempiere.base/src/org/compiere/model/MRMALine.java b/org.adempiere.base/src/org/compiere/model/MRMALine.java index 4150085e01..f37d2a8871 100644 --- a/org.adempiere.base/src/org/compiere/model/MRMALine.java +++ b/org.adempiere.base/src/org/compiere/model/MRMALine.java @@ -19,7 +19,6 @@ package org.compiere.model; import java.math.BigDecimal; import java.sql.ResultSet; import java.util.Properties; -import java.util.logging.Level; import org.adempiere.base.Core; import org.adempiere.base.IProductPricing; @@ -248,51 +247,6 @@ public class MRMALine extends X_M_RMALine public BigDecimal getTotalAmt() { BigDecimal bd = getAmt().multiply(getQty()); - - boolean documentLevel = getTax().isDocumentLevel(); - - // juddm: Tax Exempt & Tax Included in Price List & not Document Level - Adjust Line Amount - // http://sourceforge.net/tracker/index.php?func=detail&aid=1733602&group_id=176962&atid=879332 - if (getParent().isTaxIncluded() && !documentLevel) - { - BigDecimal taxStdAmt = Env.ZERO, taxThisAmt = Env.ZERO; - - MTax orderTax = getTax(); - MTax stdTax = null; - - // get the standard tax - if (getProduct() == null) - { - if (getCharge() != null) // Charge - { - stdTax = new MTax (getCtx(), - ((MTaxCategory) getCharge().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(), - get_TrxName()); - } - - } - else // Product - stdTax = new MTax (getCtx(), - ((MTaxCategory) getProduct().getC_TaxCategory()).getDefaultTax().getC_Tax_ID(), - get_TrxName()); - - if (stdTax != null) - { - if (log.isLoggable(Level.FINE)){ - log.fine("stdTax rate is " + stdTax.getRate()); - log.fine("orderTax rate is " + orderTax.getRate()); - } - - taxThisAmt = taxThisAmt.add(orderTax.calculateTax(bd, getParent().isTaxIncluded(), getPrecision())); - taxStdAmt = taxStdAmt.add(stdTax.calculateTax(bd, getParent().isTaxIncluded(), getPrecision())); - - bd = bd.subtract(taxStdAmt).add(taxThisAmt); - - if (log.isLoggable(Level.FINE)) log.fine("Price List includes Tax and Tax Changed on Order Line: New Tax Amt: " - + taxThisAmt + " Standard Tax Amt: " + taxStdAmt + " Line Net Amt: " + bd); - } - - } int precision = getPrecision(); if (bd.scale() > precision) bd = bd.setScale(precision, BigDecimal.ROUND_HALF_UP); diff --git a/org.adempiere.base/src/org/compiere/model/MRecentItem.java b/org.adempiere.base/src/org/compiere/model/MRecentItem.java index 74ed76f9f0..2a84f6056c 100644 --- a/org.adempiere.base/src/org/compiere/model/MRecentItem.java +++ b/org.adempiere.base/src/org/compiere/model/MRecentItem.java @@ -16,11 +16,13 @@ package org.compiere.model; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.logging.Level; import org.adempiere.base.Service; import org.adempiere.base.event.EventManager; @@ -42,18 +44,20 @@ import org.osgi.service.event.Event; public class MRecentItem extends X_AD_RecentItem { /** - * + * */ - private static final long serialVersionUID = 6899554875745832L; + private static final long serialVersionUID = -311416268128338337L; public static final String ON_RECENT_ITEM_CHANGED_TOPIC = "onRecentItemChanged"; /** Recent Item Cache */ - private static CCache s_cache = new CCache(Table_Name, 10); + private static CCache s_cache = new CCache(Table_Name, 10); /** Logger */ - @SuppressWarnings("unused") private static CLogger s_log = CLogger.getCLogger(MRecentItem.class); + /* Recent Item cached Label */ + private String m_label; + /************************************************************************** * Standard Constructor * @param ctx context @@ -65,13 +69,17 @@ public class MRecentItem extends X_AD_RecentItem super (ctx, AD_RecentItem_ID, trxName); if (AD_RecentItem_ID > 0) { synchronized (MRecentItem.class) { - Integer key = new Integer (AD_RecentItem_ID); + String key = getCacheKey(AD_RecentItem_ID, ctx); if (!s_cache.containsKey(key)) s_cache.put (key, this); } } } // MRecentItem + private static String getCacheKey(int AD_RecentItem_ID, Properties ctx) { + return AD_RecentItem_ID + "|" + Env.getAD_Language(ctx); + } + /** * Load Constructor * @param ctx ctx @@ -81,9 +89,9 @@ public class MRecentItem extends X_AD_RecentItem public MRecentItem (Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); - Integer key = null; + String key = null; try { - key = new Integer (rs.getInt("AD_RecentItem_ID")); + key = getCacheKey(rs.getInt("AD_RecentItem_ID"), ctx); } catch (SQLException e) { throw new AdempiereException(e); } @@ -101,7 +109,7 @@ public class MRecentItem extends X_AD_RecentItem */ public static synchronized MRecentItem get (Properties ctx, int AD_RecentItem_ID) { - Integer ii = new Integer (AD_RecentItem_ID); + String ii = getCacheKey(AD_RecentItem_ID, ctx); MRecentItem ri = (MRecentItem)s_cache.get(ii); if (ri == null) ri = new MRecentItem (ctx, AD_RecentItem_ID, null); @@ -123,7 +131,8 @@ public class MRecentItem extends X_AD_RecentItem MRecentItem retValue = it.next(); if (retValue.getAD_Table_ID() == AD_Table_ID && retValue.getRecord_ID() == Record_ID - && retValue.getCtx() == ctx + && retValue.getAD_User_ID() == AD_User_ID + && Env.getAD_Language(ctx).equals(Env.getAD_Language(retValue.getCtx())) ) { return retValue; @@ -155,7 +164,7 @@ public class MRecentItem extends X_AD_RecentItem if (retValue != null) { - Integer key = new Integer (retValue.getAD_RecentItem_ID()); + String key = getCacheKey(retValue.getAD_RecentItem_ID(), ctx); s_cache.put (key, retValue); } return retValue; @@ -265,7 +274,7 @@ public class MRecentItem extends X_AD_RecentItem @Override public boolean delete(boolean force) { - Integer ii = new Integer (getAD_RecentItem_ID()); + String ii = getCacheKey(getAD_RecentItem_ID(), getCtx()); synchronized (MRecentItem.class) { s_cache.remove(ii); } @@ -273,16 +282,23 @@ public class MRecentItem extends X_AD_RecentItem } public static List getFromUser(Properties ctx, int AD_User_ID) { - List ris = new Query(ctx, MRecentItem.Table_Name, "NVL(AD_User_ID,0)=?", null) + int[] ids = new Query(ctx, MRecentItem.Table_Name, "NVL(AD_User_ID,0)=?", null) .setOnlyActiveRecords(true) .setClient_ID() .setParameters(AD_User_ID) .setOrderBy("Updated DESC") - .list(); + .getIDs(); + List ris = new ArrayList(); + for (int id : ids) { + ris.add(MRecentItem.get(ctx, id)); + } return ris; } public String getLabel() { + if (m_label != null) { + return m_label; + } String windowName; MWindow win = MWindow.get(getCtx(), getAD_Window_ID()); MUserDefWin userDef = MUserDefWin.getBestMatch(getCtx(), getAD_Window_ID()); @@ -322,7 +338,29 @@ public class MRecentItem extends X_AD_RecentItem if (recordIdentifier.length() == 0) recordIdentifier.append(" [no identifier]"); } - return windowName + ": " + recordIdentifier.substring(1); + m_label = windowName + ": " + recordIdentifier.substring(1); + if (s_log.isLoggable(Level.INFO)) s_log.info(m_label); + return m_label; + } + + public static synchronized void clearLabel(int AD_Table_ID, int Record_ID) { + Iterator it = s_cache.values().iterator(); + while (it.hasNext()) { + MRecentItem retValue = it.next(); + if (retValue.getAD_Table_ID() == AD_Table_ID && retValue.getRecord_ID() == Record_ID) { + retValue.clearLabel(); + } + } + } + + private void clearLabel() { + m_label = null; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("MRecentItem[").append(get_ID()).append("]=").append(getLabel()); + return sb.toString(); } } // MRecentItem diff --git a/org.adempiere.base/src/org/compiere/model/MReportCube.java b/org.adempiere.base/src/org/compiere/model/MReportCube.java index 3e2df3b789..70c91e379d 100644 --- a/org.adempiere.base/src/org/compiere/model/MReportCube.java +++ b/org.adempiere.base/src/org/compiere/model/MReportCube.java @@ -63,8 +63,7 @@ public class MReportCube extends X_PA_ReportCube { "INNER JOIN Fact_Acct fact ON (fact.dateacct between p.startdate and p.enddate " + " and fact.ad_client_id = c.ad_client_id) " + "WHERE c.PA_ReportCube_ID = ? " + - "AND fact.updated > c.LastRecalculated " + - "AND p.periodtype='S' "; + "AND fact.updated > c.LastRecalculated"; log.log (Level.FINE, sql); @@ -130,10 +129,9 @@ public class MReportCube extends X_PA_ReportCube { "p.c_period_id, p.StartDate, COALESCE(SUM(AmtAcctDr),0), COALESCE(SUM(AmtAcctCr),0), " + "COALESCE(SUM(Qty),0)"); String from = " FROM fact_acct f " + - " INNER JOIN C_Period p ON ( f.DateAcct BETWEEN p.StartDate AND p.EndDate ) " + + " INNER JOIN C_Period p ON ( f.C_Period_ID = p.C_Period_ID ) " + " INNER JOIN C_Year y ON ( p.C_Year_ID = y.C_Year_ID ) " + - " WHERE p.PeriodType = 'S' " + - " AND y.C_Calendar_ID = ? "; + " WHERE y.C_Calendar_ID = ? AND f.AD_Client_ID = ? "; if ( getLastRecalculated() != null && !reset ) from += "AND p.C_Period_ID IN " + periods; @@ -190,7 +188,7 @@ public class MReportCube extends X_PA_ReportCube { String sql = insert.append(select.toString()).append(from).append(groups.toString()).toString(); if (log.isLoggable(Level.FINE))log.log(Level.FINE, sql); - Object[] params = new Object[] { getPA_ReportCube_ID(), getC_Calendar_ID() }; + Object[] params = new Object[] { getPA_ReportCube_ID(), getC_Calendar_ID(), getAD_Client_ID() }; start = System.currentTimeMillis(); int rows = DB.executeUpdateEx(sql, params, get_TrxName()); diff --git a/org.adempiere.base/src/org/compiere/model/MRequisition.java b/org.adempiere.base/src/org/compiere/model/MRequisition.java index 81d38bfeb8..ee15a69020 100644 --- a/org.adempiere.base/src/org/compiere/model/MRequisition.java +++ b/org.adempiere.base/src/org/compiere/model/MRequisition.java @@ -30,6 +30,7 @@ import org.compiere.process.DocumentEngine; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * Requisition Model @@ -364,7 +365,7 @@ public class MRequisition extends X_M_Requisition implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateDoc(new Timestamp (System.currentTimeMillis())); + setDateDoc(TimeUtil.getDay(0)); MPeriod.testPeriodOpen(getCtx(), getDateDoc(), MDocType.DOCBASETYPE_PurchaseRequisition, getAD_Org_ID()); } if (dt.isOverwriteSeqOnComplete()) { diff --git a/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java b/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java index b6449be440..b34eb87010 100644 --- a/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java +++ b/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java @@ -288,7 +288,7 @@ public class MRequisitionLine extends X_M_RequisitionLine * IDEMPIERE-178 Orders and Invoices must disallow amount lines without product/charge */ if (getParent().getC_DocType().isChargeOrProductMandatory()) { - if (getC_Charge_ID() == 0 && getM_Product_ID() == 0 && getPriceActual().signum() != 0) { + if (getC_Charge_ID() == 0 && getM_Product_ID() == 0 && (getPriceActual().signum() != 0 || getQty().signum() != 0)) { log.saveError("FillMandatory", Msg.translate(getCtx(), "ChargeOrProductMandatory")); return false; } diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 2e5fc3d285..7b07d0ba6b 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -371,7 +371,7 @@ public final class MRole extends X_AD_Role MUserRoles su = new MUserRoles(getCtx(), SUPERUSER_USER_ID, getAD_Role_ID(), get_TrxName()); su.saveEx(); // Add Role to User - if (getCreatedBy() != SUPERUSER_USER_ID) + if (getCreatedBy() != SUPERUSER_USER_ID && MSysConfig.getBooleanValue(MSysConfig.AUTO_ASSIGN_ROLE_TO_CREATOR_USER, false, getAD_Client_ID())) { MUserRoles ur = new MUserRoles(getCtx(), getCreatedBy(), getAD_Role_ID(), get_TrxName()); ur.saveEx(); diff --git a/org.adempiere.base/src/org/compiere/model/MStatusLine.java b/org.adempiere.base/src/org/compiere/model/MStatusLine.java index 09d5743e87..58c3fa163f 100644 --- a/org.adempiere.base/src/org/compiere/model/MStatusLine.java +++ b/org.adempiere.base/src/org/compiere/model/MStatusLine.java @@ -93,30 +93,36 @@ public class MStatusLine extends X_AD_StatusLine } String sql = "" - + "SELECT AD_StatusLine_ID " - + "FROM AD_StatusLineUsedIn " - + "WHERE IsActive = 'Y' " - + " AND IsStatusLine = 'Y' " - + " AND AD_Window_ID = ? " - + " AND AD_Tab_ID = ?"; + + "SELECT slu.AD_StatusLine_ID " + + "FROM AD_StatusLineUsedIn slu " + + "JOIN AD_StatusLine sl ON (sl.AD_StatusLine_ID = slu.AD_StatusLine_ID) " + + "WHERE slu.IsActive = 'Y' " + + " AND sl.IsActive = 'Y' " + + " AND slu.IsStatusLine = 'Y' " + + " AND slu.AD_Window_ID = ? " + + " AND slu.AD_Tab_ID = ?"; int slid = DB.getSQLValueEx(null, sql, window_ID, tab_ID); if (slid <= 0) { sql = "" - + "SELECT AD_StatusLine_ID " - + "FROM AD_StatusLineUsedIn " - + "WHERE IsActive = 'Y' " - + " AND IsStatusLine = 'Y' " - + " AND AD_Window_ID = ? " - + " AND AD_Tab_ID IS NULL"; + + "SELECT slu.AD_StatusLine_ID " + + "FROM AD_StatusLineUsedIn slu " + + "JOIN AD_StatusLine sl ON (sl.AD_StatusLine_ID = slu.AD_StatusLine_ID) " + + "WHERE slu.IsActive = 'Y' " + + " AND sl.IsActive = 'Y' " + + " AND slu.IsStatusLine = 'Y' " + + " AND slu.AD_Window_ID = ? " + + " AND slu.AD_Tab_ID IS NULL"; slid = DB.getSQLValueEx(null, sql, window_ID); } if (slid <= 0) { sql = "" - + "SELECT AD_StatusLine_ID " - + "FROM AD_StatusLineUsedIn " - + "WHERE IsActive = 'Y' " - + " AND IsStatusLine = 'Y' " - + " AND AD_Table_ID = ?"; + + "SELECT slu.AD_StatusLine_ID " + + "FROM AD_StatusLineUsedIn slu " + + "JOIN AD_StatusLine sl ON (sl.AD_StatusLine_ID = slu.AD_StatusLine_ID) " + + "WHERE slu.IsActive = 'Y' " + + " AND sl.IsActive = 'Y' " + + " AND slu.IsStatusLine = 'Y' " + + " AND slu.AD_Table_ID = ?"; slid = DB.getSQLValueEx(null, sql, table_ID); } if (slid > 0) { @@ -145,12 +151,14 @@ public class MStatusLine extends X_AD_StatusLine } final String sql = "" - + "SELECT DISTINCT AD_StatusLine_ID, SeqNo " - + "FROM AD_StatusLineUsedIn " - + "WHERE IsActive = 'Y' " - + " AND IsStatusLine = 'N' " - + " AND (AD_Table_ID = ? OR (AD_Window_ID=? AND AD_Tab_ID=?) OR (AD_Window_ID=? AND AD_Tab_ID IS NULL)) " - + "ORDER BY SeqNo"; + + "SELECT DISTINCT slu.AD_StatusLine_ID, slu.SeqNo " + + "FROM AD_StatusLineUsedIn slu " + + "JOIN AD_StatusLine sl ON (sl.AD_StatusLine_ID = slu.AD_StatusLine_ID) " + + "WHERE slu.IsActive = 'Y' " + + " AND sl.IsActive = 'Y' " + + " AND slu.IsStatusLine = 'N' " + + " AND (slu.AD_Table_ID = ? OR (slu.AD_Window_ID=? AND slu.AD_Tab_ID=?) OR (slu.AD_Window_ID=? AND slu.AD_Tab_ID IS NULL)) " + + "ORDER BY slu.SeqNo"; int[] wlids = DB.getIDsEx(null, sql, table_ID, window_ID, tab_ID, window_ID); if (wlids.length > 0) { ArrayList list = new ArrayList(); diff --git a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java index 73708233ee..a2445a894f 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java @@ -173,7 +173,7 @@ public class MStorageOnHand extends X_M_StorageOnHand String sqlWhere = "M_Product_ID=? AND M_Locator_ID=? AND QtyOnHand <> 0"; Query query = new Query(ctx, MStorageOnHand.Table_Name, sqlWhere, trxName) .setParameters(M_Product_ID, M_Locator_ID); - MProduct product = new MProduct(ctx, M_Product_ID, trxName); + MProduct product = MProduct.get(ctx, M_Product_ID); if (product.isUseGuaranteeDateForMPolicy()) { query.addJoinClause(" LEFT OUTER JOIN M_AttributeSetInstance asi ON (M_StorageOnHand.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) ") diff --git a/org.adempiere.base/src/org/compiere/model/MStorageReservation.java b/org.adempiere.base/src/org/compiere/model/MStorageReservation.java index c0b9603871..c8b2a4d075 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageReservation.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageReservation.java @@ -228,7 +228,7 @@ public class MStorageReservation extends X_M_StorageReservation { return true; /* Do NOT use FIFO ASI for reservation */ - MProduct prd = new MProduct(ctx, M_Product_ID, trxName); + MProduct prd = MProduct.get(ctx, M_Product_ID); if (prd.getM_AttributeSet_ID() == 0 || ! prd.getM_AttributeSet().isInstanceAttribute()) { // Product doesn't manage attribute set, always reserved with 0 M_AttributeSetInstance_ID = 0; diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index eca485fb6f..77bcaf5a63 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = 2617379167881737860L; + private static final long serialVersionUID = 8623809160538454497L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; @@ -61,6 +61,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String APPLICATION_OS_INFO_SHOWN = "APPLICATION_OS_INFO_SHOWN"; public static final String APPLICATION_URL = "APPLICATION_URL"; public static final String ATTACH_EMBEDDED_2PACK = "ATTACH_EMBEDDED_2PACK"; + public static final String AUTO_ASSIGN_ROLE_TO_CREATOR_USER = "AUTO_ASSIGN_ROLE_TO_CREATOR_USER"; public static final String AUTOMATIC_PACKIN_FOLDERS = "AUTOMATIC_PACKIN_FOLDERS"; public static final String AUTOMATIC_PACKIN_INITIAL_DELAY = "AUTOMATIC_PACKIN_INITIAL_DELAY"; public static final String AUTOMATIC_PACKIN_PROCESSING = "AUTOMATIC_PACKIN_PROCESSING"; @@ -78,20 +79,23 @@ public class MSysConfig extends X_AD_SysConfig public static final String CHECK_CREDIT_ON_PREPAY_ORDER = "CHECK_CREDIT_ON_PREPAY_ORDER"; public static final String CLIENT_ACCOUNTING = "CLIENT_ACCOUNTING"; public static final String DEFAULT_COA_PATH = "DEFAULT_COA_PATH"; + public static final String DEFAULT_ENTITYTYPE = "DEFAULT_ENTITYTYPE"; // used as default in entity type columns with get_sysconfig public static final String DICTIONARY_ID_COMMENTS = "DICTIONARY_ID_COMMENTS"; public static final String DICTIONARY_ID_PASSWORD = "DICTIONARY_ID_PASSWORD"; public static final String DICTIONARY_ID_USE_CENTRALIZED_ID = "DICTIONARY_ID_USE_CENTRALIZED_ID"; public static final String DICTIONARY_ID_USER = "DICTIONARY_ID_USER"; public static final String DICTIONARY_ID_WEBSITE = "DICTIONARY_ID_WEBSITE"; public static final String DOCACTIONBUTTON_SHOWACTIONNAME = "DOCACTIONBUTTON_SHOWACTIONNAME"; - public static final String DPVIEWS_SHOWINFOACCOUNT = "DPViews_ShowInfoAccount"; - public static final String DPVIEWS_SHOWINFOSCHEDULE = "DPViews_ShowInfoSchedule"; + public static final String DPViews_ShowInfoAccount = "DPViews_ShowInfoAccount"; + public static final String DPViews_ShowInfoSchedule = "DPViews_ShowInfoSchedule"; public static final String EMAIL_NOTIFY_2PACK = "EMAIL_NOTIFY_2PACK"; public static final String ENABLE_PAYMENTBOX_BUTTON = "ENABLE_PAYMENTBOX_BUTTON"; public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS"; public static final String HTML_REPORT_THEME = "HTML_REPORT_THEME"; - public static final String IBAN_VALIDATION = "IBAN_VALIDATION" ; - public static final String IDENTIFIER_SEPARATOR = "IDENTIFIER_SEPARATOR" ; + public static final String IBAN_VALIDATION = "IBAN_VALIDATION"; + public static final String IDENTIFIER_SEPARATOR = "IDENTIFIER_SEPARATOR"; + public static final String INFO_DEFAULTSELECTED = "INFO_DEFAULTSELECTED"; + public static final String INFO_DOUBLECLICKTOGGLESSELECTION = "INFO_DOUBLECLICKTOGGLESSELECTION"; public static final String Invoice_ReverseUseNewNumber = "Invoice_ReverseUseNewNumber"; public static final String JASPER_SWAP_MAX_PAGES = "JASPER_SWAP_MAX_PAGES"; public static final String LASTRUN_RECORD_COUNT = "LASTRUN_RECORD_COUNT"; @@ -134,8 +138,6 @@ public class MSysConfig extends X_AD_SysConfig public static final String START_VALUE_BPLOCATION_NAME = "START_VALUE_BPLOCATION_NAME"; public static final String SWING_LOGIN_ALLOW_REMEMBER_ME = "SWING_LOGIN_ALLOW_REMEMBER_ME"; public static final String SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR = "SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR"; - public static final String SYSCONFIG_INFO_DEFAULTSELECTED = "SYSCONFIG_INFO_DEFAULTSELECTED"; - public static final String SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION = "SYSCONFIG_INFO_DOUBLECLICKTOGGLESSELECTION"; public static final String SYSTEM_IN_MAINTENANCE_MODE = "SYSTEM_IN_MAINTENANCE_MODE"; public static final String SYSTEM_INSERT_CHANGELOG = "SYSTEM_INSERT_CHANGELOG"; public static final String SYSTEM_NATIVE_SEQUENCE = "SYSTEM_NATIVE_SEQUENCE"; @@ -148,6 +150,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String USER_LOCKING_MAX_INACTIVE_PERIOD_DAY = "USER_LOCKING_MAX_INACTIVE_PERIOD_DAY"; public static final String USER_LOCKING_MAX_LOGIN_ATTEMPT = "USER_LOCKING_MAX_LOGIN_ATTEMPT"; public static final String USER_LOCKING_MAX_PASSWORD_AGE_DAY = "USER_LOCKING_MAX_PASSWORD_AGE_DAY"; + public static final String USER_LOCKING_PASSWORD_NOTIFY_DAY = "USER_LOCKING_PASSWORD_NOTIFY_DAY"; public static final String USER_PASSWORD_HASH = "USER_PASSWORD_HASH"; public static final String VALIDATE_MATCHING_TO_ORDERED_QTY = "VALIDATE_MATCHING_TO_ORDERED_QTY"; public static final String WEBUI_LOGOURL = "WEBUI_LOGOURL"; @@ -182,6 +185,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String ZK_SESSION_TIMEOUT_IN_SECONDS = "ZK_SESSION_TIMEOUT_IN_SECONDS"; public static final String ZK_THEME = "ZK_THEME"; public static final String ZK_THEME_USE_FONT_ICON_FOR_IMAGE = "ZK_THEME_USE_FONT_ICON_FOR_IMAGE"; + public static final String ZOOM_ACROSS_QUERY_TIMEOUT = "ZOOM_ACROSS_QUERY_TIMEOUT"; /** * Standard Constructor diff --git a/org.adempiere.base/src/org/compiere/model/MUser.java b/org.adempiere.base/src/org/compiere/model/MUser.java index c376f53633..956457c375 100644 --- a/org.adempiere.base/src/org/compiere/model/MUser.java +++ b/org.adempiere.base/src/org/compiere/model/MUser.java @@ -21,7 +21,6 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; @@ -237,28 +236,10 @@ public class MUser extends X_AD_User */ public static String getNameOfUser (int AD_User_ID) { - String name = "?"; - // Get ID - String sql = "SELECT Name FROM AD_User WHERE AD_User_ID=?"; - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement(sql, null); - pstmt.setInt(1, AD_User_ID); - rs = pstmt.executeQuery(); - if (rs.next()) - name = rs.getString(1); - } - catch (SQLException e) - { - s_log.log(Level.SEVERE, sql, e); - } - finally - { - DB.close(rs, pstmt); - } - return name; + MUser user = get(Env.getCtx(), AD_User_ID); + if (user.getAD_User_ID() != AD_User_ID) + return "?"; + return user.getName(); } // getNameOfUser @@ -936,15 +917,14 @@ public class MUser extends X_AD_User } pwdrule.validate((getLDAPUser() != null ? getLDAPUser() : getName()), getPassword(), passwordHistorys); } - + setDatePasswordChanged(new Timestamp(new Date().getTime())); } // Hash password - IDEMPIERE-347 boolean hash_password = MSysConfig.getBooleanValue(MSysConfig.USER_PASSWORD_HASH, false); if (hash_password) setPassword(getPassword()); - - setDatePasswordChanged(new Timestamp(new Date().getTime())); + } return true; diff --git a/org.adempiere.base/src/org/compiere/model/MViewComponent.java b/org.adempiere.base/src/org/compiere/model/MViewComponent.java index 97074e6bc3..4bdbbab4d6 100644 --- a/org.adempiere.base/src/org/compiere/model/MViewComponent.java +++ b/org.adempiere.base/src/org/compiere/model/MViewComponent.java @@ -76,6 +76,7 @@ public class MViewComponent extends X_AD_ViewComponent { Query query = new Query(getCtx(), MViewColumn.Table_Name, MViewColumn.COLUMNNAME_AD_ViewComponent_ID + "=?", get_TrxName()); query.setParameters(getAD_ViewComponent_ID()); + query.setOnlyActiveRecords(true); query.setOrderBy("SeqNo, AD_ViewColumn_ID"); List list = query.list(); diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 3dffa469ab..f1de8670b8 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -2069,7 +2069,10 @@ public abstract class PO l_trxname.setLength(23); m_trxName = Trx.createTrxName(l_trxname.toString()); localTrx = Trx.get(m_trxName, true); - localTrx.setDisplayName(getClass().getName()+"_save"); + if (newRecord) + localTrx.setDisplayName(getClass().getName() + "_insert"); + else + localTrx.setDisplayName(getClass().getName() + "_update_ID" + get_ID()); localTrx.getConnection(); } else @@ -2341,9 +2344,10 @@ public abstract class PO m_newValues = new Object[size]; m_createNew = false; } - if (!newRecord) + if (!newRecord) { CacheMgt.get().reset(p_info.getTableName()); - else if (get_ID() > 0 && success) + MRecentItem.clearLabel(p_info.getAD_Table_ID(), get_ID()); + } else if (get_ID() > 0 && success) CacheMgt.get().newRecord(p_info.getTableName(), get_ID()); return success; @@ -2846,7 +2850,8 @@ public abstract class PO if (DisplayType.isLOB(dt)) { lobAdd (value, i, dt); - continue; + if (!p_info.isColumnMandatory(i)) + continue; } // ** add column ** @@ -2885,7 +2890,16 @@ public abstract class PO else if (c == String.class) sqlValues.append (encrypt(i,DB.TO_STRING ((String)value))); else if (DisplayType.isLOB(dt)) - sqlValues.append("null"); // no db dependent stuff here + { + if (p_info.isColumnMandatory(i)) + { + sqlValues.append("''"); // no db dependent stuff here -- at this point value is known to be not null + } + else + { + sqlValues.append("null"); + } + } else sqlValues.append (saveNewSpecial (value, i)); } @@ -2910,7 +2924,17 @@ public abstract class PO if (DisplayType.isLOB(dt)) { - params.add(null); + if (p_info.isColumnMandatory(i)) + { + if (dt == DisplayType.Binary) + params.add(new byte[] {0}); // -- at this point value is known to be not null + else + params.add(""); // -- at this point value is known to be not null + } + else + { + params.add(null); + } } else if (value == null || value.equals (Null.NULL)) { @@ -3195,7 +3219,7 @@ public abstract class PO { localTrxName = Trx.createTrxName("POdel"); localTrx = Trx.get(localTrxName, true); - localTrx.setDisplayName(getClass().getName()+"_delete"); + localTrx.setDisplayName(getClass().getName()+ "_delete_ID" + get_ID()); localTrx.getConnection(); m_trxName = localTrxName; } diff --git a/org.adempiere.base/src/org/compiere/model/POInfo.java b/org.adempiere.base/src/org/compiere/model/POInfo.java index c97230cc44..3f0dfa26c8 100644 --- a/org.adempiere.base/src/org/compiere/model/POInfo.java +++ b/org.adempiere.base/src/org/compiere/model/POInfo.java @@ -199,6 +199,8 @@ public class POInfo implements Serializable // m_AccessLevel = rs.getString(18); String ColumnSQL = rs.getString(19); + if (ColumnSQL != null && ColumnSQL.length() > 0 && ColumnSQL.startsWith("@SQL=")) + ColumnSQL = "NULL"; if (ColumnSQL != null && ColumnSQL.contains("@")) ColumnSQL = Env.parseContext(Env.getCtx(), -1, ColumnSQL, false, true); boolean IsEncrypted = "Y".equals(rs.getString(20)); @@ -375,8 +377,11 @@ public class POInfo implements Serializable { if (index < 0 || index >= m_columns.length) return null; - if (m_columns[index].ColumnSQL != null && m_columns[index].ColumnSQL.length() > 0) + if (m_columns[index].ColumnSQL != null && m_columns[index].ColumnSQL.length() > 0) { + if (m_columns[index].ColumnSQL.startsWith("@SQL=")) + return "NULL AS " + m_columns[index].ColumnName; return m_columns[index].ColumnSQL + " AS " + m_columns[index].ColumnName; + } return m_columns[index].ColumnName; } // getColumnSQL @@ -393,6 +398,34 @@ public class POInfo implements Serializable && m_columns[index].ColumnSQL.length() > 0; } // isVirtualColumn + /** + * Is Column Virtual DB? + * @param index index + * @return true if column is virtual DB + */ + public boolean isVirtualDBColumn (int index) + { + if (index < 0 || index >= m_columns.length) + return true; + return m_columns[index].ColumnSQL != null + && m_columns[index].ColumnSQL.length() > 0 + && !m_columns[index].ColumnSQL.startsWith("@SQL="); + } // isVirtualDBColumn + + /** + * Is Column Virtual UI? + * @param index index + * @return true if column is virtual UI + */ + public boolean isVirtualUIColumn (int index) + { + if (index < 0 || index >= m_columns.length) + return true; + return m_columns[index].ColumnSQL != null + && m_columns[index].ColumnSQL.length() > 0 + && m_columns[index].ColumnSQL.startsWith("@SQL="); + } // isVirtualUIColumn + /** * Get Column Label * @param index index diff --git a/org.adempiere.base/src/org/compiere/model/ProductCost.java b/org.adempiere.base/src/org/compiere/model/ProductCost.java index fd63e86324..2062d733d5 100644 --- a/org.adempiere.base/src/org/compiere/model/ProductCost.java +++ b/org.adempiere.base/src/org/compiere/model/ProductCost.java @@ -48,7 +48,7 @@ public class ProductCost { m_M_Product_ID = M_Product_ID; if (m_M_Product_ID != 0) - m_product = new MProduct(ctx, M_Product_ID, trxName); + m_product = MProduct.get(ctx, M_Product_ID); m_M_AttributeSetInstance_ID = M_AttributeSetInstance_ID; m_trxName = trxName; } // ProductCost diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index 41481fc29e..f064122dec 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -34,7 +34,7 @@ public class SystemIDs public final static int COLUMN_C_PAYSELECTIONCHECK_C_PAYSELECTION_ID = 7670; public final static int COLUMN_FACT_ACCT_C_ACCTSCHEMA_ID = 2513; public final static int COLUMN_FACT_ACCT_M_PRODUCT_ID = 2527; - public final static int COLUMN_M_MOVEMENTLINE_M_ATTRIBUTESETINSTANCE_ID = 8851; + public final static int COLUMN_M_MOVEMENTLINE_M_ATTRIBUTESETINSTANCE_ID = 8551; public final static int COLUMN_M_PRODUCT_M_ATTRIBUTESETINSTANCE_ID = 8418; public final static int COLUMN_S_RESOURCE_S_RESOURCETYPE_ID = 6851; public final static int COLUMN_S_RESOURCEASSIGNMENT_S_RESOURCE_ID = 6826; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Column.java b/org.adempiere.base/src/org/compiere/model/X_AD_Column.java index 0a17eba7ac..0668737e2e 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Column.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Column.java @@ -32,7 +32,7 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent /** * */ - private static final long serialVersionUID = 20180217L; + private static final long serialVersionUID = 20180723L; /** Standard Constructor */ public X_AD_Column (Properties ctx, int AD_Column_ID, String trxName) @@ -658,6 +658,30 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent return (String)get_Value(COLUMNNAME_IsEncrypted); } + /** Set HTML. + @param IsHtml + Text has HTML tags + */ + public void setIsHtml (boolean IsHtml) + { + set_Value (COLUMNNAME_IsHtml, Boolean.valueOf(IsHtml)); + } + + /** Get HTML. + @return Text has HTML tags + */ + public boolean isHtml () + { + Object oo = get_Value(COLUMNNAME_IsHtml); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Identifier. @param IsIdentifier This column is part of the record identifier @@ -1090,4 +1114,4 @@ public class X_AD_Column extends PO implements I_AD_Column, I_Persistent { return (String)get_Value(COLUMNNAME_VFormat); } -} \ No newline at end of file +} diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java b/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java index 3f13aab3a5..24cf9c8b9a 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java @@ -30,7 +30,7 @@ public class X_AD_InfoColumn extends PO implements I_AD_InfoColumn, I_Persistent /** * */ - private static final long serialVersionUID = 20180217L; + private static final long serialVersionUID = 20180828L; /** Standard Constructor */ public X_AD_InfoColumn (Properties ctx, int AD_InfoColumn_ID, String trxName) @@ -369,6 +369,23 @@ public class X_AD_InfoColumn extends PO implements I_AD_InfoColumn, I_Persistent { return (String)get_Value(COLUMNNAME_Help); } + + /** Set Input field validation. + @param InputFieldValidation + Input field validaton query + */ + public void setInputFieldValidation (String InputFieldValidation) + { + set_Value (COLUMNNAME_InputFieldValidation, InputFieldValidation); + } + + /** Get Input field validation. + @return Input field validaton query + */ + public String getInputFieldValidation () + { + return (String)get_Value(COLUMNNAME_InputFieldValidation); + } /** Set Centrally maintained. @param IsCentrallyMaintained @@ -417,6 +434,31 @@ public class X_AD_InfoColumn extends PO implements I_AD_InfoColumn, I_Persistent } return false; } + + /** + * Set Read Only. + * + * @param IsReadOnly + * Determines, if this field is Read Only + */ + public void setIsReadOnly(boolean IsReadOnly) { + set_Value(COLUMNNAME_IsReadOnly, Boolean.valueOf(IsReadOnly)); + } + + /** + * Get Read Only. + * + * @return Determines, if this field is Read Only + */ + public boolean isReadOnly() { + Object oo = get_Value(COLUMNNAME_IsReadOnly); + if (oo != null) { + if (oo instanceof Boolean) + return ((Boolean) oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } /** Set Identifier. @param IsIdentifier @@ -586,6 +628,8 @@ public class X_AD_InfoColumn extends PO implements I_AD_InfoColumn, I_Persistent public static final String QUERYOPERATOR_LeEq = "<="; /** != = != */ public static final String QUERYOPERATOR_NotEq = "!="; + /** Full Like = LIKE */ + public static final String QUERYOPERATOR_FullLike = "LIKE"; /** Set Query Operator. @param QueryOperator Operator for database query diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_UserPreference.java b/org.adempiere.base/src/org/compiere/model/X_AD_UserPreference.java index 654f4d55c1..ce2825bbb9 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_UserPreference.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_UserPreference.java @@ -29,7 +29,7 @@ public class X_AD_UserPreference extends PO implements I_AD_UserPreference, I_Pe /** * */ - private static final long serialVersionUID = 20180119L; + private static final long serialVersionUID = 20180502L; /** Standard Constructor */ public X_AD_UserPreference (Properties ctx, int AD_UserPreference_ID, String trxName) @@ -215,6 +215,27 @@ public class X_AD_UserPreference extends PO implements I_AD_UserPreference, I_Pe return false; } + /** Set Use Similar To. + @param IsUseSimilarTo Use Similar To */ + public void setIsUseSimilarTo (boolean IsUseSimilarTo) + { + set_Value (COLUMNNAME_IsUseSimilarTo, Boolean.valueOf(IsUseSimilarTo)); + } + + /** Get Use Similar To. + @return Use Similar To */ + public boolean isUseSimilarTo () + { + Object oo = get_Value(COLUMNNAME_IsUseSimilarTo); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Toggle on Double Click. @param ToggleOnDoubleClick Defines if double click in a field on grid mode switch to form view diff --git a/org.adempiere.base/src/org/compiere/model/X_M_Attribute.java b/org.adempiere.base/src/org/compiere/model/X_M_Attribute.java index 90489817ef..ae7a62972f 100644 --- a/org.adempiere.base/src/org/compiere/model/X_M_Attribute.java +++ b/org.adempiere.base/src/org/compiere/model/X_M_Attribute.java @@ -30,7 +30,7 @@ public class X_M_Attribute extends PO implements I_M_Attribute, I_Persistent /** * */ - private static final long serialVersionUID = 20171031L; + private static final long serialVersionUID = 20180911L; /** Standard Constructor */ public X_M_Attribute (Properties ctx, int M_Attribute_ID, String trxName) @@ -83,6 +83,8 @@ public class X_M_Attribute extends PO implements I_M_Attribute, I_Persistent public static final String ATTRIBUTEVALUETYPE_Number = "N"; /** List = L */ public static final String ATTRIBUTEVALUETYPE_List = "L"; + /** Date = D */ + public static final String ATTRIBUTEVALUETYPE_Date = "D"; /** Set Attribute Value Type. @param AttributeValueType Type of Attribute Value @@ -101,6 +103,23 @@ public class X_M_Attribute extends PO implements I_M_Attribute, I_Persistent return (String)get_Value(COLUMNNAME_AttributeValueType); } + /** Set Date Format. + @param DateFormat + Date format used in the input format + */ + public void setDateFormat (String DateFormat) + { + set_Value (COLUMNNAME_DateFormat, DateFormat); + } + + /** Get Date Format. + @return Date format used in the input format + */ + public String getDateFormat () + { + return (String)get_Value(COLUMNNAME_DateFormat); + } + /** Set Description. @param Description Optional short description of the record diff --git a/org.adempiere.base/src/org/compiere/model/X_M_AttributeInstance.java b/org.adempiere.base/src/org/compiere/model/X_M_AttributeInstance.java index cfcbf1c235..58ad542096 100644 --- a/org.adempiere.base/src/org/compiere/model/X_M_AttributeInstance.java +++ b/org.adempiere.base/src/org/compiere/model/X_M_AttributeInstance.java @@ -19,6 +19,7 @@ package org.compiere.model; import java.math.BigDecimal; import java.sql.ResultSet; +import java.sql.Timestamp; import java.util.Properties; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; @@ -32,7 +33,7 @@ public class X_M_AttributeInstance extends PO implements I_M_AttributeInstance, /** * */ - private static final long serialVersionUID = 20171031L; + private static final long serialVersionUID = 20180911L; /** Standard Constructor */ public X_M_AttributeInstance (Properties ctx, int M_AttributeInstance_ID, String trxName) @@ -196,6 +197,20 @@ public class X_M_AttributeInstance extends PO implements I_M_AttributeInstance, return (String)get_Value(COLUMNNAME_Value); } + /** Set Value Date. + @param ValueDate Value Date */ + public void setValueDate (Timestamp ValueDate) + { + set_Value (COLUMNNAME_ValueDate, ValueDate); + } + + /** Get Value Date. + @return Value Date */ + public Timestamp getValueDate () + { + return (Timestamp)get_Value(COLUMNNAME_ValueDate); + } + /** Set Value. @param ValueNumber Numeric Value diff --git a/org.adempiere.base/src/org/compiere/print/DataEngine.java b/org.adempiere.base/src/org/compiere/print/DataEngine.java index 552c84b0e6..a7d80cc06c 100644 --- a/org.adempiere.base/src/org/compiere/print/DataEngine.java +++ b/org.adempiere.base/src/org/compiere/print/DataEngine.java @@ -25,6 +25,7 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.Properties; import java.util.logging.Level; +import java.util.regex.Pattern; import org.adempiere.exceptions.AdempiereException; import org.compiere.model.MLookupFactory; @@ -294,16 +295,33 @@ public class DataEngine rs = pstmt.executeQuery(); m_synonym = "A"; // synonym + + // init regular object to replace table name in virtual column + String orgTable = null; + Pattern regTranslateTable = null; + if (tableName.toLowerCase().endsWith("_vt")){ + orgTable = MTable.getTableName(ctx, format.getAD_Table_ID()); + regTranslateTable = Pattern.compile("\\b" + orgTable + "\\b", Pattern.CASE_INSENSITIVE); + } + while (rs.next()) { // get Values from record int AD_Column_ID = rs.getInt(1); String ColumnName = rs.getString(2); String ColumnSQL = rs.getString(24); + if (ColumnSQL != null && ColumnSQL.length() > 0 && ColumnSQL.startsWith("@SQL=")) + ColumnSQL = "NULL"; if (ColumnSQL != null && ColumnSQL.contains("@")) ColumnSQL = Env.parseContext(Env.getCtx(), -1, ColumnSQL, false, true); if (ColumnSQL == null) ColumnSQL = ""; + else{ + // replace table with translate table IDEMPIERE-2234 + if (tableName.toLowerCase().endsWith("_vt")){ + ColumnSQL = regTranslateTable.matcher(ColumnSQL).replaceAll(tableName); + } + } int AD_Reference_ID = rs.getInt(3); int AD_Reference_Value_ID = rs.getInt(4); // ColumnInfo diff --git a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java index 593a9a8a6a..90381f9579 100644 --- a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java +++ b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java @@ -34,6 +34,7 @@ import org.adempiere.model.MTabCustomization; import org.compiere.model.GridField; import org.compiere.model.GridTab; import org.compiere.model.GridTable; +import org.compiere.model.MColumn; import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.Query; @@ -614,6 +615,8 @@ public class MPrintFormat extends X_AD_PrintFormat int seqNo = 1; for (GridField gridField : gridFields) { + if (gridField.isVirtualUIColumn()) + continue; MPrintFormatItem pfi = MPrintFormatItem.createFromGridField(pf, gridField, seqNo++); if (pfi != null) { @@ -859,7 +862,11 @@ public class MPrintFormat extends X_AD_PrintFormat int seqNo = 1; while (rs.next()) { - MPrintFormatItem pfi = MPrintFormatItem.createFromColumn (format, rs.getInt(1), seqNo++); + int columnID = rs.getInt(1); + MColumn column = MColumn.get(ctx, columnID); + if (column.isVirtualUIColumn()) + continue; + MPrintFormatItem pfi = MPrintFormatItem.createFromColumn (format, columnID, seqNo++); if (pfi != null) { list.add (pfi); @@ -897,7 +904,11 @@ public class MPrintFormat extends X_AD_PrintFormat int seqNo = 1; while (rs.next()) { - MPrintFormatItem pfi = MPrintFormatItem.createFromColumn (format, rs.getInt(1), seqNo++); + int columnID = rs.getInt(1); + MColumn column = MColumn.get(ctx, columnID); + if (column.isVirtualUIColumn()) + continue; + MPrintFormatItem pfi = MPrintFormatItem.createFromColumn (format, columnID, seqNo++); if (pfi != null) { list.add (pfi); diff --git a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java index 03f0b834d2..e2abc30d48 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java +++ b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java @@ -975,7 +975,9 @@ public class LayoutEngine implements Pageable, Printable, Doc element.setLocation(ft); m_headerFooter.addElement(element); // - String s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_MSG, "@*Header@", Env.getAD_Client_ID(Env.getCtx())); + String s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_MSG, "", Env.getAD_Client_ID(Env.getCtx())); + if (Util.isEmpty(s, true)) + s = "@*Header@"; element = new StringElement(s, font, color, null, true); element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_Center); element.setLocation(ft); @@ -983,7 +985,7 @@ public class LayoutEngine implements Pageable, Printable, Doc // String timestamp = ""; s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_DATETIME_FORMAT, Env.getAD_Client_ID(Env.getCtx())); - if (!Util.isEmpty(s)) + if (!Util.isEmpty(s, true)) timestamp = new SimpleDateFormat(s).format(System.currentTimeMillis()); else timestamp = "@*CurrentDateTime@"; diff --git a/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java b/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java index 1773484983..1e775a36f8 100644 --- a/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java +++ b/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java @@ -26,6 +26,7 @@ import org.compiere.model.ModelValidationEngine; import org.compiere.model.ModelValidator; import org.compiere.model.PO; import org.compiere.model.POInfo; +import org.compiere.util.TimeUtil; /** * Template for DocAction @@ -248,7 +249,7 @@ public class DocActionTemplate extends PO implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateInvoiced(new Timestamp (System.currentTimeMillis())); + setDateInvoiced(TimeUtil.getDay(0)); if (getDateAcct().before(getDateInvoiced())) { setDateAcct(getDateInvoiced()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java index 10e74c4a2a..6b097479df 100644 --- a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java +++ b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java @@ -40,11 +40,10 @@ import org.compiere.util.Util; */ public class ProcessInfo implements Serializable { - /** * */ - private static final long serialVersionUID = -7810177110347837681L; + private static final long serialVersionUID = 2167823616151648814L; /** * Constructor @@ -65,6 +64,9 @@ public class ProcessInfo implements Serializable m_printPreview = false; } // ProcessInfo + /** Process UUID */ + private String m_AD_Process_UU; + /** * Constructor * @param Title Title @@ -694,6 +696,15 @@ public class ProcessInfo implements Serializable return m_transactionName; } + public String getAD_Process_UU() + { + return m_AD_Process_UU; + } + + public void setAD_Process_UU(String AD_Process_UU) + { + m_AD_Process_UU = AD_Process_UU; + } /** * Set transaction name from this process * @param trxName diff --git a/org.adempiere.base/src/org/compiere/process/ServerProcessCtl.java b/org.adempiere.base/src/org/compiere/process/ServerProcessCtl.java index c8196e3961..096e78df8a 100644 --- a/org.adempiere.base/src/org/compiere/process/ServerProcessCtl.java +++ b/org.adempiere.base/src/org/compiere/process/ServerProcessCtl.java @@ -139,8 +139,8 @@ public class ServerProcessCtl 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'" @@ -148,8 +148,8 @@ public class ServerProcessCtl 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" @@ -171,6 +171,7 @@ public class ServerProcessCtl 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.base/src/org/compiere/report/FinReportJasper.java b/org.adempiere.base/src/org/compiere/report/FinReportJasper.java index b9b5c22d4f..b60797e30b 100644 --- a/org.adempiere.base/src/org/compiere/report/FinReportJasper.java +++ b/org.adempiere.base/src/org/compiere/report/FinReportJasper.java @@ -76,6 +76,7 @@ public class FinReportJasper extends FinReport poInfo.setRecord_ID(getRecord_ID()); poInfo.setAD_Process_ID(proc.getAD_Process_ID()); poInfo.setAD_PInstance_ID(instance.getAD_PInstance_ID()); + poInfo.setAD_Process_UU(proc.getAD_Process_UU()); // need to commit in order to allow jasper to view the data Trx trx = Trx.get(get_TrxName(), true); diff --git a/org.adempiere.base/src/org/compiere/util/DisplayType.java b/org.adempiere.base/src/org/compiere/util/DisplayType.java index fb7ac27013..517d8f0d72 100644 --- a/org.adempiere.base/src/org/compiere/util/DisplayType.java +++ b/org.adempiere.base/src/org/compiere/util/DisplayType.java @@ -65,6 +65,7 @@ import java.util.logging.Level; import org.adempiere.base.IDisplayTypeFactory; import org.adempiere.base.Service; +import org.compiere.model.MLanguage; /** * System Display Types. @@ -199,7 +200,7 @@ public final class DisplayType if (displayType == ID || displayType == Table || displayType == TableDir || displayType == Search || displayType == Location || displayType == Locator || displayType == Account || displayType == Assignment || displayType == PAttribute - || displayType == Image || displayType == Chart || displayType == Color) + || displayType == Image || displayType == Chart) return true; List factoryList = Service.locator().list(IDisplayTypeFactory.class).getServices(); @@ -498,11 +499,20 @@ public final class DisplayType } } - if (displayType == DateTime) + MLanguage lang = MLanguage.get(Env.getCtx(), myLanguage); + + if (displayType == DateTime) { + if (!Util.isEmpty(lang.getDatePattern()) && !Util.isEmpty(lang.getTimePattern())) + return new SimpleDateFormat(lang.getDatePattern() + " " + lang.getTimePattern()); return myLanguage.getDateTimeFormat(); - else if (displayType == Time) + } + else if (displayType == Time) { + if (!Util.isEmpty(lang.getTimePattern())) + return new SimpleDateFormat(lang.getTimePattern()); return myLanguage.getTimeFormat(); - else{ + } + + else { List factoryList = Service.locator().list(IDisplayTypeFactory.class).getServices(); for(IDisplayTypeFactory factory : factoryList){ SimpleDateFormat osgiFormat = factory.getDateFormat(displayType, myLanguage, pattern); @@ -510,8 +520,11 @@ public final class DisplayType return osgiFormat; } } - - // else if (displayType == Date) + + // Date + if (!Util.isEmpty(lang.getDatePattern())) + return new SimpleDateFormat(lang.getDatePattern()); + return myLanguage.getDateFormat(); // default } // getDateFormat @@ -622,13 +635,8 @@ public final class DisplayType else return "VARCHAR2(" + fieldLength + ")"; } - if (displayType == DisplayType.Color) // this condition is never reached - filtered above in isID - { - if (columnName.endsWith("_ID")) - return "NUMBER(10)"; - else - return "CHAR(" + fieldLength + ")"; - } + if (displayType == DisplayType.Color) + return "VARCHAR2(" + fieldLength + ")"; if (displayType == DisplayType.Button) { if (columnName.endsWith("_ID")) diff --git a/org.adempiere.base/src/org/compiere/util/EMail.java b/org.adempiere.base/src/org/compiere/util/EMail.java index 0acd0d8c43..4d8a9c7f4c 100644 --- a/org.adempiere.base/src/org/compiere/util/EMail.java +++ b/org.adempiere.base/src/org/compiere/util/EMail.java @@ -72,7 +72,7 @@ public final class EMail implements Serializable /** * */ - private static final long serialVersionUID = -2489441683920482601L; + private static final long serialVersionUID = 5355436165040508855L; //use in server bean public final static String HTML_MAIL_MARKER = "ContentType=text/html;"; @@ -602,7 +602,7 @@ public final class EMail implements Serializable } try { - m_from = new InternetAddress (newFrom, true); + m_from = createInternetAddress(newFrom); if (MSysConfig.getBooleanValue(MSysConfig.MAIL_SEND_BCC_TO_FROM, false, Env.getAD_Client_ID(Env.getCtx()))) addBcc(newFrom); } @@ -628,7 +628,7 @@ public final class EMail implements Serializable InternetAddress ia = null; try { - ia = new InternetAddress (newTo, true); + ia = createInternetAddress(newTo); } catch (Exception e) { @@ -679,7 +679,7 @@ public final class EMail implements Serializable InternetAddress ia = null; try { - ia = new InternetAddress (newCc, true); + ia = createInternetAddress(newCc); } catch (Exception e) { @@ -719,7 +719,7 @@ public final class EMail implements Serializable InternetAddress ia = null; try { - ia = new InternetAddress (bccAddress, true); + ia = createInternetAddress(bccAddress); } catch (Exception e) { @@ -758,7 +758,7 @@ public final class EMail implements Serializable InternetAddress ia = null; try { - ia = new InternetAddress (newTo, true); + ia = createInternetAddress(newTo); } catch (Exception e) { @@ -1221,4 +1221,21 @@ public final class EMail implements Serializable additionalHeaders.add(new ValueNamePair(value, name)); } + /** + * Create an internet address with personal if the email address is formatted as "Personal " + * @param email + * @return internet address with personal if defined + * @throws Exception + */ + public static InternetAddress createInternetAddress(String email) throws Exception { + InternetAddress ia = new InternetAddress (email, true); + if (email.contains("<") && email.contains(">")) { + int idx = email.lastIndexOf("<"); + String personal = email.substring(0, idx).trim(); + if (! personal.isEmpty()) + ia.setPersonal(personal); + } + return ia; + } + } // EMail diff --git a/org.adempiere.base/src/org/compiere/util/EmailSrv.java b/org.adempiere.base/src/org/compiere/util/EmailSrv.java index a1c57ce1e9..db25cef201 100644 --- a/org.adempiere.base/src/org/compiere/util/EmailSrv.java +++ b/org.adempiere.base/src/org/compiere/util/EmailSrv.java @@ -114,7 +114,7 @@ public class EmailSrv { if (lsContentTypeRaw != null){ for (String contentType : lsContentTypeRaw){ emailPartLogInfo.append (contentType); - emailPartLogInfo.append (msg.getHeader("; ")); + emailPartLogInfo.append ("; "); } } emailPartLogInfo.append ("\r\n"); diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java index 93c3886060..09d1ba5a66 100644 --- a/org.adempiere.base/src/org/compiere/util/Env.java +++ b/org.adempiere.base/src/org/compiere/util/Env.java @@ -871,14 +871,8 @@ public final class Env throw new IllegalArgumentException ("Require Context"); String s = getContext(ctx, WindowNo, context, false); // JDBC Format YYYY-MM-DD example 2000-09-11 00:00:00.0 - if (s == null || s.equals("")) - { - if (!"#date".equalsIgnoreCase(context)) - { - log.log(Level.WARNING, "No value for: " + context); - } + if (Util.isEmpty(s)) return new Timestamp(System.currentTimeMillis()); - } // BUG:3075946 KTU - Fix Thai Date /* @@ -1967,7 +1961,7 @@ public final class Env */ public static String getStandardReportFooterTrademarkText() { String s = MSysConfig.getValue(MSysConfig.STANDARD_REPORT_FOOTER_TRADEMARK_TEXT, Env.getAD_Client_ID(Env.getCtx())); - if (Util.isEmpty(s)) + if (Util.isEmpty(s, true)) s = Env.getContext(Env.getCtx(), STANDARD_REPORT_FOOTER_TRADEMARK_TEXT); if (Util.isEmpty(s)) s = Adempiere.ADEMPIERE_R; diff --git a/org.adempiere.base/src/org/compiere/util/IBAN.java b/org.adempiere.base/src/org/compiere/util/IBAN.java index 3cbb374fc4..212f80b742 100644 --- a/org.adempiere.base/src/org/compiere/util/IBAN.java +++ b/org.adempiere.base/src/org/compiere/util/IBAN.java @@ -26,7 +26,7 @@ public class IBAN { { if (iban!=null) { - return iban.trim().replace(" ", "") ; + return iban.trim().replace(" ", "").toUpperCase() ; } return null ; } diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index ffb0efe452..37b99a26d2 100644 --- a/org.adempiere.base/src/org/compiere/util/Login.java +++ b/org.adempiere.base/src/org/compiere/util/Login.java @@ -1324,6 +1324,7 @@ public class Login user.setIsLocked(false); user.setDateAccountLocked(null); user.setFailedLoginCount(0); + Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID()); if (!user.save()) log.severe("Failed to unlock user account"); } @@ -1337,6 +1338,7 @@ public class Login { user.setIsLocked(true); user.setDateAccountLocked(new Timestamp(now)); + Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID()); if (!user.save()) log.severe("Failed to lock user account"); } @@ -1441,6 +1443,7 @@ public class Login { user.setFailedLoginCount(0); user.setDateLastLogin(new Timestamp(now)); + Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID()); if (!user.save()) log.severe("Failed to update user record with date last login (" + user.getName() + " / clientID = " + user.getAD_Client_ID() + ")"); } @@ -1490,6 +1493,7 @@ public class Login user.setFailedLoginCount(count); user.setIsLocked(reachMaxAttempt); user.setDateAccountLocked(user.isLocked() ? new Timestamp(now) : null); + Env.setContext(Env.getCtx(), "#AD_Client_ID", user.getAD_Client_ID()); if (!user.save()) log.severe("Failed to update user record with increase failed login count"); } diff --git a/org.adempiere.base/src/org/compiere/wf/MWFNode.java b/org.adempiere.base/src/org/compiere/wf/MWFNode.java index 34c1824201..042b441174 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFNode.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFNode.java @@ -186,7 +186,8 @@ public class MWFNode extends X_AD_WF_Node */ private void loadNext() { - m_next = new Query(getCtx(), MWFNodeNext.Table_Name, "AD_WF_Node_ID=?", get_TrxName()) + m_next = new Query(getCtx(), MWFNodeNext.Table_Name, "AD_WF_NodeNext.AD_WF_Node_ID=?", get_TrxName()) + .addJoinClause(" JOIN AD_WF_Node ON (AD_WF_Node.AD_WF_Node_ID=AD_WF_NodeNext.AD_WF_Next_ID AND AD_WF_Node.IsActive='Y')") .setParameters(new Object[]{get_ID()}) .setOnlyActiveRecords(true) .setOrderBy(MWFNodeNext.COLUMNNAME_SeqNo) diff --git a/org.adempiere.base/src/org/compiere/wf/MWorkflow.java b/org.adempiere.base/src/org/compiere/wf/MWorkflow.java index 0d1577b623..5583fc6935 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWorkflow.java +++ b/org.adempiere.base/src/org/compiere/wf/MWorkflow.java @@ -435,7 +435,7 @@ public class MWorkflow extends X_AD_Workflow for (int i = 0; i < nexts.length; i++) { MWFNode child = getNode (nexts[i].getAD_WF_Next_ID()); - if (!child.isActive()) + if (child == null || !child.isActive()) continue; if (child.getAD_Client_ID() == 0 || child.getAD_Client_ID() == AD_Client_ID) diff --git a/org.adempiere.pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java b/org.adempiere.pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java index 31ad2fcf85..18f79c12d3 100644 --- a/org.adempiere.pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java +++ b/org.adempiere.pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java @@ -42,6 +42,10 @@ public class PipoDictionaryService implements IDictionaryService { logger.info("No PackIn Model found"); return; } + if (! packageFile.canRead()) { + logger.severe("Cannot read file " + packageFile.getName()); + return; + } String symbolicName = "org.adempiere.pipo"; if (context != null) symbolicName = context.getBundle().getSymbolicName(); diff --git a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/PackInApplicationActivator.java b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/PackInApplicationActivator.java index 5158cd9814..1619cf7b6d 100644 --- a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/PackInApplicationActivator.java +++ b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/PackInApplicationActivator.java @@ -299,7 +299,7 @@ public class PackInApplicationActivator extends AbstractActivator { for (String filePath : filePaths) { File toProcess = new File(filePath.trim()); if (!toProcess.exists()) { - logger.log(Level.SEVERE, filePath + " does not exist"); + addLog(Level.SEVERE, filePath + " does not exist"); continue; } @@ -322,14 +322,14 @@ public class PackInApplicationActivator extends AbstractActivator { } private void processFilePath(File toProcess) { - if (toProcess.isFile()) { + if (toProcess.isFile() && toProcess.canRead()) { if (toProcess.getName().toLowerCase().endsWith(".zip")) filesToProcess.add(toProcess); else { logger.log(Level.SEVERE, toProcess.getName() + " is not a valid .zip file"); return; } - } else if (toProcess.isDirectory()) { + } else if (toProcess.isDirectory() && toProcess.canRead()) { FileFilter filter = new FileFilter() { public boolean accept(File file) { if (file.getName().toUpperCase().endsWith(".ZIP") || file.isDirectory()) @@ -344,17 +344,22 @@ public class PackInApplicationActivator extends AbstractActivator { logger.info("*** Creating list from folder " + toProcess.toString()); found = true; } - if (fileToProcess.isDirectory()) + if (fileToProcess.isDirectory()) { processFilePath(fileToProcess); - else - filesToProcess.add(fileToProcess); + } else { + if (fileToProcess.canRead()) { + filesToProcess.add(fileToProcess); + } else { + addLog(Level.SEVERE, fileToProcess.getName() + " not readable"); + } + } } if (!found) { logger.log(Level.FINE, toProcess.getName() + " does not have .zip files or subfolders"); return; } } else { - logger.log(Level.SEVERE, toProcess.getName() + " not a file or folder"); + addLog(Level.SEVERE, toProcess.getName() + " not a file or folder or not readable"); } } diff --git a/org.adempiere.report.jasper-feature/feature.xml b/org.adempiere.report.jasper-feature/feature.xml index 7a59183bbc..e9d12947a4 100644 --- a/org.adempiere.report.jasper-feature/feature.xml +++ b/org.adempiere.report.jasper-feature/feature.xml @@ -26,8 +26,8 @@ id="org.adempiere.report.jasper.library" download-size="0" install-size="0" - fragment="true" - version="0.0.0"/> + version="0.0.0" + fragment="true"/> + + diff --git a/org.adempiere.report.jasper.library/.classpath b/org.adempiere.report.jasper.library/.classpath index 0ae9142b3c..fda455228c 100644 --- a/org.adempiere.report.jasper.library/.classpath +++ b/org.adempiere.report.jasper.library/.classpath @@ -4,6 +4,7 @@ + @@ -11,7 +12,6 @@ - diff --git a/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF b/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF index c86ceef00c..63d9e05a06 100644 --- a/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF +++ b/org.adempiere.report.jasper.library/META-INF/MANIFEST.MF @@ -10,12 +10,12 @@ Bundle-ClassPath: ., lib/castor-xml.jar, lib/jasperreports-chart-customizers.jar, lib/jasperreports-chart-themes.jar, + lib/jasperreports-fonts.jar, lib/jasperreports-functions.jar, lib/olap4j.jar, lib/rhino.jar, lib/spring-beans.jar, lib/spring-core.jar, - lib/xml-apis-ext.jar, lib/xmpcore.jar Import-Package: bsh, bsh.classpath, diff --git a/org.adempiere.report.jasper.library/build.properties b/org.adempiere.report.jasper.library/build.properties index 917a447cc9..860892e7b1 100644 --- a/org.adempiere.report.jasper.library/build.properties +++ b/org.adempiere.report.jasper.library/build.properties @@ -4,10 +4,10 @@ bin.includes = META-INF/,\ lib/castor-xml.jar,\ lib/jasperreports-chart-customizers.jar,\ lib/jasperreports-chart-themes.jar,\ + lib/jasperreports-fonts.jar,\ lib/jasperreports-functions.jar,\ lib/olap4j.jar,\ lib/rhino.jar,\ lib/spring-beans.jar,\ lib/spring-core.jar,\ - lib/xml-apis-ext.jar,\ lib/xmpcore.jar diff --git a/org.adempiere.report.jasper.library/copyjars.xml b/org.adempiere.report.jasper.library/copyjars.xml index 2aa085f8bc..aab9a9db48 100644 --- a/org.adempiere.report.jasper.library/copyjars.xml +++ b/org.adempiere.report.jasper.library/copyjars.xml @@ -5,6 +5,7 @@ + diff --git a/org.adempiere.report.jasper.library/note_for_update_jr_library.readme b/org.adempiere.report.jasper.library/note_for_update_jr_library.readme index 5293d7804a..c0d28b3183 100644 --- a/org.adempiere.report.jasper.library/note_for_update_jr_library.readme +++ b/org.adempiere.report.jasper.library/note_for_update_jr_library.readme @@ -11,7 +11,7 @@ guide for update: for extra like encrypt, have go to sample project to get dependency but just focus common job and already know extra like encrypt) -3. also download jasperreports-functions-x.x.x.jar +3. also download jasperreports-functions-x.x.x.jar and jasperreports-fonts-x.x.x.jar 4. now edit org.adempiere.report.jasper.library follow bellow rule + if library have same version with library already use on idempiere, just use import package or bundle dependency @@ -50,4 +50,4 @@ note: net.sf.jasperreports.engine_6.3.1.jar use package dynamic import 6. com.jaspersoft.studio.bundles.itext_2.1.7.js5 already have bcprov-jdk14-139 on Bundle-ClassPath, but manifest still import package from bcprov-jdk14-139. so i modify its manifest before call ${ECLIPSE_FOLDER}/eclipse -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -7. org.krysalis.barcode4j_2.1.0.jar have osgi version on maven but it dependency to org.apache.avalon, so use version from jasper report. it modify manifest.mf to don't depend to org.apache.avalon \ No newline at end of file +7. org.krysalis.barcode4j_2.1.0.jar have osgi version on maven but it dependency to org.apache.avalon, so use version from jasper report. it modify manifest.mf to don't depend to org.apache.avalon diff --git a/org.adempiere.report.jasper.library/pom.xml b/org.adempiere.report.jasper.library/pom.xml index 2385027db6..09911c1d8f 100644 --- a/org.adempiere.report.jasper.library/pom.xml +++ b/org.adempiere.report.jasper.library/pom.xml @@ -68,11 +68,6 @@ spring-core 2.5 - - xml-apis - xml-apis-ext - 1.3.04 - com.adobe.xmp xmpcore @@ -87,6 +82,26 @@ + + com.googlecode.maven-download-plugin + download-maven-plugin + + + download-db-seed-oracle + validate + + wget + + + ${url.file.srv}/jarfile/jp-6.3.1/jasperreports-fonts-6.3.1.jar + false + lib + jasperreports-fonts.jar + 5 + + + + - \ No newline at end of file + diff --git a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java index 7482c8be4f..d7c923e764 100644 --- a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java +++ b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/ReportStarter.java @@ -1353,7 +1353,7 @@ public class ReportStarter implements ProcessCall, ClientProcess jasperFile.setLastModified( reportFile.lastModified()); //Synchronize Dates compiledJasperReport = (JasperReport)JRLoader.loadObject(jasperFile); } catch (JRException e) { - log.log(Level.SEVERE, "Error", e); + throw new AdempiereException(e); } return compiledJasperReport; } diff --git a/org.adempiere.sdk-feature/adempiere.rmap b/org.adempiere.sdk-feature/adempiere.rmap index 0421ed52a8..ebffac93a8 100644 --- a/org.adempiere.sdk-feature/adempiere.rmap +++ b/org.adempiere.sdk-feature/adempiere.rmap @@ -10,7 +10,7 @@ - + @@ -186,7 +186,7 @@ - + diff --git a/org.adempiere.sdk-feature/materialize.properties b/org.adempiere.sdk-feature/materialize.properties index 51c8d5c4ee..5fa8e8c83a 100644 --- a/org.adempiere.sdk-feature/materialize.properties +++ b/org.adempiere.sdk-feature/materialize.properties @@ -26,7 +26,7 @@ url.zkoss.osgi=http://downloads.sourceforge.net/project/idempiere/binary.file/ja url.equinox=http://download.eclipse.org/eclipse/updates/4.7 url.jetty=http://download.eclipse.org/jetty/updates/jetty-bundles-9.x -url.orbit=http://download.eclipse.org/tools/orbit/downloads/drops/R20170919201930/repository/ +url.orbit=http://download.eclipse.org/tools/orbit/downloads/drops/R20180330011457/repository url.file.srv=http://downloads.sourceforge.net/project/idempiere/binary.file @@ -38,7 +38,7 @@ url.file.jp.lib=http://downloads.sourceforge.net/project/idempiere/binary.file/j url.jp.p2=http://downloads.sourceforge.net/project/idempiere/binary.file/jarfile/jp-p2/jp-6.3.1 -url.alpn.boot=http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.11.v20170118/alpn-boot-8.1.11.v20170118.jar +url.alpn.boot=http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.12.v20180117/alpn-boot-8.1.12.v20180117.jar extend.bundle.folder.1 extend.bundle.folder.2 diff --git a/org.adempiere.server-feature/feature.xml b/org.adempiere.server-feature/feature.xml index 07269c3cf4..8f0684c25b 100644 --- a/org.adempiere.server-feature/feature.xml +++ b/org.adempiere.server-feature/feature.xml @@ -510,4 +510,18 @@ version="0.0.0" fragment="true"/> + + + + diff --git a/org.adempiere.server-feature/hazelcast-template.xml b/org.adempiere.server-feature/hazelcast-template.xml index d18084f2e2..90e8c53bc0 100644 --- a/org.adempiere.server-feature/hazelcast-template.xml +++ b/org.adempiere.server-feature/hazelcast-template.xml @@ -211,6 +211,11 @@ --> INDEX-ONLY + + OBJECT + true + + - - diff --git a/org.adempiere.server-feature/jettyhome/etc/jetty-ssl-context-template.xml b/org.adempiere.server-feature/jettyhome/etc/jetty-ssl-context-template.xml index 9a1ff81daa..a8bfba5ba6 100644 --- a/org.adempiere.server-feature/jettyhome/etc/jetty-ssl-context-template.xml +++ b/org.adempiere.server-feature/jettyhome/etc/jetty-ssl-context-template.xml @@ -5,6 +5,7 @@ + Conscrypt / diff --git a/org.adempiere.server-feature/pom.xml b/org.adempiere.server-feature/pom.xml index 8564bebbe9..e554646e6f 100644 --- a/org.adempiere.server-feature/pom.xml +++ b/org.adempiere.server-feature/pom.xml @@ -136,7 +136,7 @@ org.mortbay.jetty.alpn alpn-boot - 8.1.11.v20170118 + ${jetty.alpn-boot.version} ../ diff --git a/org.adempiere.server-feature/server.product b/org.adempiere.server-feature/server.product index 83ed54c938..9f9a7883a2 100644 --- a/org.adempiere.server-feature/server.product +++ b/org.adempiere.server-feature/server.product @@ -3,14 +3,13 @@ - -console - -Xbootclasspath/p:alpn-boot.jar -Declipse.product=org.adempiere.server.product -Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -Dorg.osgi.framework.bootdelegation=sun.security.ssl,org.eclipse.jetty.alpn -Dosgi.compatibility.bootdelegation=true -Djetty.home=jettyhome -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-deployer.xml,etc/jetty-ssl.xml,etc/jetty-ssl-context.xml,etc/jetty-http.xml,etc/jetty-alpn.xml,etc/jetty-http2.xml,etc/jetty-https.xml -Dmail.mime.encodefilename=true -Dmail.mime.decodefilename=true -Dmail.mime.encodeparameters=true -Dmail.mime.decodeparameters=true -Dhazelcast.config=hazelcast.xml -Dorg.zkoss.zk.config.path=file://${workspace_loc}/zk.xml + -Declipse.product=org.adempiere.server.product -Dosgi.noShutdown=true -Dosgi.framework.activeThreadType=normal -Dorg.osgi.framework.bootdelegation=sun.security.ssl -Dosgi.compatibility.bootdelegation=true -Djetty.home=jettyhome -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-deployer.xml,etc/jetty-ssl.xml,etc/jetty-ssl-context.xml,etc/jetty-http.xml,etc/jetty-alpn.xml,etc/jetty-http2.xml,etc/jetty-https.xml -Dmail.mime.encodefilename=true -Dmail.mime.decodefilename=true -Dmail.mime.encodeparameters=true -Dmail.mime.decodeparameters=true -Dhazelcast.config=hazelcast.xml -Dorg.zkoss.zk.config.path=file://${workspace_loc}/zk.xml -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts @@ -18,19 +17,16 @@ - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - @@ -55,6 +51,7 @@ + diff --git a/org.adempiere.server-feature/server.product.launch b/org.adempiere.server-feature/server.product.launch index d9cd7b968d..c934321719 100644 --- a/org.adempiere.server-feature/server.product.launch +++ b/org.adempiere.server-feature/server.product.launch @@ -22,13 +22,13 @@ - + - - + + diff --git a/org.adempiere.server-feature/setup/configuration/config.ini b/org.adempiere.server-feature/setup/configuration/config.ini index 6ed81c32b0..f1b25e7b4e 100644 --- a/org.adempiere.server-feature/setup/configuration/config.ini +++ b/org.adempiere.server-feature/setup/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=setup osgi.bundles=org.eclipse.equinox.ds@1:start,\ org.eclipse.equinox.util,\ @@ -28,6 +28,7 @@ osgi.bundles=org.eclipse.equinox.ds@1:start,\ org.apache.poi,\ org.eclipse.core.jobs,\ org.eclipse.equinox.preferences,\ + org.eclipse.equinox.event,\ org.apache.commons.logging,\ javax.management.j2ee-api,\ org.eclipse.osgi,\ diff --git a/org.adempiere.server-feature/utils.unix/unix/DebianInstaller/etc/init.d/idempiere b/org.adempiere.server-feature/utils.unix/unix/DebianInstaller/etc/init.d/idempiere index 565bfd0b41..d79728fc31 100755 --- a/org.adempiere.server-feature/utils.unix/unix/DebianInstaller/etc/init.d/idempiere +++ b/org.adempiere.server-feature/utils.unix/unix/DebianInstaller/etc/init.d/idempiere @@ -39,7 +39,7 @@ esac # adjust these variables to your environment IDEMPIERE_USER=idempiere IDEMPIERE_HOME=/opt/idempiere-server -JAVA_HOME=`ls -r /usr/lib/jvm/java-[678]-openjdk*/bin/javac /usr/lib/jvm/java-[8]-oracle*/bin/javac | head -1` +JAVA_HOME=`ls -r /usr/lib/jvm/java-[6789]-openjdk*/bin/javac /usr/lib/jvm/java-[89]-oracle*/bin/javac | head -1` JAVA_HOME=`dirname $JAVA_HOME` JAVA_HOME=`dirname $JAVA_HOME` SU=su @@ -533,8 +533,8 @@ Enter postgres password:" } getidempierestatus() { - IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep ${IDEMPIERE_HOME}) - echo $IDEMPIERESTATUSSTRING | grep -q ${IDEMPIERE_HOME} + IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep) + echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application IDEMPIERESTATUS=$? } @@ -626,14 +626,14 @@ stop () { log_success_msg "Service stopped with OSGi shutdown" else log_warning_msg "Trying direct kill with signal -15" - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then log_success_msg "Service stopped with kill -15" else log_warning_msg "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then @@ -664,7 +664,7 @@ dostatus () { if [ $IDEMPIERESTATUS -eq 0 ] ; then echo echo "iDempiere is running:" - ps ax | grep -v grep | grep ${IDEMPIERE_HOME} | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' + ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' echo else echo "iDempiere is stopped" diff --git a/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh b/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh index b516ac781f..760b307d6d 100644 --- a/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh +++ b/org.adempiere.server-feature/utils.unix/unix/idempiere_Debian.sh @@ -32,8 +32,8 @@ IDEMPIERESTATUS= MAXITERATIONS=60 getidempierestatus() { - IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $IDEMPIERE_HOME) - echo $IDEMPIERESTATUSSTRING | grep -q $IDEMPIERE_HOME + IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep) + echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application IDEMPIERESTATUS=$? } @@ -96,14 +96,14 @@ stop () { log_success_msg "Service stopped with OSGi shutdown" else log_warning_msg "Trying direct kill with signal -15" - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then log_success_msg "Service stopped with kill -15" else log_warning_msg "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then @@ -118,7 +118,7 @@ stop () { restart () { stop - sleep 1 + sleep 2 start } @@ -134,7 +134,7 @@ status () { if [ $IDEMPIERESTATUS -eq 0 ] ; then echo echo "iDempiere is running:" - ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' + ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' echo else echo "iDempiere is stopped" diff --git a/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh b/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh index ae6d4637a0..4e96fd83f7 100644 --- a/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh +++ b/org.adempiere.server-feature/utils.unix/unix/idempiere_RedHat.sh @@ -25,11 +25,11 @@ IDEMPIEREUSER=idempiere RETVAL=0 IDEMPIERESTATUS= -MAXITERATIONS=60 # 2 seconds every iteration, max wait 2 minutes) +MAXITERATIONS=60 # 2 seconds every iteration, max wait 2 minutes getidempierestatus() { - IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $IDEMPIERE_HOME) - echo $IDEMPIERESTATUSSTRING | grep -q $IDEMPIERE_HOME + IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep) + echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application IDEMPIERESTATUS=$? } @@ -78,7 +78,7 @@ start () { stop () { getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then - echo "idempiere is already stopped" + echo "iDempiere is already stopped" return 1 fi echo -n "Stopping iDempiere ERP: " @@ -92,14 +92,14 @@ stop () { echo_success else echo "Trying direct kill with signal -15" - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then echo_success else echo "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then @@ -130,11 +130,11 @@ status () { getidempierestatus if [ $IDEMPIERESTATUS -eq 0 ] ; then echo - echo "idempiere is running:" - ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' + echo "iDempiere is running:" + ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' echo else - echo "idempiere is stopped" + echo "iDempiere is stopped" fi } diff --git a/org.adempiere.server-feature/utils.unix/unix/idempiere_Suse.sh b/org.adempiere.server-feature/utils.unix/unix/idempiere_Suse.sh index 063dca949b..a999dc31d4 100644 --- a/org.adempiere.server-feature/utils.unix/unix/idempiere_Suse.sh +++ b/org.adempiere.server-feature/utils.unix/unix/idempiere_Suse.sh @@ -57,8 +57,8 @@ IDEMPIERESTATUS= MAXITERATIONS=60 getidempierestatus() { - IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $IDEMPIERE_HOME) - echo $IDEMPIERESTATUSSTRING | grep -q $IDEMPIERE_HOME + IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep) + echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application IDEMPIERESTATUS=$? } @@ -123,14 +123,14 @@ stop () { echo "Service stopped with OSGi shutdown" else echo "Trying direct kill with signal -15" - kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then echo "Service stopped with kill -15" else echo "Trying direct kill with signal -9" - kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` + kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` sleep 5 getidempierestatus if [ $IDEMPIERESTATUS -ne 0 ] ; then @@ -146,7 +146,7 @@ stop () { restart () { stop - sleep 1 + sleep 2 start rc_status } @@ -166,7 +166,7 @@ status () { if [ $IDEMPIERESTATUS -eq 0 ] ; then echo echo "iDempiere is running:" - ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' + ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/' echo else echo "iDempiere is stopped" @@ -182,9 +182,6 @@ case "$1" in stop) stop ;; - reload) - restart - ;; restart) restart ;; @@ -195,7 +192,7 @@ case "$1" in status ;; *) - echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}" + echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac diff --git a/org.adempiere.server/src/main/server/org/compiere/server/AdempiereServer.java b/org.adempiere.server/src/main/server/org/compiere/server/AdempiereServer.java index 48d442b880..9a94a79bfd 100644 --- a/org.adempiere.server/src/main/server/org/compiere/server/AdempiereServer.java +++ b/org.adempiere.server/src/main/server/org/compiere/server/AdempiereServer.java @@ -117,13 +117,21 @@ public abstract class AdempiereServer implements Runnable } m_sleepMS = 0; m_nextWork = 0; - - Timestamp lastRun = new Timestamp(System.currentTimeMillis()); - m_nextWork = MSchedule.getNextRunMS(lastRun.getTime(), - p_model.getScheduleType(), p_model.getFrequencyType(), - p_model.getFrequency(), p_model.getCronPattern()); + Timestamp dateNextRun = getDateNextRun(true); + Timestamp now = new Timestamp(System.currentTimeMillis()); + if (dateNextRun != null) + { + m_nextWork = dateNextRun.getTime(); + } + else + { + m_nextWork = MSchedule.getNextRunMS(now.getTime(), + p_model.getScheduleType(), p_model.getFrequencyType(), + p_model.getFrequency(), p_model.getCronPattern()); + } - m_sleepMS = m_nextWork - lastRun.getTime(); + if (m_nextWork > now.getTime()) + m_sleepMS = m_nextWork - now.getTime(); if (log.isLoggable(Level.INFO)) log.info(" Next run: " + new Timestamp(m_nextWork) + " sleep " + m_sleepMS); // p_model.setDateNextRun(new Timestamp(m_nextWork)); diff --git a/org.adempiere.server/src/main/server/org/compiere/server/AdempiereServerMgr.java b/org.adempiere.server/src/main/server/org/compiere/server/AdempiereServerMgr.java index f4c27ff1c2..2065ae7f6e 100644 --- a/org.adempiere.server/src/main/server/org/compiere/server/AdempiereServerMgr.java +++ b/org.adempiere.server/src/main/server/org/compiere/server/AdempiereServerMgr.java @@ -176,6 +176,7 @@ public class AdempiereServerMgr implements ServiceTrackerCustomizer").append(s).append("

    "); + + 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 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 false - org.mortbay.jasper:apache-el:jar:8.5.23 + org.mortbay.jasper:apache-el:jar:${jetty.jsp.version} true 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} true false @@ -187,7 +195,7 @@ false - org.apache.commons:commons-digester3:jar:3.2 + commons-digester:commons-digester:jar:2.1 true false @@ -211,11 +219,6 @@ true false - - org.eclipse.jetty:jetty-alpn-server:jar:${jetty.version} - true - false - org.eclipse.jetty.alpn:alpn-api:jar:1.1.3.v20160715 true @@ -242,10 +245,30 @@ false - org.apache.commons:commons-collections4:jar:4.1 + org.apache.commons:commons-collections4:jar:4.2 true false + + org.eclipse.jetty:jetty-alpn-conscrypt-server:jar:${jetty.version} + true + false + + + org.eclipse.jetty:jetty-alpn-openjdk8-server:jar:${jetty.version} + true + false + + + org.conscrypt:conscrypt-openjdk-uber:jar:${jetty.conscrypt.openjdk.uber.version} + true + 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 +