diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index 520bd20190..efa8c80810 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -693,7 +693,7 @@ class CompanyController extends BaseController public function updateOriginTaxData(DefaultCompanyRequest $request, Company $company) { - if($company->settings->country_id == "840" && !$company?->account->isFreeHostedClient()) { + if($company->settings->country_id == "840" && !$company->account->isFreeHostedClient()) { try { (new CompanyTaxRate($company))->handle(); } catch(\Exception $e) { diff --git a/app/Http/Controllers/CompanyUserController.php b/app/Http/Controllers/CompanyUserController.php index c9526fec36..89dee72a52 100644 --- a/app/Http/Controllers/CompanyUserController.php +++ b/app/Http/Controllers/CompanyUserController.php @@ -119,8 +119,6 @@ class CompanyUserController extends BaseController if (! $company_user) { throw new ModelNotFoundException(ctrans('texts.company_user_not_found')); - - return; } if ($auth_user->isAdmin()) { @@ -152,7 +150,6 @@ class CompanyUserController extends BaseController if (! $company_user) { throw new ModelNotFoundException(ctrans('texts.company_user_not_found')); - return; } $this->entity_type = User::class; diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index 63c419cff8..d6fe802d4f 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -594,13 +594,11 @@ class CreditController extends BaseController $credit->service()->markPaid()->save(); return $this->itemResponse($credit); - break; case 'clone_to_credit': $credit = CloneCreditFactory::create($credit, auth()->user()->id); return $this->itemResponse($credit); - break; case 'history': // code... break; @@ -617,7 +615,7 @@ class CreditController extends BaseController return response()->streamDownload(function () use ($file) { echo $file; }, $credit->numberFormatter() . '.pdf', ['Content-Type' => 'application/pdf']); - break; + case 'archive': $this->credit_repository->archive($credit); @@ -655,7 +653,6 @@ class CreditController extends BaseController default: return response()->json(['message' => ctrans('texts.action_unavailable', ['action' => $action])], 400); - break; } } diff --git a/app/Http/Controllers/EmailController.php b/app/Http/Controllers/EmailController.php index 06cda32333..88d81f55f0 100644 --- a/app/Http/Controllers/EmailController.php +++ b/app/Http/Controllers/EmailController.php @@ -139,19 +139,19 @@ class EmailController extends BaseController return $this->itemResponse($entity_obj->fresh()); } - private function sendPurchaseOrder($entity_obj, $data, $template) - { - $this->entity_type = PurchaseOrder::class; + // private function sendPurchaseOrder($entity_obj, $data, $template) + // { + // $this->entity_type = PurchaseOrder::class; - $this->entity_transformer = PurchaseOrderTransformer::class; + // $this->entity_transformer = PurchaseOrderTransformer::class; - $data['template'] = $template; + // $data['template'] = $template; - PurchaseOrderEmail::dispatch($entity_obj, $entity_obj->company, $data); - $entity_obj->sendEvent(Webhook::EVENT_SENT_PURCHASE_ORDER, "vendor"); + // PurchaseOrderEmail::dispatch($entity_obj, $entity_obj->company, $data); + // $entity_obj->sendEvent(Webhook::EVENT_SENT_PURCHASE_ORDER, "vendor"); - return $this->itemResponse($entity_obj); - } + // return $this->itemResponse($entity_obj); + // } private function resolveClass(string $entity): string { diff --git a/app/Http/Controllers/PreviewPurchaseOrderController.php b/app/Http/Controllers/PreviewPurchaseOrderController.php index d627986822..ef1ef40d7f 100644 --- a/app/Http/Controllers/PreviewPurchaseOrderController.php +++ b/app/Http/Controllers/PreviewPurchaseOrderController.php @@ -219,139 +219,6 @@ class PreviewPurchaseOrderController extends BaseController } - public function livex(PreviewPurchaseOrderRequest $request) - { - /** @var \App\Models\User $user */ - $user = auth()->user(); - $company = $user->company(); - $file_path = (new PreviewPdf('', $company))->handle(); - $response = Response::make($file_path, 200); - $response->header('Content-Type', 'application/pdf'); - - return $response; - - MultiDB::setDb($company->db); - - $repo = new PurchaseOrderRepository(); - $entity_obj = PurchaseOrderFactory::create($company->id, $user->id); - $class = PurchaseOrder::class; - - try { - DB::connection(config('database.default'))->beginTransaction(); - - if ($request->has('entity_id')) { - /** @var \App\Models\PurchaseOrder|\Illuminate\Contracts\Database\Eloquent\Builder $entity_obj **/ - $entity_obj = \App\Models\PurchaseOrder::on(config('database.default')) - ->with('vendor.company') - ->where('id', $this->decodePrimaryKey($request->input('entity_id'))) - ->where('company_id', $company->id) - ->withTrashed() - ->first(); - } - - $entity_obj = $repo->save($request->all(), $entity_obj); - - if (!$request->has('entity_id')) { - $entity_obj->service()->fillDefaults()->save(); - } - - App::forgetInstance('translator'); - $t = app('translator'); - App::setLocale($entity_obj->company->locale()); - $t->replace(Ninja::transformTranslations($entity_obj->company->settings)); - - $html = new VendorHtmlEngine($entity_obj->invitations()->first()); - - /** @var \App\Models\Design $design */ - $design = \App\Models\Design::withTrashed()->find($entity_obj->design_id); - - /* Catch all in case migration doesn't pass back a valid design */ - if (!$design) { - $design = \App\Models\Design::find(2); - } - - if ($design->is_custom) { - $options = [ - 'custom_partials' => json_decode(json_encode($design->design), true) - ]; - $template = new PdfMakerDesign(PdfDesignModel::CUSTOM, $options); - } else { - $template = new PdfMakerDesign(strtolower($design->name)); - } - - $variables = $html->generateLabelsAndValues(); - - $state = [ - 'template' => $template->elements([ - 'client' => null, - 'vendor' => $entity_obj->vendor, - 'entity' => $entity_obj, - 'pdf_variables' => (array) $entity_obj->company->settings->pdf_variables, - 'variables' => $html->generateLabelsAndValues(), - '$product' => $design->design->product, - ]), - 'variables' => $html->generateLabelsAndValues(), - 'options' => [ - 'client' => null, - 'vendor' => $entity_obj->vendor, - 'purchase_orders' => [$entity_obj], - 'variables' => $html->generateLabelsAndValues(), - ], - 'process_markdown' => $entity_obj->company->markdown_enabled, - ]; - - $maker = new PdfMaker($state); - - $maker - ->design($template) - ->build(); - - DB::connection(config('database.default'))->rollBack(); - - if (request()->query('html') == 'true') { - return $maker->getCompiledHTML(); - } - } catch(\Exception $e) { - DB::connection(config('database.default'))->rollBack(); - return; - } - - /** @var \App\Models\User $user */ - $user = auth()->user(); - - //if phantom js...... inject here.. - if (config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom') { - return (new Phantom())->convertHtmlToPdf($maker->getCompiledHTML(true)); - } - - if (config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja') { - $pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true)); - - $numbered_pdf = $this->pageNumbering($pdf, $user->company()); - - if ($numbered_pdf) { - $pdf = $numbered_pdf; - } - - return $pdf; - } - - $file_path = (new PreviewPdf($maker->getCompiledHTML(true), $company))->handle(); - - - if (Ninja::isHosted()) { - LightLogs::create(new LivePreview()) - ->increment() - ->batch(); - } - - - $response = Response::make($file_path, 200); - $response->header('Content-Type', 'application/pdf'); - - return $response; - } - private function blankEntity() { /** @var \App\Models\User $user */ diff --git a/app/Http/Controllers/ProtectedDownloadController.php b/app/Http/Controllers/ProtectedDownloadController.php index ee5fc984ce..b578938d33 100644 --- a/app/Http/Controllers/ProtectedDownloadController.php +++ b/app/Http/Controllers/ProtectedDownloadController.php @@ -25,7 +25,6 @@ class ProtectedDownloadController extends BaseController if (!$hashed_path) { throw new SystemError('File no longer available', 404); - abort(404, 'File no longer available'); } return response()->streamDownload(function () use ($hashed_path) { diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index 38c5ba2d2b..c96733d073 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -787,7 +787,6 @@ class QuoteController extends BaseController break; default: return response()->json(['message' => ctrans('texts.action_unavailable', ['action' => $action])], 400); - break; } } diff --git a/app/Import/Transformer/BaseTransformer.php b/app/Import/Transformer/BaseTransformer.php index 32a333f66e..dbaa16d75c 100644 --- a/app/Import/Transformer/BaseTransformer.php +++ b/app/Import/Transformer/BaseTransformer.php @@ -658,7 +658,6 @@ class BaseTransformer public function getExpenseCategoryId($name) { /** @var \App\Models\ExpenseCategory $ec */ - $ec = ExpenseCategory::query()->where('company_id', $this->company->id) ->where('is_deleted', false) ->whereRaw("LOWER(REPLACE(`name`, ' ' ,'')) = ?", [ diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index f52ce435b5..9108998985 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -1205,6 +1205,7 @@ class CompanyImport implements ShouldQueue continue; } + /** @var string $storage_url */ $storage_url = (object)$this->getObject('storage_url', true); if (!Storage::exists($document->url) && is_string($storage_url)) { @@ -1351,45 +1352,31 @@ class CompanyImport implements ShouldQueue switch ($type) { case Company::class: return $this->company->id; - break; case Client::class: return $this->transformId('clients', $id); - break; case ClientContact::class: return $this->transformId('client_contacts', $id); - break; case Credit::class: return $this->transformId('credits', $id); - break; case Expense::class: return $this->transformId('expenses', $id); - break; case 'invoices': return $this->transformId('invoices', $id); - break; case Payment::class: return $this->transformId('payments', $id); - break; case Project::class: return $this->transformId('projects', $id); - break; case Product::class: return $this->transformId('products', $id); - break; case Quote::class: return $this->transformId('quotes', $id); - break; case RecurringInvoice::class: return $this->transformId('recurring_invoices', $id); - break; case Company::class: return $this->transformId('clients', $id); - break; - default: return false; - break; } } @@ -1420,10 +1407,10 @@ class CompanyImport implements ShouldQueue switch ($type) { case 'invoices': return $this->transformId('invoices', $id); - break; + case Credit::class: return $this->transformId('credits', $id); - break; + case Payment::class: return $this->transformId('payments', $id); default: diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 91d06f2b49..696b37bee8 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -1455,30 +1455,23 @@ class Import implements ShouldQueue switch ($status_id) { case 1: return $payment; - break; case 2: return $payment->service()->deletePayment(); - break; case 3: return $payment->service()->deletePayment(); - break; case 4: return $payment; - break; case 5: $payment->status_id = Payment::STATUS_PARTIALLY_REFUNDED; $payment->save(); return $payment; - break; case 6: $payment->status_id = Payment::STATUS_REFUNDED; $payment->save(); return $payment; - break; default: return $payment; - break; } } diff --git a/app/Jobs/Vendor/CreatePurchaseOrderPdf.php b/app/Jobs/Vendor/CreatePurchaseOrderPdf.php index 01ced2acba..824ac6424f 100644 --- a/app/Jobs/Vendor/CreatePurchaseOrderPdf.php +++ b/app/Jobs/Vendor/CreatePurchaseOrderPdf.php @@ -100,18 +100,6 @@ class CreatePurchaseOrderPdf implements ShouldQueue return $ps->boot()->getPdf(); - - $pdf = $this->rawPdf(); - - if ($pdf) { - try { - Storage::disk($this->disk)->put($this->file_path, $pdf); - } catch(\Exception $e) { - throw new FilePermissionsFailure($e->getMessage()); - } - } - - return $this->file_path; } public function rawPdf() diff --git a/app/Libraries/OAuth/OAuth.php b/app/Libraries/OAuth/OAuth.php index 9fef9bc3ab..e834d0628b 100644 --- a/app/Libraries/OAuth/OAuth.php +++ b/app/Libraries/OAuth/OAuth.php @@ -130,7 +130,6 @@ class OAuth return $this; default: return null; - break; } } diff --git a/app/Mail/Engine/PaymentEmailEngine.php b/app/Mail/Engine/PaymentEmailEngine.php index 7fee5173eb..26ee0ae333 100644 --- a/app/Mail/Engine/PaymentEmailEngine.php +++ b/app/Mail/Engine/PaymentEmailEngine.php @@ -516,14 +516,5 @@ class PaymentEmailEngine extends BaseEmailEngine '; - return ' - - - - -
- '. $text .' -
- '; } } diff --git a/app/PaymentDrivers/BraintreePaymentDriver.php b/app/PaymentDrivers/BraintreePaymentDriver.php index 9fe58cf6b9..74a7e7813e 100644 --- a/app/PaymentDrivers/BraintreePaymentDriver.php +++ b/app/PaymentDrivers/BraintreePaymentDriver.php @@ -354,7 +354,6 @@ class BraintreePaymentDriver extends BaseDriver return false; } - return false; } private function findTokens(string $gateway_customer_reference) diff --git a/app/PaymentDrivers/PayPal/PayPalBasePaymentDriver.php b/app/PaymentDrivers/PayPal/PayPalBasePaymentDriver.php index 5120932fd9..0db7ff2ac3 100644 --- a/app/PaymentDrivers/PayPal/PayPalBasePaymentDriver.php +++ b/app/PaymentDrivers/PayPal/PayPalBasePaymentDriver.php @@ -450,11 +450,11 @@ class PayPalBasePaymentDriver extends BaseDriver switch ($response['name']) { case 'NOT_AUTHORIZED': throw new PaymentFailed("There was a permissions issue processing this payment, please contact the merchant. ", 401); - break; + default: throw new PaymentFailed("Unknown error occurred processing payment. Please contact merchant.", 500); - break; + } } diff --git a/app/Services/Tax/Providers/TaxProvider.php b/app/Services/Tax/Providers/TaxProvider.php index 1e65d0f170..44585c75bb 100644 --- a/app/Services/Tax/Providers/TaxProvider.php +++ b/app/Services/Tax/Providers/TaxProvider.php @@ -225,7 +225,7 @@ class TaxProvider { throw new \Exception("No tax region defined for this country"); - $this->provider = EuTax::class; + // $this->provider = EuTax::class; return $this; } diff --git a/app/Transformers/ProjectTransformer.php b/app/Transformers/ProjectTransformer.php index cdf5184219..0d0bfa253f 100644 --- a/app/Transformers/ProjectTransformer.php +++ b/app/Transformers/ProjectTransformer.php @@ -47,7 +47,7 @@ class ProjectTransformer extends EntityTransformer { $transformer = new DocumentTransformer($this->serializer); - if($project->documents) { + if($project->documents->count() > 0) { return $this->includeCollection($project->documents, $transformer, Document::class); } diff --git a/resources/views/portal/ninja2020/gateways/stripe/acss/authorize.blade.php b/resources/views/portal/ninja2020/gateways/stripe/acss/authorize.blade.php index ee9b21d32f..5199d8d842 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/acss/authorize.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/acss/authorize.blade.php @@ -34,7 +34,7 @@

You have certain recourse rights if any debit does not comply with this agreement. For example, you have the right to receive reimbursement for any debit that is not authorized or is not consistent with this PAD Agreement. To obtain more information on your recourse rights, contact your financial institution.


-

You may amend or cancel this authorization at any time by providing the merchant with thirty (30) days notice at {{ $company->present()->email() }}. To obtain a sample cancellation form, or further information on cancelling a PAD agreement, please contact your financial institution.

+

You may amend or cancel this authorization at any time by providing the merchant with thirty (30) days notice at {{ $company->owner()->email }}. To obtain a sample cancellation form, or further information on cancelling a PAD agreement, please contact your financial institution.


{{ $company->present()->name() }} partners with Stripe to provide payment processing.