major code refactoring and compatibility with CiviCRM 5.51

Merged sluc23 requested to merge 5.51.x into master

We've been working in a major refactoring of haystack, to modernize coding standards and compatibility with CiviCRM 5.51

Merge request reports