From c979d175501b51c9951827940ad118bc3194b2e8 Mon Sep 17 00:00:00 2001 From: nmicoud Date: Sat, 14 Dec 2019 14:07:54 +0100 Subject: [PATCH 1/7] IDEMPIERE-4215 : Accounting Fact Reconcilation form : add a Select/DeselectAll and ZoomToDocument buttons --- .../webui/apps/form/WFactReconcile.java | 84 +++++++++++++++++-- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFactReconcile.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFactReconcile.java index 796f9c6e7f..2257011c6f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFactReconcile.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFactReconcile.java @@ -23,6 +23,7 @@ import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Textbox; +import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.WListbox; import org.adempiere.webui.editor.WDateEditor; import org.adempiere.webui.editor.WSearchEditor; @@ -35,10 +36,12 @@ import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.panel.CustomForm; import org.adempiere.webui.panel.IFormController; import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ZKUpdateUtil; import org.compiere.apps.form.FactReconcile; import org.compiere.model.MClient; import org.compiere.model.MColumn; +import org.compiere.model.MFactAcct; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; import org.compiere.model.X_C_ElementValue; @@ -47,8 +50,10 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; +import org.zkoss.zk.ui.WrongValueException; 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.Borderlayout; import org.zkoss.zul.Center; import org.zkoss.zul.North; @@ -112,6 +117,7 @@ implements IFormController, EventListener, WTableModelListener, ValueChan private Button bGenerate = cp.createButton(ConfirmPanel.A_PROCESS); private Button bReset = cp.createButton(ConfirmPanel.A_RESET); private Button bZoom = cp.createButton(ConfirmPanel.A_ZOOM); + private Button bZoomDoc = cp.createButton(ConfirmPanel.A_ZOOM); private Grid commandLayout = GridFactory.newGridLayout(); private Button bRefresh = cp.createButton(ConfirmPanel.A_REFRESH); private Label labelDateAcct = new Label(); @@ -124,6 +130,9 @@ implements IFormController, EventListener, WTableModelListener, ValueChan private boolean loading = false; private Label differenceLabel = new Label(); private Textbox differenceField = new Textbox(); + + private ToolBarButton bSelect = new ToolBarButton("SelectAll"); + private boolean checkAllSelected = true; /** * Static Init @@ -137,12 +146,19 @@ implements IFormController, EventListener, WTableModelListener, ValueChan bRefresh.addActionListener(this); bReset.addActionListener(this); bZoom.addActionListener(this); + bZoomDoc.addActionListener(this); bGenerate.setEnabled(false); bReset.setEnabled(false); //bRefresh.setText(Msg.getMsg(Env.getCtx(), "Query")); bGenerate.setLabel(Msg.getMsg(Env.getCtx(),"Process")); bReset.setLabel(Msg.getMsg(Env.getCtx(),"Reset")); bZoom.setLabel(Msg.translate(Env.getCtx(), "Fact_Acct_ID")); + bZoomDoc.setId(bZoomDoc.getId() + "Doc"); // to avoid 'org.zkoss.zk.ui.UiException: Not unique in the ID space of : Zoom' + bZoomDoc.setLabel(Msg.translate(Env.getCtx(), "ZoomDocument")); + bSelect.setMode("toggle"); + bSelect.setImage(ThemeManager.getThemeResource("images/SelectAll24.png")); + bSelect.setTooltiptext(Msg.getCleanMsg(Env.getCtx(), "SelectAll")); + bSelect.addEventListener(Events.ON_CLICK, this); // labelAcctSchema.setText(Msg.translate(Env.getCtx(), "C_AcctSchema_ID")); @@ -234,9 +250,13 @@ implements IFormController, EventListener, WTableModelListener, ValueChan ZKUpdateUtil.setWidth(commandLayout, "100%"); rows = commandLayout.newRows(); row = rows.newRow(); + row.appendCellChild(bSelect, 1); row.appendCellChild(bZoom, 1); ZKUpdateUtil.setHflex(bZoom, "true"); ZKUpdateUtil.setWidth(bZoom, "100%"); + row.appendCellChild(bZoomDoc, 1); + ZKUpdateUtil.setHflex(bZoomDoc, "true"); + ZKUpdateUtil.setWidth(bZoomDoc, "100%"); row.appendCellChild(differenceLabel.rightAlign()); ZKUpdateUtil.setHflex(differenceLabel, "true"); row.appendCellChild(differenceField, 2); @@ -251,6 +271,8 @@ implements IFormController, EventListener, WTableModelListener, ValueChan { bZoom.setTooltiptext(bZoom.getLabel()); bZoom.setLabel(null); + bZoomDoc.setTooltiptext(bZoomDoc.getLabel()); + bZoomDoc.setLabel(null); bGenerate.setTooltiptext(bGenerate.getLabel()); bGenerate.setLabel(null); bReset.setTooltiptext(bReset.getLabel()); @@ -310,11 +332,14 @@ implements IFormController, EventListener, WTableModelListener, ValueChan + "AND EXISTS (SELECT 1 FROM C_AcctSchema_Element ase " + "WHERE ase.C_Element_ID=C_ElementValue.C_Element_ID AND ase.ElementType='AC' " + "AND ase.C_AcctSchema_ID=@C_AcctSchema_ID@ AND ase.AD_Client_ID=@AD_Client_ID@) "); - fieldAccount = new WTableDirEditor("C_ElementValue_ID", false, false, true, lookupAccount); + fieldAccount = new WTableDirEditor("C_ElementValue_ID", true, false, true, lookupAccount); } public void loadData(){ + if(fieldAccount.isNullOrEmpty()) + throw new WrongValueException(fieldAccount.getComponent(), Msg.getMsg(Env.getCtx(), "FillMandatory")); + if(fieldAcctSchema.getValue()!=null) m_C_AcctSchema_ID = (Integer)fieldAcctSchema.getValue(); else @@ -419,6 +444,27 @@ implements IFormController, EventListener, WTableModelListener, ValueChan public void tableChanged(WTableModelEvent event) { if (! loading ) calculateSelection(); + + if (event.getModel() == miniTable.getModel()) { + + int row = event.getFirstRow(); + int col = event.getColumn(); + + if (row < 0) + return; + + if (checkAllSelected && col == selectedColIndex) { + ListModelTable model = miniTable.getModel(); + boolean rowUnSelected = false; + for (int i = 0; i < model.getRowCount(); i++) { + if ( ! (Boolean) model.getValueAt(i, selectedColIndex) ) { + rowUnSelected = true; + break; + } + } + bSelect.setPressed(! rowUnSelected); + } + } } @Override @@ -431,14 +477,19 @@ implements IFormController, EventListener, WTableModelListener, ValueChan resetReconciliation(); else if (event.getTarget().equals(bZoom)) - zoom(); - + zoom(MFactAcct.Table_ID); + else if (event.getTarget().equals(bZoomDoc)) + zoom(-1); + else if (event.getTarget().equals(bCancel)) SessionManager.getAppDesktop().closeActiveWindow(); else if (event.getTarget().equals(bRefresh)) loadData(); + else if (event.getTarget().equals(bSelect)) + onbSelect(); + } private void generateReconciliation() { @@ -474,6 +525,8 @@ implements IFormController, EventListener, WTableModelListener, ValueChan ((ListModelTable) miniTable.getModel()).remove(r--); } } + + bSelect.setPressed(false); } /** @@ -481,7 +534,7 @@ implements IFormController, EventListener, WTableModelListener, ValueChan * @param AD_Window_ID window id * @param zoomQuery zoom query */ - protected void zoom () + protected void zoom (int tableID) { log.info(""); @@ -493,8 +546,13 @@ implements IFormController, EventListener, WTableModelListener, ValueChan KeyNamePair pp = (KeyNamePair)miniTable.getModel().getValueAt(selected, idColIndex); int factId = pp.getKey(); - - AEnv.zoom(270, factId); + + if (tableID == MFactAcct.Table_ID) + AEnv.zoom(tableID, factId); + else { + MFactAcct fa = new MFactAcct(Env.getCtx(), factId, null); + AEnv.zoom(fa.getAD_Table_ID(), fa.getRecord_ID()); + } } // zoom private void resetReconciliation() { @@ -522,6 +580,8 @@ implements IFormController, EventListener, WTableModelListener, ValueChan ((ListModelTable) miniTable.getModel()).remove(r--); } } + + bSelect.setPressed(false); } @Override @@ -529,5 +589,17 @@ implements IFormController, EventListener, WTableModelListener, ValueChan return form; } + void onbSelect() { + ListModelTable model = miniTable.getModel(); + int rows = model.getSize(); + Boolean selectAll = bSelect.isPressed() ? Boolean.FALSE : Boolean.TRUE; + bSelect.setPressed(! bSelect.isPressed()); + checkAllSelected = false; + for (int i = 0; i < rows; i++) + model.setValueAt(selectAll, i, selectedColIndex); + checkAllSelected = true; + miniTable.setModel(model); + calculateSelection(); + } } From 853315f087b6f7d535ab1638f9519ecef4403739 Mon Sep 17 00:00:00 2001 From: nmicoud Date: Sat, 14 Dec 2019 14:17:46 +0100 Subject: [PATCH 2/7] IDEMPIERE-4133 : Resetting fact reconciliation should delete record from Fact_Reconciliation table --- org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java b/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java index 65064527df..16d96f3dd2 100644 --- a/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java +++ b/org.adempiere.ui/src/org/compiere/apps/form/FactReconcile.java @@ -250,8 +250,7 @@ public class FactReconcile { return false; } - rec.setMatchCode(null); - return rec.save(); + return rec.delete(false); } protected Vector getAccount(){ From ca714c37744d1bce325ff4c718275bb5bdbb1330 Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Thu, 21 Nov 2019 22:32:14 +0100 Subject: [PATCH 3/7] IDEMPIERE-2836 SQL Searches for advanced users --- .../oracle/201911211857_IDEMPIERE-2836.sql | 28 ++ .../201911211857_IDEMPIERE-2836.sql | 25 ++ .../adempiere/webui/window/FindWindow.java | 349 ++++++++++-------- 3 files changed, 241 insertions(+), 161 deletions(-) create mode 100644 migration/i7.1/oracle/201911211857_IDEMPIERE-2836.sql create mode 100644 migration/i7.1/postgresql/201911211857_IDEMPIERE-2836.sql diff --git a/migration/i7.1/oracle/201911211857_IDEMPIERE-2836.sql b/migration/i7.1/oracle/201911211857_IDEMPIERE-2836.sql new file mode 100644 index 0000000000..7d2b4f26c2 --- /dev/null +++ b/migration/i7.1/oracle/201911211857_IDEMPIERE-2836.sql @@ -0,0 +1,28 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2836 SQL Searches for advanced users +-- Nov 21, 2019, 10:28:50 PM CET +UPDATE AD_Field SET Help='The Validation Code displays the date, time and message of the error. + +You can add advanced SQL queries to your searches by filling this field with @SQL=[WHERE CLAUSE]. +Do not include the WHERE statement and use Fully qualified SQL statements. F.e: + +@SQL=C_Order.isActive=''Y'' AND SalesRep_ID=@AD_User_ID@ + +will filter orders by active and where the sales representative is the current user.', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-11-21 22:28:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12249 +; + +-- Nov 21, 2019, 6:54:31 PM CET +UPDATE AD_Field SET Help='The Validation Code displays the date, time and message of the error. + +You can add advanced SQL queries to your searches by filling this field with @SQL=[WHERE CLAUSE]. +Do not include the WHERE statement and use Fully qualified SQL statements. F.e: + +@SQL=C_Order.isActive=''Y'' AND SalesRep_ID=@AD_User_ID@ + +will filter orders by active and where the sales representative is the current user.', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-11-21 18:54:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206305 +; + +SELECT register_migration_script('201911211857_IDEMPIERE-2836.sql') FROM dual +; diff --git a/migration/i7.1/postgresql/201911211857_IDEMPIERE-2836.sql b/migration/i7.1/postgresql/201911211857_IDEMPIERE-2836.sql new file mode 100644 index 0000000000..c3fc87b3da --- /dev/null +++ b/migration/i7.1/postgresql/201911211857_IDEMPIERE-2836.sql @@ -0,0 +1,25 @@ +-- IDEMPIERE-2836 SQL Searches for advanced users +-- Nov 21, 2019, 10:28:50 PM CET +UPDATE AD_Field SET Help='The Validation Code displays the date, time and message of the error. + +You can add advanced SQL queries to your searches by filling this field with @SQL=[WHERE CLAUSE]. +Do not include the WHERE statement and use Fully qualified SQL statements. F.e: + +@SQL=C_Order.isActive=''Y'' AND SalesRep_ID=@AD_User_ID@ + +will filter orders by active and where the sales representative is the current user.', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-11-21 22:28:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12249 +; + +-- Nov 21, 2019, 6:54:31 PM CET +UPDATE AD_Field SET Help='The Validation Code displays the date, time and message of the error. + +You can add advanced SQL queries to your searches by filling this field with @SQL=[WHERE CLAUSE]. +Do not include the WHERE statement and use Fully qualified SQL statements. F.e: + +@SQL=C_Order.isActive=''Y'' AND SalesRep_ID=@AD_User_ID@ + +will filter orders by active and where the sales representative is the current user.', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-11-21 18:54:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206305 +; + +SELECT register_migration_script('201911211857_IDEMPIERE-2836.sql') FROM dual +; 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 446505fdd2..ddf269e5f8 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 @@ -242,6 +242,10 @@ public class FindWindow extends Window implements EventListener, ValueCha /** START DEVCOFFEE **/ private StatusBarPanel statusBar = new StatusBarPanel(); /** END DEVCOFFEE **/ + + /** IDEMPIERE-2836 User Query Where */ + private String m_whereUserQuery; + private ToolBar advancedPanelToolBar; /** * FindPanel Constructor @@ -469,10 +473,10 @@ public class FindWindow extends Window implements EventListener, ValueCha pnlButtonRight.appendChild(btnCancel); pnlButtonRight.setStyle("text-align: right"); - ToolBar toolBar = new ToolBar(); - toolBar.appendChild(btnNew); - toolBar.appendChild(btnDelete); - ZKUpdateUtil.setWidth(toolBar, "100%"); + advancedPanelToolBar = new ToolBar(); + advancedPanelToolBar.appendChild(btnNew); + advancedPanelToolBar.appendChild(btnDelete); + ZKUpdateUtil.setWidth(advancedPanelToolBar, "100%"); fQueryName.addEventListener(Events.ON_SELECT, this); @@ -541,9 +545,9 @@ public class FindWindow extends Window implements EventListener, ValueCha North north =new North(); layout.appendChild(north); - north.appendChild(toolBar); + north.appendChild(advancedPanelToolBar); - ZKUpdateUtil.setVflex(toolBar, "0"); + ZKUpdateUtil.setVflex(advancedPanelToolBar, "0"); Center center = new Center(); layout.appendChild(center); @@ -1313,6 +1317,8 @@ public class FindWindow extends Window implements EventListener, ValueCha } else if (event.getTarget() == fQueryName) { + m_whereUserQuery = null; + showAdvanced(); btnSave.setDisabled(false); btnShare.setDisabled(false); int index = fQueryName.getSelectedIndex(); @@ -1483,31 +1489,37 @@ public class FindWindow extends Window implements EventListener, ValueCha private void parseUserQuery(MUserQuery userQuery) { String code = userQuery.getCode(); - String[] segments = code.split(Pattern.quote(SEGMENT_SEPARATOR)); + if (code.startsWith("@SQL=")) { + m_whereUserQuery = "(" + code.substring(code.indexOf("=")+1, code.length()) + ")"; + log.log(Level.INFO, m_whereUserQuery); + hideAdvanced(); + } else { + String[] segments = code.split(Pattern.quote(SEGMENT_SEPARATOR)); - List rowList = advancedPanel.getChildren(); - for (int rowIndex = rowList.size() - 1; rowIndex >= 1; rowIndex--) - rowList.remove(rowIndex); + List rowList = advancedPanel.getChildren(); + for (int rowIndex = rowList.size() - 1; rowIndex >= 1; rowIndex--) + rowList.remove(rowIndex); - for (int i = 0; i < segments.length; i++) - { - String[] fields = segments[i].split(Pattern.quote(FIELD_SEPARATOR)); + for (int i = 0; i < segments.length; i++) + { + String[] fields = segments[i].split(Pattern.quote(FIELD_SEPARATOR)); - createFields(fields, i); - } - - String[] historysegments = code.split(Pattern.quote(HISTORY_SEPARATOR)); - - String history = historysegments.length > INDEX_HISTORY? historysegments[INDEX_HISTORY] : ""; - if(history.length() > 0) - { - historyCombo.setAttribute("history", history); - //historyCombo.setSelectedItem(new Comboitem(history)); - //historyCombo.setSelectedItem(new Comboitem(history, history)); - historyCombo.setSelectedIndex(getHistoryIndex(history)+1); + createFields(fields, i); + } + + String[] historysegments = code.split(Pattern.quote(HISTORY_SEPARATOR)); + + String history = historysegments.length > INDEX_HISTORY? historysegments[INDEX_HISTORY] : ""; + if(history.length() > 0) + { + historyCombo.setAttribute("history", history); + //historyCombo.setSelectedItem(new Comboitem(history)); + //historyCombo.setSelectedItem(new Comboitem(history, history)); + historyCombo.setSelectedIndex(getHistoryIndex(history)+1); + } } - advancedPanel.invalidate(); + winAdvanced.invalidate(); } private int getHistoryIndex(String value) @@ -1613,146 +1625,151 @@ public class FindWindow extends Window implements EventListener, ValueCha // m_query = new MQuery(m_tableName); m_query.addRestriction(Env.parseContext(Env.getCtx(), m_targetWindowNo, m_whereExtended, false)); - StringBuilder code = new StringBuilder(); - int openBrackets = 0; + if (m_whereUserQuery == null) { + StringBuilder code = new StringBuilder(); + + int openBrackets = 0; - List rowList = advancedPanel.getChildren(); + List rowList = advancedPanel.getChildren(); - for (int rowIndex = 1; rowIndex < rowList.size() ; rowIndex++) - { - // Column - ListItem row = (ListItem)rowList.get(rowIndex); - Listbox column = (Listbox)row.getFellow("listColumn"+row.getId()); - if (column == null) - continue; - String ColumnName = column.getSelectedItem().getValue().toString(); - String infoName = column.toString(); - // - GridField field = getTargetMField(ColumnName); - if (field == null || field.isVirtualUIColumn()) - continue; - boolean isProductCategoryField = isProductCategoryField(field.getColumnName()); - String ColumnSQL = field.getSearchColumnSQL(); - // Left brackets - Listbox listLeftBracket = (Listbox)row.getFellow("listLeftBracket"+row.getId()); - String lBrackets = listLeftBracket.getSelectedItem().getValue().toString(); - if ( lBrackets != null ) - openBrackets += lBrackets.length(); - else lBrackets = ""; - // Right brackets - Listbox listRightBracket = (Listbox)row.getFellow("listRightBracket"+row.getId()); - String rBrackets = listRightBracket.getSelectedItem().getValue().toString(); - if ( rBrackets != null ) - openBrackets -= rBrackets.length(); - else rBrackets = ""; - // And Or - Listbox listAndOr = (Listbox)row.getFellow("listAndOr"+row.getId()); - String andOr = listAndOr.getSelectedItem().getValue().toString(); - boolean and = true; - if ( rowIndex > 1 ) { - and = !"OR".equals(andOr); - } - // Op - Listbox op = (Listbox)row.getFellow("listOperator"+row.getId()); - if (op == null) - continue; - String Operator = op.getSelectedItem().getValue().toString(); + for (int rowIndex = 1; rowIndex < rowList.size() ; rowIndex++) + { + // Column + ListItem row = (ListItem)rowList.get(rowIndex); + Listbox column = (Listbox)row.getFellow("listColumn"+row.getId()); + if (column == null) + continue; + String ColumnName = column.getSelectedItem().getValue().toString(); + String infoName = column.toString(); + // + GridField field = getTargetMField(ColumnName); + if (field == null || field.isVirtualUIColumn()) + continue; + boolean isProductCategoryField = isProductCategoryField(field.getColumnName()); + String ColumnSQL = field.getSearchColumnSQL(); + // Left brackets + Listbox listLeftBracket = (Listbox)row.getFellow("listLeftBracket"+row.getId()); + String lBrackets = listLeftBracket.getSelectedItem().getValue().toString(); + if ( lBrackets != null ) + openBrackets += lBrackets.length(); + else lBrackets = ""; + // Right brackets + Listbox listRightBracket = (Listbox)row.getFellow("listRightBracket"+row.getId()); + String rBrackets = listRightBracket.getSelectedItem().getValue().toString(); + if ( rBrackets != null ) + openBrackets -= rBrackets.length(); + else rBrackets = ""; + // And Or + Listbox listAndOr = (Listbox)row.getFellow("listAndOr"+row.getId()); + String andOr = listAndOr.getSelectedItem().getValue().toString(); + boolean and = true; + if ( rowIndex > 1 ) { + and = !"OR".equals(andOr); + } + // Op + Listbox op = (Listbox)row.getFellow("listOperator"+row.getId()); + if (op == null) + continue; + String Operator = op.getSelectedItem().getValue().toString(); - // Value ****** - ListCell cellQueryFrom = (ListCell)row.getFellow("cellQueryFrom"+row.getId()); - Object value = null; - - //Allowing Date validation before save - Component compo = cellQueryFrom.getFirstChild(); - if(compo instanceof Datebox) { - Datebox dbox = (Datebox)compo; - if(dbox.getValue() != null) - value = new Timestamp(((Date)dbox.getValue()).getTime()); - } - else if(compo instanceof DatetimeBox) { - DatetimeBox dtbox = (DatetimeBox)compo; - if(dtbox.getValue() != null) - value = new Timestamp(((Date)dtbox.getValue()).getTime()); - } - else { - value = cellQueryFrom.getAttribute("value"); - } - - if (value == null) - { - if(Operator.equals(MQuery.NULL) || Operator.equals(MQuery.NOT_NULL)) - { - m_query.addRestriction(ColumnSQL, Operator, null, - infoName, null, and, openBrackets); - appendCode(code, ColumnName, Operator, "", "", andOr, lBrackets, rBrackets); - } - continue; - } - Object parsedValue = parseValue(field, value); - if (parsedValue == null) - continue; - String infoDisplay = value.toString(); - if (field.isLookup()) - infoDisplay = field.getLookup().getDisplay(value); - else if (field.getDisplayType() == DisplayType.YesNo) - infoDisplay = Msg.getMsg(Env.getCtx(), infoDisplay); - // Value2 ****** - Object value2 = null; - if (MQuery.OPERATORS[MQuery.BETWEEN_INDEX].getValue().equals(Operator)) - { - ListCell cellQueryTo = (ListCell)row.getFellow("cellQueryTo"+row.getId()); - - //Allowing Date validation before save - compo = cellQueryTo.getFirstChild(); - if(compo instanceof Datebox) { - Datebox dbox = (Datebox)compo; - if(dbox.getValue() != null) - value2 = new Timestamp(((Date)dbox.getValue()).getTime()); - } - else if(compo instanceof DatetimeBox) { - DatetimeBox dtbox = (DatetimeBox)compo; - if(dtbox.getValue() != null) - value2 = new Timestamp(((Date)dtbox.getValue()).getTime()); - } - else { - value2 = cellQueryFrom.getAttribute("value"); - } - - - value2 = cellQueryTo.getAttribute("value"); - if (value2 == null) - continue; - Object parsedValue2 = parseValue(field, value2); - String infoDisplay_to = value2.toString(); - if (parsedValue2 == null) - continue; - m_query.addRangeRestriction(ColumnSQL, parsedValue, parsedValue2, - infoName, infoDisplay, infoDisplay_to, and, openBrackets); - } - else if (isProductCategoryField && MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator)) { - if (!(parsedValue instanceof Integer)) { - continue; - } - m_query.addRestriction(getSubCategoryWhereClause(field, ((Integer) parsedValue).intValue()), and, openBrackets); - } - else if ((field.getDisplayType()==DisplayType.ChosenMultipleSelectionList||field.getDisplayType()==DisplayType.ChosenMultipleSelectionSearch||field.getDisplayType()==DisplayType.ChosenMultipleSelectionTable) && - (MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator) || MQuery.OPERATORS[MQuery.NOT_EQUAL_INDEX].getValue().equals(Operator))) - { - String clause = DB.intersectClauseForCSV(ColumnSQL, parsedValue.toString()); - if (MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator)) - m_query.addRestriction(clause, and, openBrackets); - else - m_query.addRestriction("NOT (" + clause + ")", and, openBrackets); - } - else - m_query.addRestriction(ColumnSQL, Operator, parsedValue, - infoName, infoDisplay, and, openBrackets); + // Value ****** + ListCell cellQueryFrom = (ListCell)row.getFellow("cellQueryFrom"+row.getId()); + Object value = null; + + //Allowing Date validation before save + Component compo = cellQueryFrom.getFirstChild(); + if(compo instanceof Datebox) { + Datebox dbox = (Datebox)compo; + if(dbox.getValue() != null) + value = new Timestamp(((Date)dbox.getValue()).getTime()); + } + else if(compo instanceof DatetimeBox) { + DatetimeBox dtbox = (DatetimeBox)compo; + if(dtbox.getValue() != null) + value = new Timestamp(((Date)dtbox.getValue()).getTime()); + } + else { + value = cellQueryFrom.getAttribute("value"); + } + + if (value == null) + { + if(Operator.equals(MQuery.NULL) || Operator.equals(MQuery.NOT_NULL)) + { + m_query.addRestriction(ColumnSQL, Operator, null, + infoName, null, and, openBrackets); + appendCode(code, ColumnName, Operator, "", "", andOr, lBrackets, rBrackets); + } + continue; + } + Object parsedValue = parseValue(field, value); + if (parsedValue == null) + continue; + String infoDisplay = value.toString(); + if (field.isLookup()) + infoDisplay = field.getLookup().getDisplay(value); + else if (field.getDisplayType() == DisplayType.YesNo) + infoDisplay = Msg.getMsg(Env.getCtx(), infoDisplay); + // Value2 ****** + Object value2 = null; + if (MQuery.OPERATORS[MQuery.BETWEEN_INDEX].getValue().equals(Operator)) + { + ListCell cellQueryTo = (ListCell)row.getFellow("cellQueryTo"+row.getId()); + + //Allowing Date validation before save + compo = cellQueryTo.getFirstChild(); + if(compo instanceof Datebox) { + Datebox dbox = (Datebox)compo; + if(dbox.getValue() != null) + value2 = new Timestamp(((Date)dbox.getValue()).getTime()); + } + else if(compo instanceof DatetimeBox) { + DatetimeBox dtbox = (DatetimeBox)compo; + if(dtbox.getValue() != null) + value2 = new Timestamp(((Date)dtbox.getValue()).getTime()); + } + else { + value2 = cellQueryFrom.getAttribute("value"); + } + + + value2 = cellQueryTo.getAttribute("value"); + if (value2 == null) + continue; + Object parsedValue2 = parseValue(field, value2); + String infoDisplay_to = value2.toString(); + if (parsedValue2 == null) + continue; + m_query.addRangeRestriction(ColumnSQL, parsedValue, parsedValue2, + infoName, infoDisplay, infoDisplay_to, and, openBrackets); + } + else if (isProductCategoryField && MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator)) { + if (!(parsedValue instanceof Integer)) { + continue; + } + m_query.addRestriction(getSubCategoryWhereClause(field, ((Integer) parsedValue).intValue()), and, openBrackets); + } + else if ((field.getDisplayType()==DisplayType.ChosenMultipleSelectionList||field.getDisplayType()==DisplayType.ChosenMultipleSelectionSearch||field.getDisplayType()==DisplayType.ChosenMultipleSelectionTable) && + (MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator) || MQuery.OPERATORS[MQuery.NOT_EQUAL_INDEX].getValue().equals(Operator))) + { + String clause = DB.intersectClauseForCSV(ColumnSQL, parsedValue.toString()); + if (MQuery.OPERATORS[MQuery.EQUAL_INDEX].getValue().equals(Operator)) + m_query.addRestriction(clause, and, openBrackets); + else + m_query.addRestriction("NOT (" + clause + ")", and, openBrackets); + } + else + m_query.addRestriction(ColumnSQL, Operator, parsedValue, + infoName, infoDisplay, and, openBrackets); - appendCode(code, ColumnName, Operator, value.toString(), value2 != null ? value2.toString() : "", andOr, lBrackets, rBrackets); - } - - saveQuery(saveQuery, code, shareAllUsers); + appendCode(code, ColumnName, Operator, value.toString(), value2 != null ? value2.toString() : "", andOr, lBrackets, rBrackets); + } + + saveQuery(saveQuery, code, shareAllUsers); + } else { + m_query.addRestriction(Env.parseContext(Env.getCtx(), m_targetWindowNo, m_whereUserQuery, false)); + } } // cmd_saveAdvanced @@ -2708,5 +2725,15 @@ public class FindWindow extends Window implements EventListener, ValueCha statusBar.setStatusDB(text.toString()); } // setDtatusDB /** END DEVCOFFEE **/ + + private void hideAdvanced() { + advancedPanelToolBar.setVisible(false); + advancedPanel.setVisible(false); + } + + private void showAdvanced() { + advancedPanelToolBar.setVisible(true); + advancedPanel.setVisible(true); + } } // FindPanel From dbed99a875762fd784382516ee3c6455c33d76d4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 18 Dec 2019 16:35:54 +0100 Subject: [PATCH 4/7] IDEMPIERE-2836 SQL Searches for advanced users / peer review - fix oracle script --- migration/i7.1/oracle/201911211857_IDEMPIERE-2836.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/i7.1/oracle/201911211857_IDEMPIERE-2836.sql b/migration/i7.1/oracle/201911211857_IDEMPIERE-2836.sql index 7d2b4f26c2..f4e519265c 100644 --- a/migration/i7.1/oracle/201911211857_IDEMPIERE-2836.sql +++ b/migration/i7.1/oracle/201911211857_IDEMPIERE-2836.sql @@ -8,7 +8,7 @@ UPDATE AD_Field SET Help='The Validation Code displays the date, time and messag You can add advanced SQL queries to your searches by filling this field with @SQL=[WHERE CLAUSE]. Do not include the WHERE statement and use Fully qualified SQL statements. F.e: -@SQL=C_Order.isActive=''Y'' AND SalesRep_ID=@AD_User_ID@ +'||chr(64)||'SQL=C_Order.isActive=''Y'' AND SalesRep_ID=@AD_User_ID@ will filter orders by active and where the sales representative is the current user.', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-11-21 22:28:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12249 ; @@ -19,7 +19,7 @@ UPDATE AD_Field SET Help='The Validation Code displays the date, time and messag You can add advanced SQL queries to your searches by filling this field with @SQL=[WHERE CLAUSE]. Do not include the WHERE statement and use Fully qualified SQL statements. F.e: -@SQL=C_Order.isActive=''Y'' AND SalesRep_ID=@AD_User_ID@ +'||chr(64)||'SQL=C_Order.isActive=''Y'' AND SalesRep_ID=@AD_User_ID@ will filter orders by active and where the sales representative is the current user.', IsCentrallyMaintained='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-11-21 18:54:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206305 ; From 81b5ccbc9ac819fcd635d492e590e8e52180d318 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 18 Dec 2019 22:07:56 +0100 Subject: [PATCH 5/7] IDEMPIERE-3416 Implement the ability to track open DB connections Implement Trx Display Name for forgotten class GridTabCSVImporter --- .../src/org/adempiere/impexp/GridTabCSVImporter.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index a45eed26f5..17c12b20fe 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -37,7 +37,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; -import java.util.UUID; import java.util.logging.Level; import org.adempiere.base.IGridTabImporter; @@ -242,6 +241,7 @@ public class GridTabCSVImporter implements IGridTabImporter manageMasterTrx(gridTab, null); createTrx(gridTab); } + trx.setDisplayName(GridTabCSVImporter.class.getName()+"_fileImport_" + gridTab.getTableName()); String recordResult = processRecord(importMode, gridTab, indxDetail, isDetail, idx, rowResult, childs); rowResult.append(recordResult); @@ -594,8 +594,7 @@ public class GridTabCSVImporter implements IGridTabImporter * @param gridTab */ private void createTrx(GridTab gridTab){ - - trxName = getTrxName(gridTab.getTableName()); + trxName = Trx.createTrxName("CSVImport"); gridTab.getTableModel().setImportingMode(true,trxName); trx = Trx.get(trxName,true); masterRecord = null; @@ -777,10 +776,6 @@ public class GridTabCSVImporter implements IGridTabImporter }//processRecord - private String getTrxName(String gritTabName){ - return "Import_" + gritTabName + "_" + UUID.randomUUID(); - } - private void throwAdempiereException(String msg){ throw new AdempiereException(msg); } From 0ae68806f64bc442122593901c0b0e7963ccb50f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 18 Dec 2019 22:29:33 +0100 Subject: [PATCH 6/7] IDEMPIERE-3971 Process Customization - decrease log level --- .../src/org/adempiere/webui/apps/ProcessParameterPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java index c767141464..27f7ec2123 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java @@ -251,7 +251,7 @@ public class ProcessParameterPanel extends Panel implements for (int i = 0; i < listVO.size(); i++) { createField(listVO.get(i), rows); - log.severe(listVO.get(i).ColumnName + listVO.get(i).SeqNo); + if (log.isLoggable(Level.INFO)) log.info(listVO.get(i).ColumnName + listVO.get(i).SeqNo); } } catch (SQLException e) { From 3041228c45ca83c5c37277d3233c1ef0995bccbf Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 18 Dec 2019 23:07:01 +0100 Subject: [PATCH 7/7] IDEMPIERE-4130 MaxQueryRecords by Tab (FHCA-1115) --- db/ddlutils/oracle/views/AD_TAB_V.sql | 5 +- db/ddlutils/oracle/views/AD_TAB_VT.sql | 5 +- db/ddlutils/postgresql/views/AD_TAB_V.sql | 5 +- db/ddlutils/postgresql/views/AD_TAB_VT.sql | 5 +- .../oracle/201912182232_IDEMPIERE-4130.sql | 122 ++++++++++++++++++ .../201912182232_IDEMPIERE-4130.sql | 119 +++++++++++++++++ .../src/org/compiere/model/GridTab.java | 42 +++++- .../src/org/compiere/model/GridTabVO.java | 7 +- .../src/org/compiere/model/I_AD_Tab.java | 13 ++ .../src/org/compiere/model/X_AD_Tab.java | 22 +++- .../adwindow/AbstractADWindowContent.java | 6 +- .../webui/panel/action/CSVImportAction.java | 5 +- .../adempiere/webui/window/FindWindow.java | 21 +-- 13 files changed, 350 insertions(+), 27 deletions(-) create mode 100644 migration/i7.1/oracle/201912182232_IDEMPIERE-4130.sql create mode 100644 migration/i7.1/postgresql/201912182232_IDEMPIERE-4130.sql diff --git a/db/ddlutils/oracle/views/AD_TAB_V.sql b/db/ddlutils/oracle/views/AD_TAB_V.sql index fae4a4ae4e..1f023c8c2b 100644 --- a/db/ddlutils/oracle/views/AD_TAB_V.sql +++ b/db/ddlutils/oracle/views/AD_TAB_V.sql @@ -6,7 +6,8 @@ CREATE OR REPLACE VIEW AD_TAB_V AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, - INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON) + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) AS SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, @@ -16,7 +17,7 @@ SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, - t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords FROM AD_Tab t INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) WHERE t.IsActive='Y' diff --git a/db/ddlutils/oracle/views/AD_TAB_VT.sql b/db/ddlutils/oracle/views/AD_TAB_VT.sql index bd05795bb3..0d9163e692 100644 --- a/db/ddlutils/oracle/views/AD_TAB_VT.sql +++ b/db/ddlutils/oracle/views/AD_TAB_VT.sql @@ -6,7 +6,8 @@ CREATE OR REPLACE VIEW AD_TAB_VT ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, - INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON) + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) AS SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description, trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, @@ -16,7 +17,7 @@ SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, tr t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, - t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords FROM AD_Tab t INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID) diff --git a/db/ddlutils/postgresql/views/AD_TAB_V.sql b/db/ddlutils/postgresql/views/AD_TAB_V.sql index bc691b9291..142593968d 100644 --- a/db/ddlutils/postgresql/views/AD_TAB_V.sql +++ b/db/ddlutils/postgresql/views/AD_TAB_V.sql @@ -6,7 +6,8 @@ CREATE OR REPLACE VIEW AD_TAB_V AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, - INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON) + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) AS SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, @@ -16,7 +17,7 @@ SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, - t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords FROM AD_Tab t INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) WHERE t.IsActive='Y' diff --git a/db/ddlutils/postgresql/views/AD_TAB_VT.sql b/db/ddlutils/postgresql/views/AD_TAB_VT.sql index bd05795bb3..0d9163e692 100644 --- a/db/ddlutils/postgresql/views/AD_TAB_VT.sql +++ b/db/ddlutils/postgresql/views/AD_TAB_VT.sql @@ -6,7 +6,8 @@ CREATE OR REPLACE VIEW AD_TAB_VT ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, - INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON) + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) AS SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description, trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, @@ -16,7 +17,7 @@ SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, tr t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, - t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords FROM AD_Tab t INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID) diff --git a/migration/i7.1/oracle/201912182232_IDEMPIERE-4130.sql b/migration/i7.1/oracle/201912182232_IDEMPIERE-4130.sql new file mode 100644 index 0000000000..a22e7e3e42 --- /dev/null +++ b/migration/i7.1/oracle/201912182232_IDEMPIERE-4130.sql @@ -0,0 +1,122 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-4130 MaxQueryRecords by Tab (FHCA-1115) +-- Dec 18, 2019, 10:20:27 PM CET +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,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214163,0,'Max Query Records','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.',106,'MaxQueryRecords','0',10,'N','N','N','N','N',0,'N',11,0,0,'Y',TO_DATE('2019-12-18 22:20:26','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-12-18 22:20:26','YYYY-MM-DD HH24:MI:SS'),100,2854,'Y','N','D','N','N','N','Y','33a4790c-3b91-474d-9c36-0cc85af4b700','Y',0,'N','N','N','N') +; + +-- Dec 18, 2019, 10:20:44 PM CET +ALTER TABLE AD_Tab ADD MaxQueryRecords NUMBER(10) DEFAULT 0 +; + +-- Dec 18, 2019, 10:21:56 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,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 (206373,'Max Query Records','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.',106,214163,'Y',10,350,'N','N','N','N',0,0,'Y',TO_DATE('2019-12-18 22:21:56','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-12-18 22:21:56','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','27fb6d6a-0562-4de7-a9a8-7772daca44a0','Y',330,2) +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206373 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11265 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=929 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11998 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=271 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11266 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1548 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1550 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1549 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4956 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201811 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5131 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3205 +; + +CREATE OR REPLACE VIEW AD_TAB_V +(AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, DESCRIPTION, + HELP, SEQNO, ISSINGLEROW, HASTREE, ISINFOTAB, + REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, ISDELETEABLE, + ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, ISREADONLY, + AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, + READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, + ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) +AS +SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, + t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + +CREATE OR REPLACE VIEW AD_TAB_VT +(AD_LANGUAGE, AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, + DESCRIPTION, HELP, SEQNO, ISSINGLEROW, HASTREE, + ISINFOTAB, REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, + ISDELETEABLE, ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, + ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, + COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, + ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) +AS +SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description, + trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) + INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + +SELECT register_migration_script('201912182232_IDEMPIERE-4130.sql') FROM dual +; + diff --git a/migration/i7.1/postgresql/201912182232_IDEMPIERE-4130.sql b/migration/i7.1/postgresql/201912182232_IDEMPIERE-4130.sql new file mode 100644 index 0000000000..83b0f45646 --- /dev/null +++ b/migration/i7.1/postgresql/201912182232_IDEMPIERE-4130.sql @@ -0,0 +1,119 @@ +-- IDEMPIERE-4130 MaxQueryRecords by Tab (FHCA-1115) +-- Dec 18, 2019, 10:20:27 PM CET +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,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214163,0,'Max Query Records','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.',106,'MaxQueryRecords','0',10,'N','N','N','N','N',0,'N',11,0,0,'Y',TO_TIMESTAMP('2019-12-18 22:20:26','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-12-18 22:20:26','YYYY-MM-DD HH24:MI:SS'),100,2854,'Y','N','D','N','N','N','Y','33a4790c-3b91-474d-9c36-0cc85af4b700','Y',0,'N','N','N','N') +; + +-- Dec 18, 2019, 10:20:44 PM CET +ALTER TABLE AD_Tab ADD COLUMN MaxQueryRecords NUMERIC(10) DEFAULT '0' +; + +-- Dec 18, 2019, 10:21:56 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,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 (206373,'Max Query Records','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.',106,214163,'Y',10,350,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-12-18 22:21:56','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-12-18 22:21:56','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','27fb6d6a-0562-4de7-a9a8-7772daca44a0','Y',330,2) +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206373 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11265 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=929 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11998 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=271 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11266 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1548 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1550 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1549 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=4956 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201811 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5131 +; + +-- Dec 18, 2019, 10:23:00 PM CET +UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-12-18 22:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3205 +; + +CREATE OR REPLACE VIEW AD_TAB_V +(AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, DESCRIPTION, + HELP, SEQNO, ISSINGLEROW, HASTREE, ISINFOTAB, + REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, ISDELETEABLE, + ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, ISREADONLY, + AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, + READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, + ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) +AS +SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, + t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + +CREATE OR REPLACE VIEW AD_TAB_VT +(AD_LANGUAGE, AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, + DESCRIPTION, HELP, SEQNO, ISSINGLEROW, HASTREE, + ISINFOTAB, REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, + ISDELETEABLE, ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, + ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, + COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, + ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, + INCLUDED_TAB_ID, PARENT_COLUMN_ID, AD_Tab_UU, AD_Table_UU, TREEDISPLAYEDON, + MAXQUERYRECORDS) +AS +SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description, + trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID, t.Parent_Column_ID, + t.AD_Tab_UU, tbl.AD_Table_UU, t.TreeDisplayedOn, t.MaxQueryRecords +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) + INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + +SELECT register_migration_script('201912182232_IDEMPIERE-4130.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index cb5df676a3..507b26de23 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -112,7 +112,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable /** * */ - private static final long serialVersionUID = -3115353522698098211L; + private static final long serialVersionUID = 5057703093968124177L; public static final String DEFAULT_STATUS_MESSAGE = "NavigateOrUpdate"; @@ -3392,4 +3392,44 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable public void setCalloutUI(ICalloutUI calloutUI) { this.calloutUI = calloutUI; } + + /** Get Max Query Records. + * @return If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords() { + // minimum between AD_Tab.MaxQueryRecords and AD_Role.MaxQueryRecords + int roleMaxQueryRecords = MRole.getDefault().getMaxQueryRecords(); + int tabMaxQueryRecords = m_vo.MaxQueryRecords; + if (roleMaxQueryRecords > 0 && roleMaxQueryRecords < tabMaxQueryRecords) + tabMaxQueryRecords = roleMaxQueryRecords; + return tabMaxQueryRecords; + } + + /** + * Require Query + * @param noRecords records + * @return true if query required + */ + public boolean isQueryRequire (int noRecords) + { + if (noRecords < 2) + return false; + int max = getMaxQueryRecords(); + if (max > 0 && noRecords > max) + return true; + int qu = MRole.getDefault().getConfirmQueryRecords(); + return (noRecords > qu); + } // isQueryRequire + + /** + * Over max Query + * @param noRecords records + * @return true if over max query + */ + public boolean isQueryMax (int noRecords) + { + int max = getMaxQueryRecords(); + return max > 0 && noRecords > max; + } // isQueryMax + } // GridTab diff --git a/org.adempiere.base/src/org/compiere/model/GridTabVO.java b/org.adempiere.base/src/org/compiere/model/GridTabVO.java index fae6f358d1..e2e354f020 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 = -1353087123788176368L; + private static final long serialVersionUID = 9091214632840854495L; /************************************************************************** * Create MTab VO @@ -206,6 +206,8 @@ public class GridTabVO implements Evaluatee, Serializable vo.TreeDisplayedOn = rs.getString("TreeDisplayedOn"); + vo.MaxQueryRecords = rs.getInt("MaxQueryRecords"); + vo.AD_Table_ID = rs.getInt("AD_Table_ID"); vo.TableName = rs.getString("TableName"); if (rs.getString("IsView").equals("Y")) @@ -436,6 +438,8 @@ public class GridTabVO implements Evaluatee, Serializable public boolean HasTree = false; /** Tree displayed on */ public String TreeDisplayedOn = ""; + /** Max Query Records */ + public int MaxQueryRecords = 0; /** Table */ public int AD_Table_ID; /** Table UUID */ @@ -553,6 +557,7 @@ public class GridTabVO implements Evaluatee, Serializable clone.IsInsertRecord = IsInsertRecord; clone.HasTree = HasTree; clone.TreeDisplayedOn = TreeDisplayedOn; + clone.MaxQueryRecords = MaxQueryRecords; clone.AD_Table_ID = AD_Table_ID; clone.AD_Column_ID = AD_Column_ID; clone.Parent_Column_ID = Parent_Column_ID; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Tab.java b/org.adempiere.base/src/org/compiere/model/I_AD_Tab.java index 3ae74c404a..7667f99fed 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Tab.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Tab.java @@ -428,6 +428,19 @@ public interface I_AD_Tab */ public boolean isTranslationTab(); + /** Column name MaxQueryRecords */ + public static final String COLUMNNAME_MaxQueryRecords = "MaxQueryRecords"; + + /** Set Max Query Records. + * If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public void setMaxQueryRecords (int MaxQueryRecords); + + /** Get Max Query Records. + * If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords(); + /** Column name Name */ public static final String COLUMNNAME_Name = "Name"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Tab.java b/org.adempiere.base/src/org/compiere/model/X_AD_Tab.java index c2966aa6c6..f2b826c04f 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Tab.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Tab.java @@ -30,7 +30,7 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent /** * */ - private static final long serialVersionUID = 20191121L; + private static final long serialVersionUID = 20191218L; /** Standard Constructor */ public X_AD_Tab (Properties ctx, int AD_Tab_ID, String trxName) @@ -674,6 +674,26 @@ public class X_AD_Tab extends PO implements I_AD_Tab, I_Persistent return false; } + /** Set Max Query Records. + @param MaxQueryRecords + If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public void setMaxQueryRecords (int MaxQueryRecords) + { + set_Value (COLUMNNAME_MaxQueryRecords, Integer.valueOf(MaxQueryRecords)); + } + + /** Get Max Query Records. + @return If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records + */ + public int getMaxQueryRecords () + { + Integer ii = (Integer)get_Value(COLUMNNAME_MaxQueryRecords); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Name. @param Name Alphanumeric identifier of the entity 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 649dff6613..a12634a3e5 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 @@ -657,7 +657,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements } private void initFirstTabpanel() { - adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); + adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, adTabbox.getSelectedGridTab().getMaxQueryRecords()); adTabbox.getSelectedTabpanel().activate(true); Events.echoEvent(new Event(ADTabpanel.ON_POST_INIT_EVENT, adTabbox.getSelectedTabpanel())); } @@ -705,7 +705,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements mTab.getTableName(), MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); int no = DB.getSQLValue(null, finalSQL.toString()); // - require = MRole.getDefault().isQueryRequire(no); + require = mTab.isQueryRequire(no); } // Show Query if (require) @@ -2060,7 +2060,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements { m_onlyCurrentRows = false; // search history too adTabbox.getSelectedGridTab().setQuery(query); - adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize + adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, adTabbox.getSelectedGridTab().getMaxQueryRecords()); // autoSize } if (findWindow.isCreateNew()) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/CSVImportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/CSVImportAction.java index 4aeb7723bd..66eedf00a6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/CSVImportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/CSVImportAction.java @@ -58,7 +58,6 @@ import org.adempiere.webui.util.ZKUpdateUtil; import org.compiere.model.GridTab; import org.compiere.model.MImportTemplate; import org.compiere.model.MQuery; -import org.compiere.model.MRole; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -345,14 +344,14 @@ public class CSVImportAction implements EventListener if (query != null) { query.addRestriction("1=1"); panel.getActiveGridTab().setQuery(query); - panel.getADTab().getSelectedTabpanel().query(false, 0, MRole.getDefault().getMaxQueryRecords()); + panel.getADTab().getSelectedTabpanel().query(false, 0, panel.getActiveGridTab().getMaxQueryRecords()); } panel.getActiveGridTab().dataRefresh(false); if (detailQuery != null){ detailQuery.addRestriction("1=1"); panel.getADTab().getSelectedDetailADTabpanel().getGridTab().setQuery(detailQuery); - panel.getADTab().getSelectedDetailADTabpanel().query(false, 0, MRole.getDefault().getMaxQueryRecords()); + panel.getADTab().getSelectedDetailADTabpanel().query(false, 0, panel.getActiveGridTab().getMaxQueryRecords()); panel.getADTab().getSelectedDetailADTabpanel().getGridTab().dataRefresh(false); } } catch (Exception e) { 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 ddf269e5f8..451b0a3221 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 @@ -127,16 +127,15 @@ import org.zkoss.zul.Vlayout; */ public class FindWindow extends Window implements EventListener, ValueChangeListener, DialogEvents { + /** + * + */ + private static final long serialVersionUID = 2958810511464597943L; private static final String FIND_ROW_EDITOR = "find.row.editor"; private static final String FIND_ROW_EDITOR_TO = "find.row.editor.to"; - /** - * - */ - private static final long serialVersionUID = -7374857601424061640L; - // values and label for history combo private static final String HISTORY_DAY_ALL = "All"; private static final String HISTORY_DAY_YEAR = "Year"; @@ -174,6 +173,8 @@ public class FindWindow extends Window implements EventListener, ValueCha private String m_whereExtended; /** Search Fields */ private GridField[] m_findFields; + /** The Tab */ + private GridTab m_gridTab = null; /** Resulting query */ private MQuery m_query = null; /** Is cancel ? */ @@ -268,6 +269,8 @@ public class FindWindow extends Window implements EventListener, ValueCha m_tableName = tableName; m_whereExtended = whereExtended; m_findFields = findFields; + if (findFields != null && findFields.length > 0) + m_gridTab = findFields[0].getGridTab(); m_sNew = "** ".concat(Msg.getMsg(Env.getCtx(), "New Query")).concat(" **"); m_AD_Tab_ID = adTabId; m_minRecords = minRecords; @@ -2357,15 +2360,14 @@ public class FindWindow extends Window implements EventListener, ValueCha rs = null; stmt = null; } - MRole role = MRole.getDefault(); // No Records /* if (m_total == 0 && alertZeroRecords) FDialog.warn(m_targetWindowNo, this, "FindZeroRecords");*/ // More then allowed - if (query != null && role.isQueryMax(m_total)) + if (m_gridTab != null && query != null && m_gridTab.isQueryMax(m_total)) { FDialog.error(m_targetWindowNo, this, "FindOverMax", - m_total + " > " + role.getMaxQueryRecords()); + m_total + " > " + m_gridTab.getMaxQueryRecords()); m_total = 0; // return 0 if more then allowed - teo_sarca [ 1708717 ] } else @@ -2553,8 +2555,7 @@ public class FindWindow extends Window implements EventListener, ValueCha */ public MQuery getQuery() { - MRole role = MRole.getDefault(); - if (role.isQueryMax(getTotalRecords()) && !m_isCancel) + if (m_gridTab != null && m_gridTab.isQueryMax(getTotalRecords()) && !m_isCancel) { m_query = MQuery.getNoRecordQuery (m_tableName, false); m_total = 0;