Account created on 4 February 2014, over 10 years ago
#

Recent comments

🇮🇳India jitendrapurohit

Hmm, normal webform conditionals for checkbox groups works on individual checkboxes, so eg if I have a checkbox with Color: Red, Orange, Green.

The conditional i need to write would be Hide if Any of

Red is checked.
Orange is checked.
Green is checked.

CiviCRM Options seems to be providing multiple types - select, multiselect, checkbox, radio & don't provide the separate logic for handling the conditionals.

One way to fix your usecase might be to re-type the element to use checkboxes (Can be done from Edit Element page).
Save
Then modify the conditional to check for each checkbox option as mentioned above.

Does that help?

🇮🇳India jitendrapurohit

Hi @nicholosophy

This sounds similar to the issue mentioned in this PR https://github.com/colemanw/webform_civicrm/pull/947.

PR is already merged, so i think you can just apply until the next release is out.

Please let us know if that works.

Thanks.

🇮🇳India jitendrapurohit

This is still an issue with another merge option `Count merged unique values of this field`.

Have updated the patch to include the fix for this option as well.

🇮🇳India jitendrapurohit

This is working as expected when i test it on a fresh local setup. Though, there's an issue when state field is not included on the webform (will raise a separate ticket/PR), but dont think it has anything to do with the billing address submission. Closing..

🇮🇳India jitendrapurohit

I've raised a PR here https://github.com/colemanw/webform_civicrm/pull/928

Can we please test this in detail with drush updb execution on existing webforms?

Thanks.

🇮🇳India jitendrapurohit

Any update on this please? We're looking to release the d10 version with this ticket included.

🇮🇳India jitendrapurohit

I've fixed the above mentioned issues with messenger service and method chaining. Can anyone please retest this?

Thanks.

🇮🇳India jitendrapurohit

Looks like its only affecting D7. 6.x already has this working fine.

🇮🇳India jitendrapurohit

Fixed the warnings regarding dependency injection.

🇮🇳India jitendrapurohit

Looks like a right fix @jude.hungerford. Can you please create a PR for the above patch against 6.x branch on https://github.com/colemanw/webform_civicrm? to see if it passes the test cases?

Thanks.

🇮🇳India jitendrapurohit

I've raised a PR for the fix - https://github.com/colemanw/webform_civicrm/pull/897

@VangelisP Can you please confirm if it works for you?

Thanks.

🇮🇳India jitendrapurohit

Hi @nubeli. I've reviewed & commented on the PR. Can you please have another look? Seems like there are more places that needs handling after civicrm handler is disabled.

🇮🇳India jitendrapurohit

Have raised a PR to set a default value for the currency field - https://github.com/colemanw/webform_civicrm/pull/896

I think this will set the currency on the contribution tab and will avoid submitting the empty currency field?

Can you please review it?

Thanks.

🇮🇳India jitendrapurohit

Hi @d.munio

I can't replicate this. Datelist field for birth date correctly submits the value to civicrm for me.

Can you please attach the yaml of your affected webform here so we can compare and retry to replicate this issue?

Thanks.

🇮🇳India jitendrapurohit

@MegaphoneJon I was able to replicate the wsod on Notes submit form. But looks like in my case, the reason for the fatal error was missing submission object in src/WebformCivicrmPostProcess.php.

Re webform_civicrm_webform_submission_load() - I agree this could be removed. Thanks for spotting it.

I've raised a PR - https://github.com/colemanw/webform_civicrm/pull/880

Can you please review it & confirm if it resolves the error for you as well?

🇮🇳India jitendrapurohit

It looks like the core/once library was added in https://github.com/colemanw/webform_civicrm/pull/773 already? I cant replicate the console error on my instance.

Also, we have test running on github which i think also captures any console errors.

The test is configured to run against drupal version 9.4, 9.5 & v10 and none of them fails with a js error.

Do you mean its only failing for Drupal 8?

🇮🇳India jitendrapurohit

Ah yes @maynardsmith. I was able to replicate it now for other checkbox elements.

Looks like webform assigns required=required attribute to the first checkbox element. Triggering a change event on the 3rd checkbox does not toggle the required attribute from the first option. I've raised a PR to fix - https://github.com/colemanw/webform_civicrm/pull/875

Can you please apply the patch and review it?

Thanks.

🇮🇳India jitendrapurohit

Looks like its working fine for me. @maynardsmith Can you please add some more information? Eg Drupal & Webform module version?

This is what I did and the webform submitted fine without any validation issue -

- Imported your attached webform.
- Opened the webform and selected a contact => Tag, Group and other information loaded automatically (See screeenshot).
- I haven't touched any other field and simply clicked on submit.
- The webform was submitted.

🇮🇳India jitendrapurohit

@roblog With the steps mentioned in the description, I can still replicate the issue and confirm that PR 839 fixes the problem immediately after being applied.

Can you pls try using the latest webform + webform civicrm and then apply 839 to see if it fixes?

If it fails, please attach the affected webform here so we can look further.

Thanks.

🇮🇳India jitendrapurohit

Hi @VangelisP

After applying the above patch, I get the following error on the Rule page -

Deprecated function: Optional parameter $params declared before required parameter $context is implicitly treated as a required parameter in include() (line 571 of /Users/jitendra/www/d9unit/vendor/composer/ClassLoader.php).include('/Users/jitendra/www/d9unit/web/core/includes/bootstrap.inc') (Line: 571)
Composer\Autoload\includeFile('/Users/jitendra/www/d9unit/web/modules/contrib/civicrm_group_roles/src/Batch/Sync.php') (Line: 428)
Composer\Autoload\ClassLoader->loadClass('Drupal\civicrm_group_roles\Batch\Sync') (Line: 259)
Drupal\Component\DependencyInjection\Container->createService(Array, 'civicrm_group_roles.batch.sync') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('civicrm_group_roles.batch.sync') (Line: 36)
Drupal\civicrm_group_roles\Form\ManualSyncForm::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('\Drupal\civicrm_group_roles\Form\ManualSyncForm') (Line: 48)
Drupal\Core\Controller\HtmlFormController->getFormObject(Object, '\Drupal\civicrm_group_roles\Form\ManualSyncForm') (Line: 58)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

which seems to be due to this part of the patch -

/**
    * Batch API process callback.
    *
+   * @param array $params
    * @param mixed $context
    *   Batch API context data.
    */
-  public function process(&$context) {
+  public function process($params = [], &$context) {

Changing it to public function process($params, &$context) { fixes the issue.

Also, there are fatal errors while adding a drupal role on a user after applying this patch. Can you fix that please? To replicate:

-

- Apply the patch.
- Create a rule to sync RoleA => GroupA.
- Assign RoleA to UserA => GroupA is assigned to the contact.
- Create another Rule to sync RoleB to GroupB.
- Edit the user and select RoleB on the form and save.
- Error.

From the db error: it looks like it is retrying to create an entry in civicrm_group_contact for GroupA. Here's the complete error with backtrace.

The website encountered an unexpected error. Please try again later.

Drupal\Core\Entity\EntityStorageException: DB Error: already exists in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
PEAR_Error->__construct('DB Error: already exists', -5, 16, Array, 'INSERT INTO `civicrm_group_contact` (`group_id` , `contact_id` , `status` ) VALUES ( 100 ,  23 , 'Added' )  [nativecode=1062 ** Duplicate entry '23-100' for key 'UI_contact_group']') (Line: 997)
DB_Error->__construct(-5, 16, Array, 'INSERT INTO `civicrm_group_contact` (`group_id` , `contact_id` , `status` ) VALUES ( 100 ,  23 , 'Added' )  [nativecode=1062 ** Duplicate entry '23-100' for key 'UI_contact_group']') (Line: 575)
PEAR::_raiseError(Object, NULL, -5, 16, Array, 'INSERT INTO `civicrm_group_contact` (`group_id` , `contact_id` , `status` ) VALUES ( 100 ,  23 , 'Added' )  [nativecode=1062 ** Duplicate entry '23-100' for key 'UI_contact_group']', 'DB_Error', 1) (Line: 223)
PEAR->__call('raiseError', Array) (Line: 1928)
DB_common->raiseError(-5, NULL, NULL, 'INSERT INTO `civicrm_group_contact` (`group_id` , `contact_id` , `status` ) VALUES ( 100 ,  23 , 'Added' )  [nativecode=1062 ** Duplicate entry '23-100' for key 'UI_contact_group']', '1062 ** Duplicate entry '23-100' for key 'UI_contact_group'') (Line: 943)
DB_mysqli->mysqliRaiseError() (Line: 413)
DB_mysqli->simpleQuery('INSERT INTO `civicrm_group_contact` (`group_id` , `contact_id` , `status` ) VALUES ( 100 ,  23 , 'Added' ) ') (Line: 1234)
DB_common->query('INSERT INTO `civicrm_group_contact` (`group_id` , `contact_id` , `status` ) VALUES ( 100 ,  23 , 'Added' ) ') (Line: 2696)
DB_DataObject->_query('INSERT INTO `civicrm_group_contact` (`group_id` , `contact_id` , `status` ) VALUES ( 100 ,  23 , 'Added' ) ') (Line: 1245)
DB_DataObject->insert() (Line: 683)
CRM_Core_DAO->save() (Line: 971)
CRM_Core_DAO::writeRecord(Array) (Line: 992)
CRM_Core_DAO::writeRecords(Array) (Line: 47)
Civi\Api4\Action\GroupContact\Create->write(Array) (Line: 134)
Civi\Api4\Generic\DAOCreateAction->writeObjects(Array) (Line: 35)
Civi\Api4\Generic\DAOCreateAction->_run(Object) (Line: 72)
Civi\Api4\Provider\ActionObjectProvider->invoke(Object) (Line: 158)
Civi\API\Kernel->runRequest(Object) (Line: 250)
Civi\Api4\Generic\AbstractAction->execute() (Line: 85)
civicrm_api4('GroupContact', 'create', Array) (Line: 423)
Drupal\civicrm_group_roles\CivicrmGroupRoles->updateGroupsOnContact(Object, Array) (Line: 55)
civicrm_group_roles_user_update(Object)
call_user_func_array(Object, Array) (Line: 426)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'civicrm_group_roles') (Line: 405)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('user_update', Object) (Line: 433)
Drupal\Core\Extension\ModuleHandler->invokeAll('user_update', Array) (Line: 249)
Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 903)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 598)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 784)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 523)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 804)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 46)
Drupal\user\ProfileForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 595)
Drupal\Core\Form\FormBuilder->processForm('user_form', Array, Object) (Line: 323)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
🇮🇳India jitendrapurohit

Thanks for the patch @VangelisP. Have tested it successfully and merged the changes.

🇮🇳India jitendrapurohit

Thanks @markusa for the patch. Have tested it successfully and merged the changes (except `civicrm_group_roles.services.yml` file changes since it was already present in the updated version).

🇮🇳India jitendrapurohit

I dont see civicrm_initialize() anywhere in webform_civicrm.module.

@Ranjit1032002 Are you using the latest version?

I've raised a PR to fix this - https://github.com/colemanw/webform_civicrm/pull/870

🇮🇳India jitendrapurohit

@dineshkumarbollu Why there are 3 arguments passed to debug_backtrace()? Doc has only 2 - https://www.php.net/manual/en/function.debug-backtrace.php

Can you please raise this PR against the github repo - https://github.com/colemanw/webform_civicrm. This is where our automated tests are configured to run.

🇮🇳India jitendrapurohit

I'm not able to replicate this on a clean install @nubeli. I think something is wrong with your setup. CiviCRM should be initialized using the CiviCRM Webform Handler plugin. See https://github.com/colemanw/webform_civicrm/blob/6.x/src/Plugin/WebformH...

Can you please confirm if webform_civicrm handler is present (screenshot attached) when you visit - /admin/structure/webform/manage//handlers in the URL?

If not - then the setup seems to be wrong. Is this webform migrated? If yes, the migration code need to create this handler in D9 to function correctly.

🇮🇳India jitendrapurohit

Can you please attach the affected webform yaml here. I'm not able to replicate this on the latest version.

🇮🇳India jitendrapurohit

Hi @jude.hungerford

I've raised a PR for the fix: https://github.com/colemanw/webform_civicrm/pull/862

Can you please test and confirm if it works for you? You might need to re-add the custom field on the webform.

Thanks.

🇮🇳India jitendrapurohit

I was able to replicate this with the steps mentioned above.

Looks like there was a bug in version 6.2.1 which was fixed in https://github.com/colemanw/webform_civicrm/pull/766

So now, If we've created a webform with the problematic 6.2.1 code, the subtype is stored in the webform settings with lowercase value.

The latest version is now using the exact value of subtype without altering it to lowercase, etc.

Fix: I think an upgrade code is required to update the lowercase value in all the webforms and update it to normal subtype value.

I've raised a PR - https://github.com/colemanw/webform_civicrm/pull/858

@jude.hungerford - Can you please apply the patch and run drush updb to confirm it fixes your webforms?

Thanks.

🇮🇳India jitendrapurohit

@roblog Can you test this patch please - https://github.com/colemanw/webform_civicrm/pull/839

I've replicated the problem in a test and have included the test in the PR so it does not regress again.

Thanks.

🇮🇳India jitendrapurohit

Above core issue is closed now. PR https://github.com/civicrm/civicrm-core/pull/23305 fixes the problem. Should be a part of CiviCRM version 5.58.

🇮🇳India jitendrapurohit

Looks like a problem in civicrm and not in the w_c module. The params sent from webform_civicrm is unchanges in PHP v7.4 & v8. There's an issue already raised in core - https://lab.civicrm.org/dev/core/-/issues/3942. I think this ticket should be fixed by the same.

🇮🇳India jitendrapurohit

I've raised a PR with the fix - https://github.com/colemanw/webform_civicrm/pull/835. It also includes a test so it does not regress again. @jstephens.hshsl Can you please review so we can merge it?

Thanks.

Production build 0.69.0 2024