From 0dc4b64ad0bd8fbb043a09d7ca9d14f06cc48ef3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 23 Feb 2023 20:59:14 +1100 Subject: [PATCH] Minor cleanup --- app/Factory/ClientContactFactory.php | 2 +- app/Factory/VendorContactFactory.php | 2 +- .../VendorPortal/InvitationController.php | 4 +- app/Jobs/Vendor/CreatePurchaseOrderPdf.php | 64 ++++++++++--------- app/Models/PurchaseOrder.php | 4 ++ database/factories/VendorContactFactory.php | 5 ++ 6 files changed, 45 insertions(+), 36 deletions(-) diff --git a/app/Factory/ClientContactFactory.php b/app/Factory/ClientContactFactory.php index a0115ee178..e8d16bc730 100644 --- a/app/Factory/ClientContactFactory.php +++ b/app/Factory/ClientContactFactory.php @@ -22,7 +22,7 @@ class ClientContactFactory $client_contact->first_name = ''; $client_contact->user_id = $user_id; $client_contact->company_id = $company_id; - $client_contact->contact_key = Str::random(40); + $client_contact->contact_key = Str::random(32); $client_contact->id = 0; $client_contact->send_email = true; diff --git a/app/Factory/VendorContactFactory.php b/app/Factory/VendorContactFactory.php index b46ce74de1..c347726cf3 100644 --- a/app/Factory/VendorContactFactory.php +++ b/app/Factory/VendorContactFactory.php @@ -22,7 +22,7 @@ class VendorContactFactory $vendor_contact->first_name = ''; $vendor_contact->user_id = $user_id; $vendor_contact->company_id = $company_id; - $vendor_contact->contact_key = Str::random(40); + $vendor_contact->contact_key = Str::random(32); $vendor_contact->id = 0; return $vendor_contact; diff --git a/app/Http/Controllers/VendorPortal/InvitationController.php b/app/Http/Controllers/VendorPortal/InvitationController.php index c0414d9e66..385a2c0ccc 100644 --- a/app/Http/Controllers/VendorPortal/InvitationController.php +++ b/app/Http/Controllers/VendorPortal/InvitationController.php @@ -120,9 +120,7 @@ class InvitationController extends Controller return response()->streamDownload(function () use($file) { echo $file; }, $file_name, $headers); + } - - - } diff --git a/app/Jobs/Vendor/CreatePurchaseOrderPdf.php b/app/Jobs/Vendor/CreatePurchaseOrderPdf.php index dfe9836e99..fd402aec5b 100644 --- a/app/Jobs/Vendor/CreatePurchaseOrderPdf.php +++ b/app/Jobs/Vendor/CreatePurchaseOrderPdf.php @@ -11,42 +11,44 @@ namespace App\Jobs\Vendor; -use App\Exceptions\FilePermissionsFailure; -use App\Libraries\MultiDB; -use App\Models\Account; -use App\Models\Credit; -use App\Models\CreditInvitation; -use App\Models\Design; -use App\Models\Invoice; -use App\Models\InvoiceInvitation; +use App\Utils\Ninja; use App\Models\Quote; +use App\Models\Credit; +use App\Models\Design; +use App\Models\Vendor; +use App\Models\Account; +use App\Models\Invoice; +use App\Utils\HtmlEngine; +use App\Libraries\MultiDB; +use App\Utils\Traits\Pdf\PDF; +use Illuminate\Bus\Queueable; use App\Models\QuoteInvitation; +use App\Utils\Traits\MakesHash; +use App\Utils\VendorHtmlEngine; +use App\Models\CreditInvitation; use App\Models\RecurringInvoice; +use App\Services\Pdf\PdfService; +use App\Utils\PhantomJS\Phantom; +use App\Models\InvoiceInvitation; +use App\Utils\HostedPDF\NinjaPdf; +use App\Utils\Traits\Pdf\PdfMaker; +use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\Lang; +use App\Utils\Traits\NumberFormatter; +use App\Utils\Traits\MakesInvoiceHtml; +use Illuminate\Queue\SerializesModels; +use App\Models\PurchaseOrderInvitation; +use App\Utils\Traits\Pdf\PageNumbering; +use Illuminate\Support\Facades\Storage; +use Illuminate\Queue\InteractsWithQueue; +use setasign\Fpdi\PdfParser\StreamReader; +use App\Exceptions\FilePermissionsFailure; use App\Models\RecurringInvoiceInvitation; +use Illuminate\Contracts\Queue\ShouldQueue; +use Illuminate\Foundation\Bus\Dispatchable; use App\Services\PdfMaker\Design as PdfDesignModel; use App\Services\PdfMaker\Design as PdfMakerDesign; use App\Services\PdfMaker\PdfMaker as PdfMakerService; -use App\Services\Pdf\PdfService; -use App\Utils\HostedPDF\NinjaPdf; -use App\Utils\HtmlEngine; -use App\Utils\Ninja; -use App\Utils\PhantomJS\Phantom; -use App\Utils\Traits\MakesHash; -use App\Utils\Traits\MakesInvoiceHtml; -use App\Utils\Traits\NumberFormatter; -use App\Utils\Traits\Pdf\PDF; -use App\Utils\Traits\Pdf\PageNumbering; -use App\Utils\Traits\Pdf\PdfMaker; -use App\Utils\VendorHtmlEngine; -use Illuminate\Bus\Queueable; -use Illuminate\Contracts\Queue\ShouldQueue; -use Illuminate\Foundation\Bus\Dispatchable; -use Illuminate\Queue\InteractsWithQueue; -use Illuminate\Queue\SerializesModels; -use Illuminate\Support\Facades\App; -use Illuminate\Support\Facades\Lang; -use Illuminate\Support\Facades\Storage; -use setasign\Fpdi\PdfParser\StreamReader; class CreatePurchaseOrderPdf implements ShouldQueue { @@ -56,9 +58,9 @@ class CreatePurchaseOrderPdf implements ShouldQueue private $disk; - public $invitation; - + public PurchaseOrderInvitation $invitation; + public Vendor $vendor; /** * Create a new job instance. * diff --git a/app/Models/PurchaseOrder.php b/app/Models/PurchaseOrder.php index 2b9465cdc8..dc7537a6e8 100644 --- a/app/Models/PurchaseOrder.php +++ b/app/Models/PurchaseOrder.php @@ -141,6 +141,10 @@ class PurchaseOrder extends BaseModel } } + public function getEntityType() + { + return self::class; + } public function assigned_user() { diff --git a/database/factories/VendorContactFactory.php b/database/factories/VendorContactFactory.php index f0bede1531..e4d18cb1de 100644 --- a/database/factories/VendorContactFactory.php +++ b/database/factories/VendorContactFactory.php @@ -27,7 +27,12 @@ class VendorContactFactory extends Factory 'first_name' => $this->faker->firstName(), 'last_name' => $this->faker->lastName(), 'phone' => $this->faker->phoneNumber(), + 'email_verified_at' => now(), 'email' => $this->faker->unique()->safeEmail(), + 'send_email' => true, + 'password' => bcrypt('password'), + 'remember_token' => \Illuminate\Support\Str::random(10), + 'contact_key' => \Illuminate\Support\Str::random(32), ]; } }