Verkauf: Stornorechnung — fehlende createCancellation() im InvoiceRepository ergänzt, eigene Storno-Mail
Der SalesController rief InvoiceRepository::createCancellation() auf, die Methode existierte aber nicht — jeder Storno-Versuch endete im 500er. Die Stornorechnung wird jetzt aus demselben Nummernkreis wie die Rechnung erzeugt (pdf.cancellation_invoice, Rechnungs-Briefpapier), als cancellation_invoice am Auftrag gespeichert und der Zähler erhöht. Optional geht eine Storno-Mail mit angehängter Stornorechnung (MailCancellation, Texte email.cancellation_title/_copy1line) statt der Rechnungs-Mail an den Kunden. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
be29be863f
commit
9c362f14d9
4 changed files with 254 additions and 95 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Mail\MailCancellation;
|
||||
use App\Mail\MailInvoice;
|
||||
use App\Mail\MailLogistic;
|
||||
use App\Models\Setting;
|
||||
|
|
@ -191,6 +192,29 @@ class Invoice
|
|||
Mail::to($billing_email)->bcc($bcc)->send(new MailInvoice($shopping_order));
|
||||
}
|
||||
|
||||
/**
|
||||
* Storno-Mail mit angehängter Stornorechnung (Audit 3.1: vorher hätte hier die
|
||||
* Rechnungs-Mail gestanden — der Kunde bekäme bei einer Stornierung die Rechnung).
|
||||
*/
|
||||
public static function sendCancellationMail($shopping_order)
|
||||
{
|
||||
$bcc = [];
|
||||
$billing_email = $shopping_order->shopping_user->billing_email;
|
||||
if (! $billing_email) {
|
||||
if ($shopping_order->mode === 'test') {
|
||||
$billing_email = config('app.checkout_test_mail');
|
||||
} else {
|
||||
$billing_email = config('app.checkout_mail');
|
||||
}
|
||||
}
|
||||
if ($shopping_order->mode === 'test') {
|
||||
$bcc[] = config('app.checkout_test_mail');
|
||||
} else {
|
||||
$bcc[] = config('app.checkout_mail');
|
||||
}
|
||||
Mail::to($billing_email)->bcc($bcc)->send(new MailCancellation($shopping_order));
|
||||
}
|
||||
|
||||
public static function sendLogisticMail(ShoppingOrder $shopping_order)
|
||||
{
|
||||
$to = [config('app.logistic_mail')]; // ['versand@aloe-vera.bio'];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue