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

NEW : Filter API on DATE(t.field) if equal 'YYYY-MM-DD' #31903

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

kkhelifa-opendsi
Copy link
Contributor

Filter API on DATE(t.field) if equal 'YYYY-MM-DD' #26718

@@ -14016,6 +14016,11 @@ function dolForgeCriteriaCallback($matches)
}
}

// Filter on DATE(t.field) if $tmpescaped equal 'YYYY-MM-DD'
if (strpos($operand, 'date') !== false && preg_match("/^'\d{4}\-\d{2}\-\d{2}'\$/", $tmpescaped)) {
$operand = 'DATE('.$operand.')';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of DATE function is forbidden. See https://wiki.dolibarr.org/index.php?title=Language_and_development_rules#SQL_Coding_rules

Try to use sqlDateFilter() instead.

@eldy eldy added Discussion Some questions or discussions are opened and wait answers of author or other people to be processed PR to fix - Conflict or CI error to solve The PHP unit tests return something wrong. Check details to know what to fix or solve the conflicts. and removed Discussion Some questions or discussions are opened and wait answers of author or other people to be processed labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Event: Devcamp 2024 Nancy PR to fix - Conflict or CI error to solve The PHP unit tests return something wrong. Check details to know what to fix or solve the conflicts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants