SLPĀ® phpDocs

MySLP_Accounting_Monthly_History

Accounting monthly history table management and CRUD helpers.

Table of Contents

Constants

INSTALLED_VERSION_OPTION  : mixed = 'myslp_accounting_monthly_history_installed_ver...
TABLE_SLUG  : mixed = 'slp_accounting_monthly_history'

Methods

create_record()  : array<string, int|string>|WP_Error
Create a new ledger record.
delete_record()  : true|WP_Error
Delete a ledger record.
get_monthly_matrix()  : array{months: array>, rows: array>}
Build a gap-free monthly summary matrix by entry key.
get_record()  : array<string, int|string>|null
Retrieve one record by ID.
get_table_name()  : string
Return the multisite main-site table name.
list_keys()  : array<int, string>
Return the distinct set of ledger keys.
list_records()  : array{records: array>, total: int}
Fetch a paginated list of records.
list_records_for_key()  : array<int, array<string, int|string>>
List rows for a specific ledger key ordered by date.
maybe_update_schema()  : void
Create or update the accounting monthly history table once per plugin version.
update_record()  : array<string, int|string>|WP_Error
Update an existing ledger record.
build_month_range()  : array<int, array<string, string>>
Create a continuous list of month keys and labels between two yyyy-mm values.
format_record()  : array<string, int|string>
Convert a DB row into API output.
map_orderby()  : string
Map API sort fields to SQL columns.
normalize_amount_input()  : int|WP_Error
Normalize dollar input into stored integer cents.
normalize_date_input()  : array<string, int|string>|WP_Error
Normalize user-entered date text into the DB shape.
sanitize_record_input()  : array<string, int|string>|WP_Error
Normalize and validate row input.

Constants

Methods

create_record()

Create a new ledger record.

public static create_record(array<string|int, mixed> $data) : array<string, int|string>|WP_Error
Parameters
$data : array<string|int, mixed>
Return values
array<string, int|string>|WP_Error

delete_record()

Delete a ledger record.

public static delete_record(int $id) : true|WP_Error
Parameters
$id : int
Return values
true|WP_Error

get_monthly_matrix()

Build a gap-free monthly summary matrix by entry key.

public static get_monthly_matrix() : array{months: array>, rows: array>}
Return values
array{months: array>, rows: array>}

get_record()

Retrieve one record by ID.

public static get_record(int $id) : array<string, int|string>|null
Parameters
$id : int
Return values
array<string, int|string>|null

list_records()

Fetch a paginated list of records.

public static list_records(array<string|int, mixed> $args) : array{records: array>, total: int}
Parameters
$args : array<string|int, mixed>
Return values
array{records: array>, total: int}

list_records_for_key()

List rows for a specific ledger key ordered by date.

public static list_records_for_key(string $entry_key) : array<int, array<string, int|string>>
Parameters
$entry_key : string
Return values
array<int, array<string, int|string>>

maybe_update_schema()

Create or update the accounting monthly history table once per plugin version.

public static maybe_update_schema() : void

update_record()

Update an existing ledger record.

public static update_record(int $id, array<string|int, mixed> $data) : array<string, int|string>|WP_Error
Parameters
$id : int
$data : array<string|int, mixed>
Return values
array<string, int|string>|WP_Error

build_month_range()

Create a continuous list of month keys and labels between two yyyy-mm values.

private static build_month_range(string $min_month, string $max_month) : array<int, array<string, string>>
Parameters
$min_month : string
$max_month : string
Return values
array<int, array<string, string>>

format_record()

Convert a DB row into API output.

private static format_record(array<string|int, mixed> $row) : array<string, int|string>
Parameters
$row : array<string|int, mixed>
Return values
array<string, int|string>

map_orderby()

Map API sort fields to SQL columns.

private static map_orderby(string $orderby) : string
Parameters
$orderby : string
Return values
string

normalize_amount_input()

Normalize dollar input into stored integer cents.

private static normalize_amount_input(mixed $raw_amount) : int|WP_Error

If the user leaves out a decimal point, treat the value as whole dollars.

Parameters
$raw_amount : mixed
Return values
int|WP_Error

normalize_date_input()

Normalize user-entered date text into the DB shape.

private static normalize_date_input(string $raw_date) : array<string, int|string>|WP_Error
Parameters
$raw_date : string
Return values
array<string, int|string>|WP_Error

sanitize_record_input()

Normalize and validate row input.

private static sanitize_record_input(array<string|int, mixed> $data) : array<string, int|string>|WP_Error
Parameters
$data : array<string|int, mixed>
Return values
array<string, int|string>|WP_Error
On this page

Search results