Add statement templates

This commit is contained in:
Hillel Coren 2020-10-09 17:10:08 +03:00
parent 59db8b6a50
commit b6a059f65e
5 changed files with 69 additions and 2 deletions

View File

@ -1211,6 +1211,12 @@ abstract class SettingsEntity
autoBill: clientSettings?.autoBill ?? autoBill: clientSettings?.autoBill ??
groupSettings?.autoBill ?? groupSettings?.autoBill ??
companySettings?.autoBill, companySettings?.autoBill,
emailBodyStatement: clientSettings?.emailBodyStatement ??
groupSettings?.emailBodyStatement ??
companySettings?.emailBodyStatement,
emailSubjectStatement: clientSettings?.emailSubjectStatement ??
groupSettings?.emailSubjectStatement ??
companySettings?.emailSubjectStatement,
); );
} }
@ -1630,6 +1636,14 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'email_template_custom3') @BuiltValueField(wireName: 'email_template_custom3')
String get emailBodyCustom3; String get emailBodyCustom3;
@nullable
@BuiltValueField(wireName: 'email_subject_statement')
String get emailSubjectStatement;
@nullable
@BuiltValueField(wireName: 'email_template_statement')
String get emailBodyStatement;
@nullable @nullable
@BuiltValueField(wireName: 'enable_client_portal_password') @BuiltValueField(wireName: 'enable_client_portal_password')
bool get enablePortalPassword; bool get enablePortalPassword;

View File

@ -1564,6 +1564,18 @@ class _$SettingsEntitySerializer
..add(serializers.serialize(object.emailBodyCustom3, ..add(serializers.serialize(object.emailBodyCustom3,
specifiedType: const FullType(String))); specifiedType: const FullType(String)));
} }
if (object.emailSubjectStatement != null) {
result
..add('email_subject_statement')
..add(serializers.serialize(object.emailSubjectStatement,
specifiedType: const FullType(String)));
}
if (object.emailBodyStatement != null) {
result
..add('email_template_statement')
..add(serializers.serialize(object.emailBodyStatement,
specifiedType: const FullType(String)));
}
if (object.enablePortalPassword != null) { if (object.enablePortalPassword != null) {
result result
..add('enable_client_portal_password') ..add('enable_client_portal_password')
@ -2388,6 +2400,14 @@ class _$SettingsEntitySerializer
result.emailBodyCustom3 = serializers.deserialize(value, result.emailBodyCustom3 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;
case 'email_subject_statement':
result.emailSubjectStatement = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'email_template_statement':
result.emailBodyStatement = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'enable_client_portal_password': case 'enable_client_portal_password':
result.enablePortalPassword = serializers.deserialize(value, result.enablePortalPassword = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool; specifiedType: const FullType(bool)) as bool;
@ -4684,6 +4704,10 @@ class _$SettingsEntity extends SettingsEntity {
@override @override
final String emailBodyCustom3; final String emailBodyCustom3;
@override @override
final String emailSubjectStatement;
@override
final String emailBodyStatement;
@override
final bool enablePortalPassword; final bool enablePortalPassword;
@override @override
final bool signatureOnPdf; final bool signatureOnPdf;
@ -4923,6 +4947,8 @@ class _$SettingsEntity extends SettingsEntity {
this.emailBodyCustom2, this.emailBodyCustom2,
this.emailSubjectCustom3, this.emailSubjectCustom3,
this.emailBodyCustom3, this.emailBodyCustom3,
this.emailSubjectStatement,
this.emailBodyStatement,
this.enablePortalPassword, this.enablePortalPassword,
this.signatureOnPdf, this.signatureOnPdf,
this.enableEmailMarkup, this.enableEmailMarkup,
@ -5104,6 +5130,8 @@ class _$SettingsEntity extends SettingsEntity {
emailBodyCustom2 == other.emailBodyCustom2 && emailBodyCustom2 == other.emailBodyCustom2 &&
emailSubjectCustom3 == other.emailSubjectCustom3 && emailSubjectCustom3 == other.emailSubjectCustom3 &&
emailBodyCustom3 == other.emailBodyCustom3 && emailBodyCustom3 == other.emailBodyCustom3 &&
emailSubjectStatement == other.emailSubjectStatement &&
emailBodyStatement == other.emailBodyStatement &&
enablePortalPassword == other.enablePortalPassword && enablePortalPassword == other.enablePortalPassword &&
signatureOnPdf == other.signatureOnPdf && signatureOnPdf == other.signatureOnPdf &&
enableEmailMarkup == other.enableEmailMarkup && enableEmailMarkup == other.enableEmailMarkup &&
@ -5198,7 +5226,7 @@ class _$SettingsEntity extends SettingsEntity {
$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($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, timezoneId.hashCode), dateFormatId.hashCode), enableMilitaryTime.hashCode), languageId.hashCode), showCurrencyCode.hashCode), currencyId.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), defaultPaymentTerms.hashCode), companyGatewayIds.hashCode), defaultTaskRate.hashCode), sendReminders.hashCode), enablePortal.hashCode), enablePortalDashboard.hashCode), enablePortalTasks.hashCode), emailStyle.hashCode), replyToEmail.hashCode), bccEmail.hashCode), pdfEmailAttachment.hashCode), ublEmailAttachment.hashCode), documentEmailAttachment.hashCode), emailStyleCustom.hashCode), customMessageDashboard.hashCode), customMessageUnpaidInvoice.hashCode), customMessagePaidInvoice.hashCode), customMessageUnapprovedQuote.hashCode), autoArchiveInvoice.hashCode), autoArchiveQuote.hashCode), autoEmailInvoice.hashCode), autoConvertQuote.hashCode), enableInclusiveTaxes.hashCode), translations.hashCode), taskNumberPattern.hashCode), taskNumberCounter.hashCode), expenseNumberPattern.hashCode), expenseNumberCounter.hashCode), vendorNumberPattern.hashCode), vendorNumberCounter.hashCode), ticketNumberPattern.hashCode), ticketNumberCounter.hashCode), paymentNumberPattern.hashCode), paymentNumberCounter.hashCode), invoiceNumberPattern.hashCode), invoiceNumberCounter.hashCode), recurringInvoiceNumberPattern.hashCode), recurringInvoiceNumberCounter.hashCode), quoteNumberPattern.hashCode), quoteNumberCounter.hashCode), clientNumberPattern.hashCode), clientNumberCounter.hashCode), creditNumberPattern.hashCode), creditNumberCounter.hashCode), recurringNumberPrefix.hashCode), resetCounterFrequencyId.hashCode), resetCounterDate.hashCode), counterPadding.hashCode), sharedInvoiceQuoteCounter.hashCode), defaultInvoiceTerms.hashCode), defaultQuoteTerms.hashCode), defaultQuoteFooter.hashCode), defaultCreditTerms.hashCode), defaultCreditFooter.hashCode), defaultInvoiceDesignId.hashCode), defaultQuoteDesignId.hashCode), defaultCreditDesignId.hashCode), defaultInvoiceFooter.hashCode), invoiceLabels.hashCode), defaultTaxName1.hashCode), defaultTaxRate1.hashCode), defaultTaxName2.hashCode), defaultTaxRate2.hashCode), defaultTaxName3.hashCode), defaultTaxRate3.hashCode), defaultPaymentTypeId.hashCode), invoiceFields.hashCode), pdfVariables.hashCode), emailSignature.hashCode), emailSubjectInvoice.hashCode), emailSubjectQuote.hashCode), emailSubjectPayment.hashCode), emailSubjectPaymentPartial.hashCode), emailBodyInvoice.hashCode), emailBodyQuote.hashCode), emailBodyPayment.hashCode), emailBodyPaymentPartial.hashCode), emailSubjectReminder1.hashCode), emailSubjectReminder2.hashCode), emailSubjectReminder3.hashCode), emailBodyReminder1.hashCode), emailBodyReminder2.hashCode), emailBodyReminder3.hashCode), emailSubjectCustom1.hashCode), emailBodyCustom1.hashCode), emailSubjectCustom2.hashCode), emailBodyCustom2.hashCode), emailSubjectCustom3.hashCode), emailBodyCustom3.hashCode), enablePortalPassword.hashCode), signatureOnPdf.hashCode), enableEmailMarkup.hashCode), showAcceptInvoiceTerms.hashCode), showAcceptQuoteTerms.hashCode), requireInvoiceSignature.hashCode), requireQuoteSignature.hashCode), name.hashCode), companyLogo.hashCode), website.hashCode), address1.hashCode), address2.hashCode), city.hashCode), state.hashCode), postalCode.hashCode), phone.hashCode), email.hashCode), countryId.hashCode), vatNumber.hashCode), idNumber.hashCode), pageSize.hashCode), fontSize.hashCode), primaryColor.hashCode), secondaryColor.hashCode), primaryFont.hashCode), secondaryFont.hashCode), hidePaidToDate.hashCode), embedDocuments.hashCode), allPagesHeader.hashCode), allPagesFooter.hashCode), enableReminder1.hashCode), enableReminder2.hashCode), enableReminder3.hashCode), enableReminder4.hashCode), numDaysReminder1.hashCode), numDaysReminder2.hashCode), numDaysReminder3.hashCode), scheduleReminder1.hashCode), scheduleReminder2.hashCode), scheduleReminder3.hashCode), endlessReminderFrequencyId.hashCode), lateFeeAmount1.hashCode), lateFeeAmount2.hashCode), lateFeeAmount3.hashCode), lateFeeAmountEndless.hashCode), lateFeePercent1.hashCode), lateFeePercent2.hashCode), lateFeePercent3.hashCode), lateFeePercentEndless.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($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, timezoneId.hashCode), dateFormatId.hashCode), enableMilitaryTime.hashCode), languageId.hashCode), showCurrencyCode.hashCode), currencyId.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), defaultPaymentTerms.hashCode), companyGatewayIds.hashCode), defaultTaskRate.hashCode), sendReminders.hashCode), enablePortal.hashCode), enablePortalDashboard.hashCode), enablePortalTasks.hashCode), emailStyle.hashCode), replyToEmail.hashCode), bccEmail.hashCode), pdfEmailAttachment.hashCode), ublEmailAttachment.hashCode), documentEmailAttachment.hashCode), emailStyleCustom.hashCode), customMessageDashboard.hashCode), customMessageUnpaidInvoice.hashCode), customMessagePaidInvoice.hashCode), customMessageUnapprovedQuote.hashCode), autoArchiveInvoice.hashCode), autoArchiveQuote.hashCode), autoEmailInvoice.hashCode), autoConvertQuote.hashCode), enableInclusiveTaxes.hashCode), translations.hashCode), taskNumberPattern.hashCode), taskNumberCounter.hashCode), expenseNumberPattern.hashCode), expenseNumberCounter.hashCode), vendorNumberPattern.hashCode), vendorNumberCounter.hashCode), ticketNumberPattern.hashCode), ticketNumberCounter.hashCode), paymentNumberPattern.hashCode), paymentNumberCounter.hashCode), invoiceNumberPattern.hashCode), invoiceNumberCounter.hashCode), recurringInvoiceNumberPattern.hashCode), recurringInvoiceNumberCounter.hashCode), quoteNumberPattern.hashCode), quoteNumberCounter.hashCode), clientNumberPattern.hashCode), clientNumberCounter.hashCode), creditNumberPattern.hashCode), creditNumberCounter.hashCode), recurringNumberPrefix.hashCode), resetCounterFrequencyId.hashCode), resetCounterDate.hashCode), counterPadding.hashCode), sharedInvoiceQuoteCounter.hashCode), defaultInvoiceTerms.hashCode), defaultQuoteTerms.hashCode), defaultQuoteFooter.hashCode), defaultCreditTerms.hashCode), defaultCreditFooter.hashCode), defaultInvoiceDesignId.hashCode), defaultQuoteDesignId.hashCode), defaultCreditDesignId.hashCode), defaultInvoiceFooter.hashCode), invoiceLabels.hashCode), defaultTaxName1.hashCode), defaultTaxRate1.hashCode), defaultTaxName2.hashCode), defaultTaxRate2.hashCode), defaultTaxName3.hashCode), defaultTaxRate3.hashCode), defaultPaymentTypeId.hashCode), invoiceFields.hashCode), pdfVariables.hashCode), emailSignature.hashCode), emailSubjectInvoice.hashCode), emailSubjectQuote.hashCode), emailSubjectPayment.hashCode), emailSubjectPaymentPartial.hashCode), emailBodyInvoice.hashCode), emailBodyQuote.hashCode), emailBodyPayment.hashCode), emailBodyPaymentPartial.hashCode), emailSubjectReminder1.hashCode), emailSubjectReminder2.hashCode), emailSubjectReminder3.hashCode), emailBodyReminder1.hashCode), emailBodyReminder2.hashCode), emailBodyReminder3.hashCode), emailSubjectCustom1.hashCode), emailBodyCustom1.hashCode), emailSubjectCustom2.hashCode), emailBodyCustom2.hashCode), emailSubjectCustom3.hashCode), emailBodyCustom3.hashCode), emailSubjectStatement.hashCode), emailBodyStatement.hashCode), enablePortalPassword.hashCode), signatureOnPdf.hashCode), enableEmailMarkup.hashCode), showAcceptInvoiceTerms.hashCode), showAcceptQuoteTerms.hashCode), requireInvoiceSignature.hashCode), requireQuoteSignature.hashCode), name.hashCode), companyLogo.hashCode), website.hashCode), address1.hashCode), address2.hashCode), city.hashCode), state.hashCode), postalCode.hashCode), phone.hashCode), email.hashCode), countryId.hashCode), vatNumber.hashCode), idNumber.hashCode), pageSize.hashCode), fontSize.hashCode), primaryColor.hashCode), secondaryColor.hashCode), primaryFont.hashCode), secondaryFont.hashCode), hidePaidToDate.hashCode), embedDocuments.hashCode), allPagesHeader.hashCode), allPagesFooter.hashCode), enableReminder1.hashCode), enableReminder2.hashCode), enableReminder3.hashCode), enableReminder4.hashCode), numDaysReminder1.hashCode), numDaysReminder2.hashCode), numDaysReminder3.hashCode), scheduleReminder1.hashCode), scheduleReminder2.hashCode), scheduleReminder3.hashCode), endlessReminderFrequencyId.hashCode), lateFeeAmount1.hashCode), lateFeeAmount2.hashCode), lateFeeAmount3.hashCode), lateFeeAmountEndless.hashCode), lateFeePercent1.hashCode), lateFeePercent2.hashCode), lateFeePercent3.hashCode), lateFeePercentEndless.hashCode),
emailSubjectReminder4.hashCode), emailSubjectReminder4.hashCode),
emailBodyReminder4.hashCode), emailBodyReminder4.hashCode),
clientOnlinePaymentNotification.hashCode), clientOnlinePaymentNotification.hashCode),
@ -5322,6 +5350,8 @@ class _$SettingsEntity extends SettingsEntity {
..add('emailBodyCustom2', emailBodyCustom2) ..add('emailBodyCustom2', emailBodyCustom2)
..add('emailSubjectCustom3', emailSubjectCustom3) ..add('emailSubjectCustom3', emailSubjectCustom3)
..add('emailBodyCustom3', emailBodyCustom3) ..add('emailBodyCustom3', emailBodyCustom3)
..add('emailSubjectStatement', emailSubjectStatement)
..add('emailBodyStatement', emailBodyStatement)
..add('enablePortalPassword', enablePortalPassword) ..add('enablePortalPassword', enablePortalPassword)
..add('signatureOnPdf', signatureOnPdf) ..add('signatureOnPdf', signatureOnPdf)
..add('enableEmailMarkup', enableEmailMarkup) ..add('enableEmailMarkup', enableEmailMarkup)
@ -5889,6 +5919,16 @@ class SettingsEntityBuilder
set emailBodyCustom3(String emailBodyCustom3) => set emailBodyCustom3(String emailBodyCustom3) =>
_$this._emailBodyCustom3 = emailBodyCustom3; _$this._emailBodyCustom3 = emailBodyCustom3;
String _emailSubjectStatement;
String get emailSubjectStatement => _$this._emailSubjectStatement;
set emailSubjectStatement(String emailSubjectStatement) =>
_$this._emailSubjectStatement = emailSubjectStatement;
String _emailBodyStatement;
String get emailBodyStatement => _$this._emailBodyStatement;
set emailBodyStatement(String emailBodyStatement) =>
_$this._emailBodyStatement = emailBodyStatement;
bool _enablePortalPassword; bool _enablePortalPassword;
bool get enablePortalPassword => _$this._enablePortalPassword; bool get enablePortalPassword => _$this._enablePortalPassword;
set enablePortalPassword(bool enablePortalPassword) => set enablePortalPassword(bool enablePortalPassword) =>
@ -6317,6 +6357,8 @@ class SettingsEntityBuilder
_emailBodyCustom2 = _$v.emailBodyCustom2; _emailBodyCustom2 = _$v.emailBodyCustom2;
_emailSubjectCustom3 = _$v.emailSubjectCustom3; _emailSubjectCustom3 = _$v.emailSubjectCustom3;
_emailBodyCustom3 = _$v.emailBodyCustom3; _emailBodyCustom3 = _$v.emailBodyCustom3;
_emailSubjectStatement = _$v.emailSubjectStatement;
_emailBodyStatement = _$v.emailBodyStatement;
_enablePortalPassword = _$v.enablePortalPassword; _enablePortalPassword = _$v.enablePortalPassword;
_signatureOnPdf = _$v.signatureOnPdf; _signatureOnPdf = _$v.signatureOnPdf;
_enableEmailMarkup = _$v.enableEmailMarkup; _enableEmailMarkup = _$v.enableEmailMarkup;
@ -6508,6 +6550,8 @@ class SettingsEntityBuilder
emailBodyCustom2: emailBodyCustom2, emailBodyCustom2: emailBodyCustom2,
emailSubjectCustom3: emailSubjectCustom3, emailSubjectCustom3: emailSubjectCustom3,
emailBodyCustom3: emailBodyCustom3, emailBodyCustom3: emailBodyCustom3,
emailSubjectStatement: emailSubjectStatement,
emailBodyStatement: emailBodyStatement,
enablePortalPassword: enablePortalPassword, enablePortalPassword: enablePortalPassword,
signatureOnPdf: signatureOnPdf, signatureOnPdf: signatureOnPdf,
enableEmailMarkup: enableEmailMarkup, enableEmailMarkup: enableEmailMarkup,

View File

@ -154,6 +154,7 @@ class EmailTemplate extends EnumClass {
static const EmailTemplate custom1 = _$custom1_email; static const EmailTemplate custom1 = _$custom1_email;
static const EmailTemplate custom2 = _$custom2_email; static const EmailTemplate custom2 = _$custom2_email;
static const EmailTemplate custom3 = _$custom3_email; static const EmailTemplate custom3 = _$custom3_email;
static const EmailTemplate statement = _$statement_email;
static BuiltSet<EmailTemplate> get values => _$templateValues; static BuiltSet<EmailTemplate> get values => _$templateValues;

View File

@ -220,6 +220,7 @@ const EmailTemplate _$reminder_endless_email =
const EmailTemplate _$custom1_email = const EmailTemplate._('custom1'); const EmailTemplate _$custom1_email = const EmailTemplate._('custom1');
const EmailTemplate _$custom2_email = const EmailTemplate._('custom2'); const EmailTemplate _$custom2_email = const EmailTemplate._('custom2');
const EmailTemplate _$custom3_email = const EmailTemplate._('custom3'); const EmailTemplate _$custom3_email = const EmailTemplate._('custom3');
const EmailTemplate _$statement_email = const EmailTemplate._('statement');
EmailTemplate _$templateValueOf(String name) { EmailTemplate _$templateValueOf(String name) {
switch (name) { switch (name) {
@ -247,6 +248,8 @@ EmailTemplate _$templateValueOf(String name) {
return _$custom2_email; return _$custom2_email;
case 'custom3': case 'custom3':
return _$custom3_email; return _$custom3_email;
case 'statement':
return _$statement_email;
default: default:
throw new ArgumentError(name); throw new ArgumentError(name);
} }
@ -266,6 +269,7 @@ final BuiltSet<EmailTemplate> _$templateValues =
_$custom1_email, _$custom1_email,
_$custom2_email, _$custom2_email,
_$custom3_email, _$custom3_email,
_$statement_email,
]); ]);
const UserPermission _$create = const UserPermission._('create'); const UserPermission _$create = const UserPermission._('create');

View File

@ -155,6 +155,10 @@ class _TemplatesAndRemindersState extends State<TemplatesAndReminders>
settings = settings.rebuild((b) => b settings = settings.rebuild((b) => b
..emailBodyCustom3 = body ..emailBodyCustom3 = body
..emailSubjectCustom3 = subject); ..emailSubjectCustom3 = subject);
} else if (_template == EmailTemplate.statement) {
settings = settings.rebuild((b) => b
..emailBodyStatement = body
..emailSubjectStatement = subject);
} }
if (settings != widget.viewModel.settings) { if (settings != widget.viewModel.settings) {
@ -248,7 +252,7 @@ class _TemplatesAndRemindersState extends State<TemplatesAndReminders>
if ([ if ([
EmailTemplate.invoice, EmailTemplate.invoice,
EmailTemplate.payment, EmailTemplate.payment,
EmailTemplate.partial_payment EmailTemplate.partial_payment,
].contains(value) && ].contains(value) &&
!company.isModuleEnabled(EntityType.invoice)) { !company.isModuleEnabled(EntityType.invoice)) {
return false; return false;