mein-sterntours/dev/backups/phase2-offers-2026-04-17/PATCHES/Repositories.full.diff
2026-04-17 17:19:11 +02:00

159 lines
7.7 KiB
Diff

diff --git a/app/Repositories/BookingPDFRepository.php b/app/Repositories/BookingPDFRepository.php
index 505ddaf..e5ba139 100644
--- a/app/Repositories/BookingPDFRepository.php
+++ b/app/Repositories/BookingPDFRepository.php
@@ -22,7 +22,7 @@ class BookingPDFRepository extends BaseRepository
public function __construct(Booking $model)
{
$this->model = $model;
- $this->prepath = Storage::disk('public')->getAdapter()->getPathPrefix();
+ $this->prepath = Storage::disk('public')->path('');
}
public function update($data)
@@ -63,13 +63,13 @@ class BookingPDFRepository extends BaseRepository
{
$document = new stdClass();
$document->name = 'registration';
- $document->number = $this->model->lead_id;
+ $document->number = $this->model->inquiry_id;
$document->title = 'BUCHUNGSAUFTRAG';
$document->voucher = null;
$document->date = now();
$document->total = $this->model->getPriceRaw();
$dir = $this->getDirPath('pdf', 'booking', $document->date->format('Y'));
- $filename = "Buchnungsauftrag-" . $this->model->lead_id . ".pdf";
+ $filename = "Buchnungsauftrag-" . $this->model->inquiry_id . ".pdf";
$pdf_file = new CreatePDF('pdf.booking_registration');
$data = [
'booking' => $this->model,
@@ -85,7 +85,7 @@ class BookingPDFRepository extends BaseRepository
{
$document = new stdClass();
$document->name = 'confirmation';
- $document->number = $this->model->lead_id;
+ $document->number = $this->model->inquiry_id;
$document->title = 'REISEBESTÄTIGUNG';
$document->voucher = null;
$document->date = now();
@@ -104,7 +104,7 @@ class BookingPDFRepository extends BaseRepository
$document->final_payment_date = date('Y-m-d');
}
$dir = $this->getDirPath('pdf', 'booking', $document->date->format('Y'));
- $filename = "Reisebestätigung-" . $this->model->lead_id . ".pdf";
+ $filename = "Reisebestätigung-" . $this->model->inquiry_id . ".pdf";
$pdf_file = new CreatePDF('pdf.booking_confirmation');
$data = [
@@ -160,14 +160,14 @@ class BookingPDFRepository extends BaseRepository
{
$document = new stdClass();
$document->name = 'voucher';
- $document->number = $this->model->lead_id;
+ $document->number = $this->model->inquiry_id;
$document->name = 'voucher';
$document->title = $agency ? 'VOUCHER Agentur' : 'VOUCHER';
$document->voucher = $agency ? 'agency' : 'client';
$document->date = now();
$dir = $this->getDirPath('pdf', 'voucher', $document->date->format('Y'));
- $filename = ($agency ? 'VoucherAgentur' : 'Voucher') . "-" . $this->model->lead_id . ".pdf";
+ $filename = ($agency ? 'VoucherAgentur' : 'Voucher') . "-" . $this->model->inquiry_id . ".pdf";
$pdf_file = new CreatePDF('pdf.booking_voucher');
$data = [
@@ -224,7 +224,7 @@ class BookingPDFRepository extends BaseRepository
//init document
$document = new stdClass();
$document->name = $identifier;
- $document->number = $this->model->lead_id;
+ $document->number = $this->model->inquiry_id;
$document->title = 'STORNOBESTÄTIGUNG';
$document->voucher = null;
$document->date = Carbon::parse($data['storno_print']);
@@ -253,7 +253,7 @@ class BookingPDFRepository extends BaseRepository
$dir = $this->getDirPath('pdf', 'storno', $document->date->format('Y'));
- $filename = "Reisestornierung -" . $this->model->lead_id . ".pdf";
+ $filename = "Reisestornierung -" . $this->model->inquiry_id . ".pdf";
$pdf_file = new CreatePDF('pdf.booking_storno');
$data = [
@@ -288,7 +288,9 @@ class BookingPDFRepository extends BaseRepository
$fill = [
'booking_id' => $this->model->id,
'customer_id' => $this->model->customer_id,
- 'lead_id' => $this->model->lead_id,
+ // booking_documents.lead_id ist ein Shadow-Feld von booking.inquiry_id;
+ // die Spalte selbst wird von Phase 2 nicht umbenannt.
+ 'lead_id' => $this->model->inquiry_id,
'identifier' => $identifier,
'filename' => $filename,
'dir' => $dir,
diff --git a/app/Repositories/CustomerMailRepository.php b/app/Repositories/CustomerMailRepository.php
index c1b1226..6397f0c 100644
--- a/app/Repositories/CustomerMailRepository.php
+++ b/app/Repositories/CustomerMailRepository.php
@@ -135,7 +135,8 @@ class CustomerMailRepository extends BaseRepository {
$customer_mail->fill([
'booking_id' => $booking->id,
'customer_id' => $booking->customer_id,
- 'lead_id' => $booking->lead_id,
+ // customer_mails.lead_id-Spalte bleibt unverändert; Wert kommt aus booking.inquiry_id
+ 'lead_id' => $booking->inquiry_id,
'is_answer' => $is_answer,
'reply_id' => $reply_id,
'email' => $mail_from,
@@ -153,7 +154,8 @@ class CustomerMailRepository extends BaseRepository {
$customer_mail = CustomerMail::create([
'booking_id' => $booking->id,
'customer_id' => $booking->customer_id,
- 'lead_id' => $booking->lead_id,
+ // customer_mails.lead_id-Spalte bleibt unverändert; Wert kommt aus booking.inquiry_id
+ 'lead_id' => $booking->inquiry_id,
'is_answer' => $is_answer,
'reply_id' => $reply_id,
'email' => $mail_from,
@@ -300,7 +302,7 @@ class CustomerMailRepository extends BaseRepository {
$value->id = $customer_mail->booking_id;
$value->booking = $booking;
$value->show = 'single';
- $value->lead_title_id = " - (".$value->booking->lead_id.")";
+ $value->lead_title_id = " - (".$value->booking->inquiry_id.")";
$tmp = [];
@@ -342,7 +344,7 @@ class CustomerMailRepository extends BaseRepository {
$value->booking = $booking;
$value->show = 'single';
$value->draft = true;
- $value->lead_title_id = " - (".$value->booking->lead_id.")";
+ $value->lead_title_id = " - (".$value->booking->inquiry_id.")";
}else{
//multi
@@ -379,8 +381,8 @@ class CustomerMailRepository extends BaseRepository {
$value->draft = false;
$value->booking = $booking;
$value->message = "";
- $value->subject = " - (".$value->booking->lead_id.")";
- $value->lead_title_id = " - (".$value->booking->lead_id.")";
+ $value->subject = " - (".$value->booking->inquiry_id.")";
+ $value->lead_title_id = " - (".$value->booking->inquiry_id.")";
$value->s_placeholder = "Betreff des Kunden";
$value->m_placeholder = "Nachricht des Kunden";
if(isset($data['customer_mail_id']) && $customer_mail = CustomerMail::find($data['customer_mail_id'])){
diff --git a/app/Repositories/LeadRepository.php b/app/Repositories/LeadRepository.php
index 929426d..ad0ac87 100644
--- a/app/Repositories/LeadRepository.php
+++ b/app/Repositories/LeadRepository.php
@@ -134,7 +134,7 @@ class LeadRepository extends BaseRepository {
$data = [
'booking_date' => date('Y-m-d'), //now
'customer_id' => $this->model->customer->id,
- 'lead_id' => $this->model->id,
+ 'inquiry_id' => $this->model->id,
'new_drafts' => 1,
'sf_guard_user_id' => $this->model->sf_guard_user_id,
'branch_id' => 4,