summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/administration.cpp152
-rw-r--r--src/administration_reader.cpp8
-rw-r--r--src/administration_writer.cpp108
-rw-r--r--src/ui/imgui_extensions.cpp16
-rw-r--r--src/ui/ui_invoices.cpp2
5 files changed, 143 insertions, 143 deletions
diff --git a/src/administration.cpp b/src/administration.cpp
index 5476718..724f25f 100644
--- a/src/administration.cpp
+++ b/src/administration.cpp
@@ -233,27 +233,27 @@ char* administration::get_default_currency()
char* administration::get_currency_symbol_for_currency(char* code)
{
// Major European currencies
- if (strcmp(code, "EUR") == 0) return "€"; // Euro
- if (strcmp(code, "GBP") == 0) return "£"; // British Pound
- if (strcmp(code, "CHF") == 0) return "CHF"; // Swiss Franc (no special sign, usually "CHF")
- if (strcmp(code, "NOK") == 0) return "kr"; // Norwegian Krone
- if (strcmp(code, "SEK") == 0) return "kr"; // Swedish Krona
- if (strcmp(code, "DKK") == 0) return "kr"; // Danish Krone
- if (strcmp(code, "ISK") == 0) return "kr"; // Icelandic Króna
- if (strcmp(code, "CZK") == 0) return "Kč"; // Czech Koruna
- if (strcmp(code, "PLN") == 0) return "zł"; // Polish Złoty
- if (strcmp(code, "HUF") == 0) return "Ft"; // Hungarian Forint
- if (strcmp(code, "RON") == 0) return "lei"; // Romanian Leu
- if (strcmp(code, "BGN") == 0) return "лв"; // Bulgarian Lev
- if (strcmp(code, "HRK") == 0) return "kn"; // Croatian Kuna (before Euro, now EUR since 2023)
- if (strcmp(code, "RSD") == 0) return "дин"; // Serbian Dinar
- if (strcmp(code, "MKD") == 0) return "ден"; // Macedonian Denar
- if (strcmp(code, "ALL") == 0) return "L"; // Albanian Lek
- if (strcmp(code, "MDL") == 0) return "L"; // Moldovan Leu
- if (strcmp(code, "BYN") == 0) return "Br"; // Belarusian Ruble
- if (strcmp(code, "UAH") == 0) return "₴"; // Ukrainian Hryvnia
- if (strcmp(code, "RUB") == 0) return "₽"; // Russian Ruble
- if (strcmp(code, "TRY") == 0) return "₺"; // Turkish Lira
+ if (strops::equals(code, "EUR")) return "€"; // Euro
+ if (strops::equals(code, "GBP")) return "£"; // British Pound
+ if (strops::equals(code, "CHF")) return "CHF"; // Swiss Franc (no special sign, usually "CHF")
+ if (strops::equals(code, "NOK")) return "kr"; // Norwegian Krone
+ if (strops::equals(code, "SEK")) return "kr"; // Swedish Krona
+ if (strops::equals(code, "DKK")) return "kr"; // Danish Krone
+ if (strops::equals(code, "ISK")) return "kr"; // Icelandic Króna
+ if (strops::equals(code, "CZK")) return "Kč"; // Czech Koruna
+ if (strops::equals(code, "PLN")) return "zł"; // Polish Złoty
+ if (strops::equals(code, "HUF")) return "Ft"; // Hungarian Forint
+ if (strops::equals(code, "RON")) return "lei"; // Romanian Leu
+ if (strops::equals(code, "BGN")) return "лв"; // Bulgarian Lev
+ if (strops::equals(code, "HRK")) return "kn"; // Croatian Kuna (before Euro, now EUR since 2023)
+ if (strops::equals(code, "RSD")) return "дин"; // Serbian Dinar
+ if (strops::equals(code, "MKD")) return "ден"; // Macedonian Denar
+ if (strops::equals(code, "ALL")) return "L"; // Albanian Lek
+ if (strops::equals(code, "MDL")) return "L"; // Moldovan Leu
+ if (strops::equals(code, "BYN")) return "Br"; // Belarusian Ruble
+ if (strops::equals(code, "UAH")) return "₴"; // Ukrainian Hryvnia
+ if (strops::equals(code, "RUB")) return "₽"; // Russian Ruble
+ if (strops::equals(code, "TRY")) return "₺"; // Turkish Lira
// Unknown currency
return "?";
@@ -506,7 +506,7 @@ void administration::create_income_statement(income_statement* statement)
assert(yy == quarter->year && qq == quarter->quarter);
quarter->is_empty = 0;
- if (strcmp(inv->project_id, "") == 0) {
+ if (strops::equals(inv->project_id, "")) {
if (inv->is_outgoing) {
quarter->uncategorized_revenue += inv->total;
quarter->uncategorized_taxes += inv->tax;
@@ -523,7 +523,7 @@ void administration::create_income_statement(income_statement* statement)
int project_report_index = -1;
for (u32 x = 0; x < quarter->report_count; x++)
{
- if (strcmp(quarter->reports[x].project_id, inv->project_id) == 0) {
+ if (strops::equals(quarter->reports[x].project_id, inv->project_id)) {
project_report_index = x;
break;
}
@@ -542,11 +542,11 @@ void administration::create_income_statement(income_statement* statement)
report->expenses_total += inv->total;
quarter->profit -= inv->total;
- if (strcmp(inv->cost_center_id, "") != 0) {
+ if (strops::equals(inv->cost_center_id, "") != 0) {
int expense_report_index = -1;
for (u32 x = 0; x < report->expense_count; x++)
{
- if (strcmp(report->expenses[x].cost_center_id, inv->cost_center_id) == 0) {
+ if (strops::equals(report->expenses[x].cost_center_id, inv->cost_center_id)) {
expense_report_index = x;
break;
}
@@ -627,7 +627,7 @@ void administration::company_info_set(contact data)
// =======================
a_err administration::contact_import(contact data)
{
- if (strcmp(data.id, MY_COMPANY_ID) == 0)
+ if (strops::equals(data.id, MY_COMPANY_ID))
{
administration::company_info_import(data);
return A_ERR_SUCCESS;
@@ -674,7 +674,7 @@ a_err administration::contact_update(contact data)
while (list_iterator_hasnext(&g_administration.contacts)) {
contact* c = (contact *)list_iterator_next(&g_administration.contacts);
- if (strcmp(c->id, data.id) == 0) {
+ if (strops::equals(c->id, data.id)) {
memops::copy(c, &data, sizeof(data));
if (contact_changed_event_callback) contact_changed_event_callback(c);
@@ -695,7 +695,7 @@ a_err administration::contact_remove(contact data)
while (list_iterator_hasnext(&g_administration.contacts)) {
contact* c = (contact *)list_iterator_next(&g_administration.contacts);
- if (strcmp(c->id, data.id) == 0) {
+ if (strops::equals(c->id, data.id)) {
list_iterator_stop(&g_administration.contacts);
if (list_delete(&g_administration.contacts, c) != 0) return A_ERR_GENERIC;
@@ -769,7 +769,7 @@ a_err administration::contact_get_by_id(contact* buffer, char* id)
{
// Include company info in contact lookup because this might be
// used in forms.
- if (strcmp(id, g_administration.company_info.id) == 0)
+ if (strops::equals(id, g_administration.company_info.id))
{
*buffer = g_administration.company_info;
return A_ERR_SUCCESS;
@@ -780,7 +780,7 @@ a_err administration::contact_get_by_id(contact* buffer, char* id)
while (list_iterator_hasnext(&g_administration.contacts)) {
contact c = *(contact *)list_iterator_next(&g_administration.contacts);
- if (strcmp(c.id, id) == 0) {
+ if (strops::equals(c.id, id)) {
list_iterator_stop(&g_administration.contacts);
*buffer = c;
result = A_ERR_SUCCESS;
@@ -868,7 +868,7 @@ a_err administration::project_get_by_id(project* buffer, char* id)
list_iterator_start(&g_administration.projects);
while (list_iterator_hasnext(&g_administration.projects)) {
project c = *(project *)list_iterator_next(&g_administration.projects);
- if (strcmp(c.id, id) == 0)
+ if (strops::equals(c.id, id))
{
*buffer = c;
list_iterator_stop(&g_administration.projects);
@@ -985,7 +985,7 @@ a_err administration::project_update(project data)
while (list_iterator_hasnext(&g_administration.projects)) {
project* c = (project *)list_iterator_next(&g_administration.projects);
- if (strcmp(c->id, data.id) == 0) {
+ if (strops::equals(c->id, data.id)) {
memops::copy(c, &data, sizeof(data));
list_iterator_stop(&g_administration.projects);
@@ -1006,7 +1006,7 @@ a_err administration::project_remove(project data)
while (list_iterator_hasnext(&g_administration.projects)) {
project* c = (project *)list_iterator_next(&g_administration.projects);
- if (strcmp(c->id, data.id) == 0) {
+ if (strops::equals(c->id, data.id)) {
list_iterator_stop(&g_administration.projects);
if (list_delete(&g_administration.projects, c) != 0) return A_ERR_GENERIC;
@@ -1049,7 +1049,7 @@ a_err administration::tax_rate_remove(tax_rate data)
while (list_iterator_hasnext(&g_administration.tax_rates)) {
tax_rate* c = (tax_rate *)list_iterator_next(&g_administration.tax_rates);
- if (strcmp(c->internal_code, data.internal_code) == 0)
+ if (strops::equals(c->internal_code, data.internal_code))
{
list_iterator_stop(&g_administration.tax_rates);
if (list_delete(&g_administration.tax_rates, c) != 0) return A_ERR_GENERIC;
@@ -1071,7 +1071,7 @@ a_err administration::tax_rate_exists(tax_rate data)
while (list_iterator_hasnext(&g_administration.tax_rates)) {
tax_rate c = *(tax_rate *)list_iterator_next(&g_administration.tax_rates);
- if (strcmp(c.internal_code, data.internal_code) == 0)
+ if (strops::equals(c.internal_code, data.internal_code))
{
list_iterator_stop(&g_administration.tax_rates);
return A_ERR_SUCCESS;
@@ -1089,7 +1089,7 @@ a_err administration::tax_rate_get_by_internal_code(tax_rate* buffer, char* id)
list_iterator_start(&g_administration.tax_rates);
while (list_iterator_hasnext(&g_administration.tax_rates)) {
tax_rate c = *(tax_rate *)list_iterator_next(&g_administration.tax_rates);
- if (strcmp(c.internal_code, id) == 0)
+ if (strops::equals(c.internal_code, id))
{
*buffer = c;
list_iterator_stop(&g_administration.tax_rates);
@@ -1175,7 +1175,7 @@ a_err administration::cost_center_get_by_id(cost_center* buffer, char* id)
list_iterator_start(&g_administration.cost_centers);
while (list_iterator_hasnext(&g_administration.cost_centers)) {
cost_center c = *(cost_center *)list_iterator_next(&g_administration.cost_centers);
- if (strcmp(c.id, id) == 0)
+ if (strops::equals(c.id, id))
{
*buffer = c;
list_iterator_stop(&g_administration.cost_centers);
@@ -1210,7 +1210,7 @@ static bool get_cost_center_by_code(char* code, cost_center* buffer)
while (list_iterator_hasnext(&g_administration.cost_centers)) {
cost_center c = *(cost_center *)list_iterator_next(&g_administration.cost_centers);
*buffer = c;
- if (strcmp(code, c.code) == 0) {
+ if (strops::equals(code, c.code)) {
result = true;
break;
}
@@ -1274,7 +1274,7 @@ a_err administration::cost_center_update(cost_center data)
while (list_iterator_hasnext(&g_administration.cost_centers)) {
cost_center* c = (cost_center *)list_iterator_next(&g_administration.cost_centers);
- if (strcmp(c->id, data.id) == 0) {
+ if (strops::equals(c->id, data.id)) {
memops::copy(c, &data, sizeof(data));
list_iterator_stop(&g_administration.cost_centers);
@@ -1297,35 +1297,35 @@ static char* get_default_currency_for_country(char* country_code)
return "EUR"; // default
// Non-euro EU currencies
- if (strcmp(country_code, "BG") == 0) return "BGN"; // Bulgaria
- else if (strcmp(country_code, "CZ") == 0) return "CZK"; // Czechia
- else if (strcmp(country_code, "DK") == 0) return "DKK"; // Denmark
- else if (strcmp(country_code, "HU") == 0) return "HUF"; // Hungary
- else if (strcmp(country_code, "PL") == 0) return "PLN"; // Poland
- else if (strcmp(country_code, "RO") == 0) return "RON"; // Romania
- else if (strcmp(country_code, "SE") == 0) return "SEK"; // Sweden
+ if (strops::equals(country_code, "BG")) return "BGN"; // Bulgaria
+ else if (strops::equals(country_code, "CZ")) return "CZK"; // Czechia
+ else if (strops::equals(country_code, "DK")) return "DKK"; // Denmark
+ else if (strops::equals(country_code, "HU")) return "HUF"; // Hungary
+ else if (strops::equals(country_code, "PL")) return "PLN"; // Poland
+ else if (strops::equals(country_code, "RO")) return "RON"; // Romania
+ else if (strops::equals(country_code, "SE")) return "SEK"; // Sweden
// Eurozone members
- else if (strcmp(country_code, "AT") == 0) return "EUR"; // Austria
- else if (strcmp(country_code, "BE") == 0) return "EUR"; // Belgium
- else if (strcmp(country_code, "CY") == 0) return "EUR"; // Cyprus
- else if (strcmp(country_code, "DE") == 0) return "EUR"; // Germany
- else if (strcmp(country_code, "EE") == 0) return "EUR"; // Estonia
- else if (strcmp(country_code, "ES") == 0) return "EUR"; // Spain
- else if (strcmp(country_code, "FI") == 0) return "EUR"; // Finland
- else if (strcmp(country_code, "FR") == 0) return "EUR"; // France
- else if (strcmp(country_code, "GR") == 0) return "EUR"; // Greece
- else if (strcmp(country_code, "HR") == 0) return "EUR"; // Croatia
- else if (strcmp(country_code, "IE") == 0) return "EUR"; // Ireland
- else if (strcmp(country_code, "IT") == 0) return "EUR"; // Italy
- else if (strcmp(country_code, "LT") == 0) return "EUR"; // Lithuania
- else if (strcmp(country_code, "LU") == 0) return "EUR"; // Luxembourg
- else if (strcmp(country_code, "LV") == 0) return "EUR"; // Latvia
- else if (strcmp(country_code, "MT") == 0) return "EUR"; // Malta
- else if (strcmp(country_code, "NL") == 0) return "EUR"; // Netherlands
- else if (strcmp(country_code, "PT") == 0) return "EUR"; // Portugal
- else if (strcmp(country_code, "SI") == 0) return "EUR"; // Slovenia
- else if (strcmp(country_code, "SK") == 0) return "EUR"; // Slovakia
+ else if (strops::equals(country_code, "AT")) return "EUR"; // Austria
+ else if (strops::equals(country_code, "BE")) return "EUR"; // Belgium
+ else if (strops::equals(country_code, "CY")) return "EUR"; // Cyprus
+ else if (strops::equals(country_code, "DE")) return "EUR"; // Germany
+ else if (strops::equals(country_code, "EE")) return "EUR"; // Estonia
+ else if (strops::equals(country_code, "ES")) return "EUR"; // Spain
+ else if (strops::equals(country_code, "FI")) return "EUR"; // Finland
+ else if (strops::equals(country_code, "FR")) return "EUR"; // France
+ else if (strops::equals(country_code, "GR")) return "EUR"; // Greece
+ else if (strops::equals(country_code, "HR")) return "EUR"; // Croatia
+ else if (strops::equals(country_code, "IE")) return "EUR"; // Ireland
+ else if (strops::equals(country_code, "IT")) return "EUR"; // Italy
+ else if (strops::equals(country_code, "LT")) return "EUR"; // Lithuania
+ else if (strops::equals(country_code, "LU")) return "EUR"; // Luxembourg
+ else if (strops::equals(country_code, "LV")) return "EUR"; // Latvia
+ else if (strops::equals(country_code, "MT")) return "EUR"; // Malta
+ else if (strops::equals(country_code, "NL")) return "EUR"; // Netherlands
+ else if (strops::equals(country_code, "PT")) return "EUR"; // Portugal
+ else if (strops::equals(country_code, "SI")) return "EUR"; // Slovenia
+ else if (strops::equals(country_code, "SK")) return "EUR"; // Slovakia
// Default fallback
return "EUR";
@@ -1373,7 +1373,7 @@ static void administration_recalculate_invoice_totals(invoice* invoice)
}
list_iterator_stop(&invoice->billing_items);
- if (strcmp(invoice->currency, administration::get_default_currency()) == 0) {
+ if (strops::equals(invoice->currency, administration::get_default_currency())) {
invoice->tax = invoice->orig_tax;
invoice->total = invoice->orig_total;
invoice->net = invoice->orig_net;
@@ -1418,7 +1418,7 @@ a_err administration::invoice_remove(invoice* inv)
while (list_iterator_hasnext(&g_administration.invoices)) {
invoice* c = (invoice *)list_iterator_next(&g_administration.invoices);
- if (strcmp(c->id, inv->id) == 0)
+ if (strops::equals(c->id, inv->id))
{
list_iterator_stop(&g_administration.invoices);
administration_destroy_list(&c->billing_items);
@@ -1460,7 +1460,7 @@ a_err administration::invoice_update(invoice* inv)
while (list_iterator_hasnext(&g_administration.invoices)) {
invoice* c = (invoice *)list_iterator_next(&g_administration.invoices);
- if (strcmp(c->id, inv->id) == 0)
+ if (strops::equals(c->id, inv->id))
{
memops::copy(c, inv, sizeof(invoice));
list_iterator_stop(&g_administration.invoices);
@@ -1482,7 +1482,7 @@ a_err administration::invoice_import(invoice* inv)
inv->issued_at -= (inv->issued_at % 86400);
inv->delivered_at -= (inv->delivered_at % 86400);
inv->expires_at -= (inv->expires_at % 86400);
- inv->is_outgoing = strcmp(inv->supplier.id, MY_COMPANY_ID) == 0;
+ inv->is_outgoing = strops::equals(inv->supplier.id, MY_COMPANY_ID);
invoice copy = administration::invoice_create_copy(inv); // Create copy to make copy of billing item list.
invoice* new_inv = (invoice*)memops::alloc(sizeof(invoice));
@@ -1507,7 +1507,7 @@ a_err administration::invoice_add(invoice* inv)
inv->issued_at -= (inv->issued_at % 86400);
inv->delivered_at -= (inv->delivered_at % 86400);
inv->expires_at -= (inv->expires_at % 86400);
- inv->is_outgoing = strcmp(inv->supplier.id, MY_COMPANY_ID) == 0;
+ inv->is_outgoing = strops::equals(inv->supplier.id, MY_COMPANY_ID);
inv->payment_means.payment_method = PAYMENT_METHOD_STANDING_AGREEMENT;
strops::copy(inv->payment_means.payee_bank_account, inv->supplier.bank_account, sizeof(inv->payment_means.payee_bank_account));
@@ -1590,7 +1590,7 @@ a_err administration::invoice_get_by_id(invoice* buffer, char* id)
while (list_iterator_hasnext(&g_administration.invoices)) {
invoice c = *(invoice *)list_iterator_next(&g_administration.invoices);
- if (strcmp(c.id, id) == 0) {
+ if (strops::equals(c.id, id)) {
list_iterator_stop(&g_administration.invoices);
*buffer = c;
result = A_ERR_SUCCESS;
@@ -1630,7 +1630,7 @@ bool administration::invoice_get_subtotal_for_tax_rate(invoice* invoice, tax_rat
while (list_iterator_hasnext(&invoice->billing_items)) {
billing_item* c = (billing_item *)list_iterator_next(&invoice->billing_items);
- if (strcmp(c->tax_internal_code, rate.internal_code) == 0)
+ if (strops::equals(c->tax_internal_code, rate.internal_code))
{
result = true;
buffer->tax += c->tax;
@@ -1658,7 +1658,7 @@ u32 administration::invoice_get_tax_rates(invoice* invoice, tax_rate* buffer)
bool exists = false;
for (u32 i = 0; i < write_cursor; i++) {
- if (strcmp(buffer[i].internal_code, c.tax_internal_code) == 0) {
+ if (strops::equals(buffer[i].internal_code, c.tax_internal_code)) {
exists = true;
break;
}
@@ -1787,7 +1787,7 @@ a_err administration::billing_item_remove_from_invoice(invoice* invoice, billing
while (list_iterator_hasnext(&invoice->billing_items)) {
billing_item* c = (billing_item *)list_iterator_next(&invoice->billing_items);
- if (strcmp(c->id, item.id) == 0) {
+ if (strops::equals(c->id, item.id)) {
list_iterator_stop(&invoice->billing_items);
if (list_delete(&invoice->billing_items, c) != 0) return A_ERR_GENERIC;
memops::unalloc(c);
@@ -1805,7 +1805,7 @@ a_err administration::billing_item_update_in_invoice(invoice* invoice, billing_i
while (list_iterator_hasnext(&invoice->billing_items)) {
billing_item* c = (billing_item *)list_iterator_next(&invoice->billing_items);
- if (strcmp(c->id, item.id) == 0) {
+ if (strops::equals(c->id, item.id)) {
memops::copy(c, &item, sizeof(billing_item));
list_iterator_stop(&invoice->billing_items);
diff --git a/src/administration_reader.cpp b/src/administration_reader.cpp
index 4edf501..4e375c5 100644
--- a/src/administration_reader.cpp
+++ b/src/administration_reader.cpp
@@ -83,7 +83,7 @@ bool administration_reader::open_existing(char* file_path)
if (strlen(name) == 0) continue;
- if (strcmp(name, ADMIN_FILE_INFO) == 0)
+ if (strops::equals(name, ADMIN_FILE_INFO))
{
administration_reader::import_administration_info(buffer, (size_t)size);
}
@@ -193,7 +193,7 @@ bool administration_reader::read_invoice_from_xml(invoice* result, char* buffer,
char customer_endpoint_id[50];
xml_get_str_x(root, customer_endpoint_id, 50, "cac:AccountingCustomerParty", "cac:Party", "cbc:EndpointID", 0);
- if (strcmp(customer_endpoint_id, "[CONSUMER]") == 0) data.customer.type = contact_type::CONTACT_CONSUMER;
+ if (strops::equals(customer_endpoint_id, "[CONSUMER]")) data.customer.type = contact_type::CONTACT_CONSUMER;
// Addressee
xml_get_str_x(root, data.addressee.name, MAX_LEN_LONG_DESC, "cac:Delivery", "cac:DeliveryParty", "cac:PartyName", "cbc:Name", 0);
@@ -210,7 +210,7 @@ bool administration_reader::read_invoice_from_xml(invoice* result, char* buffer,
xml_node* child = xml_node_child(root, x);
char* child_name = (char*)xml_easy_name(child);
- if (strcmp(child_name, "cac:InvoiceLine") == 0)
+ if (strops::equals(child_name, "cac:InvoiceLine"))
{
billing_item bi = {0};
@@ -224,7 +224,7 @@ bool administration_reader::read_invoice_from_xml(invoice* result, char* buffer,
char percentage_buffer[5] = {0};
xml_get_str_attribute(child, percentage_buffer, 5, "unitCode", "cbc:InvoicedQuantity", 0);
- bi.amount_is_percentage = strcmp(percentage_buffer, "%") == 0;
+ bi.amount_is_percentage = strops::equals(percentage_buffer, "%");
xml_get_str_attribute(child, bi.currency, 5, "currencyID", "cbc:LineExtensionAmount", 0);
bi.discount_is_percentage = xml_get_node_x(child, "cac:AllowanceCharge", "cbc:MultiplierFactorNumeric", 0) != 0;
diff --git a/src/administration_writer.cpp b/src/administration_writer.cpp
index aae264b..f3f090f 100644
--- a/src/administration_writer.cpp
+++ b/src/administration_writer.cpp
@@ -165,35 +165,35 @@ static char* get_eas_id_for_contact(contact contact)
char* country_code = contact.address.country_code;
// Countries using tax identification numbers.
- if (strcmp(country_code, "AT") == 0) return contact.taxid; // Austria
- if (strcmp(country_code, "BE") == 0) return contact.taxid; // Belgium
- if (strcmp(country_code, "BG") == 0) return contact.taxid; // Bulgaria
- if (strcmp(country_code, "CY") == 0) return contact.taxid; // Cyprus
- if (strcmp(country_code, "CZ") == 0) return contact.taxid; // Czech Republic
- if (strcmp(country_code, "DE") == 0) return contact.taxid; // Germany
- if (strcmp(country_code, "EE") == 0) return contact.taxid; // Estonia
- if (strcmp(country_code, "FR") == 0) return contact.taxid; // France
- if (strcmp(country_code, "GR") == 0) return contact.taxid; // Greece
- if (strcmp(country_code, "HR") == 0) return contact.taxid; // Croatia
- if (strcmp(country_code, "HU") == 0) return contact.taxid; // Hungary
- if (strcmp(country_code, "IE") == 0) return contact.taxid; // Ireland
- if (strcmp(country_code, "LU") == 0) return contact.taxid; // Luxembourg
- if (strcmp(country_code, "LV") == 0) return contact.taxid; // Latvia
- if (strcmp(country_code, "MT") == 0) return contact.taxid; // Malta
- if (strcmp(country_code, "PL") == 0) return contact.taxid; // Poland
- if (strcmp(country_code, "PT") == 0) return contact.taxid; // Portugal
- if (strcmp(country_code, "RO") == 0) return contact.taxid; // Romania
- if (strcmp(country_code, "SI") == 0) return contact.taxid; // Slovenia
- if (strcmp(country_code, "SK") == 0) return contact.taxid; // Slovakia
- if (strcmp(country_code, "ES") == 0) return contact.taxid; // Spain
+ if (strops::equals(country_code, "AT")) return contact.taxid; // Austria
+ if (strops::equals(country_code, "BE")) return contact.taxid; // Belgium
+ if (strops::equals(country_code, "BG")) return contact.taxid; // Bulgaria
+ if (strops::equals(country_code, "CY")) return contact.taxid; // Cyprus
+ if (strops::equals(country_code, "CZ")) return contact.taxid; // Czech Republic
+ if (strops::equals(country_code, "DE")) return contact.taxid; // Germany
+ if (strops::equals(country_code, "EE")) return contact.taxid; // Estonia
+ if (strops::equals(country_code, "FR")) return contact.taxid; // France
+ if (strops::equals(country_code, "GR")) return contact.taxid; // Greece
+ if (strops::equals(country_code, "HR")) return contact.taxid; // Croatia
+ if (strops::equals(country_code, "HU")) return contact.taxid; // Hungary
+ if (strops::equals(country_code, "IE")) return contact.taxid; // Ireland
+ if (strops::equals(country_code, "LU")) return contact.taxid; // Luxembourg
+ if (strops::equals(country_code, "LV")) return contact.taxid; // Latvia
+ if (strops::equals(country_code, "MT")) return contact.taxid; // Malta
+ if (strops::equals(country_code, "PL")) return contact.taxid; // Poland
+ if (strops::equals(country_code, "PT")) return contact.taxid; // Portugal
+ if (strops::equals(country_code, "RO")) return contact.taxid; // Romania
+ if (strops::equals(country_code, "SI")) return contact.taxid; // Slovenia
+ if (strops::equals(country_code, "SK")) return contact.taxid; // Slovakia
+ if (strops::equals(country_code, "ES")) return contact.taxid; // Spain
// Countries using business identification numbers.
- if (strcmp(country_code, "NL") == 0) return contact.businessid; // Netherlands
- if (strcmp(country_code, "SE") == 0) return contact.businessid; // Sweden
- if (strcmp(country_code, "LT") == 0) return contact.businessid; // Lithuania
- if (strcmp(country_code, "IT") == 0) return contact.businessid; // Italy
- if (strcmp(country_code, "FI") == 0) return contact.businessid; // Finland
- if (strcmp(country_code, "DK") == 0) return contact.businessid; // Denmark
+ if (strops::equals(country_code, "NL")) return contact.businessid; // Netherlands
+ if (strops::equals(country_code, "SE")) return contact.businessid; // Sweden
+ if (strops::equals(country_code, "LT")) return contact.businessid; // Lithuania
+ if (strops::equals(country_code, "IT")) return contact.businessid; // Italy
+ if (strops::equals(country_code, "FI")) return contact.businessid; // Finland
+ if (strops::equals(country_code, "DK")) return contact.businessid; // Denmark
return NULL; // Unknown country code
}
@@ -207,33 +207,33 @@ static char* get_eas_scheme_for_contact(contact contact)
// https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/
char* country_code = addr.country_code;
- if (strcmp(country_code, "AT") == 0) return "9914"; // Austria
- if (strcmp(country_code, "BE") == 0) return "9925"; // Belgium
- if (strcmp(country_code, "BG") == 0) return "9926"; // Bulgaria
- if (strcmp(country_code, "CY") == 0) return "9928"; // Cyprus
- if (strcmp(country_code, "CZ") == 0) return "9929"; // Czech Republic
- if (strcmp(country_code, "DE") == 0) return "9930"; // Germany
- if (strcmp(country_code, "DK") == 0) return "0096"; // Denmark
- if (strcmp(country_code, "EE") == 0) return "9931"; // Estonia
- if (strcmp(country_code, "FR") == 0) return "9957"; // France
- if (strcmp(country_code, "GR") == 0) return "9933"; // Greece
- if (strcmp(country_code, "HR") == 0) return "9934"; // Croatia
- if (strcmp(country_code, "HU") == 0) return "9910"; // Hungary
- if (strcmp(country_code, "IE") == 0) return "9935"; // Ireland
- if (strcmp(country_code, "FI") == 0) return "0212"; // Finland
- if (strcmp(country_code, "IT") == 0) return "0208"; // Italy
- if (strcmp(country_code, "LT") == 0) return "0200"; // Lithuania
- if (strcmp(country_code, "LU") == 0) return "9938"; // Luxembourg
- if (strcmp(country_code, "LV") == 0) return "9939"; // Latvia
- if (strcmp(country_code, "MT") == 0) return "9943"; // Malta
- if (strcmp(country_code, "NL") == 0) return "0106"; // Netherlands
- if (strcmp(country_code, "PL") == 0) return "9945"; // Poland
- if (strcmp(country_code, "PT") == 0) return "9946"; // Portugal
- if (strcmp(country_code, "RO") == 0) return "9947"; // Romania
- if (strcmp(country_code, "SE") == 0) return "0007"; // Sweden
- if (strcmp(country_code, "SI") == 0) return "9949"; // Slovenia
- if (strcmp(country_code, "SK") == 0) return "9950"; // Slovakia
- if (strcmp(country_code, "ES") == 0) return "9920"; // Spain
+ if (strops::equals(country_code, "AT")) return "9914"; // Austria
+ if (strops::equals(country_code, "BE")) return "9925"; // Belgium
+ if (strops::equals(country_code, "BG")) return "9926"; // Bulgaria
+ if (strops::equals(country_code, "CY")) return "9928"; // Cyprus
+ if (strops::equals(country_code, "CZ")) return "9929"; // Czech Republic
+ if (strops::equals(country_code, "DE")) return "9930"; // Germany
+ if (strops::equals(country_code, "DK")) return "0096"; // Denmark
+ if (strops::equals(country_code, "EE")) return "9931"; // Estonia
+ if (strops::equals(country_code, "FR")) return "9957"; // France
+ if (strops::equals(country_code, "GR")) return "9933"; // Greece
+ if (strops::equals(country_code, "HR")) return "9934"; // Croatia
+ if (strops::equals(country_code, "HU")) return "9910"; // Hungary
+ if (strops::equals(country_code, "IE")) return "9935"; // Ireland
+ if (strops::equals(country_code, "FI")) return "0212"; // Finland
+ if (strops::equals(country_code, "IT")) return "0208"; // Italy
+ if (strops::equals(country_code, "LT")) return "0200"; // Lithuania
+ if (strops::equals(country_code, "LU")) return "9938"; // Luxembourg
+ if (strops::equals(country_code, "LV")) return "9939"; // Latvia
+ if (strops::equals(country_code, "MT")) return "9943"; // Malta
+ if (strops::equals(country_code, "NL")) return "0106"; // Netherlands
+ if (strops::equals(country_code, "PL")) return "9945"; // Poland
+ if (strops::equals(country_code, "PT")) return "9946"; // Portugal
+ if (strops::equals(country_code, "RO")) return "9947"; // Romania
+ if (strops::equals(country_code, "SE")) return "0007"; // Sweden
+ if (strops::equals(country_code, "SI")) return "9949"; // Slovenia
+ if (strops::equals(country_code, "SK")) return "9950"; // Slovakia
+ if (strops::equals(country_code, "ES")) return "9920"; // Spain
return NULL; // Unknown country code
}
diff --git a/src/ui/imgui_extensions.cpp b/src/ui/imgui_extensions.cpp
index 63e8eeb..66160ae 100644
--- a/src/ui/imgui_extensions.cpp
+++ b/src/ui/imgui_extensions.cpp
@@ -98,7 +98,7 @@ namespace ImGui
for (int i = 0; i < country::get_count(); i++)
{
- if (strcmp(country::get_code_by_index(i), buffer) == 0)
+ if (strops::equals(country::get_code_by_index(i), buffer))
{
selected_country = countries[i];
break;
@@ -256,7 +256,7 @@ namespace ImGui
{
for (u32 i = 0; i < costcenter_count; i++)
{
- if (strcmp(buffer[i].id, costcenter_id) == 0)
+ if (strops::equals(buffer[i].id, costcenter_id))
{
selected_costcenter = &buffer[i];
break;
@@ -269,7 +269,7 @@ namespace ImGui
{
for (u32 n = 0; n < costcenter_count; n++)
{
- bool is_selected = selected_costcenter && strcmp(selected_costcenter->id, buffer[n].id) == 0;
+ bool is_selected = selected_costcenter && strops::equals(selected_costcenter->id, buffer[n].id);
if (ImGui::Selectable(locale::get(buffer[n].description), is_selected)) {
selected_costcenter_index = n;
}
@@ -297,7 +297,7 @@ namespace ImGui
{
for (u32 i = 0; i < project_count; i++)
{
- if (strcmp(buffer[i].id, project_id) == 0)
+ if (strops::equals(buffer[i].id, project_id))
{
selected_project = &buffer[i];
break;
@@ -310,7 +310,7 @@ namespace ImGui
{
for (u32 n = 0; n < project_count; n++)
{
- bool is_selected = selected_project && strcmp(selected_project->id, buffer[n].id) == 0;
+ bool is_selected = selected_project && strops::equals(selected_project->id, buffer[n].id);
if (ImGui::Selectable(buffer[n].description, is_selected)) {
selected_project_index = n;
}
@@ -338,7 +338,7 @@ namespace ImGui
{
for (u32 i = 0; i < tax_rate_count; i++)
{
- if (strcmp(buffer[i].internal_code, tax_internal_code) == 0)
+ if (strops::equals(buffer[i].internal_code, tax_internal_code))
{
selected_tax_rate = &buffer[i];
break;
@@ -364,7 +364,7 @@ namespace ImGui
{
for (u32 n = 0; n < tax_rate_count; n++)
{
- bool is_selected = selected_tax_rate && strcmp(selected_tax_rate->internal_code, buffer[n].internal_code) == 0;
+ bool is_selected = selected_tax_rate && strops::equals(selected_tax_rate->internal_code, buffer[n].internal_code);
char category_code_desc[MAX_LEN_LONG_DESC];
strops::format(category_code_desc, MAX_LEN_LONG_DESC, "taxrate.code.%s", buffer[n].internal_code);
@@ -415,7 +415,7 @@ namespace ImGui
{
for (int i = 0; i < currency_count; i++)
{
- if (strcmp(currencies[i], currency) == 0)
+ if (strops::equals(currencies[i], currency))
{
currentCurrency = i;
break;
diff --git a/src/ui/ui_invoices.cpp b/src/ui/ui_invoices.cpp
index 4ae1669..277ce46 100644
--- a/src/ui/ui_invoices.cpp
+++ b/src/ui/ui_invoices.cpp
@@ -137,7 +137,7 @@ void draw_invoice_items_form(invoice* invoice, bool outgoing)
ImGui::TableSetColumnIndex(8);
ImGui::Text("%.2f %s", invoice->orig_total, invoice->currency);
- if (strcmp(invoice->currency, administration::get_default_currency()) != 0) {
+ if (!strops::equals(invoice->currency, administration::get_default_currency())) {
ImGui::TableNextRow();
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, IM_COL32(50, 50, 50, 255));