Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Create donation receipt with "Search Action Designer" #197

Open
Detsieber opened this issue Jun 11, 2024 · 2 comments
Open

Comments

@Detsieber
Copy link

It should be possible to create a donation receipt for one or many contacts using the SearchActionDesigner extension.

In order to achieve this, it probably would be necessary to create an API call to create donation receipts.

@jensschuppe
Copy link
Collaborator

I actually can't see a reason for custom search actions using Search Action Designer, as there already is a search action for contact search results (i.e. generating donation receipts for multiple contacts), see

/**
* Add an action for creating donation receipts after doing a search
*
* @param string $objectType specifies the component
* @param array $tasks the list of actions
*
* @access public
*/
function donrec_civicrm_searchTasks($objectType, &$tasks) {
// add DONATION RECEIPT task to contact list
if ($objectType == 'contact') {
if (CRM_Core_Permission::check('create and withdraw receipts')) {
$tasks[] = array(
'title' => E::ts('Issue donation receipt(s)'),
'class' => 'CRM_Donrec_Form_Task_DonrecTask',
'result' => false);
$tasks[] = array(
'title' => E::ts('Withdraw donation receipt(s)'),
'class' => 'CRM_Donrec_Form_Task_DonrecResetTask',
'result' => false);
}
}

Could you provide some background for why the built-in forms don't work for you?

However, adding an API (v4) for creating donation receipts is a reasonable thing to do and should come with some refactoring of the (very) old code in this extension. This would allow for easier creation of actions for SearchKit-based searches of contacts and contributions. Something similar has been done in the CiviOffice extension, see systopia/de.systopia.civioffice#53

Refactoring should involve:

  • Merge CRM_Donrec_Form_Task_Create (which is actually not a task but a form controller used for a route), DonrecTask and ContributeTask in a trait (see CiviOffice's CreateDocumentsTrait)
  • CRM_Donrec_Logic_Selector::createSnapshot():
    • make independent from form field names (especially date picker fields)
    • use entity_type and entity_ids for receiving contact/contribution IDs
    • throw exceptions on errors
    • should be "the API"

@Peter-Reck
Copy link

@jensschuppe : Before civiCRM alle ZBW had be sent in paper form with a cover letter that where we easily could add personal notes. Now we switched to PFD ZWB's and it would be helpful to add personal comments to the existing eMail template. This could also be used to add seasonal greetings etc.

Using a Search action, even for a single ZWB would allow us to have all steps that we want to be done for sending out a ZWB within a single action. So the voluntieering team members do not need to recall every Single step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants