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
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 Feb 12 '20 at 8:33
  • Did the patch work for you? – Pradeep Nayak Feb 12 '20 at 8:43
  • I am not sure how to apply the patch, so want to figure that out first. Sorry :( – Moe Feb 12 '20 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 – Pradeep Nayak Feb 12 '20 at 8:47
  • You need to apply the patch for webform CiviCRM module – Pradeep Nayak Feb 12 '20 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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