Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching for supplier orders by ref_supplier fails if it contains digits only #24300

Closed
st31ny opened this issue Mar 21, 2023 · 3 comments
Closed
Assignees
Labels
Bug This is a bug (something does not work as expected) Event: Devcamp 2024 Nancy

Comments

@st31ny
Copy link

st31ny commented Mar 21, 2023

Bug

We are using the API to query supplier orders based on the ref_supplier field like this:

https://example.com/api/index.php/supplierorders?sortfield=t.rowid&sortorder=ASC&sqlfilters=t.billed=0 and t.ref_supplier like '%<REF_SUPPLIER>%'

When the <REF_SUPPLIER> happens to contain digits only, however, the requests always produces a 404.

Environment Version

16.0.4

Environment OS

Debian 10

Environment Web server

nginx 1.14

Environment PHP

PHP 7.3

Environment Database

MariaDB 10.3

Environment URL(s)

/api/index.php/supplierorders

Expected and actual behavior

Expected: The requests works regardless whether the query contains digits only or a combination of digits and letters.
Actual: The supplier order is not found, a 404 is produced. A letter (or space) has to be added to ref_supplier in order to find the order.

Steps to reproduce the behavior

  • Create a supplier order with a ref_supplier of "XYZ Supplier 12345".
  • Query orders with https://example.com/api/index.php/supplierorders?sortfield=t.rowid&sortorder=ASC&sqlfilters=t.billed=0 and t.ref_supplier like '%12345%' => Nothing found.
  • Query orders instead with https://example.com/api/index.php/supplierorders?sortfield=t.rowid&sortorder=ASC&sqlfilters=t.billed=0 and t.ref_supplier like '% 12345%' (note the space before 12345) => Order found.

Attached files

No response

@st31ny st31ny added the Bug This is a bug (something does not work as expected) label Mar 21, 2023
@github-actions github-actions bot added the Issue Stale (automatic label) This issue is stale because it has been open 1 year with no activity. Remove this label to keep open label Mar 20, 2024
@st31ny
Copy link
Author

st31ny commented Mar 21, 2024

Bug still exists in 18.0.5.

@github-actions github-actions bot removed the Issue Stale (automatic label) This issue is stale because it has been open 1 year with no activity. Remove this label to keep open label Mar 21, 2024
@lvessiller-opendsi lvessiller-opendsi self-assigned this Nov 15, 2024
@lvessiller-opendsi
Copy link
Contributor

On Dolibarr v18.0.6 you should use a filter such as :
(t.billed%3A%3D%3A0%20and%20t.ref_supplier%3Alike%3A'%2512345%25')

The url request is :
DOLIBARR_URL/api/index.php/supplierorders?sortfield=t.rowid&sortorder=ASC&limit=100&sqlfilters=(t.billed%3A%3D%3A0%20and%20t.ref_supplier%3Alike%3A'%2512345%25')

Could check if it works for you ?

@st31ny
Copy link
Author

st31ny commented Nov 18, 2024

On Dolibarr v18.0.6 you should use a filter such as : (t.billed%3A%3D%3A0%20and%20t.ref_supplier%3Alike%3A'%2512345%25')

The url request is : DOLIBARR_URL/api/index.php/supplierorders?sortfield=t.rowid&sortorder=ASC&limit=100&sqlfilters=(t.billed%3A%3D%3A0%20and%20t.ref_supplier%3Alike%3A'%2512345%25')

Could check if it works for you ?

Indeed, with the new syntax fetching supplier orders whose supplier refs contain digits only seems to work! Thanks for the hint.

@st31ny st31ny closed this as completed Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected) Event: Devcamp 2024 Nancy
Projects
None yet
Development

No branches or pull requests

3 participants