diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 210c1d1fb8..d8995179ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: postgres: # Docker Hub image # Ubuntu 22.04 supports only Postgres 14.5 - image: postgres:14.5 + image: postgres:15 # Provide the password for postgres env: POSTGRES_PASSWORD: postgres @@ -81,30 +81,6 @@ jobs: uses: ./.github/actions/adempiere-build with: nodbrestore: false - # env: - # ACTION_BUILD_DIR: ${{ github.action_path }} - # POSTGRES_HOST: localhost - # # The default PostgreSQL port - # POSTGRES_PORT: 5432 - # run: | - # echo $ACTION_BUILD_DIR - # echo $GITHUB_REF - # echo $GITHUB_HEAD_REF - # echo $GITHUB_BASE_REF - # echo ${{ github.ref }} - # echo "Current ant version: $(ant -version)" - # echo "Installing ant version 1.10.10" - # wget --no-check-certificate https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.10-bin.tar.gz - # tar -xzf apache-ant-1.10.10-bin.tar.gz - # export ANT_HOME=`pwd`/apache-ant-1.10.10 - # export PATH=${ANT_HOME}/bin:$PATH - # export ADEMPIERE_HOME=$GITHUB_WORKSPACE/adempiere/Adempiere - # echo $ANT_HOME - # echo $PATH - # echo $(ant -version) - # echo $ADEMPIERE_HOME - # # ANT performs build, install and database restore - # ant build # Build ADempiere with ant, if there are no changes in XML files - name: Build Adempiere without database restore... @@ -112,30 +88,6 @@ jobs: uses: ./.github/actions/adempiere-build with: nodbrestore: true - # env: - # ACTION_BUILD_DIR: ${{ github.action_path }} - # POSTGRES_HOST: localhost - # # The default PostgreSQL port - # POSTGRES_PORT: 5432 - # run: | - # echo $ACTION_BUILD_DIR - # echo $GITHUB_REF - # echo $GITHUB_HEAD_REF - # echo $GITHUB_BASE_REF - # echo ${{ github.ref }} - # echo "Current ant version: $(ant -version)" - # echo "Installing ant version 1.10.10" - # wget --no-check-certificate https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.10-bin.tar.gz - # tar -xzf apache-ant-1.10.10-bin.tar.gz - # export ANT_HOME=`pwd`/apache-ant-1.10.10 - # export PATH=${ANT_HOME}/bin:$PATH - # export ADEMPIERE_HOME=$GITHUB_WORKSPACE/adempiere/Adempiere - # echo $ANT_HOME - # echo $PATH - # echo $(ant -version) - # echo $ADEMPIERE_HOME - # # ANT performs only build & install. No database restore. - # ant build -Dnodbrestore=true - name: Upload Binary Files uses: actions/upload-artifact@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 573b6c8246..0a78203181 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,13 +14,13 @@ jobs: # This workflow contains a single job called "build" publish: # The type of runner that the job will run on - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # Service containers to run with `container-job` services: # Label used to access the service container postgres: # Docker Hub image - image: postgres + image: postgres:15 # Provide the password for postgres env: POSTGRES_PASSWORD: postgres @@ -36,7 +36,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # Ensure a compatible version of java is used - name: Setup Java JDK @@ -45,32 +45,12 @@ jobs: java-version: '11' java-package: jdk - # Build ADempiere with ant - - name: Build Adempiere ... - env: - ACTION_BUILD_DIR: ${{ github.action_path }} - POSTGRES_HOST: localhost - # The default PostgreSQL port - POSTGRES_PORT: 5432 - run: | - echo $ACTION_BUILD_DIR - echo $GITHUB_REF - echo $GITHUB_HEAD_REF - echo $GITHUB_BASE_REF - echo ${{ github.ref }} - echo "Current ant version: $(ant -version)" - echo "Installing ant version 1.10.10" - wget --no-check-certificate https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.10-bin.tar.gz - tar -xzf apache-ant-1.10.10-bin.tar.gz - export ANT_HOME=`pwd`/apache-ant-1.10.10 - export PATH=${ANT_HOME}/bin:$PATH - export ADEMPIERE_HOME=$GITHUB_WORKSPACE/adempiere/Adempiere - echo $ANT_HOME - echo $PATH - echo $(ant -version) - echo $ADEMPIERE_HOME - ant build - # Create Artifact for Download + # Build ADempiere with ant, if there are changes in XML files + - name: Build Adempiere with database restore... + uses: ./.github/actions/adempiere-build + with: + nodbrestore: false + - name: Upload zip uses: skx/github-action-publish-binaries@master env: @@ -96,6 +76,12 @@ jobs: with: args: 'install/build/*.tar.gz.MD5' - name: Upload Seed (Database) + uses: skx/github-action-publish-binaries@master + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_ACCESS }} + with: + args: 'adempiere/Adempiere/data/Adempiere_pg.dmp' + - name: Upload Compressed Seed (Database) uses: skx/github-action-publish-binaries@master env: GITHUB_TOKEN: ${{ secrets.TOKEN_ACCESS }} diff --git a/base/src/org/compiere/model/GridTab.java b/base/src/org/compiere/model/GridTab.java index 5ea19c13fb..d4fd241757 100644 --- a/base/src/org/compiere/model/GridTab.java +++ b/base/src/org/compiere/model/GridTab.java @@ -2404,7 +2404,7 @@ private int setCurrentRow (int newCurrentRow, boolean fireEvents) * @return current row */ public void setCurrentRow(int row){ - setCurrentRow(row, false); + setCurrentRow(row, true); } diff --git a/tools/build.xml b/tools/build.xml index 796bdcd3d0..b18c3b559a 100644 --- a/tools/build.xml +++ b/tools/build.xml @@ -335,8 +335,7 @@ - - + diff --git a/tools/lib/byte-buddy-1.12.19.jar b/tools/lib/byte-buddy-1.12.19.jar new file mode 100644 index 0000000000..2cd272d3de Binary files /dev/null and b/tools/lib/byte-buddy-1.12.19.jar differ diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/ServerContextCallback.java b/zkwebui/WEB-INF/src/org/adempiere/webui/ServerContextCallback.java index f1e1409000..a4b0dcc7a7 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/ServerContextCallback.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/ServerContextCallback.java @@ -12,42 +12,42 @@ *****************************************************************************/ package org.adempiere.webui; +import org.adempiere.webui.session.ServerContext; + import java.io.Serializable; +import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.util.Properties; -import org.adempiere.webui.session.ServerContext; - -import net.sf.cglib.proxy.InvocationHandler; - /** * Intercaptor for Server context properties that delegate to the threadlocal instance - * @author Low Heng Sin * + * @author Low Heng Sin + * @author Victor Perez Juarez . victor.perez@e-evolution.com e-Evolution + * #4021 [Bug Report] Replace obsolete library cglib.jar not compatible with JDK 11 or > https://github.com/adempiere/adempiere/issues/4021 */ public class ServerContextCallback implements InvocationHandler, Serializable { - /** - * - */ - private static final long serialVersionUID = 6708635918931322152L; + /** + * + */ + private static final long serialVersionUID = 6708635918931322152L; - public synchronized Object invoke(Object proxy, Method method, Object[] args) - throws Throwable { - Properties context = ServerContext.getCurrentInstance(); - //optimize for the 2 most common access - if (method.getName().equals("getProperty")) { - Class[] types = method.getParameterTypes(); - if (types != null && types.length == 1 && types[0] == String.class && - args != null && args.length == 1 && args[0] instanceof String) { - return context.getProperty((String)args[0]); - } - else if (types != null && types.length == 2 && types[0] == String.class && - types[1] == String.class && args != null && args[0] instanceof String && - args[1] instanceof String) - return context.getProperty((String)args[0], (String)args[1]); - } - Method m = context.getClass().getMethod(method.getName(), method.getParameterTypes()); - return m.invoke(context, args); - } + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { + Properties context = ServerContext.getCurrentInstance(); + //optimize for the 2 most common access + if (method.getName().equals("getProperty")) { + Class[] types = method.getParameterTypes(); + if (types != null && types.length == 1 && types[0] == String.class && + args != null && args.length == 1 && args[0] instanceof String) { + return context.getProperty((String) args[0]); + } else if (types != null && types.length == 2 && types[0] == String.class && + types[1] == String.class && args != null && args[0] instanceof String && + args[1] instanceof String) + return context.getProperty((String) args[0], (String) args[1]); + } + Method m = context.getClass().getMethod(method.getName(), method.getParameterTypes()); + return m.invoke(context, args); + } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/ZkContextProvider.java b/zkwebui/WEB-INF/src/org/adempiere/webui/ZkContextProvider.java index f6d586cd00..de21d50dc6 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/ZkContextProvider.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/ZkContextProvider.java @@ -16,23 +16,43 @@ *****************************************************************************/ package org.adempiere.webui; +import net.bytebuddy.implementation.InvocationHandlerAdapter; +import org.adempiere.webui.session.SessionManager; +import org.compiere.util.ContextProvider; + import java.util.Properties; -import net.sf.cglib.proxy.Enhancer; +import static net.bytebuddy.matcher.ElementMatchers.any; + -import org.adempiere.webui.session.SessionManager; -import org.compiere.util.ContextProvider; /** * * @author Low Heng Sin + * @author Victor Perez Juarez . victor.perez@e-evolution.com e-Evolution + * #4021 [Bug Report] Replace obsolete library cglib.jar not compatible with JDK 11 or > https://github.com/adempiere/adempiere/issues/4021 * */ public class ZkContextProvider implements ContextProvider { - private final static ServerContextCallback callback = new ServerContextCallback(); - private final static Properties context = (Properties) Enhancer.create(Properties.class, callback); - + private final static ServerContextCallback callback = new ServerContextCallback(); + + private final static Properties context; + + static { + try { + context = (new net.bytebuddy.ByteBuddy() + .subclass(java.util.Properties.class) + .method(any()) + .intercept(InvocationHandlerAdapter.of(callback)) + .make() + .load(ZkContextProvider.class.getClassLoader()) + .getLoaded()).newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + /** * Get server context proxy */ diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java index d34d592e2c..c627ca4196 100755 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java @@ -58,6 +58,7 @@ * @author e-Evolution , victor.perez@e-evolution.com *
  • Implement embedded or horizontal tab panel https://adempiere.atlassian.net/browse/ADEMPIERE-319 *
  • New ADempiere 3.8.0 ZK Theme Light https://adempiere.atlassian.net/browse/ADEMPIERE-320 + *
  • [Bug Report] Quick Entry not working when the icon is pushed #4023 https://github.com/adempiere/adempiere/issues/4023 * */ public class GridPanel extends Borderlayout implements EventListener @@ -123,7 +124,7 @@ public class GridPanel extends Borderlayout implements EventListener // The following fields require package or protected level of // visibility for testing - Grid listbox = new Grid(); + Grid listbox; GridTabRowRenderer renderer; AbstractADWindowPanel windowPanel; @@ -148,7 +149,16 @@ public GridPanel() public GridPanel(int windowNo) { this.windowNo = windowNo; - + listbox = new Grid(); + + listbox.addEventListener(Events.ON_FOCUS, this); + listbox.setOddRowSclass(null); + south = new South(); + this.appendChild(south); + + center = new Center(); + center.appendChild(listbox); + this.appendChild(center); } /** @@ -157,23 +167,12 @@ public GridPanel(int windowNo) */ public void init(GridTab gridTab) { + if (init && !gridTab.isQuickEntry()) return; + if (pageSize < 0) pageSize = getSysConfigPageSizeOrDefault(100); modeless = getSysConfigModelessOrDefault(false); - - if (init && !gridTab.isQuickEntry()) return; - - listbox.addEventListener(Events.ON_FOCUS, this); - listbox.setOddRowSclass(null); - - south = new South(); - this.appendChild(south); - - center = new Center(); - center.appendChild(listbox); - this.appendChild(center); - - + this.gridTab = gridTab; tableModel = gridTab.getTableModel(); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java index dc6f90ad4e..7544e33efc 100755 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java @@ -12,15 +12,6 @@ *****************************************************************************/ package org.adempiere.webui.component; -import java.sql.Timestamp; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditorPopupMenu; @@ -33,7 +24,7 @@ import org.compiere.model.GridField; import org.compiere.model.GridTab; import org.compiere.util.DisplayType; -import org.compiere.util.Env; +import org.compiere.util.Language; import org.compiere.util.NamePair; import org.spin.util.FieldCondition; import org.spin.util.FieldDefinition; @@ -57,6 +48,15 @@ import org.zkoss.zul.RowRenderer; import org.zkoss.zul.RowRendererExt; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + /** * Row renderer for GridTab grid. * @author hengsin @@ -96,7 +96,12 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt, Renderer private static final String DIVSTYLE = "border: none; width: 100%; height: 100%;"; private GridField[] gridField; - private int totalColumns = -1; + private int totalColumns = -1; + + private final Language language = Language.getLoginLanguage(); + private final DecimalFormat numberFormat = DisplayType.getNumberFormat(DisplayType.Number, language); + private final SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date, language); + /** * * @param gridTab @@ -217,14 +222,13 @@ else if (gridField.isLookup()) else return ""; } - else if (gridTab.getTableModel().getColumnClass(getColumnIndex(gridField)).equals(Timestamp.class)) + else if (DisplayType.isDate(gridField.getDisplayType())) { - SimpleDateFormat dateFormat = DisplayType.getDateFormat(gridField.getDisplayType(), AEnv.getLanguage(Env.getCtx())); return dateFormat.format((Timestamp)value); } else if (DisplayType.isNumeric(gridField.getDisplayType())) { - return DisplayType.getNumberFormat(gridField.getDisplayType(), AEnv.getLanguage(Env.getCtx())).format(value); + return numberFormat.format(value); } else if (DisplayType.Button == gridField.getDisplayType()) { @@ -458,11 +462,10 @@ else if (DisplayType.isNumeric(gridField[i].getDisplayType())) { row.appendChild(div); GridTableListModel model = (GridTableListModel) grid.getModel(); model.setEditing(false); - totalColumns=colIndex; - if (rowIndex == gridTab.getCurrentRow()) { - setCurrentRow(row); - } + } + if (rowIndex == gridTab.getCurrentRow()) { + setCurrentRow(row); } row.addEventListener(Events.ON_OK, rowListener); row.invalidate(); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java index 3c457d8b08..1f0e7f2d33 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java @@ -30,13 +30,14 @@ import java.util.Map; import java.util.Set; -import org.adempiere.webui.apps.AEnv; + import org.adempiere.webui.event.TableValueChangeEvent; import org.adempiere.webui.event.TableValueChangeListener; import org.compiere.minigrid.ColumnInfo; import org.compiere.minigrid.IDColumn; import org.compiere.util.DisplayType; -import org.compiere.util.Env; + +import org.compiere.util.Language; import org.compiere.util.MSort; import org.compiere.util.Util; import org.zkoss.zk.ui.Component; @@ -83,6 +84,9 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi private Map columnAttributesMap = new HashMap(); + private final Language language = Language.getLoginLanguage(); + private final SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date, language); + class ColumnAttributes { protected Object headerValue; @@ -259,8 +263,8 @@ private Listcell getCellComponent(WListbox table, Object field, else if (field instanceof Number) { DecimalFormat format = field instanceof BigDecimal - ? DisplayType.getNumberFormat(DisplayType.Amount, AEnv.getLanguage(Env.getCtx())) - : DisplayType.getNumberFormat(DisplayType.Integer, AEnv.getLanguage(Env.getCtx())); + ? DisplayType.getNumberFormat(DisplayType.Amount, language) + : DisplayType.getNumberFormat(DisplayType.Integer, language); // set cell value to allow sorting listcell.setValue(field.toString()); @@ -283,8 +287,6 @@ else if (field instanceof Number) } else if (field instanceof Timestamp) { - - SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date, AEnv.getLanguage(Env.getCtx())); listcell.setValue(dateFormat.format((Timestamp)field)); if (isCellEditable) {