I need a customized invoice generation. So I thought that would be pretty straightforward: I use the civicrm_post hook on Contribution when the invoice ID is updated. Unfortunately the contribution post hook is not called when the invoice_id is updated. Any suggestion on how I tackle this now for this specific instance (and yes, I will also add a PR for a core change to call the post hook when the invoice id is updated in the contribution)?
-
FYI issues.civicrm.org/jira/browse/CRM-20363 . – Kainuk - CiviCooP Mar 30 '17 at 16:30
I have temporarily solved it by making a change to the core CRM_Contribute_Form_Task_Invoice to use my function for invoice generation if the class I use can be found. Temporary fix for the customer with their current version.
What I am planning on doing as a core PR is taking out the invoiceId generation in CRM_Contribute_Form_Task_Invoice and replace it with an API call: Invoice Generate. That means anyone who wants to customize it can use the apiWrapper hook to do so. Does that make sense?
-
Another option is to use the Contribution BAO to update the invoice id. That makes invoice generation possible in the post hook. – Kainuk - CiviCooP Mar 30 '17 at 16:34