Warenwirtschaft: Bugfix — Logistik-Mail hängt den Lieferschein IMMER an
Kundenmeldung 16.07.2026: Fehlversand an die Rechnungsadresse, weil der Lieferschein (mit der Lieferadresse) in der Versand-Mail fehlte. Ursache: MailLogistic hängte ihn nur bei White-Label-Bestellungen an. Jetzt wird der Lieferschein unabhängig von Logo/White-Label immer mitgesendet; fehlt die PDF-Datei auf der Platte (Altdaten), wird sie mit bestehender Rechnungsnummer regeneriert. Dazu tote Duplikat-Klasse app/Mail/MailLogitic.php entfernt (Tippfehler-Dateiname, definierte dieselbe Klasse in einer Altversion ganz ohne Lieferschein-Anhang — Kollisionsrisiko im Classmap-Autoload). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
748f259949
commit
7d77314805
3 changed files with 178 additions and 74 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Mail;
|
||||
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Services\Invoice;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
|
|
@ -65,21 +66,20 @@ class MailLogistic extends Mailable
|
|||
'mime' => $mime,
|
||||
]);
|
||||
|
||||
// Wenn mindestens ein White-Label-Produkt enthalten ist, wird der Lieferschein (Etikett-Infos) mit angehängt
|
||||
$hasWhiteLabel = $this->shopping_order->user_white_label || $this->shopping_order->hasWhitelabelProducts();
|
||||
if ($hasWhiteLabel) {
|
||||
$filenameDelivery = Invoice::getDeliveryFilename($this->shopping_order);
|
||||
$pathDelivery = Invoice::getDownloadPathDelivery($this->shopping_order);
|
||||
if (! Storage::disk('public')->exists($pathDelivery)) {
|
||||
return;
|
||||
}
|
||||
$fileDelivery = Storage::disk('public')->path($pathDelivery);
|
||||
$mimeDelivery = Storage::disk('public')->mimeType($pathDelivery);
|
||||
|
||||
$mail->attach($fileDelivery, [
|
||||
'as' => $filenameDelivery,
|
||||
'mime' => $mimeDelivery,
|
||||
]); // attach file;
|
||||
// Kundenanforderung 16.07.2026: Der Lieferschein (mit der Lieferadresse der
|
||||
// Bestellung) wird IMMER mitgesendet — unabhängig von White-Label/Logo.
|
||||
// Vorher hing er nur bei White-Label-Bestellungen an; Folge waren
|
||||
// Fehlversände an die Rechnungsadresse.
|
||||
$pathDelivery = Invoice::getDownloadPathDelivery($this->shopping_order);
|
||||
if (! Storage::disk('public')->exists($pathDelivery)) {
|
||||
// Datei fehlt auf der Platte (Altdaten) — mit bestehender Nummer neu erzeugen
|
||||
(new InvoiceRepository($this->shopping_order))->update([]);
|
||||
}
|
||||
if (Storage::disk('public')->exists($pathDelivery)) {
|
||||
$mail->attach(Storage::disk('public')->path($pathDelivery), [
|
||||
'as' => Invoice::getDeliveryFilename($this->shopping_order),
|
||||
'mime' => Storage::disk('public')->mimeType($pathDelivery),
|
||||
]);
|
||||
}
|
||||
|
||||
return $mail;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue