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 : allow search all to filter on extrafield on order list #27285

Closed

Conversation

atm-quentin
Copy link
Contributor

NEW allow search all to filter on extrafield on order list

new conf allowing user to search on extrafield during global search

@@ -163,6 +163,27 @@
$fieldstosearchall["c.note_private"] = "NotePrivate";
}

if (getDolGlobalInt(strtoupper($object->table_element).'_SEARCHALL_EXTRAFIELDS_ENABLE') > 0) {
Copy link
Member

@eldy eldy Jan 3, 2024

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 ?

Copy link
Contributor Author

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.

Copy link
Member

@eldy eldy Jan 12, 2024

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.

Copy link
Contributor Author

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 ?

Copy link
Member

@eldy eldy Jan 15, 2024

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.

@eldy eldy added the Discussion Some questions or discussions are opened and wait answers of author or other people to be processed label Jan 3, 2024
@eldy eldy added the PR not qualified PR is not qualified (feature not enough requested, duplicate feature or other reason) label Jan 23, 2024
@atm-quentin atm-quentin closed this Mar 8, 2024
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 PR not qualified PR is not qualified (feature not enough requested, duplicate feature or other reason)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants