mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Static analysis
This commit is contained in:
parent
93c6de7747
commit
028eb24fd9
@ -241,7 +241,7 @@ class CreditExport extends BaseExport
|
||||
}
|
||||
|
||||
if (in_array('credit.user_id', $this->input['report_keys'])) {
|
||||
$entity['credit.user_id'] = $credit->user ? $credit->user->present()->name() : '';
|
||||
$entity['credit.user_id'] = $credit->user ? $credit->user->present()->name() : ''; //@phpstan-ignore-line
|
||||
}
|
||||
|
||||
return $entity;
|
||||
|
@ -85,7 +85,7 @@ class ExpenseExport extends BaseExport
|
||||
->where('company_id', $this->company->id);
|
||||
|
||||
|
||||
if(!$this->input['include_deleted'] ?? false) {
|
||||
if(!$this->input['include_deleted'] ?? false) { // @phpstan-ignore-line
|
||||
$query->where('is_deleted', 0);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ class InvoiceExport extends BaseExport
|
||||
->where('company_id', $this->company->id);
|
||||
|
||||
|
||||
if(!$this->input['include_deleted'] ?? false) {
|
||||
if(!$this->input['include_deleted'] ?? false) {// @phpstan-ignore-line
|
||||
$query->where('is_deleted', 0);
|
||||
}
|
||||
|
||||
@ -166,7 +166,8 @@ class InvoiceExport extends BaseExport
|
||||
}
|
||||
|
||||
if (in_array('invoice.user_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.user_id'] = $invoice->user ? $invoice->user->present()->name() : '';
|
||||
$entity['invoice.user_id'] = $invoice->user ? $invoice->user->present()->name() : ''; // @phpstan-ignore-line
|
||||
|
||||
}
|
||||
|
||||
return $entity;
|
||||
|
@ -75,7 +75,7 @@ class InvoiceItemExport extends BaseExport
|
||||
})
|
||||
->where('company_id', $this->company->id);
|
||||
|
||||
if(!$this->input['include_deleted'] ?? false) {
|
||||
if(!$this->input['include_deleted'] ?? false) {// @phpstan-ignore-line
|
||||
$query->where('is_deleted', 0);
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ class InvoiceItemExport extends BaseExport
|
||||
}
|
||||
|
||||
if (in_array('invoice.user_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.user_id'] = $invoice->user ? $invoice->user->present()->name() : '';
|
||||
$entity['invoice.user_id'] = $invoice->user ? $invoice->user->present()->name() : '';// @phpstan-ignore-line
|
||||
}
|
||||
|
||||
return $entity;
|
||||
|
@ -63,7 +63,7 @@ class PurchaseOrderExport extends BaseExport
|
||||
})
|
||||
->where('company_id', $this->company->id);
|
||||
|
||||
if(!$this->input['include_deleted'] ?? false) {
|
||||
if(!$this->input['include_deleted'] ?? false) { // @phpstan-ignore-line
|
||||
$query->where('is_deleted', 0);
|
||||
}
|
||||
|
||||
@ -167,7 +167,8 @@ class PurchaseOrderExport extends BaseExport
|
||||
}
|
||||
|
||||
if (in_array('purchase_order.user_id', $this->input['report_keys'])) {
|
||||
$entity['purchase_order.user_id'] = $purchase_order->user ? $purchase_order->user->present()->name() : '';
|
||||
$entity['purchase_order.user_id'] = $purchase_order->user ? $purchase_order->user->present()->name() : ''; // @phpstan-ignore-line
|
||||
|
||||
}
|
||||
|
||||
if (in_array('purchase_order.assigned_user_id', $this->input['report_keys'])) {
|
||||
|
@ -429,7 +429,7 @@ class ClientController extends BaseController
|
||||
/** @var ?\Postmark\Models\DynamicResponseModel $response */
|
||||
$response = $postmark->activateBounce((int)$bounce_id);
|
||||
|
||||
if($response && $response?->Message == 'OK' && !$response->Bounce->Inactive && $response->Bounce->Email) {
|
||||
if($response && $response?->Message == 'OK' && !$response->Bounce->Inactive && $response->Bounce->Email) { // @phpstan-ignore-line
|
||||
|
||||
$email = $response->Bounce->Email;
|
||||
//remove email from quarantine. //@TODO
|
||||
|
@ -57,8 +57,9 @@ class ContactHashLoginController extends Controller
|
||||
return render('generic.error', [
|
||||
'title' => session()->get('title'),
|
||||
'notification' => session()->get('notification'),
|
||||
'account' => auth()->guard('contact')?->user()?->user?->account,
|
||||
'company' => auth()->guard('contact')?->user()?->user?->company
|
||||
'account' => auth()->guard('contact')?->user()?->user?->account,// @phpstan-ignore-line
|
||||
'company' => auth()->guard('contact')?->user()?->user?->company // @phpstan-ignore-line
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ use Illuminate\Http\Request;
|
||||
*/
|
||||
class MailgunWebhookController extends BaseController
|
||||
{
|
||||
private $invitation;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -36,21 +36,16 @@ class ReportExportController extends BaseController
|
||||
return response()->json(['message' => 'Still working.....'], 409);
|
||||
}
|
||||
|
||||
if($report) {
|
||||
Cache::forget($hash);
|
||||
|
||||
Cache::forget($hash);
|
||||
|
||||
$headers = [
|
||||
'Content-Disposition' => 'attachment',
|
||||
'Content-Type' => 'text/csv',
|
||||
];
|
||||
|
||||
return response()->streamDownload(function () use ($report) {
|
||||
echo $report;
|
||||
}, $this->filename, $headers);
|
||||
|
||||
}
|
||||
$headers = [
|
||||
'Content-Disposition' => 'attachment',
|
||||
'Content-Type' => 'text/csv',
|
||||
];
|
||||
|
||||
return response()->streamDownload(function () use ($report) {
|
||||
echo $report;
|
||||
}, $this->filename, $headers);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -34,12 +34,9 @@ class ReportPreviewController extends BaseController
|
||||
return response()->json(['message' => 'Still working.....'], 409);
|
||||
}
|
||||
|
||||
if($report) {
|
||||
Cache::forget($hash);
|
||||
|
||||
Cache::forget($hash);
|
||||
|
||||
return response()->json($report, 200);
|
||||
}
|
||||
return response()->json($report, 200);
|
||||
|
||||
|
||||
}
|
||||
|
@ -122,26 +122,26 @@ class SelfUpdateController extends BaseController
|
||||
return response()->json(['message' => 'Update completed'], 200);
|
||||
}
|
||||
|
||||
private function runModelChecks()
|
||||
{
|
||||
Company::query()
|
||||
->cursor()
|
||||
->each(function ($company) {
|
||||
// private function runModelChecks()
|
||||
// {
|
||||
// Company::query()
|
||||
// ->cursor()
|
||||
// ->each(function ($company) {
|
||||
|
||||
$settings = $company->settings;
|
||||
// $settings = $company->settings;
|
||||
|
||||
if(property_exists($settings->pdf_variables, 'purchase_order_details')) {
|
||||
return;
|
||||
}
|
||||
// if(property_exists($settings->pdf_variables, 'purchase_order_details')) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
$pdf_variables = $settings->pdf_variables;
|
||||
$pdf_variables->purchase_order_details = [];
|
||||
$settings->pdf_variables = $pdf_variables;
|
||||
$company->settings = $settings;
|
||||
$company->save();
|
||||
// $pdf_variables = $settings->pdf_variables;
|
||||
// $pdf_variables->purchase_order_details = [];
|
||||
// $settings->pdf_variables = $pdf_variables;
|
||||
// $company->settings = $settings;
|
||||
// $company->save();
|
||||
|
||||
});
|
||||
}
|
||||
// });
|
||||
// }
|
||||
|
||||
private function clearCacheDir()
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ class TwilioController extends BaseController
|
||||
return response()->json(['message' => 'Please update your first and/or last name in the User Details before verifying your number.'], 400);
|
||||
}
|
||||
|
||||
if (!$user->phone || $user->phone == '') {
|
||||
if (!$user->phone || empty($user->phone)) {
|
||||
return response()->json(['message' => 'User found, but no valid phone number on file, please contact support.'], 400);
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ class UpdateClientRequest extends Request
|
||||
* down to the free plan setting properties which
|
||||
* are saveable
|
||||
*
|
||||
* @param \stdClass $settings
|
||||
* @param mixed $settings
|
||||
* @return \stdClass $settings
|
||||
*/
|
||||
private function filterSaveableSettings($settings)
|
||||
|
@ -18,7 +18,6 @@ class ClientEmailHistoryRequest extends Request
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
private string $error_message = '';
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
|
@ -20,7 +20,6 @@ class EntityEmailHistoryRequest extends Request
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
private string $error_message = '';
|
||||
private string $entity_plural = '';
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
|
@ -126,7 +126,7 @@ class UpdateRecurringInvoiceRequest extends Request
|
||||
}
|
||||
|
||||
if (isset($input['line_items'])) {
|
||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||
$input['line_items'] = $this->cleanItems($input['line_items']);
|
||||
$input['amount'] = $this->entityTotalAmount($input['line_items']);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@ use Illuminate\Auth\Access\AuthorizationException;
|
||||
|
||||
class GenericReportRequest extends Request
|
||||
{
|
||||
private string $error_message = '';
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
|
@ -77,7 +77,7 @@ class UpdateUserRequest extends Request
|
||||
unset($input['oauth_user_token']);
|
||||
}
|
||||
|
||||
if(isset($input['password']) && strlen($input['password'] ?? '') > 1)
|
||||
if(isset($input['password']) && is_string($input['password']))
|
||||
{
|
||||
$input['password'] = trim($input['password']);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class HasValidPhoneNumber implements Rule
|
||||
|
||||
$twilio = new \Twilio\Rest\Client($sid, $token);
|
||||
|
||||
$country = auth()->user()->account?->companies()?->first()?->country();
|
||||
$country = auth()->user()->account?->companies()?->first()?->country(); //@phpstan-ignore-line
|
||||
|
||||
if (!$country || strlen(auth()->user()->phone) < 2) {
|
||||
return true;
|
||||
|
@ -186,7 +186,7 @@ class Task extends BaseModel
|
||||
}
|
||||
|
||||
if($this->status) {
|
||||
return '<h5><span class="badge badge-primary">' . $this->status?->name ?? '';
|
||||
return '<h5><span class="badge badge-primary">' . $this->status?->name ?? ''; //@phpstan-ignore-line
|
||||
}
|
||||
|
||||
return '';
|
||||
|
@ -136,16 +136,16 @@ class EntityViewedNotification extends Notification
|
||||
// return $data;
|
||||
// }
|
||||
|
||||
private function buildSubject()
|
||||
{
|
||||
$subject = ctrans(
|
||||
"texts.notification_{$this->entity_name}_viewed_subject",
|
||||
[
|
||||
'client' => $this->contact->present()->name(),
|
||||
$this->entity_name => $this->entity->number,
|
||||
]
|
||||
);
|
||||
// private function buildSubject()
|
||||
// {
|
||||
// $subject = ctrans(
|
||||
// "texts.notification_{$this->entity_name}_viewed_subject",
|
||||
// [
|
||||
// 'client' => $this->contact->present()->name(),
|
||||
// $this->entity_name => $this->entity->number,
|
||||
// ]
|
||||
// );
|
||||
|
||||
return $subject;
|
||||
}
|
||||
// return $subject;
|
||||
// }
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$error = 'Payment Aborted';
|
||||
}
|
||||
|
||||
if (! is_null($this->payment_hash)) {
|
||||
if (! is_null($this->payment_hash)) { //@phpstan-ignore-line
|
||||
$this->unWindGatewayFees($this->payment_hash);
|
||||
}
|
||||
|
||||
@ -830,7 +830,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
}
|
||||
|
||||
$invoices_string = \implode(', ', collect($this->payment_hash->invoices())->pluck('invoice_number')->toArray()) ?: null;
|
||||
$amount = Number::formatMoney($this->payment_hash?->amount_with_fee() ?? 0, $this->client);
|
||||
$amount = Number::formatMoney($this->payment_hash?->amount_with_fee() ?? 0, $this->client); // @phpstan-ignore-line
|
||||
|
||||
if($abbreviated && $invoices_string) {
|
||||
return $invoices_string;
|
||||
|
@ -40,7 +40,7 @@ class Webhook
|
||||
$error_details = $e->error_details;
|
||||
nlog($error_details);
|
||||
|
||||
$http_status_code = isset($e->http_metadata) ? $e->http_metadata->getStatusCode() : null;
|
||||
$http_status_code = isset($e->http_metadata) ? $e->http_metadata->getStatusCode() : null; //@phpstan-ignore-line
|
||||
} catch (CheckoutAuthorizationException $e) {
|
||||
// Bad Invalid authorization
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class CreditCard
|
||||
|
||||
$this->logResponse($response);
|
||||
|
||||
throw new PaymentFailed($response_status['message'] ?? 'Unknown response from gateway, please contact you merchant.', 400);
|
||||
throw new PaymentFailed($response_status['message'] ?? 'Unknown response from gateway, please contact you merchant.', 400); //@phpstan-ignore-line
|
||||
}
|
||||
|
||||
//success
|
||||
@ -135,7 +135,7 @@ class CreditCard
|
||||
$invoice_numbers = '';
|
||||
|
||||
if ($this->eway_driver->payment_hash->data) {
|
||||
$invoice_numbers = collect($this->eway_driver->payment_hash->data->invoices)->pluck('invoice_number')->implode(',');
|
||||
$invoice_numbers = collect($this->eway_driver->payment_hash->data->invoices)->pluck('invoice_number')->implode(','); //@phpstan-ignore-line
|
||||
}
|
||||
|
||||
$amount = array_sum(array_column($this->eway_driver->payment_hash->invoices(), 'amount')) + $this->eway_driver->payment_hash->fee_total;
|
||||
|
@ -173,7 +173,7 @@ class ACH implements MethodInterface
|
||||
$description = "Amount {$request->amount} from client {$this->go_cardless->client->present()->name()}";
|
||||
}
|
||||
|
||||
$amount = $this->go_cardless->convertToGoCardlessAmount($this->go_cardless->payment_hash?->amount_with_fee(), $this->go_cardless->client->currency()->precision);
|
||||
$amount = $this->go_cardless->convertToGoCardlessAmount($this->go_cardless->payment_hash?->amount_with_fee(), $this->go_cardless->client->currency()->precision); //@phpstan-ignore-line
|
||||
|
||||
try {
|
||||
$payment = $this->go_cardless->gateway->payments()->create([
|
||||
|
@ -156,7 +156,7 @@ class MolliePaymentDriver extends BaseDriver
|
||||
return [
|
||||
'transaction_reference' => $refund->id,
|
||||
'transaction_response' => json_encode($refund),
|
||||
'success' => $refund->status === 'refunded' ? true : false,
|
||||
'success' => $refund->status === 'refunded' ? true : false, //@phpstan-ignore-line
|
||||
'description' => $refund->description,
|
||||
'code' => 200,
|
||||
];
|
||||
|
@ -489,7 +489,7 @@ class StripePaymentDriver extends BaseDriver
|
||||
{
|
||||
$customer = Customer::retrieve($customer_id, $this->stripe_connect_auth);
|
||||
|
||||
return $customer ?? null;
|
||||
return $customer ?? null; // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,8 +46,9 @@ class ZugferdEDocument extends AbstractService {
|
||||
$this->document->getDocumentInformation($documentno, $documenttypecode, $documentdate, $invoiceCurrency, $taxCurrency, $documentname, $documentlanguage, $effectiveSpecifiedPeriod);
|
||||
$this->document->getDocumentSummation($grandTotalAmount, $duePayableAmount, $lineTotalAmount, $chargeTotalAmount, $allowanceTotalAmount, $taxBasisTotalAmount, $taxTotalAmount, $roundingAmount, $totalPrepaidAmount);
|
||||
|
||||
$expense = Expense::where('amount', $grandTotalAmount)->where("transaction_reference", $documentno)->whereDate("date", $documentdate)->first();
|
||||
if (empty($expense)) {
|
||||
/** @var \App\Models\Expense $expense */
|
||||
$expense = Expense::where("company_id", $user->company()->id)->where('amount', $grandTotalAmount)->where("transaction_reference", $documentno)->whereDate("date", $documentdate)->first();
|
||||
if (!$expense) {
|
||||
// The document does not exist as an expense
|
||||
// Handle accordingly
|
||||
$visualizer = new ZugferdVisualizer($this->document);
|
||||
@ -59,13 +60,11 @@ class ZugferdEDocument extends AbstractService {
|
||||
|
||||
$expense = ExpenseFactory::create($user->company()->id, $user->id);
|
||||
$expense->date = $documentdate;
|
||||
$expense->user_id = $user->id;
|
||||
$expense->company_id = $user->company->id;
|
||||
$expense->public_notes = $documentno;
|
||||
$expense->currency_id = Currency::whereCode($invoiceCurrency)->first()->id;
|
||||
$expense->currency_id = Currency::whereCode($invoiceCurrency)->first()->id ?? $user->company()->settings->currency_id;
|
||||
$expense->save();
|
||||
|
||||
$origin_file = TempFile::UploadedFileFromRaw($this->tempdocument, $this->documentname, "application/xml");
|
||||
$origin_file = TempFile::UploadedFileFromRaw($this->tempdocument, $this->documentname, "application/xml");
|
||||
(new UploadFile($origin_file, UploadFile::DOCUMENT, $user, $expense->company, $expense, null, false))->handle();
|
||||
$uploaded_file = TempFile::UploadedFileFromRaw($visualizer->renderPdf(), $documentno."_visualiser.pdf", "application/pdf");
|
||||
(new UploadFile($uploaded_file, UploadFile::DOCUMENT, $user, $expense->company, $expense, null, false))->handle();
|
||||
|
@ -44,7 +44,7 @@ use CleverIt\UBL\Invoice\FatturaPA\common\FatturaElettronicaHeader;
|
||||
*/
|
||||
class FatturaPA extends AbstractService
|
||||
{
|
||||
private $xml;
|
||||
// private $xml;
|
||||
|
||||
//urn:cen.eu:en16931:2017#compliant#urn:fatturapa.gov.it:CIUS-IT:2.0.0
|
||||
//<cbc:EndpointID schemeID=" 0201 ">UFF001</cbc:EndpointID>
|
||||
|
@ -205,7 +205,7 @@ class AdminEmail implements ShouldQueue
|
||||
$this->entityEmailFailed($message);
|
||||
|
||||
/* Don't send postmark failures to Sentry */
|
||||
if (Ninja::isHosted() && (!$e instanceof ClientException)) {
|
||||
if (Ninja::isHosted() && (!$e instanceof ClientException)) { //@phpstan-ignore-line
|
||||
app('sentry')->captureException($e);
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,6 @@ class RefundPayment
|
||||
|
||||
public function __construct(public Payment $payment, public array $refund_data)
|
||||
{
|
||||
$this->gateway_refund_status = false;
|
||||
|
||||
$this->activity_repository = new ActivityRepository();
|
||||
}
|
||||
|
||||
public function run()
|
||||
|
@ -1665,7 +1665,7 @@ class PdfBuilder
|
||||
if ($child['element'] !== 'script') {
|
||||
if ($this->service->company->markdown_enabled && array_key_exists('content', $child)) {
|
||||
$child['content'] = str_replace('<br>', "\r", ($child['content'] ?? ''));
|
||||
$child['content'] = $this->commonmark->convert($child['content'] ?? '');
|
||||
$child['content'] = $this->commonmark->convert($child['content'] ?? ''); //@phpstan-ignore-line
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ class PdfMock
|
||||
'$country_2' => 'AF',
|
||||
'$firstName' => 'Benedict',
|
||||
'$user.name' => 'Derrick Monahan DDS Erna Wunsch',
|
||||
'$font_name' => isset($this->settings?->primary_font) ? $this->settings?->primary_font : 'Roboto',
|
||||
'$font_name' => isset($this->settings?->primary_font) ? $this->settings?->primary_font : 'Roboto', //@phpstan-ignore-line
|
||||
'$auto_bill' => 'This invoice will automatically be billed to your credit card on file on the due date.',
|
||||
'$payments' => '',
|
||||
'$task.tax' => '',
|
||||
|
@ -287,7 +287,7 @@ class Design extends BaseDesign
|
||||
{
|
||||
$elements = [];
|
||||
|
||||
if (!$this->client) {
|
||||
if (!$this->client) {//@phpstan-ignore-line
|
||||
return $elements;
|
||||
}
|
||||
|
||||
@ -359,7 +359,7 @@ class Design extends BaseDesign
|
||||
$variables = $this->context['pdf_variables']['credit_details'];
|
||||
}
|
||||
|
||||
if ($this->vendor) {
|
||||
if ($this->vendor) { //@phpstan-ignore-line
|
||||
$variables = $this->context['pdf_variables']['purchase_order_details'];
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,9 @@ trait DesignHelpers
|
||||
|
||||
$this->document();
|
||||
|
||||
$this->settings_object = $this->vendor ? $this->vendor->company : $this->client;
|
||||
$this->settings_object = $this->vendor ? $this->vendor->company : $this->client; //@phpstan-ignore-line
|
||||
|
||||
$this->company = $this->vendor ? $this->vendor->company : $this->client->company;
|
||||
$this->company = $this->vendor ? $this->vendor->company : $this->client->company; //@phpstan-ignore-line
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -387,7 +387,7 @@ trait DesignHelpers
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($this->client->company->custom_fields && ! property_exists($this->client->company->custom_fields, $field)) {
|
||||
if ($this->client->company->custom_fields && ! property_exists($this->client->company->custom_fields, $field)) { //@phpstan-ignore-line
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -27,16 +27,6 @@ class PdfMaker
|
||||
|
||||
public $document;
|
||||
|
||||
private $xpath;
|
||||
|
||||
private $filters = [
|
||||
'<![CDATA[' => '',
|
||||
'<![CDATA[<![CDATA[' => '',
|
||||
']]]]><![CDATA[>]]>' => '',
|
||||
']]>' => '',
|
||||
'<?xml version="1.0" encoding="utf-8" standalone="yes"??>' => '',
|
||||
];
|
||||
|
||||
private $options;
|
||||
|
||||
/** @var CommonMarkConverter */
|
||||
|
@ -94,7 +94,7 @@ trait PdfMakerUtilities
|
||||
if ($child['element'] !== 'script') {
|
||||
if (array_key_exists('process_markdown', $this->data) && array_key_exists('content', $child) && $this->data['process_markdown']) {
|
||||
$child['content'] = str_replace('<br>', "\r", ($child['content'] ?? ''));
|
||||
$child['content'] = $this->commonmark->convert($child['content'] ?? '');
|
||||
$child['content'] = $this->commonmark->convert($child['content'] ?? ''); //@phpstan-ignore-line
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,11 @@ class CreateInvitations extends AbstractService
|
||||
|
||||
public function run()
|
||||
{
|
||||
$contacts = $this->purchase_order?->vendor?->contacts()->get();
|
||||
|
||||
if(!$this->purchase_order->vendor)
|
||||
return $this->purchase_order;
|
||||
|
||||
$contacts = $this->purchase_order->vendor->contacts()->get();
|
||||
|
||||
if ($contacts->count() == 0) {
|
||||
$this->createBlankContact();
|
||||
|
@ -11,19 +11,15 @@
|
||||
|
||||
namespace App\Services\PurchaseOrder;
|
||||
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\Webhook;
|
||||
use App\Models\PurchaseOrder;
|
||||
|
||||
class MarkSent
|
||||
{
|
||||
private $vendor;
|
||||
|
||||
private $purchase_order;
|
||||
|
||||
public function __construct($vendor, $purchase_order)
|
||||
|
||||
public function __construct(public Vendor $vendor, public PurchaseOrder $purchase_order)
|
||||
{
|
||||
$this->vendor = $vendor;
|
||||
$this->purchase_order = $purchase_order;
|
||||
}
|
||||
|
||||
public function run()
|
||||
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Services\Quote;
|
||||
|
||||
use App\Events\Quote\QuoteWasMarkedApproved;
|
||||
use App\Models\Quote;
|
||||
use App\Utils\Ninja;
|
||||
|
||||
class MarkApproved
|
||||
{
|
||||
private $client;
|
||||
|
||||
public function __construct($client)
|
||||
{
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
public function run($quote)
|
||||
{
|
||||
/* Return immediately if status is not draft */
|
||||
if ($quote->status_id != Quote::STATUS_SENT) {
|
||||
return $quote;
|
||||
}
|
||||
|
||||
$quote->service()->setStatus(Quote::STATUS_APPROVED)->applyNumber()->save();
|
||||
|
||||
event(new QuoteWasMarkedApproved($quote, $quote->company, Ninja::eventVars()));
|
||||
|
||||
return $quote;
|
||||
}
|
||||
}
|
@ -171,39 +171,39 @@ class UpdateReminder extends AbstractService
|
||||
return $this->quote;
|
||||
}
|
||||
|
||||
private function addTimeInterval($date, $endless_reminder_frequency_id): ?Carbon
|
||||
{
|
||||
if (! $date) {
|
||||
return null;
|
||||
}
|
||||
// private function addTimeInterval($date, $endless_reminder_frequency_id): ?Carbon
|
||||
// {
|
||||
// if (! $date) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
switch ($endless_reminder_frequency_id) {
|
||||
case RecurringInvoice::FREQUENCY_DAILY:
|
||||
return Carbon::parse($date)->addDay()->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_WEEKLY:
|
||||
return Carbon::parse($date)->addWeek()->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_TWO_WEEKS:
|
||||
return Carbon::parse($date)->addWeeks(2)->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_FOUR_WEEKS:
|
||||
return Carbon::parse($date)->addWeeks(4)->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_MONTHLY:
|
||||
return Carbon::parse($date)->addMonthNoOverflow()->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_TWO_MONTHS:
|
||||
return Carbon::parse($date)->addMonthsNoOverflow(2)->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_THREE_MONTHS:
|
||||
return Carbon::parse($date)->addMonthsNoOverflow(3)->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_FOUR_MONTHS:
|
||||
return Carbon::parse($date)->addMonthsNoOverflow(4)->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_SIX_MONTHS:
|
||||
return Carbon::parse($date)->addMonthsNoOverflow(6)->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_ANNUALLY:
|
||||
return Carbon::parse($date)->addYear()->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_TWO_YEARS:
|
||||
return Carbon::parse($date)->addYears(2)->startOfDay();
|
||||
case RecurringInvoice::FREQUENCY_THREE_YEARS:
|
||||
return Carbon::parse($date)->addYears(3)->startOfDay();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// switch ($endless_reminder_frequency_id) {
|
||||
// case RecurringInvoice::FREQUENCY_DAILY:
|
||||
// return Carbon::parse($date)->addDay()->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_WEEKLY:
|
||||
// return Carbon::parse($date)->addWeek()->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_TWO_WEEKS:
|
||||
// return Carbon::parse($date)->addWeeks(2)->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_FOUR_WEEKS:
|
||||
// return Carbon::parse($date)->addWeeks(4)->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_MONTHLY:
|
||||
// return Carbon::parse($date)->addMonthNoOverflow()->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_TWO_MONTHS:
|
||||
// return Carbon::parse($date)->addMonthsNoOverflow(2)->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_THREE_MONTHS:
|
||||
// return Carbon::parse($date)->addMonthsNoOverflow(3)->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_FOUR_MONTHS:
|
||||
// return Carbon::parse($date)->addMonthsNoOverflow(4)->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_SIX_MONTHS:
|
||||
// return Carbon::parse($date)->addMonthsNoOverflow(6)->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_ANNUALLY:
|
||||
// return Carbon::parse($date)->addYear()->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_TWO_YEARS:
|
||||
// return Carbon::parse($date)->addYears(2)->startOfDay();
|
||||
// case RecurringInvoice::FREQUENCY_THREE_YEARS:
|
||||
// return Carbon::parse($date)->addYears(3)->startOfDay();
|
||||
// default:
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class UpdatePrice extends AbstractService
|
||||
->where('is_deleted', 0)
|
||||
->first();
|
||||
|
||||
if ($product) {
|
||||
if ($product) { //@phpstan-ignore-line
|
||||
$line_items[$key]->cost = floatval($product->price);
|
||||
}
|
||||
}
|
||||
|
@ -183,17 +183,17 @@ class ProfitLoss
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getForeignIncome(): array
|
||||
{
|
||||
return $this->foreign_income;
|
||||
}
|
||||
// private function getForeignIncome(): array
|
||||
// {
|
||||
// return $this->foreign_income;
|
||||
// }
|
||||
|
||||
private function filterPaymentIncome()
|
||||
{
|
||||
$payments = $this->paymentIncome();
|
||||
// private function filterPaymentIncome()
|
||||
// {
|
||||
// $payments = $this->paymentIncome();
|
||||
|
||||
return $this;
|
||||
}
|
||||
// return $this;
|
||||
// }
|
||||
|
||||
/*
|
||||
//returns an array of objects
|
||||
@ -427,26 +427,26 @@ class ProfitLoss
|
||||
+"payments_converted": "12260.870000000000",
|
||||
+"currency_id": 1,
|
||||
*/
|
||||
private function paymentIncome()
|
||||
{
|
||||
return \DB::select('
|
||||
SELECT
|
||||
SUM(coalesce(payments.amount - payments.refunded,0)) as payments,
|
||||
SUM(coalesce(payments.amount - payments.refunded,0)) * IFNULL(payments.exchange_rate ,1) as payments_converted,
|
||||
payments.currency_id as currency_id
|
||||
FROM clients
|
||||
INNER JOIN
|
||||
payments ON
|
||||
clients.id=payments.client_id
|
||||
WHERE payments.status_id IN (1,4,5,6)
|
||||
AND clients.is_deleted = false
|
||||
AND payments.is_deleted = false
|
||||
AND payments.company_id = :company_id
|
||||
AND (payments.date BETWEEN :start_date AND :end_date)
|
||||
GROUP BY currency_id
|
||||
ORDER BY currency_id;
|
||||
', ['company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
|
||||
}
|
||||
// private function paymentIncome()
|
||||
// {
|
||||
// return \DB::select('
|
||||
// SELECT
|
||||
// SUM(coalesce(payments.amount - payments.refunded,0)) as payments,
|
||||
// SUM(coalesce(payments.amount - payments.refunded,0)) * IFNULL(payments.exchange_rate ,1) as payments_converted,
|
||||
// payments.currency_id as currency_id
|
||||
// FROM clients
|
||||
// INNER JOIN
|
||||
// payments ON
|
||||
// clients.id=payments.client_id
|
||||
// WHERE payments.status_id IN (1,4,5,6)
|
||||
// AND clients.is_deleted = false
|
||||
// AND payments.is_deleted = false
|
||||
// AND payments.company_id = :company_id
|
||||
// AND (payments.date BETWEEN :start_date AND :end_date)
|
||||
// GROUP BY currency_id
|
||||
// ORDER BY currency_id;
|
||||
// ', ['company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
|
||||
// }
|
||||
|
||||
private function expenseData()
|
||||
{
|
||||
@ -544,18 +544,18 @@ class ProfitLoss
|
||||
return round(($amount * $exchange_rate), 2);
|
||||
}
|
||||
|
||||
private function expenseCalcWithTax()
|
||||
{
|
||||
return \DB::select('
|
||||
SELECT sum(expenses.amount) as amount,
|
||||
IFNULL(expenses.currency_id, :company_currency) as currency_id
|
||||
FROM expenses
|
||||
WHERE expenses.is_deleted = 0
|
||||
AND expenses.company_id = :company_id
|
||||
AND (expenses.date BETWEEN :start_date AND :end_date)
|
||||
GROUP BY currency_id
|
||||
', ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
|
||||
}
|
||||
// private function expenseCalcWithTax()
|
||||
// {
|
||||
// return \DB::select('
|
||||
// SELECT sum(expenses.amount) as amount,
|
||||
// IFNULL(expenses.currency_id, :company_currency) as currency_id
|
||||
// FROM expenses
|
||||
// WHERE expenses.is_deleted = 0
|
||||
// AND expenses.company_id = :company_id
|
||||
// AND (expenses.date BETWEEN :start_date AND :end_date)
|
||||
// GROUP BY currency_id
|
||||
// ', ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $this->start_date, 'end_date' => $this->end_date]);
|
||||
// }
|
||||
|
||||
private function setBillingReportType()
|
||||
{
|
||||
|
@ -23,8 +23,6 @@ class EmailStatementService
|
||||
use MakesHash;
|
||||
use MakesDates;
|
||||
|
||||
private Client $client;
|
||||
|
||||
public function __construct(public Scheduler $scheduler)
|
||||
{
|
||||
}
|
||||
@ -45,9 +43,6 @@ class EmailStatementService
|
||||
$query->cursor()
|
||||
->each(function ($_client) {
|
||||
|
||||
/**@var \App\Models\Client $_client */
|
||||
$this->client = $_client;
|
||||
|
||||
//work out the date range
|
||||
$statement_properties = $this->calculateStatementProperties($_client);
|
||||
|
||||
|
@ -102,7 +102,7 @@ class SubscriptionCalculator
|
||||
$line_item->quantity = (float) $item['quantity'];
|
||||
$line_item->cost = (float) $item['product']['price'];
|
||||
$line_item->notes = $item['product']['notes'];
|
||||
$line_item->tax_id = (string)$item['product']['tax_id'] ?? '1';
|
||||
$line_item->tax_id = (string)$item['product']['tax_id'] ?? '1'; //@phpstan-ignore-line
|
||||
$items[] = $line_item;
|
||||
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ class SubscriptionService
|
||||
|
||||
/* 06-04-2022 */
|
||||
/* We may not be in a state where the user is present */
|
||||
if (auth()->guard('contact')) {
|
||||
if (auth()->guard('contact')->user()) {
|
||||
return $this->handleRedirect('/client/invoices/'.$this->encodePrimaryKey($payment_hash->fee_invoice_id));
|
||||
}
|
||||
}
|
||||
@ -200,7 +200,7 @@ class SubscriptionService
|
||||
$license->first_name = $contact ? $contact->first_name : ' ';
|
||||
$license->last_name = $contact ? $contact->last_name : ' ';
|
||||
$license->is_claimed = 1;
|
||||
$license->transaction_reference = $payment_hash?->payment?->transaction_reference ?: ' ';
|
||||
$license->transaction_reference = $payment_hash?->payment?->transaction_reference ?: ' '; //@phpstan-ignore-line
|
||||
$license->product_id = self::WHITE_LABEL;
|
||||
$license->recurring_invoice_id = $recurring_invoice->id;
|
||||
|
||||
|
@ -1327,6 +1327,7 @@ class TemplateService
|
||||
{
|
||||
$entity_string = '';
|
||||
|
||||
//@phpstan-ignore-next-line
|
||||
match($this->entity) {
|
||||
($this->entity instanceof Invoice) => $entity_string = 'invoice',
|
||||
($this->entity instanceof Quote) => $entity_string = 'quote',
|
||||
|
@ -31,4 +31,10 @@ parameters:
|
||||
- '#Access to protected property#'
|
||||
- '#Call to undefined method .*#'
|
||||
- '#Argument of an invalid type stdClass supplied for foreach, only iterables are supported.#'
|
||||
- '#Comparison operation ">=" between int<1, max> and 1 is always true#'
|
||||
- '#Comparison operation ">=" between int<1, max> and 1 is always true#'
|
||||
- '#Negated boolean expression is always#'
|
||||
- '#Ternary operator condition#'
|
||||
- '#Expression on left side of ?? is not nullable.#'
|
||||
- '#Left side of && is always true.#'
|
||||
- '#Right side of && is always true.#'
|
||||
|
Loading…
x
Reference in New Issue
Block a user