eileenmcnaughton / nz.co.fuzion.relatedpermissions

Empowers inherited permissions throughout Civi
Other
9 stars 13 forks source link

Install fails on D9(?) #37

Open MegaphoneJon opened 2 years ago

MegaphoneJon commented 2 years ago

I was just able to successfully install this on a D7 w/ 5.46alpha. When I tried installing on D9 w/ 5.44, I got the following stacktrace.

When I traced it down, it seems like the issue is with creating the option values from within CustomField.create. The option group and values are created, but not saved to the database due to being in a transaction. When the custom field is created, it fails because the option_group_id references a non-existent record.

I'm reporting it just for other folks to find - I'm going to manually create the fields and move on.

#1 /home/jon/local/mysite/web/sites/all/civicrm-custom/extensions/nz.co.fuzion.relatedpermissions/CRM/Relatedpermissions/Upgrader.php(95): CRM_Relatedpermissions_Upgrader->create_custom_fields()
#2 /home/jon/local/mysite/web/sites/all/civicrm-custom/extensions/nz.co.fuzion.relatedpermissions/CRM/Relatedpermissions/Upgrader/Base.php(306): CRM_Relatedpermissions_Upgrader->install()
#3 /home/jon/local/mysite/web/sites/all/civicrm-custom/extensions/nz.co.fuzion.relatedpermissions/relatedpermissions.civix.php(131): CRM_Relatedpermissions_Upgrader_Base->onInstall()
#4 /home/jon/local/mysite/web/sites/all/civicrm-custom/extensions/nz.co.fuzion.relatedpermissions/relatedpermissions.php(30): _relatedpermissions_civix_civicrm_install()
#5 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Extension/Manager/Module.php(61): relatedpermissions_civicrm_install()
#6 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Extension/Manager/Module.php(33): CRM_Extension_Manager_Module->callHook(Object(CRM_Extension_Info), 'install')
#7 /home/jon/local/mysite/vendor/civicrm/civicrm-core/CRM/Extension/Manager.php(293): CRM_Extension_Manager_Module->onPreInstall(Object(CRM_Extension_Info))
#8 /home/jon/local/mysite/vendor/civicrm/civicrm-core/api/v3/Extension.php(42): CRM_Extension_Manager->install(Array)
#9 /home/jon/local/mysite/vendor/civicrm/civicrm-core/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_extension_install(Array)
#10 /home/jon/local/mysite/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(149): Civi\API\Provider\MagicFunctionProvider->invoke(Array)
#11 /home/jon/local/mysite/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest(Array)
#12 /home/jon/local/mysite/vendor/civicrm/civicrm-core/api/api.php(22): Civi\API\Kernel->runSafe('Extension', 'install', Array)
#13 phar:///usr/local/bin/cv/src/Command/BaseCommand.php(49): civicrm_api('Extension', 'install', Array)
#14 phar:///usr/local/bin/cv/src/Command/ExtensionEnableCommand.php(91): Civi\Cv\Command\BaseCommand->callApiSuccess(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput), 'Extension', 'install', Array)
#15 phar:///usr/local/bin/cv/vendor/symfony/console/Command/Command.php(257): Civi\Cv\Command\ExtensionEnableCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 phar:///usr/local/bin/cv/vendor/symfony/console/Application.php(850): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 phar:///usr/local/bin/cv/vendor/symfony/console/Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(Civi\Cv\Command\ExtensionEnableCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 phar:///usr/local/bin/cv/src/Application.php(46): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 phar:///usr/local/bin/cv/vendor/symfony/console/Application.php(124): Civi\Cv\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 phar:///usr/local/bin/cv/src/Application.php(15): Symfony\Component\Console\Application->run()
#21 phar:///usr/local/bin/cv/bin/cv(27): Civi\Cv\Application::main('phar:///usr/loc...')
#22 /usr/local/bin/cv(14): require('phar:///usr/loc...')
#23 {main}
lbl-knts commented 1 year ago

My setting ist quiet same w D10 / 5.67.0. I am really unsure about the actual issue. I followed Jon's advice and used my own API script to create all OptionGroups, OptionValues, CustomGroups, and CustomFields. Apparently, CiviCRM does not (anymore) accept that custom fields can extend relationship types. The odyssey between API3 and API4 adds to the confusion. Mysterious errors, like not accepting "Int" as a field type, are also part of the puzzle. Anyway, in D7, the fields appear in the GUI as custom field sets and custom fields. After successfully incorporating the fields and options via API in D10, they are only visible on relationships, no longer in the custom field sets. Therefore, I suspect that the core issue lies in creating custom fields (sets) for relationship types. Subsequently, the extension could be installed.