diff --git a/client b/client index 474b9761..a46ff110 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit 474b9761ce151f7cf0b8e7e1daa931fdfb2e555a +Subproject commit a46ff11093302dfaea766cf09067c9a4011b7501 diff --git a/client-gui2 b/client-gui2 index 7c8d53d4..c4d5a9d2 160000 --- a/client-gui2 +++ b/client-gui2 @@ -1 +1 @@ -Subproject commit 7c8d53d4e952b1a5834bc7fc988798539a4664fd +Subproject commit c4d5a9d22bb669d711971d1cbf84a3389ef61fbe diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index 7ce10b52..87573a2c 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -743,4 +743,8 @@ message ListColumnTypesResponse { // Every column type, declarable or not, ordered by name. repeated ColumnType column_types = 1; + + // Every canonical ISO-4217 code accepted by currency-bearing columns and + // profile accounting settings, ordered alphabetically. + repeated string currency_codes = 2; } diff --git a/common/src/money.rs b/common/src/money.rs index dd479191..944931cf 100644 --- a/common/src/money.rs +++ b/common/src/money.rs @@ -18,6 +18,24 @@ pub fn require_iso_currency_code(currency_code: &str) -> Result<&'static iso::Cu iso::find(currency_code).ok_or_else(|| format!("Unknown ISO-4217 currency: {currency_code}")) } +/// Returns every currency accepted by [`require_iso_currency_code`], ordered by +/// its canonical alphabetic code. +pub fn iso_currency_codes() -> Vec<&'static str> { + let mut currencies = Vec::new(); + for first in b'A'..=b'Z' { + for second in b'A'..=b'Z' { + for third in b'A'..=b'Z' { + let bytes = [first, second, third]; + let code = std::str::from_utf8(&bytes).expect("uppercase ASCII currency code"); + if let Some(currency) = iso::find(code) { + currencies.push(currency.iso_alpha_code); + } + } + } + } + currencies +} + #[cfg(test)] mod tests { use super::*; diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 40435b67..54a97cb0 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.table_definition.rs b/common/src/proto/komp_ac.table_definition.rs index 58adeb9c..5ae3147a 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -734,6 +734,10 @@ pub struct ListColumnTypesResponse { /// Every column type, declarable or not, ordered by name. #[prost(message, repeated, tag = "1")] pub column_types: ::prost::alloc::vec::Vec, + /// Every canonical ISO-4217 code accepted by currency-bearing columns and + /// profile accounting settings, ordered alphabetically. + #[prost(string, repeated, tag = "2")] + pub currency_codes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Nested message and enum types in `ListColumnTypesResponse`. pub mod list_column_types_response {