Hi,
I am co-maintainer of Drupal Project Managment (Drupal PM) and related PM Invoice module.
The 7.x-1.x version of Drupal PM uses its own invoicing entity. We have decided to stop doing that and reuse Invoice. This would reduce duplication of effort. For this we are providing a connector module which would provide rules and action integration with various invoicing module. You can read about the discussion here #2342329: Future of PM Invoice module.
In order to accomplish this,
We would need a clean api to create invoice, organization and items programmatically. Using REST API to create invoices (#1997320: How to create an invoice trough rest api in php or other method from my custom module?) in the same system seems to be a hacky solution.
Am attaching a patch to help visualize the changes required.
Once the patch is applied i could call the function from my module to add an item to the invoice.
<?php
$invoice = node_load(123); // load the invoice node.
$active_template = $invoice->invoice['template'];
$item = array(
"iid" => NULL,
"invoice_number" => $invoice->invoice['invoice_number'],
"description" => 'Some description of item',
"quantity" => '1',
"price_without_vat" => '100',
"price_with_vat" => "",
"vat" => _invoice_get_variable($active_template, 'vat'),
);
invoice_controller_save_item($item);
?php>
Is it feasible?
I am ready to provide similar patches if required.
Comment | File | Size | Author |
---|---|---|---|
#2 | issue-2350455-01-interacting-with-other-modules-concept.patch | 1.66 KB | D34dMan |
Comments
Comment #1
D34dMan CreditAttribution: D34dMan commentedComment #2
D34dMan CreditAttribution: D34dMan commentedThe original patch had a bug. Correcting the infinite loop bug and uploading a fresh patch.