2019-06-28 20:54:40 +00:00
|
|
|
<?php
|
|
|
|
use CRM_Tbusainvoicegen_ExtensionUtil as E;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoicegen.Generate API specification (optional)
|
|
|
|
* This is used for documentation and validation.
|
|
|
|
*
|
|
|
|
* @param array $spec description of fields supported by this API call
|
|
|
|
* @return void
|
|
|
|
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards
|
|
|
|
*/
|
|
|
|
function _civicrm_api3_invoicegen_Generate_spec(&$spec) {
|
2019-06-28 21:30:27 +00:00
|
|
|
$spec['contact_id']['api.required'] = 0;
|
2019-06-28 22:01:05 +00:00
|
|
|
$spec['billing_period']['api.required'] = 1;
|
2019-06-28 20:54:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoicegen.Generate API
|
|
|
|
*
|
|
|
|
* @param array $params
|
|
|
|
* @return array API result descriptor
|
|
|
|
* @see civicrm_api3_create_success
|
|
|
|
* @see civicrm_api3_create_error
|
|
|
|
* @throws API_Exception
|
|
|
|
*/
|
|
|
|
function civicrm_api3_invoicegen_Generate($params) {
|
2019-06-28 21:30:27 +00:00
|
|
|
$returnValues = CRM_Tbusainvoicegen_Timebank::generate($params['contact_id'], $params['billing_period']);
|
|
|
|
return civicrm_api3_create_success($returnValues, $params, 'Invoicegen', 'generate');
|
2019-06-28 20:54:40 +00:00
|
|
|
}
|