From 7eeacc854d3b07c13a3775b04ed7a87e8c83065a Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Mon, 16 Jul 2018 21:00:00 +0200 Subject: [PATCH 1/9] IDEMPIERE-3748 Script altercolumn is not recreating previously assigned permissions on dependent views (AP2-357) --- .../postgresql/functions/altercolumn.sql | 31 +++- .../oracle/201807111333_Ticket_AP2-357.sql | 4 + .../201807111333_Ticket_AP2-357.sql | 148 ++++++++++++++++++ 3 files changed, 177 insertions(+), 6 deletions(-) create mode 100644 migration/i5.1/oracle/201807111333_Ticket_AP2-357.sql create mode 100644 migration/i5.1/postgresql/201807111333_Ticket_AP2-357.sql 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/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/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 +; From f02e7494b72da3dec91e0374a2a7ab200e708224 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 16 Jul 2018 21:52:31 +0200 Subject: [PATCH 2/9] IDEMPIERE-3747 Find a better place for the clear button in Find Window --- .../WEB-INF/src/org/adempiere/webui/window/FindWindow.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 86330bc8c0..86b946842d 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 @@ -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; @@ -364,7 +365,6 @@ public class FindWindow extends Window implements EventListener, ValueCha btnCancel.addEventListener(Events.ON_CLICK,this); Panel pnlButtonRight = new Panel(); - pnlButtonRight.appendChild(btnClear); pnlButtonRight.appendChild(btnOk); pnlButtonRight.appendChild(btnCancel); pnlButtonRight.setStyle("text-align:right"); @@ -373,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(); From 42a69abfd8dc6482fdc485773664c64a0d701f20 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Mon, 16 Jul 2018 22:19:36 +0200 Subject: [PATCH 3/9] IDEMPIERE-3746 Use AD_Language.DatePattern and TimePattern --- .../oracle/201807161530_IDEMPIERE-3746.sql | 18 +++++++++++++++ .../201807161530_IDEMPIERE-3746.sql | 15 ++++++++++++ .../src/org/compiere/util/DisplayType.java | 23 +++++++++++++++---- 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 migration/i5.1/oracle/201807161530_IDEMPIERE-3746.sql create mode 100644 migration/i5.1/postgresql/201807161530_IDEMPIERE-3746.sql 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/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/org.adempiere.base/src/org/compiere/util/DisplayType.java b/org.adempiere.base/src/org/compiere/util/DisplayType.java index e78f1c2fbb..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. @@ -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 From 71e8c2f87883ca172685dc3839ee5768c414a5b1 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 16 Jul 2018 22:19:49 +0200 Subject: [PATCH 4/9] IDEMPIERE-3746 Use AD_Language.DatePattern and TimePattern --- .../src/org/compiere/model/MLanguage.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) 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; From fce33028c33b2e1517301440b14afe7013b203b4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 19 Jul 2018 19:42:45 +0200 Subject: [PATCH 5/9] =?UTF-8?q?IDEMPIERE-3749=20Exception=20on=20create=20?= =?UTF-8?q?Request=20from=20mail=20/=20integrate=20patch=20from=20=D0=95?= =?UTF-8?q?=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=9A=D1=83=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D1=81=D0=BA=D0=B8=D0=B9=20(ekurensky)=20-=20peer=20revie?= =?UTF-8?q?wed=20by=20Hiep=20Lq?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- org.adempiere.base/src/org/compiere/util/EmailSrv.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); From ba541e7dc073d6cbaa76f812e81923c0b44e29f2 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 19 Jul 2018 23:09:04 +0200 Subject: [PATCH 6/9] IDEMPIERE-1539 search without "%" mark in value, name, description fields --- migration/i5.1/oracle/201312231347_IDEMPIERE-1539.sql | 11 +++++++++++ .../i5.1/postgresql/201312231347_IDEMPIERE-1539.sql | 8 ++++++++ .../src/org/compiere/model/X_AD_InfoColumn.java | 4 +++- .../src/org/adempiere/webui/info/InfoWindow.java | 11 +++++++---- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 migration/i5.1/oracle/201312231347_IDEMPIERE-1539.sql create mode 100644 migration/i5.1/postgresql/201312231347_IDEMPIERE-1539.sql 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/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/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java b/org.adempiere.base/src/org/compiere/model/X_AD_InfoColumn.java index 2f9d7c3010..447c61b2c1 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 = 20171031L; + private static final long serialVersionUID = 20180719L; /** Standard Constructor */ public X_AD_InfoColumn (Properties ctx, int AD_InfoColumn_ID, String trxName) @@ -572,6 +572,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.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 b2a8b53bb2..86ea7ac733 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 @@ -987,14 +987,17 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL 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()); if (!valueStr.toString().endsWith("%")) valueStr.append("%"); - pstmt.setString(parameterIndex, valueStr.toString()); - } else { - pstmt.setString(parameterIndex, (String)value); + } 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); } From 18e38574fb23b2bd4495241797dd8c7d25c9dea5 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 23 Jul 2018 19:02:33 +0200 Subject: [PATCH 7/9] IDEMPIERE-3744 Quick Entry is not Working when update --- .../WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3789cc9171..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 @@ -297,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()); From dad417a3df633883d9da8b18697c75ad8b662f64 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 23 Jul 2018 19:53:46 +0200 Subject: [PATCH 8/9] Integrate patch suggested by Ricardo Alexsander Santana https://groups.google.com/d/msg/idempiere/ur7Wx1DlXt8/TL2xL_2uBAAJ --- org.adempiere.base-feature/feature.xml | 2 +- org.adempiere.sdk-feature/adempiere.rmap | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base-feature/feature.xml b/org.adempiere.base-feature/feature.xml index 73d7fae252..b31cd0810e 100644 --- a/org.adempiere.base-feature/feature.xml +++ b/org.adempiere.base-feature/feature.xml @@ -387,7 +387,7 @@ unpack="false"/> - + @@ -183,7 +183,7 @@ - + From ea2151698dfcaa12aeb89f10a47fe6c406f947a0 Mon Sep 17 00:00:00 2001 From: z5k1 Date: Mon, 23 Jul 2018 20:40:53 +0200 Subject: [PATCH 9/9] IDEMPIERE-3737 System preference cant display ad_user_id in other clients that lead null ad_user_id be saved --- .../oracle/201807232033_IDEMPIERE-3737.sql | 19 +++++++++++++++++++ .../201807232033_IDEMPIERE-3737.sql | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 migration/i5.1/oracle/201807232033_IDEMPIERE-3737.sql create mode 100644 migration/i5.1/postgresql/201807232033_IDEMPIERE-3737.sql 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/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 +; +