<?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) { $spec['contact_id']['description'] = 'Specify a timebank\'s contact ID to generate the invoice for, or leave blank to select all active timebanks.'; $spec['billing_period']['description'] = 'The year, a dash, and a 1 or 2 for the first or second half of the year. E.g. 2019-2 for 7/1/19-12/31/19.'; $spec['billing_period']['api.required'] = 1; $spec['invoice_date']['description'] = 'Date of the invoice(s) to generate, or leave blank for today\'s date. Format as: 2019-7-25'; $spec['due_date']['description'] = 'Due date of the invoice(s), or leave blank for March 31st/September 30th (based on billing period. Format as: 2019-7-25'; $spec['period_begin_date']['description'] = 'Period begin date, or leave blank for January 1st/July 1st (based on billing period). Format as: 2019-7-25'; $spec['period_end_date']['description'] = 'Period end date, or leave blank for June 30th/December 31st (based on billing period). Format as: 2019-7-25'; } /** * 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) { $returnValues = CRM_Tbusainvoicegen_Timebank::generate($params); return civicrm_api3_create_success($returnValues, $params, 'Invoicegen', 'generate'); }