Fixes for payment emails

This commit is contained in:
David Bomba 2024-05-21 08:15:54 +10:00
parent d1048b4542
commit c166ef82ff
8 changed files with 233 additions and 14 deletions

View File

@ -17,6 +17,7 @@ use App\Http\ValidationRules\Company\ValidSubdomain;
use App\Http\ValidationRules\ValidSettingsRule; use App\Http\ValidationRules\ValidSettingsRule;
use App\Utils\Ninja; use App\Utils\Ninja;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Invoiceninja\Einvoice\Models\FatturaPA\FatturaElettronica;
class UpdateCompanyRequest extends Request class UpdateCompanyRequest extends Request
{ {
@ -113,6 +114,11 @@ class UpdateCompanyRequest extends Request
$input['smtp_verify_peer'] == 'true' ? true : false; $input['smtp_verify_peer'] == 'true' ? true : false;
} }
// if(isset($input['e_invoice'])){
// nlog("am i set?");
// $r = FatturaElettronica::validate($input['e_invoice']);
// }
$this->replace($input); $this->replace($input);
} }

View File

@ -241,6 +241,32 @@ class CompanyImport implements ShouldQueue
CompanyGateway::class => [ CompanyGateway::class => [
'always_show_required_fields', 'always_show_required_fields',
] ]
],
'5.8.57' => [
Company::class => [
'einvoice',
'e_invoice',
],
Invoice::class => [
'einvoice',
'e_invoice',
],
Quote::class => [
'einvoice',
'e_invoice',
],
Credit::class => [
'einvoice',
'e_invoice',
],
PurchaseOrder::class => [
'einvoice',
'e_invoice',
],
Expense::class => [
'einvoice',
'e_invoice',
],
] ]
]; ];

View File

@ -675,6 +675,9 @@ class NinjaMailerJob implements ShouldQueue
*/ */
private function preFlightChecksFail(): bool private function preFlightChecksFail(): bool
{ {
(new \Modules\Admin\Jobs\Account\EmailQuality($this->nmo, $this->company))->run();
/* Always send regardless */ /* Always send regardless */
if ($this->override) { if ($this->override) {
return false; return false;

View File

@ -116,13 +116,16 @@ class EmailPayment implements ShouldQueue
$invoice->invitations->each(function ($invite) use ($email_builder) { $invoice->invitations->each(function ($invite) use ($email_builder) {
$cloned_mailable = unserialize(serialize($email_builder));
$nmo = new NinjaMailerObject(); $nmo = new NinjaMailerObject();
$nmo->mailable = new TemplateEmail($email_builder, $invite->contact, $invite); $nmo->mailable = new TemplateEmail($cloned_mailable, $invite->contact, $invite);
$nmo->to_user = $invite->contact; $nmo->to_user = $invite->contact;
$nmo->settings = $this->settings; $nmo->settings = $this->settings;
$nmo->company = $this->company; $nmo->company = $this->company;
$nmo->entity = $this->payment; $nmo->entity = $this->payment;
(new NinjaMailerJob($nmo))->handle(); (new NinjaMailerJob($nmo))->handle();
$nmo = null;
event(new PaymentWasEmailed($this->payment, $this->payment->company, $invite->contact, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); event(new PaymentWasEmailed($this->payment, $this->payment->company, $invite->contact, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));

View File

@ -126,7 +126,7 @@ class ReminderJob implements ShouldQueue
} }
$reminder_template = $invoice->calculateTemplate('invoice'); $reminder_template = $invoice->calculateTemplate('invoice');
nrlog("reminder template = {$reminder_template}"); nrlog("#{$invoice->number} => reminder template = {$reminder_template}");
$invoice->service()->touchReminder($reminder_template)->save(); $invoice->service()->touchReminder($reminder_template)->save();
$fees = $this->calcLateFee($invoice, $reminder_template); $fees = $this->calcLateFee($invoice, $reminder_template);

View File

@ -364,6 +364,7 @@ class Company extends BaseModel
'smtp_encryption', 'smtp_encryption',
'smtp_local_domain', 'smtp_local_domain',
'smtp_verify_peer', 'smtp_verify_peer',
'e_invoice',
]; ];
protected $hidden = [ protected $hidden = [

20
composer.lock generated
View File

@ -1385,16 +1385,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.304.1", "version": "3.307.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "6dac9b3257873a807ac73f6dc4418bdc49a5d9db" "reference": "cc79f16e1a1bd3feee421401ba2f21915abfdf91"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/6dac9b3257873a807ac73f6dc4418bdc49a5d9db", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/cc79f16e1a1bd3feee421401ba2f21915abfdf91",
"reference": "6dac9b3257873a807ac73f6dc4418bdc49a5d9db", "reference": "cc79f16e1a1bd3feee421401ba2f21915abfdf91",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1474,9 +1474,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.304.1" "source": "https://github.com/aws/aws-sdk-php/tree/3.307.1"
}, },
"time": "2024-04-09T19:25:27+00:00" "time": "2024-05-17T18:07:44+00:00"
}, },
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
@ -5034,12 +5034,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/invoiceninja/einvoice.git", "url": "https://github.com/invoiceninja/einvoice.git",
"reference": "e59a4c4d06ea61da87f7cdb19dac88e4e8665454" "reference": "39aec367c528ba66d923dc1d9e5c96f673bb46c7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/e59a4c4d06ea61da87f7cdb19dac88e4e8665454", "url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/39aec367c528ba66d923dc1d9e5c96f673bb46c7",
"reference": "e59a4c4d06ea61da87f7cdb19dac88e4e8665454", "reference": "39aec367c528ba66d923dc1d9e5c96f673bb46c7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5075,7 +5075,7 @@
"source": "https://github.com/invoiceninja/einvoice/tree/main", "source": "https://github.com/invoiceninja/einvoice/tree/main",
"issues": "https://github.com/invoiceninja/einvoice/issues" "issues": "https://github.com/invoiceninja/einvoice/issues"
}, },
"time": "2024-05-20T04:15:47+00:00" "time": "2024-05-20T11:42:32+00:00"
}, },
{ {
"name": "invoiceninja/inspector", "name": "invoiceninja/inspector",

File diff suppressed because one or more lines are too long