3

I have setup a webform using the Civi/Drupal webform module, which allows people to submit payments they intend to make and keep it as Pending before they make it.

What is happening is the contribution goes in as Pending but when you change the amount and go to record a payment the amount stays as the original amount. This is because a payment was recorded.

How do i stop contribution page from recording a payment and i just want the contribution to be Pending in CiviCRM Contribution Page on that users account.

Thanks

1
  • drupal 7? would that be?
    – petednz - fuzion
    Commented Feb 11, 2020 at 20:34

1 Answer 1

1

Yes, its a bug in civicrm webform module as it doesn't record line item correctly. The price field value and price field id are missing. I have a patch(for 7.x-5.0) that works for contribution amount field but not for line item field in webform. If you are using contribution amount than you can give it a try.

diff --git a/includes/wf_crm_webform_postprocess.inc b/includes/wf_crm_webform_postprocess.inc
index ea9dc8f..5a78d2e 100644
--- a/includes/wf_crm_webform_postprocess.inc
+++ b/includes/wf_crm_webform_postprocess.inc
@@ -1552,14 +1552,17 @@ class wf_crm_webform_postprocess extends wf_crm_webform_base {
     // Contribution
     $fid = 'civicrm_1_contribution_1_contribution_total_amount';
     if (isset($this->enabled[$fid]) || $this->getData($fid) > 0) {
-      $this->line_items[] = array(
-        'qty' => 1,
-        'unit_price' => $this->getData($fid),
+      $params = [
         'financial_type_id' => $this->contribution_page['financial_type_id'],
+        'total_amount' => $this->getData($fid),
+      ];
+      CRM_Price_BAO_LineItem::getLineItemArray($params, NULL, 'contribution');
+      $lineItem = reset(reset($params['line_item']));
+      $this->line_items[] = array_merge($lineItem, [
         'label' => wf_crm_aval($this->node->webform['components'], $this->enabled[$fid] . ':name', t('Contribution')),
         'element' => 'civicrm_1_contribution_1',
         'entity_table' => 'civicrm_contribution',
-      );
+      ]);
     }
     // LineItems
     $fid = "civicrm_1_lineitem_1_contribution_line_total";
8
  • Thanks for this - Where do i post this patch?
    – Moe
    Commented Feb 12, 2020 at 8:33
  • Did the patch work for you? Commented Feb 12, 2020 at 8:43
  • I am not sure how to apply the patch, so want to figure that out first. Sorry :(
    – Moe
    Commented Feb 12, 2020 at 8:45
  • The patch should be on 7.x - 5.0 version of the module... But it should also work for version greater than 7.x-24... you can either apply it manually or use command Commented Feb 12, 2020 at 8:47
  • You need to apply the patch for webform CiviCRM module Commented Feb 12, 2020 at 8:48

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.