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

FIX_forgeSQLFromUniversalSearchCriteria was unusable #26921

Conversation

atm-saamiperdrix
Copy link
Contributor

forgeSQLFromUniversalSearchCriteria was unusable

@eldy
Copy link
Member

eldy commented Dec 1, 2023

Can you provide an example of a case that was not working.
Add it as a phpunit test in method testDolForgeCriteriaCallback() and check that after the change, phpunit is ok ?

@eldy eldy added the Discussion Some questions or discussions are opened and wait answers of author or other people to be processed label Dec 1, 2023
@carmelchas
Copy link
Contributor

I am using version 18.x and found issues when trying to use "Form::select_thirdparty_list" with ajax select2.

print img_picto('', '').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)',            'SelectThirdParty', 0, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');


Search produces the following error:
   "Bad syntax of the search string"

I tried updating the filter to "( s.client IN (1,2,3) )" and get the same error.

I see two(2) issues here:
A. The function does not allow for more than one condition.
B. The function is rejecting perfectly functional filters.

@carmelchas
Copy link
Contributor

Additional example from v18

$object->fields['fk_project'] = array('type'=>'integer:Project:projet/class/project.class.php:1:fk_soc='.$thirdparty_soc_id, 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf- >project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'validate'=>'1',);

Here it is rejecting the filter "fk_soc=123" with the error "Bad syntax of the search string"

carmelchas added a commit to carmelchas/dolibarr that referenced this pull request Mar 14, 2024
Promote modification from Pull request Dolibarr#26921 to v18 to resolve issues related to Issue breaking project and third-party dropdowns with reasonably acceptable filters that fail this test.
@eldy
Copy link
Member

eldy commented Mar 14, 2024

The string syntax for filter looks wrong.
((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)
You should have use the Universal Search Filter syntax (A structured filter string with parenthesis, AND OR and a criteria
(operand1:operator:operand2). So
(((s.client:=:1) OR (s.client:=:2) OR (s.client:=:3)) AND (s.status:=:1))

@hregis
Copy link
Contributor

hregis commented Mar 14, 2024

@eldy maybe add IN in this function ? ;-)

((s.client:IN:1,2,3) AND (s.status:=:1))

@hregis
Copy link
Contributor

hregis commented Mar 14, 2024

@eldy c'est pas déjà pris en charge d'ailleurs ?

((s.client:in:1,2,3) AND (s.status:=:1))

@eldy
Copy link
Member

eldy commented Mar 15, 2024

@eldy c'est pas déjà pris en charge d'ailleurs ?

((s.client:in:1,2,3) AND (s.status:=:1))

Je crois que si...
I think so ...

@hregis
Copy link
Contributor

hregis commented Mar 15, 2024

@eldy arrête de parler français on va se faire engueuler ! ;-)

@carmelchas
Copy link
Contributor

Thank you! We will try this.

@carmelchas
Copy link
Contributor

Je m'excuse de ne pas avoir tenté de poser ma question en français. :-(
Merci. Nous allons essayer cette approche.

@hregis
Copy link
Contributor

hregis commented Mar 15, 2024

@carmelchas tu as bien fait de ne pas parler français ! ;-) c'était un joke ! il est préférable de parler anglais... voir américain ! ;-)

@carmelchas
Copy link
Contributor

carmelchas commented Mar 15, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Some questions or discussions are opened and wait answers of author or other people to be processed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants