diff --git a/lib/data/models/company_model.dart b/lib/data/models/company_model.dart index 24f05f07b..70a00ede8 100644 --- a/lib/data/models/company_model.dart +++ b/lib/data/models/company_model.dart @@ -120,6 +120,7 @@ abstract class CompanyEntity extends Object invoiceTaskLock: false, convertPaymentCurrency: false, convertExpenseCurrency: false, + notifyVendorWhenPaid: false, groups: BuiltList(), taxRates: BuiltList(), taskStatuses: BuiltList(), @@ -304,6 +305,9 @@ abstract class CompanyEntity extends Object @BuiltValueField(wireName: 'convert_expense_currency') bool get convertExpenseCurrency; + @BuiltValueField(wireName: 'notify_vendor_when_paid') + bool get notifyVendorWhenPaid; + BuiltList get groups; BuiltList get activities; @@ -716,6 +720,7 @@ abstract class CompanyEntity extends Object ..matomoId = '' ..convertPaymentCurrency = false ..convertExpenseCurrency = false + ..notifyVendorWhenPaid = false ..systemLogs.replace(BuiltList()) ..subscriptions.replace(BuiltList()) ..recurringExpenses.replace(BuiltList()) diff --git a/lib/data/models/company_model.g.dart b/lib/data/models/company_model.g.dart index 6bf848dcd..ff3385cb8 100644 --- a/lib/data/models/company_model.g.dart +++ b/lib/data/models/company_model.g.dart @@ -173,6 +173,9 @@ class _$CompanyEntitySerializer implements StructuredSerializer { 'convert_expense_currency', serializers.serialize(object.convertExpenseCurrency, specifiedType: const FullType(bool)), + 'notify_vendor_when_paid', + serializers.serialize(object.notifyVendorWhenPaid, + specifiedType: const FullType(bool)), 'groups', serializers.serialize(object.groups, specifiedType: @@ -608,6 +611,10 @@ class _$CompanyEntitySerializer implements StructuredSerializer { result.convertExpenseCurrency = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool; break; + case 'notify_vendor_when_paid': + result.notifyVendorWhenPaid = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; case 'groups': result.groups.replace(serializers.deserialize(value, specifiedType: const FullType( @@ -1679,6 +1686,8 @@ class _$CompanyEntity extends CompanyEntity { @override final bool convertExpenseCurrency; @override + final bool notifyVendorWhenPaid; + @override final BuiltList groups; @override final BuiltList activities; @@ -1849,6 +1858,7 @@ class _$CompanyEntity extends CompanyEntity { this.invoiceTaskLock, this.convertPaymentCurrency, this.convertExpenseCurrency, + this.notifyVendorWhenPaid, this.groups, this.activities, this.taxRates, @@ -2000,6 +2010,8 @@ class _$CompanyEntity extends CompanyEntity { convertPaymentCurrency, 'CompanyEntity', 'convertPaymentCurrency'); BuiltValueNullFieldError.checkNotNull( convertExpenseCurrency, 'CompanyEntity', 'convertExpenseCurrency'); + BuiltValueNullFieldError.checkNotNull( + notifyVendorWhenPaid, 'CompanyEntity', 'notifyVendorWhenPaid'); BuiltValueNullFieldError.checkNotNull(groups, 'CompanyEntity', 'groups'); BuiltValueNullFieldError.checkNotNull( activities, 'CompanyEntity', 'activities'); @@ -2159,6 +2171,7 @@ class _$CompanyEntity extends CompanyEntity { invoiceTaskLock == other.invoiceTaskLock && convertPaymentCurrency == other.convertPaymentCurrency && convertExpenseCurrency == other.convertExpenseCurrency && + notifyVendorWhenPaid == other.notifyVendorWhenPaid && groups == other.groups && activities == other.activities && taxRates == other.taxRates && @@ -2242,7 +2255,7 @@ class _$CompanyEntity extends CompanyEntity { $jc( $jc( $jc( - $jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, enableCustomSurchargeTaxes1.hashCode), enableCustomSurchargeTaxes2.hashCode), enableCustomSurchargeTaxes3.hashCode), enableCustomSurchargeTaxes4.hashCode), sizeId.hashCode), industryId.hashCode), subdomain.hashCode), portalMode.hashCode), portalDomain.hashCode), updateProducts.hashCode), convertProductExchangeRate.hashCode), convertRateToClient.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), enableProductDiscount.hashCode), defaultTaskIsDateBased.hashCode), defaultQuantity.hashCode), showProductDetails.hashCode), clientCanRegister.hashCode), isLarge.hashCode), isDisabled.hashCode), enableShopApi.hashCode), companyKey.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), numberOfInvoiceTaxRates.hashCode), numberOfItemTaxRates.hashCode), numberOfExpenseTaxRates.hashCode), expenseInclusiveTaxes.hashCode), sessionTimeout.hashCode), passwordTimeout.hashCode), oauthPasswordRequired.hashCode), markdownEnabled.hashCode), markdownEmailEnabled.hashCode), useCommaAsDecimalPlace.hashCode), reportIncludeDrafts.hashCode), reportIncludeDeleted.hashCode), useQuoteTermsOnConversion.hashCode), enableApplyingPayments.hashCode), trackInventory.hashCode), stockNotificationThreshold.hashCode), stockNotification.hashCode), invoiceTaskLock.hashCode), convertPaymentCurrency.hashCode), convertExpenseCurrency.hashCode), groups.hashCode), activities.hashCode), taxRates.hashCode), taskStatuses.hashCode), taskStatusMap.hashCode), companyGateways.hashCode), expenseCategories.hashCode), users.hashCode), clients.hashCode), products.hashCode), invoices.hashCode), recurringInvoices.hashCode), recurringExpenses.hashCode), payments.hashCode), quotes.hashCode), credits.hashCode), purchaseOrders.hashCode), bankAccounts.hashCode), transactions.hashCode), transactionRules.hashCode), tasks.hashCode), projects.hashCode), expenses.hashCode), vendors.hashCode), designs.hashCode), documents.hashCode), tokens.hashCode), webhooks.hashCode), subscriptions.hashCode), paymentTerms.hashCode), systemLogs.hashCode), clientRegistrationFields.hashCode), customFields.hashCode), slackWebhookUrl.hashCode), googleAnalyticsKey.hashCode), matomoUrl.hashCode), matomoId.hashCode), markExpensesInvoiceable.hashCode), markExpensesPaid.hashCode), invoiceExpenseDocuments.hashCode), invoiceTaskDocuments.hashCode), + $jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, enableCustomSurchargeTaxes1.hashCode), enableCustomSurchargeTaxes2.hashCode), enableCustomSurchargeTaxes3.hashCode), enableCustomSurchargeTaxes4.hashCode), sizeId.hashCode), industryId.hashCode), subdomain.hashCode), portalMode.hashCode), portalDomain.hashCode), updateProducts.hashCode), convertProductExchangeRate.hashCode), convertRateToClient.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), enableProductDiscount.hashCode), defaultTaskIsDateBased.hashCode), defaultQuantity.hashCode), showProductDetails.hashCode), clientCanRegister.hashCode), isLarge.hashCode), isDisabled.hashCode), enableShopApi.hashCode), companyKey.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), numberOfInvoiceTaxRates.hashCode), numberOfItemTaxRates.hashCode), numberOfExpenseTaxRates.hashCode), expenseInclusiveTaxes.hashCode), sessionTimeout.hashCode), passwordTimeout.hashCode), oauthPasswordRequired.hashCode), markdownEnabled.hashCode), markdownEmailEnabled.hashCode), useCommaAsDecimalPlace.hashCode), reportIncludeDrafts.hashCode), reportIncludeDeleted.hashCode), useQuoteTermsOnConversion.hashCode), enableApplyingPayments.hashCode), trackInventory.hashCode), stockNotificationThreshold.hashCode), stockNotification.hashCode), invoiceTaskLock.hashCode), convertPaymentCurrency.hashCode), convertExpenseCurrency.hashCode), notifyVendorWhenPaid.hashCode), groups.hashCode), activities.hashCode), taxRates.hashCode), taskStatuses.hashCode), taskStatusMap.hashCode), companyGateways.hashCode), expenseCategories.hashCode), users.hashCode), clients.hashCode), products.hashCode), invoices.hashCode), recurringInvoices.hashCode), recurringExpenses.hashCode), payments.hashCode), quotes.hashCode), credits.hashCode), purchaseOrders.hashCode), bankAccounts.hashCode), transactions.hashCode), transactionRules.hashCode), tasks.hashCode), projects.hashCode), expenses.hashCode), vendors.hashCode), designs.hashCode), documents.hashCode), tokens.hashCode), webhooks.hashCode), subscriptions.hashCode), paymentTerms.hashCode), systemLogs.hashCode), clientRegistrationFields.hashCode), customFields.hashCode), slackWebhookUrl.hashCode), googleAnalyticsKey.hashCode), matomoUrl.hashCode), matomoId.hashCode), markExpensesInvoiceable.hashCode), markExpensesPaid.hashCode), invoiceExpenseDocuments.hashCode), invoiceTaskDocuments.hashCode), invoiceTaskTimelog.hashCode), invoiceTaskDatelog.hashCode), invoiceTaskProject.hashCode), @@ -2313,6 +2326,7 @@ class _$CompanyEntity extends CompanyEntity { ..add('invoiceTaskLock', invoiceTaskLock) ..add('convertPaymentCurrency', convertPaymentCurrency) ..add('convertExpenseCurrency', convertExpenseCurrency) + ..add('notifyVendorWhenPaid', notifyVendorWhenPaid) ..add('groups', groups) ..add('activities', activities) ..add('taxRates', taxRates) @@ -2602,6 +2616,11 @@ class CompanyEntityBuilder set convertExpenseCurrency(bool convertExpenseCurrency) => _$this._convertExpenseCurrency = convertExpenseCurrency; + bool _notifyVendorWhenPaid; + bool get notifyVendorWhenPaid => _$this._notifyVendorWhenPaid; + set notifyVendorWhenPaid(bool notifyVendorWhenPaid) => + _$this._notifyVendorWhenPaid = notifyVendorWhenPaid; + ListBuilder _groups; ListBuilder get groups => _$this._groups ??= new ListBuilder(); @@ -2972,6 +2991,7 @@ class CompanyEntityBuilder _invoiceTaskLock = $v.invoiceTaskLock; _convertPaymentCurrency = $v.convertPaymentCurrency; _convertExpenseCurrency = $v.convertExpenseCurrency; + _notifyVendorWhenPaid = $v.notifyVendorWhenPaid; _groups = $v.groups.toBuilder(); _activities = $v.activities.toBuilder(); _taxRates = $v.taxRates.toBuilder(); @@ -3114,6 +3134,7 @@ class CompanyEntityBuilder invoiceTaskLock: BuiltValueNullFieldError.checkNotNull(invoiceTaskLock, 'CompanyEntity', 'invoiceTaskLock'), convertPaymentCurrency: BuiltValueNullFieldError.checkNotNull(convertPaymentCurrency, 'CompanyEntity', 'convertPaymentCurrency'), convertExpenseCurrency: BuiltValueNullFieldError.checkNotNull(convertExpenseCurrency, 'CompanyEntity', 'convertExpenseCurrency'), + notifyVendorWhenPaid: BuiltValueNullFieldError.checkNotNull(notifyVendorWhenPaid, 'CompanyEntity', 'notifyVendorWhenPaid'), groups: groups.build(), activities: activities.build(), taxRates: taxRates.build(), diff --git a/lib/ui/settings/expense_settings.dart b/lib/ui/settings/expense_settings.dart index 133aa0efb..74782b543 100644 --- a/lib/ui/settings/expense_settings.dart +++ b/lib/ui/settings/expense_settings.dart @@ -88,6 +88,16 @@ class _ExpenseSettingsState extends State { ), ], ), + FormCard(children: [ + SwitchListTile( + activeColor: Theme.of(context).colorScheme.secondary, + title: Text(localization.notifyVendorWhenPaid), + value: company.notifyVendorWhenPaid ?? false, + subtitle: Text(localization.notifyVendorWhenPaidHelp), + onChanged: (value) => viewModel.onCompanyChanged( + company.rebuild((b) => b..notifyVendorWhenPaid = value)), + ), + ]), if (company.numberOfItemTaxRates > 0) FormCard( children: [ diff --git a/lib/ui/settings/settings_list.dart b/lib/ui/settings/settings_list.dart index f774ae00b..293b8c38f 100644 --- a/lib/ui/settings/settings_list.dart +++ b/lib/ui/settings/settings_list.dart @@ -418,7 +418,7 @@ class SettingsSearch extends StatelessWidget { 'auto_start_tasks', 'show_tasks_table', 'client_portal', - 'lock_tasks', + 'lock_invoiced_tasks', ], ], kSettingsTaskStatuses: [ @@ -431,6 +431,8 @@ class SettingsSearch extends StatelessWidget { 'should_be_invoiced', 'mark_paid', 'inclusive_taxes', + 'convert_currency', + 'notify_vendor_when_paid', ], ], kSettingsExpenseCategories: [ diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index b367c0706..25195835f 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -16,6 +16,9 @@ mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { // STARTER: lang key - do not remove comment + 'notify_vendor_when_paid': 'Notify Vendor When Paid', + 'notify_vendor_when_paid_help': + 'Send an email to the vendor when the expense is marked as paid', 'update_payment': 'Update Payment', 'markup': 'Markup', 'purchase_order_created': 'Purchase Order Created', @@ -92933,6 +92936,14 @@ mixin LocalizationsProvider on LocaleCodeAware { _localizedValues[localeCode]['update_payment'] ?? _localizedValues['en']['update_payment']; + String get notifyVendorWhenPaid => + _localizedValues[localeCode]['notify_vendor_when_paid'] ?? + _localizedValues['en']['notify_vendor_when_paid']; + + String get notifyVendorWhenPaidHelp => + _localizedValues[localeCode]['notify_vendor_when_paid_help'] ?? + _localizedValues['en']['notify_vendor_when_paid_help']; + // STARTER: lang field - do not remove comment String lookup(String key) {