Answers.Body: <p>I just published an extension called <a href="https://github.com/MegaphoneJon/com.megaphonetech.softcreditcustomfields" rel="nofollow noreferrer">Soft Credit Custom Fields</a>.  As a side effect of what it does, it also allows you to search for soft credit type even when returning hard contributions, which should solve this issue.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-26T22:23:51.750Z
Answers.LastActivityDate: 2019-03-26T22:23:51.750Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Note that with SearchKit you can avoid Advanced Search malfunction.</p>
  <pre><code>[
    [
      &quot;SavedSearch&quot;,
      &quot;save&quot;,
      {
        &quot;records&quot;: [
          {
            &quot;name&quot;: &quot;Fundraisers_P2P&quot;,
            &quot;label&quot;: &quot;Fundraisers P2P&quot;,
            &quot;api_entity&quot;: &quot;Contact&quot;,
            &quot;api_params&quot;: {
              &quot;version&quot;: 4,
              &quot;select&quot;: [
                &quot;id&quot;,
                &quot;sort_name&quot;,
                &quot;contact_type:label&quot;,
                &quot;contact_sub_type:label&quot;,
                &quot;GROUP_CONCAT(DISTINCT Contact_ContributionSoft_contact_id_01.soft_credit_type_id:label) AS GROUP_CONCAT_Contact_ContributionSoft_contact_id_01_soft_credit_type_id_label&quot;
              ],
              &quot;orderBy&quot;: [],
              &quot;where&quot;: [
                [
                  &quot;Contact_ContributionSoft_contact_id_01.soft_credit_type_id:name&quot;,
                  &quot;=&quot;,
                  &quot;pcp&quot;
                ]
              ],
              &quot;groupBy&quot;: [
                &quot;id&quot;
              ],
              &quot;join&quot;: [
                [
                  &quot;ContributionSoft AS Contact_ContributionSoft_contact_id_01&quot;,
                  &quot;INNER&quot;,
                  [
                    &quot;id&quot;,
                    &quot;=&quot;,
                    &quot;Contact_ContributionSoft_contact_id_01.contact_id&quot;
                  ]
                ]
              ],
              &quot;having&quot;: []
            }
          }
        ],
        &quot;match&quot;: [
          &quot;name&quot;
        ]
      }
    ]
  ]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-22T17:06:46.417Z
Answers.LastActivityDate: 2023-12-22T17:06:46.417Z
Answers.UserDisplayName: Francesc Bassas i Bullich
Body: <p>I have just upgraded from 4.4 to 4.7.19 and can't seem to identify a certain group of contacts now that the "In honour of" functionality has been subsumed into Soft credits.</p>
  
  <p>When admin processes a membership, if the box "Record Payment from a Different Contact?" is ticked you can record that the payment for the membership was made by someone other than the member and send the receipt to the "other" rather than the member.  </p>
  
  <p>This results in the actual contribution being recorded against the "other" contact and a soft credit being recorded for the member.</p>
  
  <p>I need to create a smart group of all the "paid for someone else" contacts for a certain soft credit type. </p>
  
  <p>In Advanced Search with results displayed as contacts, when defining contribution search criteria the options for the <strong>Contributions OR Soft Credits?</strong> field are:</p>
  
  <ul>
  <li>Contributions only </li>
  <li>Soft credits only</li>
  <li>Soft credits with related Hard credit</li>
  <li>Both</li>
  </ul>
  
  <p>(With the last three options a box that lets you specify soft credit type appears.)</p>
  
  <p>Based on the names of the options, my plan was to create groups of contacts from  "Soft credits only" and "Soft credits with related Hard credit** searches and use the include/exclude custom search to create the "related hard credit contacts" group.  But it doesn't work.</p>
  
  <p>I would have thought <strong>Soft credits with related Hard credit</strong> should have given me a list of both the contacts getting a soft credit and the contacts who made the contributions that lead to the soft credits. However the results for <strong>Soft credits with related Hard credit</strong> are the same as the results for <strong>Soft credits only</strong> AND the results for <strong>Both</strong> are also the same.</p>
  
  <p>This is true whether I am displaying results as contacts or as contributions.</p>
  
  <p>So, I am not sure how the last three options differ from each other and I am no closer to being able to identify those people/organisations who paid for someone else's membership. </p>
  
  <p>I did look at Search Builder also, but it does not seem to recognize any of the soft credit fields.</p>
  
  <p>Does anyone have any suggestions?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-26T18:08:24.557Z
Comments.Text: I spent some time playing with this and to me it's a bug.  I dug into the code a bit and see that it creates a temp table that includes both.  It looks like the where clause for the query against the temp table should also return contact id's for both; though, of course those built up sql queries can end up with all sorts of things in them.
Comments.UserDisplayName: Paul-Tahoe
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-27T06:38:07.993Z
Comments.Text: I have worked out that "Soft credits with related Hard credit" and "Both" searches work as the terms suggest if you don't specify the Soft credit type.  Once you specify the soft creidt type they revert to displaying the same results as for "soft Credit only" searches.  This is bug IMO.  I will create an issue  for it.  I will post back the issue link when that is done.
Comments.UserDisplayName: JoAnne
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-17T10:38:11.537Z
Comments.Text: Here's the issue reported by @JoAnne [CRM-20645 "Soft credits with related Hard credit" and "Both" searches don't work properly when soft credit type is specified](https://issues.civicrm.org/jira/browse/CRM-20645)
Comments.UserDisplayName: Francesc Bassas i Bullich
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-18T14:32:24.443Z
Comments.Text: I reopened @JoAnne issue at https://lab.civicrm.org/dev/core/issues/1055
Comments.UserDisplayName: Francesc Bassas i Bullich
Tags: <contributions><search><soft-credit>
Title: How can I identify the hard contributions/contributors that lead to a soft credit?
ThreadText: # How can I identify the hard contributions/contributors that lead to a soft credit?
  
  (Asked by: username_0 on 2017-05-26)
  
  I have just upgraded from 4.4 to 4.7.19 and can't seem to identify a certain group of contacts now that the "In honour of" functionality has been subsumed into Soft credits.
  
  When admin processes a membership, if the box "Record Payment from a Different Contact?" is ticked you can record that the payment for the membership was made by someone other than the member and send the receipt to the "other" rather than the member.
  
  This results in the actual contribution being recorded against the "other" contact and a soft credit being recorded for the member.
  
  I need to create a smart group of all the "paid for someone else" contacts for a certain soft credit type.
  
  In Advanced Search with results displayed as contacts, when defining contribution search criteria the options for the **Contributions OR Soft Credits?** field are:
  
  * Contributions only
  * Soft credits only
  * Soft credits with related Hard credit
  * Both
  
  (With the last three options a box that lets you specify soft credit type appears.)
  
  Based on the names of the options, my plan was to create groups of contacts from "Soft credits only" and "Soft credits with related Hard credit\*\* searches and use the include/exclude custom search to create the "related hard credit contacts" group. But it doesn't work.
  
  I would have thought **Soft credits with related Hard credit** should have given me a list of both the contacts getting a soft credit and the contacts who made the contributions that lead to the soft credits. However the results for **Soft credits with related Hard credit** are the same as the results for **Soft credits only** AND the results for **Both** are also the same.
  
  This is true whether I am displaying results as contacts or as contributions.
  
  So, I am not sure how the last three options differ from each other and I am no closer to being able to identify those people/organisations who paid for someone else's membership.
  
  I did look at Search Builder also, but it does not seem to recognize any of the soft credit fields.
  
  Does anyone have any suggestions?
  
  **Tags:** contributions, search, soft-credit
  
  > **Comments:**
  > **username_1**: I spent some time playing with this and to me it's a bug.  I dug into the code a bit and see that it creates a temp table that includes both.  It looks like the where clause for the query against the temp table should also return contact id's for both; though, of course those built up sql queries can end up with all sorts of things in them.  
  > **username_0**: I have worked out that "Soft credits with related Hard credit" and "Both" searches work as the terms suggest if you don't specify the Soft credit type.  Once you specify the soft creidt type they revert to displaying the same results as for "soft Credit only" searches.  This is bug IMO.  I will create an issue  for it.  I will post back the issue link when that is done.  
  > **username_2**: Here's the issue reported by @username_0 [CRM-20645 "Soft credits with related Hard credit" and "Both" searches don't work properly when soft credit type is specified](https://issues.civicrm.org/jira/browse/CRM-20645)  
  > **username_2**: I reopened @username_0 issue at https://lab.civicrm.org/dev/core/issues/1055  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2019-03-26. Score: 2
  
  I just published an extension called [Soft Credit Custom Fields](https://github.com/MegaphoneJon/com.megaphonetech.softcreditcustomfields). As a side effect of what it does, it also allows you to search for soft credit type even when returning hard contributions, which should solve this issue.
  
  
  ---
  
  ### Answer by username_2 on 2023-12-22. Score: 0
  
  Note that with SearchKit you can avoid Advanced Search malfunction.
  
  ```
  [
    [
      "SavedSearch",
      "save",
      {
        "records": [
          {
            "name": "Fundraisers_P2P",
            "label": "Fundraisers P2P",
            "api_entity": "Contact",
            "api_params": {
              "version": 4,
              "select": [
                "id",
                "sort_name",
                "contact_type:label",
                "contact_sub_type:label",
                "GROUP_CONCAT(DISTINCT Contact_ContributionSoft_contact_id_01.soft_credit_type_id:label) AS GROUP_CONCAT_Contact_ContributionSoft_contact_id_01_soft_credit_type_id_label"
              ],
              "orderBy": [],
              "where": [
                [
                  "Contact_ContributionSoft_contact_id_01.soft_credit_type_id:name",
                  "=",
                  "pcp"
                ]
              ],
              "groupBy": [
                "id"
              ],
              "join": [
                [
                  "ContributionSoft AS Contact_ContributionSoft_contact_id_01",
                  "INNER",
                  [
                    "id",
                    "=",
                    "Contact_ContributionSoft_contact_id_01.contact_id"
                  ]
                ]
              ],
              "having": []
            }
          }
        ],
        "match": [
          "name"
        ]
      }
    ]
  ]
  
  ```
  
  
  ---
  
  