Files
itflow/api/v1/recurring_expenses/read.php
johnnyq ecbb974fff API stage 3, calendar events, trips, accounts and money, contracts, and files and folders: calendars can be read, and calendar events read with their attendees, created once or repeating for a client or nobody, changed, sent as invitations, skipped for a day of a series and deleted, following calendarEventCan(); trips can be read, logged, changed and deleted through tripSave() and tripDelete(), anyone their own and someone else's with Financial; accounts can be read with their balances, added, changed, archived, unarchived and deleted while nothing is on them, other income and transfers read, recorded, changed and deleted, and recurring expenses read, set up, changed, paused and resumed, recorded now, moved on past missed runs and deleted, keeping reconciled lines as they were; contracts can be read with their prepaid hours and signing state, added, changed, made active, renewed, cancelled and deleted, sent for signature or the link sent again, the request withdrawn, prepaid hours added with a draft invoice or deleted, tickets' time drawn or put back, and the billing recurring invoice made, linked or unlinked; a client's files can be read, uploaded as base64, downloaded, renamed, moved, archived, unarchived and deleted once archived, and folders read, made, renamed, moved and deleted with their contents moved up; new api/v1/form_input.php builds a save function's input from the API's field names; the upload allow-list moves from agent/post/file.php into fileUploadExtensions() so Upload Files and the API check the same list; enforce_api_rbac.php maps the new resources, lets events, calendars and trips check their own rules, puts the new state changes at Modify and treats files/download as a read; 26.11.9 changelog entries
2026-11-13 23:51:10 -05:00

29 lines
1.3 KiB
PHP

<?php
/*
* API - Recurring Expenses - Read
* GET /api/v1/recurring_expenses/read.php
*
* Bills that come round - a monthly hosting bill, a yearly domain - each with
* its vendor's, category's and account's names, when it is next due, and whether
* it runs (recurring_expense_status 1) or is paused or ended (0).
*
* recurring_expense_id optional - Just this one
* client_id optional - Just this client's; 0 for the business's own
* limit, offset optional - Paging
*/
require_once '../validate_api_key.php';
require_once '../require_get_method.php';
$where = 'recurring_expense_archived_at IS NULL' . (isset($_GET['recurring_expense_id']) ? ' AND recurring_expense_id = ' . intval($_GET['recurring_expense_id']) : '');
$sql = mysqli_query($mysqli, "SELECT recurring_expenses.*, vendor_name, category_name, account_name, client_name FROM recurring_expenses
LEFT JOIN vendors ON vendor_id = recurring_expense_vendor_id
LEFT JOIN categories ON category_id = recurring_expense_category_id
LEFT JOIN accounts ON account_id = recurring_expense_account_id
LEFT JOIN clients ON client_id = recurring_expense_client_id
WHERE $where " . apiClientScopeSql('recurring_expense_client_id') . " ORDER BY recurring_expense_next_date, recurring_expense_id LIMIT $limit OFFSET $offset");
// Output
require_once "../read_output.php";