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

Fatal error Call to undefined function omnipaymultiprocessor_civicrm_managed() #253

Open
bastienho opened this issue Oct 13, 2023 · 3 comments

Comments

@bastienho
Copy link
Contributor

Since 50b580e, I got this error:

PHP Fatal error:  Uncaught Error: 
Call to undefined function omnipaymultiprocessor_civicrm_managed() 
in CRM/Core/Payment/OmnipayMultiProcessor.php:1349
bastienho added a commit to agencenous/nz.co.fuzion.omnipaymultiprocessor that referenced this issue Oct 13, 2023
@bastienho
Copy link
Contributor Author

It seems that we missed something in the fix.

There is no more Fatal Error, but Metadata are not loaded anymore. I think this is because the path in populateEntities() is not the main extension path.

Perhaps could we declare it in a constant and use it after in other files (this would work wherever the file are)

diff --git a/CRM/Core/Payment/OmnipayMultiProcessor.php b/CRM/Core/Payment/OmnipayMultiProcessor.php
index 2b933e70..649a8fc4 100644
--- a/CRM/Core/Payment/OmnipayMultiProcessor.php
+++ b/CRM/Core/Payment/OmnipayMultiProcessor.php
@@ -1340,7 +1340,7 @@ class CRM_Core_Payment_OmnipayMultiProcessor extends CRM_Core_Payment_PaymentExt
    * Copied from civix as was being internally used.
    */
   private function populateEntities(&$entities) {
-    $mgdFiles = CRM_Utils_File::findFiles(__DIR__, '*.mgd.php');
+    $mgdFiles = CRM_Utils_File::findFiles(OMNIPAYMULTIPROCESSOR_DIRECTORY, '*.mgd.php');
     sort($mgdFiles);
     foreach ($mgdFiles as $file) {
       $es = include $file;
diff --git a/omnipaymultiprocessor.php b/omnipaymultiprocessor.php
index 5eb7166e..9c1ed25a 100644
--- a/omnipaymultiprocessor.php
+++ b/omnipaymultiprocessor.php
@@ -3,6 +3,8 @@
 require_once 'omnipaymultiprocessor.civix.php';
 use CRM_Omnipaymultiprocessor_ExtensionUtil as E;
 
+define ('OMNIPAYMULTIPROCESSOR_DIRECTORY', __DIR__);
+
 /**
  * Implementation of hook_civicrm_config
  *

@mattwire
Copy link
Contributor

@bastienho See #257

@bastienho
Copy link
Contributor Author

@mattwire My bad, I wasn't aware of E::path(). This is much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants