details: https://code.openbravo.com/erp/devel/pi/rev/dedc560d25aa changeset: 29521:dedc560d25aa user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Thu May 19 17:23:31 2016 +0200 summary: [pi-selector-performance] Added filtering by ID for default selector filters Now the SelectorDefaultFilterActionHandler builds the default filtering criteria in order to filter FK columns by ID. Together with this an issue is solved on the openSelectorWindow function of OBSelectorItem, because the scroll was being kept after reopening the selector pop-up, which caused a wrong request after the first pop-up opening.
details: https://code.openbravo.com/erp/devel/pi/rev/6a32d5039ff1 changeset: 29522:6a32d5039ff1 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Thu May 19 17:33:29 2016 +0200 summary: [pi-selector-performance] Selected properties in selector drop-down requests The requests performed by the drop-down of the selector now include just the needed properties: 1- The fields to be displayed on the pick list are requested using the SELECTED_PROPERTIES parameter. 2- The display field, value field and out fields are requested using the EXTRA_PROPERTIES parameter. This is because this parameter is always used on the requests as it is part of the selector template definition within the view. details: https://code.openbravo.com/erp/devel/pi/rev/2b0b24c7b1ea changeset: 29523:2b0b24c7b1ea user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Thu May 19 17:46:36 2016 +0200 summary: [pi-selector-perform^Cce] Unneeded query performed when targetRecordId is null The targetRecordId parameter is used on the DefaultJsonDataService to compute a new startrow based on this paremeter value. If this parameter arrives with a null or empty value, the query to compute the new startrow must not be launched. Until now, this query was fired when targetRecordId parameter was received on the backend without considering its value. For example, this behavior could be reproduced after following these steps: 1- Edit an existing sales order line in form view. 2- Open the product selector pop-up. 3- Remove the default filters. details: https://code.openbravo.com/erp/devel/pi/rev/44d7c1416d17 changeset: 29524:44d7c1416d17 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Thu May 19 18:24:39 2016 +0200 summary: [pi-selector-performance] Use inner join when possible Due to performance reasons, entities joined for sorting the query should use an inner join instead of a left join when possible. This is because a left join sometimes prevent using indexes for sorting. This does not happen for inner joins. Together with this views whose primary key is the result of a concatenation of several columns, should not use that primary key for predictable sorting, because it is not an indexable key. In this type of cases, the id of the referenced entity used as value field is used for predictable sorting. details: https://code.openbravo.com/erp/devel/pi/rev/d118d1a72456 changeset: 29525:d118d1a72456 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Thu May 19 18:36:38 2016 +0200 summary: [pi-selector-performance] Refactor M_PRODUCT_PRICE_WAREHOUSE_V view The M_PRODUCT_PRICE_WAREHOUSE_V has been refactored, instead of joining it with M_PRODUCT_WAREHOUSE_QTYS_V the quantities (available, on hand, reserved and ordered) are calculated with subqueries for each row. This solution performs better in environments with big amount of records specially in M_STORAGE_DETAIL and M_STORAGE_PENDING tables. details: https://code.openbravo.com/erp/devel/pi/rev/004803cbabb9 changeset: 29526:004803cbabb9 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Fri May 20 10:49:04 2016 +0200 summary: [pi-selector-performance] Mechanism to detect if filter by id is supported A new flag has been included in the request when opening the a selector in order to detect if filter by ID can be applied for default filtering. This is because SelectorDefaultFilterActionHandler is used by selectors in classic mode (OBSelectorWidget) also. This way, the changes done to filter by ID are transparent for this kind of selectors. details: https://code.openbravo.com/erp/devel/pi/rev/5e18e02f0807 changeset: 29527:5e18e02f0807 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Fri May 20 11:14:49 2016 +0200 summary: [pi-selector-performance] Code improvements in ob-selector-item details: https://code.openbravo.com/erp/devel/pi/rev/5935fce6d33f changeset: 29528:5935fce6d33f user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Mon May 23 14:09:25 2016 +0200 summary: [pi-selector-performance] Code review improvements details: https://code.openbravo.com/erp/devel/pi/rev/91dd33fdf821 changeset: 29529:91dd33fdf821 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Mon May 23 16:33:50 2016 +0200 summary: [pi-selector-performance] Improved comment details: https://code.openbravo.com/erp/devel/pi/rev/9105dfe33d79 changeset: 29530:9105dfe33d79 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Tue May 24 08:50:54 2016 +0200 summary: fixes issue 33015: Performance Improvements in Product Selector diffstat: modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java | 22 +- modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java | 10 - modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/WeldBaseTest.java | 8 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/ParameterUtils.java | 2 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java | 4 - modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentWindowComponent.java | 4 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ApplicationDictionaryCachedStructures.java | 8 +- modules/org.openbravo.client.kernel/src-test/org/openbravo/client/kernel/freemarker/test/FreemarkerTemplateProcessorTest.java | 15 +- modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl | 10 +- modules/org.openbravo.service.datasource/web/org.openbravo.service.datasource/js/ob-datasource-utilities.js | 8 +- modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java | 35 ++- modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java | 42 ++++- modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorConstants.java | 9 +- modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java | 39 +++- modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js | 87 +++++++++- src-core/src/org/openbravo/data/Sqlc.java | 12 +- src-core/src/org/openbravo/utils/FileUtility.java | 30 +-- src-db/database/model/functions/C_INVOICE_CREATE.xml | 17 +- src-db/database/model/functions/M_RESERVATION_REALLOCATE.xml | 8 +- src-db/database/model/views/M_PRODUCT_PRICE_WAREHOUSE_V.xml | 2 +- src-test/src/org/openbravo/test/xml/XMLBaseTest.java | 19 +- src-wad/src/org/openbravo/wad/ActionButtonJava_Responser.javaxml | 1 + src-wad/src/org/openbravo/wad/ActionButton_Responser.javaxml | 1 + src/org/openbravo/base/secureApp/LoginHandler.java | 2 - src/org/openbravo/base/secureApp/VariablesSecureApp.java | 1 - src/org/openbravo/costing/StandardCostAdjustment.java | 4 - src/org/openbravo/erpCommon/ad_actionButton/ProjectCopyFrom.java | 2 + src/org/openbravo/erpCommon/ad_actionButton/ProjectSetType.java | 2 + src/org/openbravo/erpCommon/ad_forms/Fact.java | 12 +- src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java | 2 - src/org/openbravo/erpCommon/ad_reports/ReportValuationStock.java | 9 +- src/org/openbravo/erpCommon/ad_reports/ReportValuationStock_data.xsql | 5 +- src/org/openbravo/erpCommon/businessUtility/AccountTree.java | 10 +- src/org/openbravo/erpCommon/modules/ImportModule.java | 3 +- src/org/openbravo/erpCommon/modules/UninstallModule.java | 2 +- src/org/openbravo/erpCommon/obps/ActivationKey.java | 8 +- src/org/openbravo/erpCommon/obps/ModuleLicenseRestrictions.java | 4 +- src/org/openbravo/erpCommon/utility/AntExecutor.java | 2 +- src/org/openbravo/erpCommon/utility/BasicUtility.java | 4 +- src/org/openbravo/erpCommon/utility/ComboTableData.java | 8 +- src/org/openbravo/erpCommon/utility/ModelSQLGeneration.java | 4 +- src/org/openbravo/erpCommon/utility/TableSQLData.java | 6 +- src/org/openbravo/erpCommon/utility/Utility.java | 5 +- src/org/openbravo/erpCommon/utility/WindowTree.java | 4 +- src/org/openbravo/erpCommon/utility/WindowTreeUtility.java | 4 +- src/org/openbravo/materialmgmt/ServicePriceUtils.java | 21 +-- src/org/openbravo/services/webservice/Module.java | 2 +- src/org/openbravo/services/webservice/Module1.java | 2 +- src/org/openbravo/services/webservice/Module2.java | 2 +- src/org/openbravo/services/webservice/ModuleDependency.java | 2 +- src/org/openbravo/services/webservice/ModuleInstallDetail.java | 2 +- src/org/openbravo/services/webservice/SimpleModule.java | 2 +- src/org/openbravo/services/webservice/SimpleModule1.java | 2 +- src/org/openbravo/services/webservice/SimpleModule2.java | 2 +- 54 files changed, 319 insertions(+), 214 deletions(-) diffs (truncated from 1616 to 300 lines): diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java Tue May 24 08:50:54 2016 +0200 @@ -21,6 +21,7 @@ import java.math.BigDecimal; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -49,6 +50,7 @@ import org.openbravo.dal.service.OBCriteria; import org.openbravo.dal.service.OBDal; import org.openbravo.dal.service.OBDao; +import org.openbravo.dal.service.OBQuery; import org.openbravo.database.ConnectionProvider; import org.openbravo.erpCommon.utility.OBDateUtils; import org.openbravo.erpCommon.utility.OBError; @@ -310,7 +312,7 @@ boolean isWriteOff = psdRow.getBoolean("writeoff"); // psdIds can be grouped - String[] psdIds = strPSDIds.replaceAll(" ", "").split(","); + List<String> psdIds = Arrays.asList(strPSDIds.replaceAll(" ", "").split(",")); List<FIN_PaymentScheduleDetail> psds = getOrderedPaymentScheduleDetails(psdIds); BigDecimal outstandingAmount = BigDecimal.ZERO; BigDecimal remainingAmount = paidAmount; @@ -332,8 +334,7 @@ } // Manage negative amounts if ((remainingAmount.signum() > 0 && remainingAmount.compareTo(outstandingAmount) >= 0) - || ((remainingAmount.signum() < 0 && outstandingAmount.signum() < 0) && (remainingAmount - .compareTo(outstandingAmount) >= 0))) { + || (remainingAmount.signum() < 0 && remainingAmount.compareTo(outstandingAmount) <= 0)) { assignAmount = outstandingAmount; remainingAmount = remainingAmount.subtract(outstandingAmount); } else { @@ -611,12 +612,15 @@ return message; } - private List<FIN_PaymentScheduleDetail> getOrderedPaymentScheduleDetails(String[] psdSet) { - OBCriteria<FIN_PaymentScheduleDetail> orderedPSDs = OBDal.getInstance().createCriteria( - FIN_PaymentScheduleDetail.class); - orderedPSDs.add(Restrictions.in(FIN_PaymentScheduleDetail.PROPERTY_ID, psdSet)); - orderedPSDs.addOrderBy(FIN_PaymentScheduleDetail.PROPERTY_PAYMENTDETAILS, true); - orderedPSDs.addOrderBy(FIN_PaymentScheduleDetail.PROPERTY_AMOUNT, true); + private List<FIN_PaymentScheduleDetail> getOrderedPaymentScheduleDetails(List<String> psdSet) { + StringBuffer where = new StringBuffer(); + where.append(" as psd"); + where.append(" where psd." + FIN_PaymentScheduleDetail.PROPERTY_ID + " in (:psdSet)"); + where.append(" order by psd." + FIN_PaymentScheduleDetail.PROPERTY_PAYMENTDETAILS); + where.append(", abs(psd." + FIN_PaymentScheduleDetail.PROPERTY_AMOUNT + ")"); + OBQuery<FIN_PaymentScheduleDetail> orderedPSDs = OBDal.getInstance().createQuery( + FIN_PaymentScheduleDetail.class, where.toString()); + orderedPSDs.setNamedParameter("psdSet", psdSet); return orderedPSDs.list(); } diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Tue May 24 08:50:54 2016 +0200 @@ -1571,12 +1571,6 @@ * any FinAccPaymentMethod related to paymentMethodId FIN_PaymentMethod ordered by default field. * FinAccPaymentMethod must have pay in/out active and must be compatible with currencyId Currency * if currencyId is not null. - * - * @param paymentMethodId - * @param financialAccountId - * @param issotrx - * @param currencyId - * @return */ public static FinAccPaymentMethod getFinancialAccountPaymentMethod(String paymentMethodId, String financialAccountId, boolean issotrx, String currencyId) { @@ -1624,10 +1618,6 @@ /** * Appends existing Financial Account Transaction description with either GL Item Description or * Payment description in a new line - * - * @param description - * @param descriptionToAppend - * @return returnDescription */ public static String getFinAccTransactionDescription(String description, diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/WeldBaseTest.java --- a/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/WeldBaseTest.java Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/WeldBaseTest.java Tue May 24 08:50:54 2016 +0200 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2015 Openbravo SLU + * All portions are Copyright (C) 2010-2016 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -57,6 +57,12 @@ @Deployment public static JavaArchive createTestArchive() { if (archive == null) { + + // Setting this property to "true" is avoided throwing an error when this class is used with + // analytics module. It is a workaround for Weld proxy bug. See issue: + // https://issues.openbravo.com/view.php?id=32704 + System.setProperty("com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager", "true"); + log.info("Creating cdi archive..."); final String sourcePath = OBPropertiesProvider.getInstance().getOpenbravoProperties() .getProperty("source.path"); diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.client.application/src/org/openbravo/client/application/ParameterUtils.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ParameterUtils.java Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ParameterUtils.java Tue May 24 08:50:54 2016 +0200 @@ -188,7 +188,7 @@ * the parameter to get the Default Value from * @param session * the HttpSession of the request - * @param context + * @param _context * the JSONObject with the context information of the request. * @return the DefaultValue of the Parameter. * @throws ScriptException diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java Tue May 24 08:50:54 2016 +0200 @@ -96,14 +96,10 @@ /** * Method to upload files. This method calls needed handler class * - * @param requestParams - * * @param strTab * the tab Id where the attachment is done * @param strKey * the recordId where the attachment is done - * @param strDataType - * the datatype of the document that is attached * @param strDocumentOrganization * the organization ID of the record where the attachment is done * @param file diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentWindowComponent.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentWindowComponent.java Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentWindowComponent.java Tue May 24 08:50:54 2016 +0200 @@ -111,9 +111,9 @@ * Sets the Attachment Method and Tab. Actualizes metadata depending on this tab an attachment * method * - * @param tab + * @param _tab * Tab to set. - * @param attMethod + * @param _attMethod * Method to set. */ public void initialize(Tab _tab, AttachmentMethod _attMethod) { diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ApplicationDictionaryCachedStructures.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ApplicationDictionaryCachedStructures.java Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ApplicationDictionaryCachedStructures.java Tue May 24 08:50:54 2016 +0200 @@ -290,10 +290,10 @@ * Gets the list of parameters associated to an Attachment Method and a Tab. The list is sorted so * the fixed parameters are returned first. * - * @param attachMethod - * active attachment method - * @param tab - * tab to take metadata + * @param strAttMethodId + * active attachment method id + * @param strTabId + * tab id to take metadata * @return List of parameters by attachment method and tab sorted by Fixed and Sequence Number * where fixed parameters are first. */ diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.client.kernel/src-test/org/openbravo/client/kernel/freemarker/test/FreemarkerTemplateProcessorTest.java --- a/modules/org.openbravo.client.kernel/src-test/org/openbravo/client/kernel/freemarker/test/FreemarkerTemplateProcessorTest.java Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.client.kernel/src-test/org/openbravo/client/kernel/freemarker/test/FreemarkerTemplateProcessorTest.java Tue May 24 08:50:54 2016 +0200 @@ -23,7 +23,6 @@ import static org.junit.Assert.fail; import java.io.File; -import java.io.FileInputStream; import java.net.URL; import java.util.Arrays; import java.util.Collections; @@ -33,6 +32,7 @@ import javax.inject.Inject; +import org.apache.commons.io.FileUtils; import org.junit.Before; import org.junit.Test; import org.openbravo.base.model.Entity; @@ -153,8 +153,8 @@ template.setModule(getModule()); for (Template dependency : dependencies) { - final TemplateDependency templateDependency = OBProvider.getInstance() - .get(TemplateDependency.class); + final TemplateDependency templateDependency = OBProvider.getInstance().get( + TemplateDependency.class); templateDependency.setObclkerTemplate(template); templateDependency.setDependsOnTemplate(dependency); template.getOBCLKERTemplateDependencyList().add(templateDependency); @@ -166,14 +166,7 @@ private String readTemplateSource(String fileName) throws Exception { final URL url = this.getClass().getResource(fileName + ".ftl"); final File file = new File(url.toURI()); - return readFileAsString(file); - } - - private static String readFileAsString(File file) throws java.io.IOException { - byte[] buffer = new byte[(int) file.length()]; - FileInputStream f = new FileInputStream(file); - f.read(buffer); - return new String(buffer); + return FileUtils.readFileToString(file); } private Module getModule() { diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl --- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl Tue May 24 08:50:54 2016 +0200 @@ -68,12 +68,14 @@ FILTER_PARAMETER : '_filter', SQL_FILTER_PARAMETER : '_sqlFilter', SORTBY_PARAMETER : '_sortBy', - OR_EXPRESSION: '_OrExpression', - TEXT_MATCH_PARAMETER_OVERRIDE: '_textMatchStyleOverride', + OR_EXPRESSION : '_OrExpression', + TEXT_MATCH_PARAMETER_OVERRIDE : '_textMatchStyleOverride', SUCCESS : 'success', - DBL_CLICK_DELAY: 300, + DBL_CLICK_DELAY : 300, ERROR : 'error', - IS_PICK_AND_EDIT : '_isPickAndEdit' + IS_PICK_AND_EDIT : '_isPickAndEdit', + SELECTED_PROPERTIES : '_selectedProperties', + EXTRA_PROPERTIES : '_extraProperties' }, Styles : { diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.service.datasource/web/org.openbravo.service.datasource/js/ob-datasource-utilities.js --- a/modules/org.openbravo.service.datasource/web/org.openbravo.service.datasource/js/ob-datasource-utilities.js Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.service.datasource/web/org.openbravo.service.datasource/js/ob-datasource-utilities.js Tue May 24 08:50:54 2016 +0200 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2009-2013 Openbravo SLU + * All portions are Copyright (C) 2009-2016 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -185,8 +185,12 @@ isc.OBRestDataSource.addProperties({ sendDSRequest: function (dsRequest) { //TODO: Report an issue to SmartClient - This part is a work around + var extraProperties = {}; if (dsRequest.params && this.requestProperties && this.requestProperties.params) { - isc.addProperties(dsRequest.params, this.requestProperties.params); + if (dsRequest.params._extraProperties) { + extraProperties[OB.Constants.EXTRA_PROPERTIES] = dsRequest.params._extraProperties; + } + isc.addProperties(dsRequest.params, this.requestProperties.params, extraProperties); } // if the datasource is not paginated, paginate them in case of selectors working in 2.50 UI. // in other cases error is thrown from server side. diff -r a0e1933e5b81 -r 9105dfe33d79 modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java --- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java Thu May 19 11:14:55 2016 +0200 +++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java Tue May 24 08:50:54 2016 +0200 @@ -160,10 +160,12 @@ private String distinctPropertyPath; private DataEntityQueryService subDataEntityQueryService; - // map that indicates, for a property, if its join definition is used only in joins used for - // filtering the grid - // see issue https://issues.openbravo.com/view.php?id=26279 - private Map<String, Boolean> gridFilterExclusiveJoinMap = new HashMap<String, Boolean>(); + // map that indicates, for a property, if it should be joined using an inner join or a left join. + // An inner join will be used if one of the following cases is fulfilled: + // 1- the join definition of the property is used only in joins used for filtering the grid. + // 2- the join definition is included for sorting, and the property used to make the join is + // mandatory, i.e., the inner join can be used safely. + private Map<String, Boolean> useInnerJoinMap = new HashMap<String, Boolean>(); private int aliasOffset = 0; @@ -1547,9 +1549,9 @@ path = orderByExpression[0]; direction = " " + orderByExpression[1] + " "; } - boolean fromCriteria = false; - final String resolvedPath = resolveJoins(JsonUtils.getPropertiesOnPath(getEntity(), path), - path, fromCriteria); + List<Property> properties = JsonUtils.getPropertiesOnPath(getEntity(), path); + // decide whether the entity joined for sorting have to use a left join or an inner join + final String resolvedPath = resolveJoins(properties, path, canUseInnerJoin(properties)); sb.append(resolvedPath); ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits