5

I am using CiviCRM 4.7 in combination with Webform CiviCRM version 7.4-14. The payment fields are not showing, but on submitting it asks for the invisible fields to be filled in.

Is there anything wrong with the config that I am missing?

1

3 Answers 3

3

Webform-CiviCRM integration is not yet compatible with CiviCRM 4.7. See here: https://www.drupal.org/node/2661232

3

TLDR; I've created a patched repo for easier download: https://github.com/emphanos/webform_civicrm

cd <your_drupal_7_docroot>
cd sites/all/modules/contrib/
rm -rf webform_civicrm
git clone https://github.com/emphanos/webform_civicrm.git
drush en -y webform_civicrm
drush updatedb -y
drush cc all

The longer more detailed information on the bug fix:

For webform_civicrm to work with CiviCRM 4.7.18 you'll need the latest dev branch of webform https://www.drupal.org/project/webform_civicrm/releases/7.x-4.x-dev (released 2017-Apr-05) and patch it with this patch https://www.drupal.org/files/issues/2661232.patch

cd <your_doc_root>
drush dl -y webform_civicrm --dev
drush en -y webform_civicrm
drush updatedb -y
cd sites/all/modules/contrib/webform_civicrm/
wget https://www.drupal.org/files/issues/2661232.patch

(see issue here: https://www.drupal.org/node/2661232) NOTE: Everything except for the last chunk of the patch will be applied, just skip the last chunk.

patch -p1 < 2661232.patch
patching file includes/wf_crm_webform_base.inc
Hunk #1 succeeded at 32 (offset 8 lines).
Hunk #2 succeeded at 71 with fuzz 2 (offset 11 lines).
patching file includes/wf_crm_webform_postprocess.inc
Hunk #1 succeeded at 1926 with fuzz 1 (offset 151 lines).
patching file includes/wf_crm_webform_preprocess.inc
Hunk #1 FAILED at 183.
1 out of 1 hunk FAILED -- saving rejects to file includes/wf_crm_webform_preprocess.inc.rej
patching file js/webform_civicrm_payment.js
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n] n
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file js/webform_civicrm_payment.js.rej

You'll notice that the payment fields don't get displayed, but that the total is also coming out as zero. There is a problem in the JQuery summation function in tally() that will incorrectly add up the data-amount values and in case the total is zero will not display the payment block.

The Paypal Express Orange Checkout button will also not work, so it's best to hide it from showing up to avoid user confusion.

You'll need to fix the tally function you need to apply a few changes to this file sites/all/modules/contrib/webform_civicrm/js/webform_civicrm_payment.js

diff --git a/js/webform_civicrm_payment.js b/js/webform_civicrm_payment.js
index d1eaf44..a8ad53d 100644
--- a/js/webform_civicrm_payment.js
+++ b/js/webform_civicrm_payment.js
@@ -26,11 +26,7 @@ cj(function($) {
         // When an express payment button is clicked, skip the billing fields and submit the form with a placeholder
         var $expressButton = $('input[name$=_upload_express]', '#billing-payment-block');
         if ($expressButton.length) {
-          $expressButton.removeClass('crm-form-submit').click(function(e) {
-            e.preventDefault();
-            $('input[name=credit_card_number]', '#billing-payment-block').val('express');
-            $(this).closest('form').find('input.webform-submit.button-primary').click();
-          })
+            $('#billing-payment-block .description').hide();
         }
       });
     }
@@ -50,7 +46,7 @@ cj(function($) {

   function tally() {
     var total = 0;
-    $('.line-item:visible', '#wf-crm-billing-items').each(function() {
+    $("#wf-crm-billing-items tr:not(#wf-crm-billing-total)").each(function() {
       total += parseFloat($(this).data('amount'));
     });
     $('td+td', '#wf-crm-billing-total').html(CRM.formatMoney(total));
3
  • Does this also work for 4.7.19? We just updated our dev site to the latest CiviCRM and I cloned the repository, however I'm not still not seeing the payment fields. May 12, 2017 at 19:42
  • I haven't tested this on the latest 4.7.19 but once I do I'll report back here and update the repo. Also, did you by chance clear the drupal cache after enabling the drupal module? May 20, 2017 at 8:22
  • I've since updated to 4.7.20, however I've cleared the cache multiple times on both versions with the patched version you provided and still nothing. I've also used the latest dev version (June 14th) and nothing. Jun 19, 2017 at 23:04
0

Try the following suggestions:

1) Clear Drupal Cache (under System -> Performance).

2) Look to see if you are using any custom templates - these can show different fields to those required by webform. If you aren't a coder your developer or webadmin will be able to help you here.

3) Remember that payment values generally need to be handled differently than normal data. Particularly be wary of this information being stored longer than needed in the submissions table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.