mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 15:47:32 -04:00 
			
		
		
		
	
						commit
						d33dc4c2f5
					
				| @ -1 +1 @@ | ||||
| 5.5.43 | ||||
| 5.5.44 | ||||
| @ -11,6 +11,7 @@ | ||||
| 
 | ||||
| namespace App\Filters; | ||||
| 
 | ||||
| use App\Models\Company; | ||||
| use App\Models\User; | ||||
| use Illuminate\Database\Eloquent\Builder; | ||||
| 
 | ||||
| @ -54,6 +55,15 @@ class DocumentFilters extends QueryFilters | ||||
|         return $this->builder->orderBy($sort_col[0], $sort_col[1]); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     public function company_documents($value = 'false') | ||||
|     { | ||||
|         if($value == 'true') | ||||
|             return $this->builder->where('documentable_type', Company::class); | ||||
|      | ||||
|         return $this->builder; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Returns the base query. | ||||
|      * | ||||
|  | ||||
| @ -131,8 +131,6 @@ class EmailController extends BaseController | ||||
|         if(Ninja::isHosted() && !$entity_obj->company->account->account_sms_verified) | ||||
|               return response(['message' => 'Please verify your account to send emails.'], 400); | ||||
|          | ||||
|         nlog($entity); | ||||
| 
 | ||||
|         if($entity == 'purchaseOrder' || $entity == 'purchase_order' || $template == 'purchase_order' || $entity == 'App\Models\PurchaseOrder'){ | ||||
|             return $this->sendPurchaseOrder($entity_obj, $data, $template); | ||||
|         } | ||||
| @ -141,7 +139,7 @@ class EmailController extends BaseController | ||||
|             if (! $invitation->contact->trashed() && $invitation->contact->email) { | ||||
|                 $entity_obj->service()->markSent()->save(); | ||||
| 
 | ||||
|                 EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data); | ||||
|                 EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data)->delay(now()->addSeconds(2)); | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
| @ -194,7 +192,7 @@ class EmailController extends BaseController | ||||
| 
 | ||||
|         $data['template'] = $template; | ||||
|          | ||||
|         PurchaseOrderEmail::dispatch($entity_obj, $entity_obj->company, $data); | ||||
|         PurchaseOrderEmail::dispatch($entity_obj, $entity_obj->company, $data)->delay(now()->addSeconds(2)); | ||||
|          | ||||
|         return $this->itemResponse($entity_obj); | ||||
| 
 | ||||
|  | ||||
| @ -45,6 +45,8 @@ class StoreExpenseRequest extends Request | ||||
|             $rules['client_id'] = 'bail|sometimes|exists:clients,id,company_id,'.auth()->user()->company()->id; | ||||
|         } | ||||
| 
 | ||||
|         $rules['category_id'] = 'bail|nullable|sometimes|exists:expense_categories,id,company_id,'.auth()->user()->company()->id.',is_deleted,0'; | ||||
| 
 | ||||
|         return $this->globalRules($rules); | ||||
|     } | ||||
| 
 | ||||
| @ -54,10 +56,6 @@ class StoreExpenseRequest extends Request | ||||
| 
 | ||||
|         $input = $this->decodePrimaryKeys($input); | ||||
| 
 | ||||
|         if (array_key_exists('category_id', $input) && is_string($input['category_id'])) { | ||||
|             $input['category_id'] = $this->decodePrimaryKey($input['category_id']); | ||||
|         } | ||||
| 
 | ||||
|         if (! array_key_exists('currency_id', $input) || strlen($input['currency_id']) == 0) { | ||||
|             $input['currency_id'] = (string) auth()->user()->company()->settings->currency_id; | ||||
|         } | ||||
| @ -66,7 +64,6 @@ class StoreExpenseRequest extends Request | ||||
|             $input['color'] = ''; | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         /* Ensure the project is related */ | ||||
|         if (array_key_exists('project_id', $input) && isset($input['project_id'])) { | ||||
|             $project = Project::withTrashed()->where('id', $input['project_id'])->company()->first(); | ||||
|  | ||||
| @ -41,6 +41,8 @@ class UpdateExpenseRequest extends Request | ||||
|             $rules['number'] = Rule::unique('expenses')->where('company_id', auth()->user()->company()->id)->ignore($this->expense->id); | ||||
|         } | ||||
| 
 | ||||
|         $rules['category_id'] = 'bail|sometimes|nullable|exists:expense_categories,id,company_id,'.auth()->user()->company()->id.',is_deleted,0'; | ||||
| 
 | ||||
|         return $this->globalRules($rules); | ||||
|     } | ||||
| 
 | ||||
| @ -50,10 +52,6 @@ class UpdateExpenseRequest extends Request | ||||
| 
 | ||||
|         $input = $this->decodePrimaryKeys($input); | ||||
| 
 | ||||
|         if (array_key_exists('category_id', $input) && is_string($input['category_id'])) { | ||||
|             $input['category_id'] = $this->decodePrimaryKey($input['category_id']); | ||||
|         } | ||||
| 
 | ||||
|         if (array_key_exists('documents', $input)) { | ||||
|             unset($input['documents']); | ||||
|         } | ||||
|  | ||||
| @ -39,6 +39,6 @@ class ValidCompanyQuantity implements Rule | ||||
|      */ | ||||
|     public function message() | ||||
|     { | ||||
|         return ctrans('texts.company_limit_reached'); | ||||
|         return ctrans('texts.company_limit_reached', ['limit' => Ninja::isSelfHost() ? 10 : auth()->user()->company()->account->hosted_company_count]); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -11,6 +11,7 @@ | ||||
| 
 | ||||
| namespace App\Mail\Engine; | ||||
| 
 | ||||
| use App\Jobs\Entity\CreateRawPdf; | ||||
| use App\Models\Account; | ||||
| use App\Utils\HtmlEngine; | ||||
| use App\Utils\Ninja; | ||||
| @ -117,11 +118,17 @@ class CreditEmailEngine extends BaseEmailEngine | ||||
|             ->setTextBody($text_body); | ||||
| 
 | ||||
|         if ($this->client->getSetting('pdf_email_attachment') !== false && $this->credit->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { | ||||
|             if (Ninja::isHosted()) { | ||||
|                 $this->setAttachments([$this->credit->pdf_file_path($this->invitation, 'url', true)]); | ||||
|             } else { | ||||
|                 $this->setAttachments([$this->credit->pdf_file_path($this->invitation)]); | ||||
|             } | ||||
|             // if (Ninja::isHosted()) {
 | ||||
|             //     $this->setAttachments([$this->credit->pdf_file_path($this->invitation, 'url', true)]);
 | ||||
|             // } else {
 | ||||
|             //     $this->setAttachments([$this->credit->pdf_file_path($this->invitation)]);
 | ||||
|             // }
 | ||||
| 
 | ||||
|              $pdf = ((new CreateRawPdf($this->invitation, $this->invitation->company->db))->handle()); | ||||
| 
 | ||||
|             $this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->credit->numberFormatter().'.pdf']]);    | ||||
| 
 | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         //attach third party documents
 | ||||
| @ -129,11 +136,11 @@ class CreditEmailEngine extends BaseEmailEngine | ||||
| 
 | ||||
|             // Storage::url
 | ||||
|             foreach ($this->credit->documents as $document) { | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]); | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]); | ||||
|             } | ||||
| 
 | ||||
|             foreach ($this->credit->company->documents as $document) { | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]); | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -13,6 +13,7 @@ namespace App\Mail\Engine; | ||||
| 
 | ||||
| use App\DataMapper\EmailTemplateDefaults; | ||||
| use App\Jobs\Entity\CreateEntityPdf; | ||||
| use App\Jobs\Entity\CreateRawPdf; | ||||
| use App\Models\Account; | ||||
| use App\Models\Expense; | ||||
| use App\Models\Task; | ||||
| @ -126,11 +127,15 @@ class InvoiceEmailEngine extends BaseEmailEngine | ||||
|             ->setTextBody($text_body); | ||||
| 
 | ||||
|         if ($this->client->getSetting('pdf_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { | ||||
|             if (Ninja::isHosted()) { | ||||
|                 $this->setAttachments([$this->invoice->pdf_file_path($this->invitation, 'url', true)]); | ||||
|             } else { | ||||
|                 $this->setAttachments([$this->invoice->pdf_file_path($this->invitation)]); | ||||
|             } | ||||
|             // if (Ninja::isHosted()) {
 | ||||
|             //     $this->setAttachments([$this->invoice->pdf_file_path($this->invitation, 'url', true)]);
 | ||||
|             // } else {
 | ||||
|             //     $this->setAttachments([$this->invoice->pdf_file_path($this->invitation)]);
 | ||||
|             // }
 | ||||
|         //        $file = (new CreateRawPdf($invitation, $invitation->company->db))->handle();
 | ||||
|             $pdf = ((new CreateRawPdf($this->invitation, $this->invitation->company->db))->handle()); | ||||
| 
 | ||||
|             $this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->invoice->numberFormatter().'.pdf']]);    | ||||
|         } | ||||
| 
 | ||||
|         //attach third party documents
 | ||||
| @ -138,11 +143,11 @@ class InvoiceEmailEngine extends BaseEmailEngine | ||||
| 
 | ||||
|             // Storage::url
 | ||||
|             foreach ($this->invoice->documents as $document) { | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL]]); | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]); | ||||
|             } | ||||
| 
 | ||||
|             foreach ($this->invoice->company->documents as $document) { | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL]]); | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]); | ||||
|             } | ||||
| 
 | ||||
|             $line_items = $this->invoice->line_items; | ||||
| @ -160,7 +165,7 @@ class InvoiceEmailEngine extends BaseEmailEngine | ||||
|                                        ->cursor() | ||||
|                                        ->each(function ($expense) { | ||||
|                                            foreach ($expense->documents as $document) { | ||||
|                                                $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL]]); | ||||
|                                                $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]); | ||||
|                                            } | ||||
|                                        }); | ||||
|                 } | ||||
| @ -176,7 +181,7 @@ class InvoiceEmailEngine extends BaseEmailEngine | ||||
|                                        ->cursor() | ||||
|                                        ->each(function ($task) { | ||||
|                                            foreach ($task->documents as $document) { | ||||
|                                                $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL]]); | ||||
|                                                $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]); | ||||
|                                            } | ||||
|                                        }); | ||||
|                 } | ||||
|  | ||||
| @ -12,6 +12,7 @@ | ||||
| namespace App\Mail\Engine; | ||||
| 
 | ||||
| use App\DataMapper\EmailTemplateDefaults; | ||||
| use App\Jobs\Entity\CreateRawPdf; | ||||
| use App\Models\Account; | ||||
| use App\Utils\Helpers; | ||||
| use App\Utils\Ninja; | ||||
| @ -89,11 +90,15 @@ class PaymentEmailEngine extends BaseEmailEngine | ||||
| 
 | ||||
|         if ($this->client->getSetting('pdf_email_attachment') !== false && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { | ||||
|             $this->payment->invoices->each(function ($invoice) { | ||||
|                 if (Ninja::isHosted()) { | ||||
|                     $this->setAttachments([$invoice->pdf_file_path($invoice->invitations->first(), 'url', true)]); | ||||
|                 } else { | ||||
|                     $this->setAttachments([$invoice->pdf_file_path($invoice->invitations->first())]); | ||||
|                 } | ||||
|                 // if (Ninja::isHosted()) {
 | ||||
|                 //     $this->setAttachments([$invoice->pdf_file_path($invoice->invitations->first(), 'url', true)]);
 | ||||
|                 // } else {
 | ||||
|                 //     $this->setAttachments([$invoice->pdf_file_path($invoice->invitations->first())]);
 | ||||
|                 // }
 | ||||
|             $pdf = ((new CreateRawPdf($invoice->invitations->first(), $invoice->company->db))->handle()); | ||||
| 
 | ||||
|             $this->setAttachments([['file' => base64_encode($pdf), 'name' => $invoice->numberFormatter().'.pdf']]);  | ||||
| 
 | ||||
|             }); | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -13,6 +13,7 @@ namespace App\Mail\Engine; | ||||
| 
 | ||||
| use App\DataMapper\EmailTemplateDefaults; | ||||
| use App\Jobs\Entity\CreateEntityPdf; | ||||
| use App\Jobs\Vendor\CreatePurchaseOrderPdf; | ||||
| use App\Models\Account; | ||||
| use App\Models\Expense; | ||||
| use App\Models\PurchaseOrder; | ||||
| @ -125,11 +126,16 @@ class PurchaseOrderEmailEngine extends BaseEmailEngine | ||||
|             ->setTextBody($text_body); | ||||
| 
 | ||||
|         if ($this->vendor->getSetting('pdf_email_attachment') !== false && $this->purchase_order->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { | ||||
|             if (Ninja::isHosted()) { | ||||
|                 $this->setAttachments([$this->purchase_order->pdf_file_path($this->invitation, 'url', true)]); | ||||
|             } else { | ||||
|                 $this->setAttachments([$this->purchase_order->pdf_file_path($this->invitation)]); | ||||
|             } | ||||
|             // if (Ninja::isHosted()) {
 | ||||
|             //     $this->setAttachments([$this->purchase_order->pdf_file_path($this->invitation, 'url', true)]);
 | ||||
|             // } else {
 | ||||
|             //     $this->setAttachments([$this->purchase_order->pdf_file_path($this->invitation)]);
 | ||||
|             // }
 | ||||
| 
 | ||||
|             $pdf = (new CreatePurchaseOrderPdf($this->invitation))->rawPdf(); | ||||
| 
 | ||||
|             $this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->purchase_order->numberFormatter().'.pdf']]);    | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         //attach third party documents
 | ||||
| @ -138,10 +144,12 @@ class PurchaseOrderEmailEngine extends BaseEmailEngine | ||||
|             // Storage::url
 | ||||
|             foreach ($this->purchase_order->documents as $document) { | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]); | ||||
|                 // $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
 | ||||
|             } | ||||
| 
 | ||||
|             foreach ($this->purchase_order->company->documents as $document) { | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]); | ||||
|                 // $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
 | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
|  | ||||
| @ -11,6 +11,7 @@ | ||||
| 
 | ||||
| namespace App\Mail\Engine; | ||||
| 
 | ||||
| use App\Jobs\Entity\CreateRawPdf; | ||||
| use App\Models\Account; | ||||
| use App\Utils\HtmlEngine; | ||||
| use App\Utils\Ninja; | ||||
| @ -116,11 +117,15 @@ class QuoteEmailEngine extends BaseEmailEngine | ||||
|             ->setTextBody($text_body); | ||||
| 
 | ||||
|         if ($this->client->getSetting('pdf_email_attachment') !== false && $this->quote->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { | ||||
|             if (Ninja::isHosted()) { | ||||
|                 $this->setAttachments([$this->quote->pdf_file_path($this->invitation, 'url', true)]); | ||||
|             } else { | ||||
|                 $this->setAttachments([$this->quote->pdf_file_path($this->invitation)]); | ||||
|             } | ||||
|             // if (Ninja::isHosted()) {
 | ||||
|             //     $this->setAttachments([$this->quote->pdf_file_path($this->invitation, 'url', true)]);
 | ||||
|             // } else {
 | ||||
|             //     $this->setAttachments([$this->quote->pdf_file_path($this->invitation)]);
 | ||||
|             // }
 | ||||
| 
 | ||||
|             $pdf = ((new CreateRawPdf($this->invitation, $this->invitation->company->db))->handle()); | ||||
| 
 | ||||
|             $this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->quote->numberFormatter().'.pdf']]);   | ||||
|         } | ||||
| 
 | ||||
|         //attach third party documents
 | ||||
| @ -128,11 +133,11 @@ class QuoteEmailEngine extends BaseEmailEngine | ||||
| 
 | ||||
|             // Storage::url
 | ||||
|             foreach ($this->quote->documents as $document) { | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]); | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]); | ||||
|             } | ||||
| 
 | ||||
|             foreach ($this->quote->company->documents as $document) { | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]); | ||||
|                 $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -120,45 +120,53 @@ class TemplateEmail extends Mailable | ||||
| 
 | ||||
|         /*In the hosted platform we need to slow things down a little for Storage to catch up.*/ | ||||
| 
 | ||||
|         if(Ninja::isHosted() && $this->invitation){ | ||||
|         // if(Ninja::isHosted() && $this->invitation){
 | ||||
| 
 | ||||
|             $path = false; | ||||
|         //     $path = false;
 | ||||
| 
 | ||||
|             if($this->invitation->invoice) | ||||
|                 $path = $this->client->invoice_filepath($this->invitation).$this->invitation->invoice->numberFormatter().'.pdf'; | ||||
|             elseif($this->invitation->quote) | ||||
|                 $path = $this->client->quote_filepath($this->invitation).$this->invitation->quote->numberFormatter().'.pdf'; | ||||
|             elseif($this->invitation->credit) | ||||
|                 $path = $this->client->credit_filepath($this->invitation).$this->invitation->credit->numberFormatter().'.pdf'; | ||||
|         //     if($this->invitation->invoice)
 | ||||
|         //         $path = $this->client->invoice_filepath($this->invitation).$this->invitation->invoice->numberFormatter().'.pdf';
 | ||||
|         //     elseif($this->invitation->quote)
 | ||||
|         //         $path = $this->client->quote_filepath($this->invitation).$this->invitation->quote->numberFormatter().'.pdf';
 | ||||
|         //     elseif($this->invitation->credit)
 | ||||
|         //         $path = $this->client->credit_filepath($this->invitation).$this->invitation->credit->numberFormatter().'.pdf';
 | ||||
| 
 | ||||
|             sleep(1); | ||||
|         //     sleep(1);
 | ||||
| 
 | ||||
|             if($path && !Storage::disk(config('filesystems.default'))->exists($path)){ | ||||
|         //     if($path && !Storage::disk(config('filesystems.default'))->exists($path)){
 | ||||
| 
 | ||||
|                 sleep(2); | ||||
|         //         sleep(2);
 | ||||
| 
 | ||||
|                 if(!Storage::disk(config('filesystems.default'))->exists($path)) { | ||||
|                     (new CreateEntityPdf($this->invitation))->handle(); | ||||
|                     sleep(2); | ||||
|                 } | ||||
|         //         if(!Storage::disk(config('filesystems.default'))->exists($path)) {
 | ||||
|         //             (new CreateEntityPdf($this->invitation))->handle();
 | ||||
|         //             sleep(2);
 | ||||
|         //         }
 | ||||
| 
 | ||||
|             } | ||||
|         //     }
 | ||||
| 
 | ||||
|         // }
 | ||||
| 
 | ||||
|         //        $file = (new CreateRawPdf($invitation, $invitation->company->db))->handle();
 | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         //22-10-2022 - Performance - To improve the performance/reliability of sending emails, attaching as Data is much better, stubs in place
 | ||||
|         foreach ($this->build_email->getAttachments() as $file) { | ||||
|             if (is_string($file)) { | ||||
|                 // nlog($file);
 | ||||
|                 // $file_data = file_get_contents($file);
 | ||||
|                 // $this->attachData($file_data, basename($file));
 | ||||
|                 $this->attach($file); | ||||
|             } elseif (is_array($file)) { | ||||
|                 // nlog($file['path']);
 | ||||
|                 // $file_data = file_get_contents($file['path']);
 | ||||
|                 // $this->attachData($file_data, $file['name']);
 | ||||
|             // if (is_string($file)) {
 | ||||
|             //     // nlog($file);
 | ||||
|             //     // $file_data = file_get_contents($file);
 | ||||
|             //     // $this->attachData($file_data, basename($file));
 | ||||
|             //     $this->attach($file);
 | ||||
|             // } elseif (is_array($file)) {
 | ||||
|             //     // nlog($file['path']);
 | ||||
|             //     // $file_data = file_get_contents($file['path']);
 | ||||
|             //     // $this->attachData($file_data, $file['name']);
 | ||||
|             //     $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]);
 | ||||
|             // }
 | ||||
|             if(array_key_exists('file', $file)) | ||||
|                 $this->attachData(base64_decode($file['file']), $file['name']); | ||||
|             else | ||||
|                 $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]); | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         if ($this->invitation && $this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { | ||||
|  | ||||
| @ -110,40 +110,39 @@ class VendorTemplateEmail extends Mailable | ||||
|                 'whitelabel' => $this->vendor->user->account->isPaid() ? true : false, | ||||
|                 'logo' => $this->company->present()->logo($settings), | ||||
|             ]); | ||||
|             //->withSymfonyMessage(function ($message) {
 | ||||
|             //    $message->getHeaders()->addTextHeader('Tag', $this->company->company_key);
 | ||||
|             //    $message->invitation = $this->invitation;
 | ||||
|             //});
 | ||||
|             // ->tag($this->company->company_key);
 | ||||
| 
 | ||||
|         if(Ninja::isHosted() && $this->invitation){ | ||||
| 
 | ||||
|             $path = false; | ||||
|         // if(Ninja::isHosted() && $this->invitation){
 | ||||
| 
 | ||||
|             if($this->invitation->purchase_order) | ||||
|                 $path = $this->vendor->purchase_order_filepath($this->invitation).$this->invitation->purchase_order->numberFormatter().'.pdf'; | ||||
|         //     $path = false;
 | ||||
| 
 | ||||
|             sleep(1); | ||||
|         //     if($this->invitation->purchase_order)
 | ||||
|         //         $path = $this->vendor->purchase_order_filepath($this->invitation).$this->invitation->purchase_order->numberFormatter().'.pdf';
 | ||||
| 
 | ||||
|             if($path && !Storage::disk(config('filesystems.default'))->exists($path)){ | ||||
|         //     sleep(1);
 | ||||
| 
 | ||||
|                 sleep(2); | ||||
|         //     if($path && !Storage::disk(config('filesystems.default'))->exists($path)){
 | ||||
| 
 | ||||
|                 if(!Storage::disk(config('filesystems.default'))->exists($path)) { | ||||
|                     (new CreatePurchaseOrderPdf($this->invitation))->handle(); | ||||
|                     sleep(2); | ||||
|                 } | ||||
|         //         sleep(2);
 | ||||
| 
 | ||||
|             } | ||||
|         //         if(!Storage::disk(config('filesystems.default'))->exists($path)) {
 | ||||
|         //             (new CreatePurchaseOrderPdf($this->invitation))->handle();
 | ||||
|         //             sleep(2);
 | ||||
|         //         }
 | ||||
| 
 | ||||
|         } | ||||
|         //     }
 | ||||
| 
 | ||||
|         // }
 | ||||
| 
 | ||||
|         foreach ($this->build_email->getAttachments() as $file) { | ||||
|             if (is_string($file)) { | ||||
|                 $this->attach($file); | ||||
|             } elseif (is_array($file)) { | ||||
|                 $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]); | ||||
|             } | ||||
|             // if (is_string($file)) {
 | ||||
|             //     $this->attach($file);
 | ||||
|             // } elseif (is_array($file)) {
 | ||||
|             //     $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]);
 | ||||
|             // }
 | ||||
| 
 | ||||
|             $this->attachData(base64_decode($file['file']), $file['name']); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         return $this; | ||||
|  | ||||
| @ -28,6 +28,6 @@ class NinjaPdf | ||||
|             RequestOptions::JSON => ['html' => $html], | ||||
|         ]); | ||||
| 
 | ||||
|         return $response->getBody(); | ||||
|         return $response->getBody()->getContents(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -14,8 +14,8 @@ return [ | ||||
|     'require_https' => env('REQUIRE_HTTPS', true), | ||||
|     'app_url' => rtrim(env('APP_URL', ''), '/'), | ||||
|     'app_domain' => env('APP_DOMAIN', 'invoicing.co'), | ||||
|     'app_version' => '5.5.43', | ||||
|     'app_tag' => '5.5.43', | ||||
|     'app_version' => '5.5.44', | ||||
|     'app_tag' => '5.5.44', | ||||
|     'minimum_client_version' => '5.0.16', | ||||
|     'terms_version' => '1.0.1', | ||||
|     'api_secret' => env('API_SECRET', ''), | ||||
|  | ||||
| @ -4063,7 +4063,7 @@ $LANG = array( | ||||
|      'save_payment_method_details' => 'Save payment method details', | ||||
|      'new_card' => 'New card', | ||||
|      'new_bank_account' => 'New bank account', | ||||
|      'company_limit_reached' => 'Limit of 10 companies per account.', | ||||
|      'company_limit_reached' => 'Limit of :limit companies per account.', | ||||
|      'credits_applied_validation' => 'Total credits applied cannot be MORE than total of invoices', | ||||
|      'credit_number_taken' => 'Credit number already taken', | ||||
|      'credit_not_found' => 'Credit not found', | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user