Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-45807

Shopping Portlet: Order Search always returns empty result if form fields are empty (null vs ' ' problem)

    Details

    • Type: Regression Bug
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s: 6.2.10 EE GA1
    • Fix Version/s: None
    • Component/s: Util, Util > Shopping
    • Labels:
      None
    • Databases:
      SQL Server 2012

      Description

      Reproduce: order something then go to the orders tab. Press Search with nothing selected. You should at least see the order you just placed but instead the result set is empty.

      It used to work in 6.0.2.

      I've turned on SQL logging. The SQL prepared statement is more or less the same
      08.04.14 07:57:57- SELECT top 20 FROM ShoppingOrder ... WHERE (groupId = ?) AND (companyId = ?) AND ( (number_ LIKE ? OR ? IS NULL) AND (billingFirstName LIKE ? OR ? IS NULL) AND (billingLastName LIKE ? OR ? IS NULL) AND
      (billingEmailAddress LIKE ? OR ? IS NULL) AND (shippingFirstName LIKE ? OR ? IS NULL) AND (shippingLastName LIKE ? OR ? IS NULL) AND (shippingEmailAddress LIKE ? OR ? IS NULL) AND (ppPaymentStatus != ?) ) ORDER BY ShoppingOrder.createDate DESC

      The parameters however are null in 6.02.

      08.04.14 11:41:51- binding '10157' to parameter: 1
      08.04.14 11:41:51- binding '10132' to parameter: 2
      08.04.14 11:41:51- binding null to parameter: 3
      08.04.14 11:41:51- binding null to parameter: 4
      ...
      08.04.14 11:41:51- binding null to parameter: 16
      08.04.14 11:41:51- binding 'LIFERAY_STATUS_LATEST' to parameter: 17

      and empty strings in 6.2

      08.04.14 07:57:57- binding parameter [1] as [BIGINT] - 10158
      08.04.14 07:57:57- binding parameter [2] as [BIGINT] - 10133
      08.04.14 07:57:57- binding parameter [3] as [VARCHAR] -
      08.04.14 07:57:57- binding parameter [4] as [VARCHAR] -
      ...
      08.04.14 07:57:57- binding parameter [16] as [VARCHAR] -
      08.04.14 07:57:57- binding parameter [17] as [VARCHAR] - LIFERAY_STATUS_LATEST

      So billingFirstName like null or null is null used to work while

      billingFirstName like '' or '' is null doesn't.

      I think the problem is this change in OrderSearchTerms: https://github.com/liferay/liferay-portal/commit/6c413511f3cdb95d167626f8cc6cc78b9955d257#diff-5d89759c7d5b4c06deda4d3330cdc35c

      The constructor used to call DAOParamUtil.getLike or DaoParamUtil.getString which would transform an emtpy string in a null and now it doesn't.

        Attachments

          Activity

            People

            • Assignee:
              lu.liu Lu Liu
              Reporter:
              ana.oleski Ana Oleski (Inactive)
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 1 week, 4 days ago

                Packages

                Version Package