- π¬π§United Kingdom davej
@markusa I may have tracked down one scenario where civicrm_entity doesn't assign the correct prefix to a Civi table. This was happening on a custom field set table called
civicrm_value_confidentiality__data_protection_6
. I suspect the problem may be this code in src/Plugin/views/query/CivicrmSql.php , functionquery()
:// If the table is not prefixed with civicrm_, assume it is a Drupal table // and convert it to a fully qualified table name. But, make sure it has // not already been converted. // Also do not convert any drupal custom fields. if ((strpos($table['table'], 'civicrm_') !== 0 && strpos($table['table'], '.') === FALSE) || (strpos($table['table'], 'civicrm_') === 0 && strpos($table['table'], '__') !== FALSE)) { $table['table'] = $connection->getFullQualifiedTableName($table['table']); }
I.e. if the table name contains a double underscore, then regard it as already fully qualified?
- πΊπΈUnited States markusa
@davej
Ok, yep, I think we need to enhance that logic. Double underscore was a way we tried to assume a table is a Drupal table.
- πΊπΈUnited States markusa
Here's a PR for the 8.x-3.x branch, which is what you are using for Drupal 9
https://github.com/eileenmcnaughton/civicrm_entity/pull/432
https://patch-diff.githubusercontent.com/raw/eileenmcnaughton/civicrm_en...Please let me know if this fixes the issue for you, and if so, I'll get it merged.
- π¬π§United Kingdom davej
Hi @markusa,
I've given that a quick test on a view which previously failed on civicrm_value tables with a double underscore and the fix looks successful there. I haven't given it comprehensive testing to see if it breaks anything else but it looks good on that specific issue and the change to the logic seems reasonable. Looks like you're having to take into account a case where a table name begins with civicrm_ but will be found in the Drupal db, which does ring a bell - some Civi-related modules' tables, maybe?
Thanks!
Dave
- πΊπΈUnited States markusa
Ok great, if it fixes your error, that's what I need to know.
I'm testing the other scenarios we tested when originally making these updates. So far so good.Likely to get merged soon and in next release sometime in June.
- πΊπΈUnited States markusa
Pushed this out to a release, in 8.x-3.5 and 4.0.0-alpha4
- π¬π§United Kingdom davej
Hi Mark,
Wow, that was quick! Open source at its best. Thank you.
Dave
- π¬π§United Kingdom chumkui
- Status changed to Fixed
8 months ago 7:53pm 25 April 2024 Automatically closed - issue fixed for 2 weeks with no activity.