diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/administration.cpp | 50 | ||||
| -rw-r--r-- | src/administration_reader.cpp | 54 | ||||
| -rw-r--r-- | src/administration_writer.cpp | 60 | ||||
| -rw-r--r-- | src/exporter.cpp | 6 | ||||
| -rw-r--r-- | src/importer.cpp | 78 | ||||
| -rw-r--r-- | src/ui/imgui_extensions.cpp | 10 | ||||
| -rw-r--r-- | src/ui/ui_contacts.cpp | 2 | ||||
| -rw-r--r-- | src/ui/ui_expenses.cpp | 6 | ||||
| -rw-r--r-- | src/ui/ui_invoices.cpp | 4 | ||||
| -rw-r--r-- | src/ui/ui_settings.cpp | 8 |
10 files changed, 139 insertions, 139 deletions
diff --git a/src/administration.cpp b/src/administration.cpp index 3905c74..41ad2fc 100644 --- a/src/administration.cpp +++ b/src/administration.cpp @@ -134,7 +134,7 @@ void administration_create() list_init(&g_administration.cost_centers); strops::copy(g_administration.path, "", sizeof(g_administration.path)); - memops::zero(&g_administration.ai_service, sizeof(ai_service)); + memops::zero(&g_administration.active_ai_service, sizeof(ai_service)); memops::zero(&g_administration.all_ai_services, sizeof(g_administration.all_ai_services)); // Load all tax rates. @@ -235,7 +235,7 @@ void administration::create_default(const char* save_file) // ======================= ai_service administration::get_active_ai_service() { - return g_administration.ai_service; + return g_administration.active_ai_service; } ai_service administration::get_ai_service(ai_provider provider) @@ -245,12 +245,12 @@ ai_service administration::get_ai_service(ai_provider provider) email_service administration::get_email_service() { - return g_administration.email_service; + return g_administration.active_email_service; } void administration::set_email_service(email_service provider) { - g_administration.email_service = provider; + g_administration.active_email_service = provider; if (administration_data_changed_event_callback) administration_data_changed_event_callback(); } @@ -262,7 +262,7 @@ void administration::import_ai_service(ai_service service) void administration::set_active_ai_service(ai_service service) { g_administration.all_ai_services[(u32)service.provider] = service; - g_administration.ai_service = service; + g_administration.active_ai_service = service; if (administration_data_changed_event_callback) administration_data_changed_event_callback(); } @@ -375,7 +375,7 @@ void administration::create_tax_statement(tax_statement* statement) { STOPWATCH_START; - char* country_code = company_info_get().address.country_code; + char* country_code = company_info_get().addr.country_code; assert(statement); statement->report_count = 0; @@ -676,14 +676,14 @@ contact administration::company_info_get() void administration::company_info_import(contact data) { g_administration.company_info = data; - strops::copy(g_administration.default_currency, get_default_currency_for_country(g_administration.company_info.address.country_code), MAX_LEN_CURRENCY); + strops::copy(g_administration.default_currency, get_default_currency_for_country(g_administration.company_info.addr.country_code), MAX_LEN_CURRENCY); } void administration::company_info_set(contact data) { strops::copy(data.id, MY_COMPANY_ID, sizeof(data.id)); g_administration.company_info = data; - strops::copy(g_administration.default_currency, get_default_currency_for_country(g_administration.company_info.address.country_code), MAX_LEN_CURRENCY); + strops::copy(g_administration.default_currency, get_default_currency_for_country(g_administration.company_info.addr.country_code), MAX_LEN_CURRENCY); if (contact_changed_event_callback) contact_changed_event_callback(&data); } @@ -877,10 +877,10 @@ a_err administration::addressee_is_valid(delivery_info data) { a_err result = A_ERR_SUCCESS; if (strops::empty(data.name)) result |= A_ERR_MISSING_NAME; - if (strops::empty(data.address.city)) result |= A_ERR_MISSING_CITY; - if (strops::empty(data.address.postal)) result |= A_ERR_MISSING_POSTAL; - if (strops::empty(data.address.address1)) result |= A_ERR_MISSING_ADDRESS1; - if (strops::empty(data.address.country_code)) result |= A_ERR_MISSING_COUNTRYCODE; + if (strops::empty(data.addr.city)) result |= A_ERR_MISSING_CITY; + if (strops::empty(data.addr.postal)) result |= A_ERR_MISSING_POSTAL; + if (strops::empty(data.addr.address1)) result |= A_ERR_MISSING_ADDRESS1; + if (strops::empty(data.addr.country_code)) result |= A_ERR_MISSING_COUNTRYCODE; return result; } @@ -890,10 +890,10 @@ a_err administration::contact_is_valid(contact data) a_err result = A_ERR_SUCCESS; if (strops::empty(data.name)) result |= A_ERR_MISSING_NAME; if (strops::empty(data.email)) result |= A_ERR_MISSING_EMAIL; - if (strops::empty(data.address.city)) result |= A_ERR_MISSING_CITY; - if (strops::empty(data.address.postal)) result |= A_ERR_MISSING_POSTAL; - if (strops::empty(data.address.address1)) result |= A_ERR_MISSING_ADDRESS1; - if (strops::empty(data.address.country_code)) result |= A_ERR_MISSING_COUNTRYCODE; + if (strops::empty(data.addr.city)) result |= A_ERR_MISSING_CITY; + if (strops::empty(data.addr.postal)) result |= A_ERR_MISSING_POSTAL; + if (strops::empty(data.addr.address1)) result |= A_ERR_MISSING_ADDRESS1; + if (strops::empty(data.addr.country_code)) result |= A_ERR_MISSING_COUNTRYCODE; if (data.type == contact_type::CONTACT_BUSINESS) { @@ -1414,7 +1414,7 @@ invoice administration::invoice_create_empty() result.delivered_at = result.issued_at; result.expires_at = result.issued_at + administration::get_default_invoice_expire_duration(); list_init(&result.billing_items); - strops::copy(result.currency, get_default_currency_for_country(g_administration.company_info.address.country_code), MAX_LEN_CURRENCY); + strops::copy(result.currency, get_default_currency_for_country(g_administration.company_info.addr.country_code), MAX_LEN_CURRENCY); return result; } @@ -1505,12 +1505,12 @@ a_err administration::invoice_remove(invoice* inv) static void invoice_set_addressee(invoice* inv, contact contact) { memops::copy(&inv->addressee.name, &contact.name, sizeof(inv->addressee.name)); - memops::copy(&inv->addressee.address.address1, &contact.address.address1, sizeof(inv->addressee.address.address1)); - memops::copy(&inv->addressee.address.address2, &contact.address.address2, sizeof(inv->addressee.address.address2)); - memops::copy(&inv->addressee.address.city, &contact.address.city, sizeof(inv->addressee.address.city)); - memops::copy(&inv->addressee.address.postal, &contact.address.postal, sizeof(inv->addressee.address.postal)); - memops::copy(&inv->addressee.address.region, &contact.address.region, sizeof(inv->addressee.address.region)); - memops::copy(&inv->addressee.address.country_code, &contact.address.country_code, sizeof(inv->addressee.address.country_code)); + memops::copy(&inv->addressee.addr.address1, &contact.addr.address1, sizeof(inv->addressee.addr.address1)); + memops::copy(&inv->addressee.addr.address2, &contact.addr.address2, sizeof(inv->addressee.addr.address2)); + memops::copy(&inv->addressee.addr.city, &contact.addr.city, sizeof(inv->addressee.addr.city)); + memops::copy(&inv->addressee.addr.postal, &contact.addr.postal, sizeof(inv->addressee.addr.postal)); + memops::copy(&inv->addressee.addr.region, &contact.addr.region, sizeof(inv->addressee.addr.region)); + memops::copy(&inv->addressee.addr.country_code, &contact.addr.country_code, sizeof(inv->addressee.addr.country_code)); } a_err administration::invoice_update(invoice* inv) @@ -1542,7 +1542,7 @@ a_err administration::invoice_update(invoice* inv) a_err administration::invoice_import(invoice* inv) { - inv->is_triangulation = !memops::equals(&inv->addressee.address, &inv->customer.address, sizeof(address)); + inv->is_triangulation = !memops::equals(&inv->addressee.addr, &inv->customer.addr, sizeof(address)); inv->issued_at -= (inv->issued_at % 86400); inv->delivered_at -= (inv->delivered_at % 86400); @@ -1574,7 +1574,7 @@ a_err administration::invoice_add(invoice* inv) inv->expires_at -= (inv->expires_at % 86400); inv->is_outgoing = strops::equals(inv->supplier.id, MY_COMPANY_ID); - inv->payment_means.payment_method = PAYMENT_METHOD_STANDING_AGREEMENT; + inv->payment_means.method = PAYMENT_METHOD_STANDING_AGREEMENT; strops::copy(inv->payment_means.payee_bank_account, inv->supplier.bank_account, sizeof(inv->payment_means.payee_bank_account)); strops::copy(inv->payment_means.payee_account_name, inv->supplier.name, sizeof(inv->payment_means.payee_account_name)); strops::copy(inv->payment_means.service_provider_id, "", sizeof(inv->payment_means.service_provider_id)); diff --git a/src/administration_reader.cpp b/src/administration_reader.cpp index 81f5b02..aadc853 100644 --- a/src/administration_reader.cpp +++ b/src/administration_reader.cpp @@ -137,13 +137,13 @@ bool administration_reader::read_invoice_from_xml(invoice* result, char* buffer, data.delivered_at = xml_get_date_x(root, "cac:Delivery", "cbc:ActualDeliveryDate", 0); // References - xml_get_str_x(root, data.document.copy_path, MAX_LEN_PATH, "cac:AdditionalDocumentReference", "cbc:ID", 0); - xml_get_str_x(root, data.document.original_path, MAX_LEN_PATH, "cac:AdditionalDocumentReference", "cbc:DocumentDescription", 0); + xml_get_str_x(root, data.orig_document.copy_path, MAX_LEN_PATH, "cac:AdditionalDocumentReference", "cbc:ID", 0); + xml_get_str_x(root, data.orig_document.original_path, MAX_LEN_PATH, "cac:AdditionalDocumentReference", "cbc:DocumentDescription", 0); xml_get_str_x(root, data.project_id, MAX_LEN_ID, "cac:ProjectReference", "cbc:ID", 0); xml_get_str(root, data.cost_center_id, MAX_LEN_ID, "cac:AccountingCost"); // Payment means - data.payment_means.payment_method = (payment_method)xml_get_s32_x(root, "cac:PaymentMeans", "cbc:PaymentMeansCode", 0); + data.payment_means.method = (payment_method)xml_get_s32_x(root, "cac:PaymentMeans", "cbc:PaymentMeansCode", 0); xml_get_str_x(root, data.payment_means.payee_bank_account, MAX_LEN_BANK, "cac:PaymentMeans", "cac:PayeeFinancialAccount", "cbc:ID", 0); xml_get_str_x(root, data.payment_means.payee_account_name, MAX_LEN_LONG_DESC, "cac:PaymentMeans", "cac:PayeeFinancialAccount", "cbc:Name", 0); xml_get_str_x(root, data.payment_means.service_provider_id, MAX_LEN_ID, "cac:PaymentMeans", "cac:PayeeFinancialAccount", "cac:FinancialInstitutionBranch", "cac:FinancialInstitution", "cbc:ID", 0); @@ -159,12 +159,12 @@ bool administration_reader::read_invoice_from_xml(invoice* result, char* buffer, xml_get_str_x(root, data.supplier.id, MAX_LEN_ID, "cac:AccountingSupplierParty", "cac:Party", "cac:Contact", "cbc:Name", 0); strops::copy(data.supplier.bank_account, data.payment_means.payee_bank_account, MAX_LEN_BANK); xml_get_str_x(root, data.supplier.name, MAX_LEN_LONG_DESC, "cac:AccountingSupplierParty", "cac:Party", "cac:PartyName", "cbc:Name", 0); - xml_get_str_x(root, data.supplier.address.address1, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:StreetName", 0); - xml_get_str_x(root, data.supplier.address.address2, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:AdditionalStreetName", 0); - xml_get_str_x(root, data.supplier.address.city, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:CityName", 0); - xml_get_str_x(root, data.supplier.address.postal, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:PostalZone", 0); - xml_get_str_x(root, data.supplier.address.region, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:CountrySubentity", 0); - xml_get_str_x(root, data.supplier.address.country_code, MAX_LEN_COUNTRY_CODE, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cac:Country", "cbc:IdentificationCode", 0); + xml_get_str_x(root, data.supplier.addr.address1, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:StreetName", 0); + xml_get_str_x(root, data.supplier.addr.address2, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:AdditionalStreetName", 0); + xml_get_str_x(root, data.supplier.addr.city, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:CityName", 0); + xml_get_str_x(root, data.supplier.addr.postal, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:PostalZone", 0); + xml_get_str_x(root, data.supplier.addr.region, MAX_LEN_ADDRESS, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cbc:CountrySubentity", 0); + xml_get_str_x(root, data.supplier.addr.country_code, MAX_LEN_COUNTRY_CODE, "cac:AccountingSupplierParty", "cac:Party", "cac:PostalAddress", "cac:Country", "cbc:IdentificationCode", 0); xml_get_str_x(root, data.supplier.taxid, MAX_LEN_TAXID, "cac:AccountingSupplierParty", "cac:Party", "cac:PartyTaxScheme", "cbc:CompanyID", 0); xml_get_str_x(root, data.supplier.businessid, MAX_LEN_BUSINESSID, "cac:AccountingSupplierParty", "cac:Party", "cac:PartyIdentification", "cbc:ID", 0); xml_get_str_x(root, data.supplier.phone_number, MAX_LEN_PHONE, "cac:AccountingSupplierParty", "cac:Party", "cac:Contact", "cbc:Telephone", 0); @@ -174,12 +174,12 @@ bool administration_reader::read_invoice_from_xml(invoice* result, char* buffer, xml_get_str_x(root, data.customer.id, MAX_LEN_ID, "cac:AccountingCustomerParty", "cac:Party", "cac:Contact", "cbc:Name", 0); strops::copy(data.customer.bank_account, data.payment_means.payer_bank_account, MAX_LEN_BANK); xml_get_str_x(root, data.customer.name, MAX_LEN_LONG_DESC, "cac:AccountingCustomerParty", "cac:Party", "cac:PartyName", "cbc:Name", 0); - xml_get_str_x(root, data.customer.address.address1, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:StreetName", 0); - xml_get_str_x(root, data.customer.address.address2, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:AdditionalStreetName", 0); - xml_get_str_x(root, data.customer.address.city, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:CityName", 0); - xml_get_str_x(root, data.customer.address.postal, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:PostalZone", 0); - xml_get_str_x(root, data.customer.address.region, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:CountrySubentity", 0); - xml_get_str_x(root, data.customer.address.country_code, MAX_LEN_COUNTRY_CODE, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cac:Country", "cbc:IdentificationCode", 0); + xml_get_str_x(root, data.customer.addr.address1, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:StreetName", 0); + xml_get_str_x(root, data.customer.addr.address2, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:AdditionalStreetName", 0); + xml_get_str_x(root, data.customer.addr.city, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:CityName", 0); + xml_get_str_x(root, data.customer.addr.postal, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:PostalZone", 0); + xml_get_str_x(root, data.customer.addr.region, MAX_LEN_ADDRESS, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cbc:CountrySubentity", 0); + xml_get_str_x(root, data.customer.addr.country_code, MAX_LEN_COUNTRY_CODE, "cac:AccountingCustomerParty", "cac:Party", "cac:PostalAddress", "cac:Country", "cbc:IdentificationCode", 0); xml_get_str_x(root, data.customer.taxid, MAX_LEN_TAXID, "cac:AccountingCustomerParty", "cac:Party", "cac:PartyTaxScheme", "cbc:CompanyID", 0); xml_get_str_x(root, data.customer.businessid, MAX_LEN_BUSINESSID, "cac:AccountingCustomerParty", "cac:Party", "cac:PartyIdentification", "cbc:ID", 0); xml_get_str_x(root, data.customer.phone_number, MAX_LEN_PHONE, "cac:AccountingCustomerParty", "cac:Party", "cac:Contact", "cbc:Telephone", 0); @@ -191,12 +191,12 @@ bool administration_reader::read_invoice_from_xml(invoice* result, char* buffer, // Addressee xml_get_str_x(root, data.addressee.name, MAX_LEN_LONG_DESC, "cac:Delivery", "cac:DeliveryParty", "cac:PartyName", "cbc:Name", 0); - xml_get_str_x(root, data.addressee.address.address1, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:StreetName", 0); - xml_get_str_x(root, data.addressee.address.address2, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:AdditionalStreetName", 0); - xml_get_str_x(root, data.addressee.address.city, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:CityName", 0); - xml_get_str_x(root, data.addressee.address.postal, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:PostalZone", 0); - xml_get_str_x(root, data.addressee.address.region, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:CountrySubentity", 0); - xml_get_str_x(root, data.addressee.address.country_code, MAX_LEN_COUNTRY_CODE, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cac:Country", "cbc:IdentificationCode", 0); + xml_get_str_x(root, data.addressee.addr.address1, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:StreetName", 0); + xml_get_str_x(root, data.addressee.addr.address2, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:AdditionalStreetName", 0); + xml_get_str_x(root, data.addressee.addr.city, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:CityName", 0); + xml_get_str_x(root, data.addressee.addr.postal, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:PostalZone", 0); + xml_get_str_x(root, data.addressee.addr.region, MAX_LEN_ADDRESS, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cbc:CountrySubentity", 0); + xml_get_str_x(root, data.addressee.addr.country_code, MAX_LEN_COUNTRY_CODE, "cac:Delivery", "cac:DeliveryLocation", "cac:Address", "cac:Country", "cbc:IdentificationCode", 0); size_t child_count = xml_node_children(root); for (size_t x = 0; x < child_count; x++) @@ -316,12 +316,12 @@ bool administration_reader::import_contact(char* buffer, size_t buffer_size) xml_get_str(root, data.bank_account, MAX_LEN_BANK, "BankAccount"); struct xml_node* node_address = xml_easy_child(root, (uint8_t *)"Address", 0); - xml_get_str(node_address, data.address.address1, MAX_LEN_ADDRESS, "AddressLine1"); - xml_get_str(node_address, data.address.address2, MAX_LEN_ADDRESS, "AddressLine2"); - xml_get_str(node_address, data.address.country_code, MAX_LEN_COUNTRY_CODE, "CountryCode"); - xml_get_str(node_address, data.address.city, MAX_LEN_ADDRESS, "City"); - xml_get_str(node_address, data.address.postal, MAX_LEN_ADDRESS, "Postal"); - xml_get_str(node_address, data.address.region, MAX_LEN_ADDRESS, "Region"); + xml_get_str(node_address, data.addr.address1, MAX_LEN_ADDRESS, "AddressLine1"); + xml_get_str(node_address, data.addr.address2, MAX_LEN_ADDRESS, "AddressLine2"); + xml_get_str(node_address, data.addr.country_code, MAX_LEN_COUNTRY_CODE, "CountryCode"); + xml_get_str(node_address, data.addr.city, MAX_LEN_ADDRESS, "City"); + xml_get_str(node_address, data.addr.postal, MAX_LEN_ADDRESS, "Postal"); + xml_get_str(node_address, data.addr.region, MAX_LEN_ADDRESS, "Region"); a_err result = administration::contact_import(data); if (result == A_ERR_SUCCESS) { diff --git a/src/administration_writer.cpp b/src/administration_writer.cpp index ee0ccdb..ad6f200 100644 --- a/src/administration_writer.cpp +++ b/src/administration_writer.cpp @@ -337,7 +337,7 @@ static const char* get_eas_id_for_contact(contact *contact) } // https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/ - char* country_code = contact->address.country_code; + char* country_code = contact->addr.country_code; // Countries using tax identification numbers. if (strops::equals(country_code, "AT")) return contact->taxid; // Austria @@ -379,7 +379,7 @@ static const char* get_eas_scheme_for_contact(contact contact) return "0203"; // @Hack } - address addr = contact.address; + address addr = contact.addr; // https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/ char* country_code = addr.country_code; @@ -469,7 +469,7 @@ static const char* _get_file_extension(const char *path) { static void _add_document_to_zip(invoice* inv) { - document* doc = &inv->document; + document* doc = &inv->orig_document; if (strops::empty(doc->copy_path) && !strops::empty(doc->original_path)) { @@ -552,8 +552,8 @@ bool administration_writer::save_invoice_blocking(invoice inv) strops::replace(file_content, buf_length, "{{CURRENCY}}", inv.currency); strops::replace(file_content, buf_length, "{{PROJECT_ID}}", inv.project_id); strops::replace(file_content, buf_length, "{{COST_CENTER_ID}}", inv.cost_center_id); - strops::replace(file_content, buf_length, "{{INVOICE_DOCUMENT_COPY}}", inv.document.copy_path); - strops::replace(file_content, buf_length, "{{INVOICE_DOCUMENT_ORIG}}", inv.document.original_path); + strops::replace(file_content, buf_length, "{{INVOICE_DOCUMENT_COPY}}", inv.orig_document.copy_path); + strops::replace(file_content, buf_length, "{{INVOICE_DOCUMENT_ORIG}}", inv.orig_document.original_path); //strops::replace_int32(file_content, buf_length, "{{INVOICE_STATUS}}", (s32)inv.status); // Supplier data @@ -561,12 +561,12 @@ bool administration_writer::save_invoice_blocking(invoice inv) strops::replace(file_content, buf_length, "{{SUPPLIER_ENDPOINT_ID}}", get_eas_id_for_contact(&inv.supplier)); strops::replace(file_content, buf_length, "{{SUPPLIER_ID}}", inv.supplier.id); strops::replace(file_content, buf_length, "{{SUPPLIER_NAME}}", inv.supplier.name); - strops::replace(file_content, buf_length, "{{SUPPLIER_STREET}}", inv.supplier.address.address1); - strops::replace(file_content, buf_length, "{{SUPPLIER_STREET2}}", inv.supplier.address.address2); - strops::replace(file_content, buf_length, "{{SUPPLIER_CITY}}", inv.supplier.address.city); - strops::replace(file_content, buf_length, "{{SUPPLIER_POSTAL}}", inv.supplier.address.postal); - strops::replace(file_content, buf_length, "{{SUPPLIER_REGION}}", inv.supplier.address.region); - strops::replace(file_content, buf_length, "{{SUPPLIER_COUNTRY}}", inv.supplier.address.country_code); + strops::replace(file_content, buf_length, "{{SUPPLIER_STREET}}", inv.supplier.addr.address1); + strops::replace(file_content, buf_length, "{{SUPPLIER_STREET2}}", inv.supplier.addr.address2); + strops::replace(file_content, buf_length, "{{SUPPLIER_CITY}}", inv.supplier.addr.city); + strops::replace(file_content, buf_length, "{{SUPPLIER_POSTAL}}", inv.supplier.addr.postal); + strops::replace(file_content, buf_length, "{{SUPPLIER_REGION}}", inv.supplier.addr.region); + strops::replace(file_content, buf_length, "{{SUPPLIER_COUNTRY}}", inv.supplier.addr.country_code); strops::replace(file_content, buf_length, "{{SUPPLIER_VAT_ID}}", inv.supplier.taxid); strops::replace(file_content, buf_length, "{{SUPPLIER_LEGAL_NAME}}", inv.supplier.name); strops::replace(file_content, buf_length, "{{SUPPLIER_BUSINESS_ID}}", inv.supplier.businessid); @@ -578,12 +578,12 @@ bool administration_writer::save_invoice_blocking(invoice inv) strops::replace(file_content, buf_length, "{{CUSTOMER_ENDPOINT_ID}}", get_eas_id_for_contact(&inv.customer)); strops::replace(file_content, buf_length, "{{CUSTOMER_ID}}", inv.customer.id); strops::replace(file_content, buf_length, "{{CUSTOMER_NAME}}", inv.customer.name); - strops::replace(file_content, buf_length, "{{CUSTOMER_STREET}}", inv.customer.address.address1); - strops::replace(file_content, buf_length, "{{CUSTOMER_STREET2}}", inv.customer.address.address2); - strops::replace(file_content, buf_length, "{{CUSTOMER_CITY}}", inv.customer.address.city); - strops::replace(file_content, buf_length, "{{CUSTOMER_POSTAL}}", inv.customer.address.postal); - strops::replace(file_content, buf_length, "{{CUSTOMER_REGION}}", inv.customer.address.region); - strops::replace(file_content, buf_length, "{{CUSTOMER_COUNTRY}}", inv.customer.address.country_code); + strops::replace(file_content, buf_length, "{{CUSTOMER_STREET}}", inv.customer.addr.address1); + strops::replace(file_content, buf_length, "{{CUSTOMER_STREET2}}", inv.customer.addr.address2); + strops::replace(file_content, buf_length, "{{CUSTOMER_CITY}}", inv.customer.addr.city); + strops::replace(file_content, buf_length, "{{CUSTOMER_POSTAL}}", inv.customer.addr.postal); + strops::replace(file_content, buf_length, "{{CUSTOMER_REGION}}", inv.customer.addr.region); + strops::replace(file_content, buf_length, "{{CUSTOMER_COUNTRY}}", inv.customer.addr.country_code); strops::replace(file_content, buf_length, "{{CUSTOMER_VAT_ID}}", inv.customer.taxid); strops::replace(file_content, buf_length, "{{CUSTOMER_LEGAL_NAME}}", inv.customer.name); strops::replace(file_content, buf_length, "{{CUSTOMER_BUSINESS_ID}}", inv.customer.businessid); @@ -595,15 +595,15 @@ bool administration_writer::save_invoice_blocking(invoice inv) strftime(date_buffer, sizeof(date_buffer), "%Y-%m-%d", tm_info); strops::replace(file_content, buf_length, "{{DELIVERY_DATE}}", date_buffer); strops::replace(file_content, buf_length, "{{DELIVERY_NAME}}", inv.addressee.name); - strops::replace(file_content, buf_length, "{{DELIVERY_STREET}}", inv.addressee.address.address1); - strops::replace(file_content, buf_length, "{{DELIVERY_STREET2}}", inv.addressee.address.address2); - strops::replace(file_content, buf_length, "{{DELIVERY_CITY}}", inv.addressee.address.city); - strops::replace(file_content, buf_length, "{{DELIVERY_POSTAL}}", inv.addressee.address.postal); - strops::replace(file_content, buf_length, "{{DELIVERY_REGION}}", inv.addressee.address.region); - strops::replace(file_content, buf_length, "{{DELIVERY_COUNTRY}}", inv.addressee.address.country_code); + strops::replace(file_content, buf_length, "{{DELIVERY_STREET}}", inv.addressee.addr.address1); + strops::replace(file_content, buf_length, "{{DELIVERY_STREET2}}", inv.addressee.addr.address2); + strops::replace(file_content, buf_length, "{{DELIVERY_CITY}}", inv.addressee.addr.city); + strops::replace(file_content, buf_length, "{{DELIVERY_POSTAL}}", inv.addressee.addr.postal); + strops::replace(file_content, buf_length, "{{DELIVERY_REGION}}", inv.addressee.addr.region); + strops::replace(file_content, buf_length, "{{DELIVERY_COUNTRY}}", inv.addressee.addr.country_code); // Payment means - strops::replace_int32(file_content, buf_length, "{{PAYMENT_TYPE}}", inv.payment_means.payment_method); + strops::replace_int32(file_content, buf_length, "{{PAYMENT_TYPE}}", inv.payment_means.method); strops::replace(file_content, buf_length, "{{RECIPIENT_IBAN}}", inv.payment_means.payee_bank_account); strops::replace(file_content, buf_length, "{{RECIPIENT_NAME}}", inv.payment_means.payee_account_name); strops::replace(file_content, buf_length, "{{RECIPIENT_BIC}}", inv.payment_means.service_provider_id); @@ -884,12 +884,12 @@ bool administration_writer::save_contact_blocking(contact c) strops::replace(file_content, buf_length, "{{CONTACT_EMAIL}}", c.email); strops::replace(file_content, buf_length, "{{CONTACT_PHONENUMBER}}", c.phone_number); strops::replace(file_content, buf_length, "{{CONTACT_BANKACCOUNT}}", c.bank_account); - strops::replace(file_content, buf_length, "{{CONTACT_ADDRESS1}}", c.address.address1); - strops::replace(file_content, buf_length, "{{CONTACT_ADDRESS2}}", c.address.address2); - strops::replace(file_content, buf_length, "{{CONTACT_COUNTRY}}", c.address.country_code); - strops::replace(file_content, buf_length, "{{CONTACT_CITY}}", c.address.city); - strops::replace(file_content, buf_length, "{{CONTACT_POSTAL}}", c.address.postal); - strops::replace(file_content, buf_length, "{{CONTACT_REGION}}", c.address.region); + strops::replace(file_content, buf_length, "{{CONTACT_ADDRESS1}}", c.addr.address1); + strops::replace(file_content, buf_length, "{{CONTACT_ADDRESS2}}", c.addr.address2); + strops::replace(file_content, buf_length, "{{CONTACT_COUNTRY}}", c.addr.country_code); + strops::replace(file_content, buf_length, "{{CONTACT_CITY}}", c.addr.city); + strops::replace(file_content, buf_length, "{{CONTACT_POSTAL}}", c.addr.postal); + strops::replace(file_content, buf_length, "{{CONTACT_REGION}}", c.addr.region); char final_path[50]; strops::format(final_path, 50, "%s.xml", c.id); diff --git a/src/exporter.cpp b/src/exporter.cpp index 54d2b59..21ff778 100644 --- a/src/exporter.cpp +++ b/src/exporter.cpp @@ -40,12 +40,12 @@ exporter::email_provider_impl exporter::get_email_provider_implementation(email_ static int _send_email_t(void* arg) { exporter::export_request* request = (exporter::export_request*)arg; - request->status = exporter::status::EXPORT_WAITING_FOR_RESPONSE; + request->status = exporter::export_status::EXPORT_WAITING_FOR_RESPONSE; exporter::email_provider_impl impl = exporter::get_email_provider_implementation(administration::get_email_service().provider); request->error = impl.send_email(request->sender, request->recipient, request->subject, request->text); - request->status = exporter::status::EXPORT_DONE; + request->status = exporter::export_status::EXPORT_DONE; request->done_at = time(NULL); if (request->callback) request->callback(request->error); @@ -58,7 +58,7 @@ exporter::export_request* exporter::send_email(const char* sender, const char* r exporter::export_request* result = (exporter::export_request*)memops::alloc(sizeof(exporter::export_request)); result->started_at = time(NULL); result->error = E_ERR_SUCCESS; - result->status = exporter::status::EXPORT_STARTING; + result->status = exporter::export_status::EXPORT_STARTING; result->sender = sender; result->recipient = recipient; result->subject = subject; diff --git a/src/importer.cpp b/src/importer.cpp index c3757ce..23bdcbe 100644 --- a/src/importer.cpp +++ b/src/importer.cpp @@ -69,22 +69,22 @@ static void _batch_query_response_handler(invoice* buffer, char* json) } else if (strops::equals(rb, "5")) { strops::get_json_value(json, "address1", rb, alloc_size); - strops::copy(buffer->supplier.address.address1, rb, sizeof(buffer->supplier.address.address1)); + strops::copy(buffer->supplier.addr.address1, rb, sizeof(buffer->supplier.addr.address1)); strops::get_json_value(json, "address2", rb, alloc_size); - strops::copy(buffer->supplier.address.address2, rb, sizeof(buffer->supplier.address.address2)); + strops::copy(buffer->supplier.addr.address2, rb, sizeof(buffer->supplier.addr.address2)); strops::get_json_value(json, "city", rb, alloc_size); - strops::copy(buffer->supplier.address.city, rb, sizeof(buffer->supplier.address.city)); + strops::copy(buffer->supplier.addr.city, rb, sizeof(buffer->supplier.addr.city)); strops::get_json_value(json, "postal", rb, alloc_size); - strops::copy(buffer->supplier.address.postal, rb, sizeof(buffer->supplier.address.postal)); + strops::copy(buffer->supplier.addr.postal, rb, sizeof(buffer->supplier.addr.postal)); strops::get_json_value(json, "region", rb, alloc_size); - strops::copy(buffer->supplier.address.region, rb, sizeof(buffer->supplier.address.region)); + strops::copy(buffer->supplier.addr.region, rb, sizeof(buffer->supplier.addr.region)); strops::get_json_value(json, "country_code", rb, alloc_size); - strops::copy(buffer->supplier.address.country_code, rb, sizeof(buffer->supplier.address.country_code)); + strops::copy(buffer->supplier.addr.country_code, rb, sizeof(buffer->supplier.addr.country_code)); strops::get_json_value(json, "is_business", rb, alloc_size); buffer->supplier.type = (strops::equals(rb, "true")) ? contact_type::CONTACT_BUSINESS : contact_type::CONTACT_CONSUMER; @@ -109,22 +109,22 @@ static void _batch_query_response_handler(invoice* buffer, char* json) } else if (strops::equals(rb, "6")) { strops::get_json_value(json, "address1", rb, alloc_size); - strops::copy(buffer->customer.address.address1, rb, sizeof(buffer->customer.address.address1)); + strops::copy(buffer->customer.addr.address1, rb, sizeof(buffer->customer.addr.address1)); strops::get_json_value(json, "address2", rb, alloc_size); - strops::copy(buffer->customer.address.address2, rb, sizeof(buffer->customer.address.address2)); + strops::copy(buffer->customer.addr.address2, rb, sizeof(buffer->customer.addr.address2)); strops::get_json_value(json, "city", rb, alloc_size); - strops::copy(buffer->customer.address.city, rb, sizeof(buffer->customer.address.city)); + strops::copy(buffer->customer.addr.city, rb, sizeof(buffer->customer.addr.city)); strops::get_json_value(json, "postal", rb, alloc_size); - strops::copy(buffer->customer.address.postal, rb, sizeof(buffer->customer.address.postal)); + strops::copy(buffer->customer.addr.postal, rb, sizeof(buffer->customer.addr.postal)); strops::get_json_value(json, "region", rb, alloc_size); - strops::copy(buffer->customer.address.region, rb, sizeof(buffer->customer.address.region)); + strops::copy(buffer->customer.addr.region, rb, sizeof(buffer->customer.addr.region)); strops::get_json_value(json, "country_code", rb, alloc_size); - strops::copy(buffer->customer.address.country_code, rb, sizeof(buffer->customer.address.country_code)); + strops::copy(buffer->customer.addr.country_code, rb, sizeof(buffer->customer.addr.country_code)); strops::get_json_value(json, "is_business", rb, alloc_size); buffer->customer.type = (strops::equals(rb, "true")) ? contact_type::CONTACT_BUSINESS : contact_type::CONTACT_CONSUMER; @@ -149,22 +149,22 @@ static void _batch_query_response_handler(invoice* buffer, char* json) } else if (strops::equals(rb, "7")) { strops::get_json_value(json, "address1", rb, alloc_size); - strops::copy(buffer->addressee.address.address1, rb, sizeof(buffer->addressee.address.address1)); + strops::copy(buffer->addressee.addr.address1, rb, sizeof(buffer->addressee.addr.address1)); strops::get_json_value(json, "address2", rb, alloc_size); - strops::copy(buffer->addressee.address.address2, rb, sizeof(buffer->addressee.address.address2)); + strops::copy(buffer->addressee.addr.address2, rb, sizeof(buffer->addressee.addr.address2)); strops::get_json_value(json, "city", rb, alloc_size); - strops::copy(buffer->addressee.address.city, rb, sizeof(buffer->addressee.address.city)); + strops::copy(buffer->addressee.addr.city, rb, sizeof(buffer->addressee.addr.city)); strops::get_json_value(json, "postal", rb, alloc_size); - strops::copy(buffer->addressee.address.postal, rb, sizeof(buffer->addressee.address.postal)); + strops::copy(buffer->addressee.addr.postal, rb, sizeof(buffer->addressee.addr.postal)); strops::get_json_value(json, "region", rb, alloc_size); - strops::copy(buffer->addressee.address.region, rb, sizeof(buffer->addressee.address.region)); + strops::copy(buffer->addressee.addr.region, rb, sizeof(buffer->addressee.addr.region)); strops::get_json_value(json, "country_code", rb, alloc_size); - strops::copy(buffer->addressee.address.country_code, rb, sizeof(buffer->addressee.address.country_code)); + strops::copy(buffer->addressee.addr.country_code, rb, sizeof(buffer->addressee.addr.country_code)); strops::get_json_value(json, "name", rb, alloc_size); strops::copy(buffer->addressee.name, rb, sizeof(buffer->addressee.name)); @@ -210,16 +210,16 @@ static int _ai_document_to_invoice_t(void *arg) char* file_path = request->file_path; importer::ai_provider_impl impl = importer::get_ai_provider_implementation(administration::get_active_ai_service().provider); - request->status = importer::status::IMPORT_UPLOADING_FILE; + request->status = importer::import_status::IMPORT_UPLOADING_FILE; char file_id[100]; if (!impl.upload_file(file_path, file_id, 100)) { - request->status = importer::status::IMPORT_DONE; + request->status = importer::import_status::IMPORT_DONE; request->error = I_ERR_FAILED_UPLOAD; return 0; } - request->status = importer::status::IMPORT_WAITING_FOR_RESPONSE; + request->status = importer::import_status::IMPORT_WAITING_FOR_RESPONSE; const char* queries[] = { "What is the invoice number/ID? Return json containing sequential_number (string), query_id = 1 (string)", @@ -252,14 +252,14 @@ static int _ai_document_to_invoice_t(void *arg) invoice inv = administration::invoice_create_empty(); if (!impl.batch_query_with_file(queries, sizeof(queries) / sizeof(char*), file_id, &inv, _batch_query_response_handler)) { - request->status = importer::status::IMPORT_DONE; + request->status = importer::import_status::IMPORT_DONE; request->error = I_ERR_FAILED_QUERY; return 0; } inv.extras.status = invoice_status::INVOICE_RECEIVED; - inv.is_triangulation = !memops::equals(&inv.addressee.address, &inv.customer.address, sizeof(address)); + inv.is_triangulation = !memops::equals(&inv.addressee.addr, &inv.customer.addr, sizeof(address)); strops::copy(inv.customer.id, MY_COMPANY_ID, MAX_LEN_ID); @@ -268,10 +268,10 @@ static int _ai_document_to_invoice_t(void *arg) strops::copy(inv.cost_center_id, "", MAX_LEN_ID); // Set document references and save copy to disk. - strops::copy(inv.document.original_path, file_path, MAX_LEN_PATH); - strops::copy(inv.document.copy_path, "", MAX_LEN_PATH); + strops::copy(inv.orig_document.original_path, file_path, MAX_LEN_PATH); + strops::copy(inv.orig_document.copy_path, "", MAX_LEN_PATH); - request->status = importer::status::IMPORT_DONE; + request->status = importer::import_status::IMPORT_DONE; request->result = administration::invoice_create_copy(&inv); return 0; } @@ -281,7 +281,7 @@ importer::invoice_request* importer::ai_document_to_invoice(char* file_path) importer::invoice_request* result = (importer::invoice_request*)memops::alloc(sizeof(importer::invoice_request)); result->started_at = time(NULL); result->error = I_ERR_SUCCESS; - result->status = importer::status::IMPORT_STARTING; + result->status = importer::import_status::IMPORT_STARTING; strops::copy(result->file_path, file_path, MAX_LEN_PATH); thrd_t thr; @@ -298,20 +298,20 @@ static int _ai_get_available_models_t(void* arg) importer::ai_provider_impl impl = importer::get_ai_provider_implementation(request->service); if (!impl.get_available_models) { - request->status = importer::status::IMPORT_DONE; + request->status = importer::import_status::IMPORT_DONE; request->error = I_ERR_UNIMPLEMENTED; return 0; } - request->status = importer::status::IMPORT_WAITING_FOR_RESPONSE; + request->status = importer::import_status::IMPORT_WAITING_FOR_RESPONSE; if (!impl.get_available_models(request)) { - request->status = importer::status::IMPORT_DONE; + request->status = importer::import_status::IMPORT_DONE; request->error = I_ERR_FAILED_QUERY; return 0; } - request->status = importer::status::IMPORT_DONE; + request->status = importer::import_status::IMPORT_DONE; return 0; } @@ -321,14 +321,14 @@ importer::model_list_request* importer::ai_get_available_models(ai_provider serv importer::model_list_request* result = (importer::model_list_request*)memops::alloc(sizeof(importer::model_list_request)); result->started_at = time(NULL); result->error = I_ERR_SUCCESS; - result->status = importer::status::IMPORT_STARTING; + result->status = importer::import_status::IMPORT_STARTING; result->result_count = 0; result->service = service; memops::zero(result->result, sizeof(result->result)); thrd_t thr; if (thrd_create(&thr, _ai_get_available_models_t, result) != thrd_success) { - result->status = importer::status::IMPORT_DONE; + result->status = importer::import_status::IMPORT_DONE; result->error = I_ERR_FAILED_QUERY; return 0; } @@ -336,15 +336,15 @@ importer::model_list_request* importer::ai_get_available_models(ai_provider serv return result; } -const char* importer::status_to_string(importer::status status) +const char* importer::status_to_string(importer::import_status status) { switch(status) { - case importer::status::IMPORT_STARTING: return locale::get("import.status.starting"); - case importer::status::IMPORT_UPLOADING_FILE: return locale::get("import.status.uploading_file"); - case importer::status::IMPORT_QUERYING: return locale::get("import.status.querying"); - case importer::status::IMPORT_WAITING_FOR_RESPONSE: return locale::get("import.status.waiting_for_result"); - case importer::status::IMPORT_DONE: return locale::get("import.status.done"); + case importer::import_status::IMPORT_STARTING: return locale::get("import.status.starting"); + case importer::import_status::IMPORT_UPLOADING_FILE: return locale::get("import.status.uploading_file"); + case importer::import_status::IMPORT_QUERYING: return locale::get("import.status.querying"); + case importer::import_status::IMPORT_WAITING_FOR_RESPONSE: return locale::get("import.status.waiting_for_result"); + case importer::import_status::IMPORT_DONE: return locale::get("import.status.done"); } return ""; } diff --git a/src/ui/imgui_extensions.cpp b/src/ui/imgui_extensions.cpp index 2c13546..4112568 100644 --- a/src/ui/imgui_extensions.cpp +++ b/src/ui/imgui_extensions.cpp @@ -455,7 +455,7 @@ namespace ImGui for (int i = 0; i < autocomplete_count; i++) { autocomplete_strings[i] = (char*)memops::alloc(200); - strops::format(autocomplete_strings[i], 200, "%s (%s %s)", autocomplete_list[i].name, autocomplete_list[i].address.address1, autocomplete_list[i].address.address2); + strops::format(autocomplete_strings[i], 200, "%s (%s %s)", autocomplete_list[i].name, autocomplete_list[i].addr.address1, autocomplete_list[i].addr.address2); } int autocomplete_index = ImGui::InputTextWithAutocomplete(locale::get("contact.form.fullname"), @@ -486,7 +486,7 @@ namespace ImGui if (with_autocomplete) _ContactFormNameAutocomplete(buffer, last_err & A_ERR_MISSING_NAME); else ImGui::InputTextWithErrorHint(locale::get("contact.form.fullname"), buffer->name, IM_ARRAYSIZE(buffer->name), last_err & A_ERR_MISSING_NAME); - ImGui::AddressForm(&buffer->address, last_err, active_countries_only); + ImGui::AddressForm(&buffer->addr, last_err, active_countries_only); ImGui::ContactTypeDropdown(&buffer->type); @@ -775,7 +775,7 @@ namespace ImGui ImGui::InputTextWithErrorHint(locale::get("contact.form.fullname"), buffer->name, IM_ARRAYSIZE(buffer->name), last_err & A_ERR_MISSING_NAME); - ImGui::AddressForm(&buffer->address, last_err); + ImGui::AddressForm(&buffer->addr, last_err); if (viewing_only) ImGui::EndDisabled(); ImGui::PopID(); @@ -799,7 +799,7 @@ namespace ImGui static time_t status_changed_at = 0; static e_err last_err; - if (active_request && active_request->status == exporter::status::EXPORT_DONE && is_new_request) + if (active_request && active_request->status == exporter::export_status::EXPORT_DONE && is_new_request) { is_new_request = false; show_status_change = true; @@ -807,7 +807,7 @@ namespace ImGui status_changed_at = time(NULL); } - if (active_request && active_request->status != exporter::status::EXPORT_DONE) { + if (active_request && active_request->status != exporter::export_status::EXPORT_DONE) { is_new_request = true; ImGui::BeginDisabled(); ImGui::BeginCombo("##sendStatus", NULL, 1 << 20); diff --git a/src/ui/ui_contacts.cpp b/src/ui/ui_contacts.cpp index b1fa01b..99896ce 100644 --- a/src/ui/ui_contacts.cpp +++ b/src/ui/ui_contacts.cpp @@ -110,7 +110,7 @@ static void draw_contact_list() } ImGui::TableSetColumnIndex(1); ImGui::Text(c.name); - ImGui::TableSetColumnIndex(2); ImGui::Text("%s %s", c.address.address1, c.address.address2); + ImGui::TableSetColumnIndex(2); ImGui::Text("%s %s", c.addr.address1, c.addr.address2); ImGui::TableSetColumnIndex(3); diff --git a/src/ui/ui_expenses.cpp b/src/ui/ui_expenses.cpp index 168517f..6ac043f 100644 --- a/src/ui/ui_expenses.cpp +++ b/src/ui/ui_expenses.cpp @@ -109,8 +109,8 @@ static void draw_expense_form(invoice* buffer, bool viewing_only = false) ImGui::Separator(); ImGui::Spacing(); - if (ImGui::FileSelect(locale::get("ui.fileselect.text"), buffer->document.original_path)) { - buffer->document.copy_path[0] = 0; + if (ImGui::FileSelect(locale::get("ui.fileselect.text"), buffer->orig_document.original_path)) { + buffer->orig_document.copy_path[0] = 0; } ImGui::Spacing(); @@ -415,7 +415,7 @@ static void draw_import_request() { assert(active_import_request); - if (active_import_request->status == importer::status::IMPORT_DONE) { + if (active_import_request->status == importer::import_status::IMPORT_DONE) { if (active_import_request->error == I_ERR_SUCCESS) { active_invoice = active_import_request->result; current_view_state = ui::view_state::CREATE; diff --git a/src/ui/ui_invoices.cpp b/src/ui/ui_invoices.cpp index 7356207..c222050 100644 --- a/src/ui/ui_invoices.cpp +++ b/src/ui/ui_invoices.cpp @@ -225,8 +225,8 @@ static void draw_invoice_form(invoice* buffer, bool viewing_only = false) ImGui::Separator(); ImGui::Spacing(); - if (ImGui::FileSelect(locale::get("ui.fileselect.text"), buffer->document.original_path)) { - buffer->document.copy_path[0] = 0; + if (ImGui::FileSelect(locale::get("ui.fileselect.text"), buffer->orig_document.original_path)) { + buffer->orig_document.copy_path[0] = 0; } ImGui::Spacing(); diff --git a/src/ui/ui_settings.cpp b/src/ui/ui_settings.cpp index 854d065..f0a0a53 100644 --- a/src/ui/ui_settings.cpp +++ b/src/ui/ui_settings.cpp @@ -54,7 +54,7 @@ void ui::setup_settings() if (administration::company_info_is_valid()) { tax_rates = (tax_rate*)memops::alloc(sizeof(tax_rate) * 400); - tax_rate_count = country::get_available_tax_rates(administration::company_info_get().address.country_code, tax_rates, 400); + tax_rate_count = country::get_available_tax_rates(administration::company_info_get().addr.country_code, tax_rates, 400); cost_center_count = administration::cost_center_count(); cost_centers = (cost_center*)memops::alloc(cost_center_count * sizeof(cost_center)); @@ -296,7 +296,7 @@ static void draw_ai_service_ui() } // Default to first result in model list, or hardcoded default model. - if (model_request->status == importer::status::IMPORT_DONE) { + if (model_request->status == importer::import_status::IMPORT_DONE) { if (set_model_on_load) { set_model_on_load = false; @@ -309,7 +309,7 @@ static void draw_ai_service_ui() } } - if (model_request->status == importer::status::IMPORT_DONE && model_request->error == I_ERR_SUCCESS) { + if (model_request->status == importer::import_status::IMPORT_DONE && model_request->error == I_ERR_SUCCESS) { if (ImGui::BeginCombo(locale::get("settings.services.ai_service.model"), new_ai_service.model_name)) { for (u32 n = 0; n < model_request->result_count; n++) @@ -328,7 +328,7 @@ static void draw_ai_service_ui() { if (ImGui::BeginComboPreview()) { - if (model_request->status != importer::status::IMPORT_DONE) { + if (model_request->status != importer::import_status::IMPORT_DONE) { ImGui::LoadingIndicatorCircleSmall(); ImGui::SameLine(); } |
