Configured sql-order-by statement in product info not taken into account when warehouse is selected

Description

Configured sql-order-by statement in product info is not being taken into account when selected warehouse isn't null. It only works when nothing has been selected.

STEPS TO REPRODUCE

1. Log in as System Administrator
2. Open the Info Window window
3. Select the Product Info record
4. Enter any Sql ORDER BY statement you'd like to order results by. E.g: p.Name
5 Save and log out.
6. Log in as GardenWorld Admin
7. Open Product Info
8. Make sure that no warehouse is selected.
9. Click on ReQuery
10. Results are shown in alphabetical order (as expected) because of the order-by statement used.
11. Now select any warehouse there might be available for selection.
12. Results aren't shown in Alphabetical order. The results, now, use QtyAvailable DESC as its order-by statement.

RESULTS OF INVESTIGATION

The problem stated above takes places because in the InfoProductWindow class, line 847, there is a check for controlling the order-by statement when a warehouse has been selected. Below is a snippet of it.

protected void prepareTable(ColumnInfo[] layout, String from, String where, String orderBy) {
if (getSelectedWarehouseId() > 0)
{
orderBy = "QtyAvailable DESC";
}
super.prepareTable(layout, from, where, orderBy);
}

POSSIBLE SOLUTIONS
1. To take away this piece of code.
2. To use a default order-by statement not dependent on any field, so if a order-by statement in the product info is entered, it will take precedence over the default value.

Environment

None

Activity

Show:
Hiep Lq
August 2, 2015, 6:37 PM

hi , i see this issue has commit and it's resolved issue.
maybe just change status?

Assignee

Carlos Augusto Sánchez Sánchez

Reporter

Carlos Augusto Sánchez Sánchez

Labels

Tested By

None

Components

Priority

Major
Configure