diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index 92a0ae31a2..31c90f38e3 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -436,9 +436,12 @@ class CompanySettings extends BaseSettings public $auto_archive_invoice_cancelled = false; - public $vendor_portal_enable_uploads=false; + public $vendor_portal_enable_uploads = false; + + public $send_email_on_mark_paid = false; public static $casts = [ + 'send_email_on_mark_paid' => 'bool', 'vendor_portal_enable_uploads' => 'bool', 'besr_id' => 'string', 'qr_iban' => 'string', diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index ccfd3e25cd..1cfe1b5bdd 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -92,6 +92,9 @@ class MarkPaid extends AbstractService $payment->service()->applyNumber()->save(); + if($payment->company->getSetting('send_email_on_mark_paid')) + $payment->service()->sendEmail(); + $this->setExchangeRate($payment); /* Create a payment relationship to the invoice entity */