-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 : allow search all to filter on extrafield on order list #27285
NEW : allow search all to filter on extrafield on order list #27285
Conversation
@@ -163,6 +163,27 @@ | |||
$fieldstosearchall["c.note_private"] = "NotePrivate"; | |||
} | |||
|
|||
if (getDolGlobalInt(strtoupper($object->table_element).'_SEARCHALL_EXTRAFIELDS_ENABLE') > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the modulebuilder template we already have the extrafields for the table into the list of fields in the select for main object. Also the hook "printFieldListFrom" can add the LEFT JOIN '.MAIN_DB_PREFIX.'commandedet_extrafields for the fields in the extrafields of lines (not addd by default)
Also the hook "completeFieldsToSearchAll" already exists to allow to complete the "$fieldstosearchall". It was just not added into list of order (only on new modules). I fixed this today.
So with hooks, we can already complete the search_all. Looks better and more generic than a hidden option _SEARCHALL_EXTRAFIELDS_ENABLE as it works everywhere with no code addition. Don't you think so ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems like a better option, but to properly integrate it into the core, how would you proceed ?
I had considered using a tpl file, but based on your suggestion, that doesn't seem like the right solution.
There doesn't seem to be a hook file actions_commande.class.php.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is nothing to do. The hook completeFieldsToSearchAll was added into commande/list.php 9 days ago.
So now you have all required hooks to have an external module add the fields of its choice (extra fields or fields from any other table) into the $fieldstosearchall, by using hooks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but you don't want to have this feature in dolibarr core ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may introduce such a feature in core. But if we add a feature to use extrafields into the search all, we should be able to decide which extrafields to use. Adding ALL may often make the feature useless.
Also, the order list is using the old school coding. If we introduce such a feature, it must first be added into modulebuilder template to define how to use it. Then, and only after, we will see how to backport the generic code into "old school" pages to have it also on old pages.
NEW allow search all to filter on extrafield on order list
new conf allowing user to search on extrafield during global search