Problem/Motivation

Sorting "Ubercart discount usage data" for a discount code by the User column results in an SQL error "Column 'user_id' in order clause is ambiguous".

Proposed resolution

Fix query headers in uc_discounts_report_for_discount() to sort by "username" field, rather than "user_id" which appears as a field twice in the results (once as an alias for u.uid, once as a field from the discounts table).

I think sorting by the displayed username, alphabetically, makes more sense than sorting by the arbitrary user ID.

Remaining tasks

Generate patch, test, review.

User interface changes

Sorting by "User" sorts the visible usernames alphabetically, rather than sorting them by the hidden UID values.

API changes

None.

CommentFileSizeAuthor
#1 sort-by-user.patch582 bytesfonant

Comments

fonant’s picture

Status: Active » Needs review
StatusFileSize
new582 bytes

Simple patch attached,