1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Updates for license checks

This commit is contained in:
David Bomba 2023-08-02 19:10:39 +10:00
parent 2ca3246af8
commit 4bfe59d2f9
2 changed files with 23 additions and 1 deletions

View File

@ -137,7 +137,7 @@ class LicenseController extends BaseController
} }
} else { } else {
$error = [ $error = [
'message' => trans('texts.white_label_license_error'), 'message' => 'There was an issue connecting to the license server. Please check your network.',
'errors' => new stdClass, 'errors' => new stdClass,
]; ];

View File

@ -164,6 +164,28 @@ trait ChartQueries
"), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]); "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
} }
// public function getPaymentsQuery($start_date, $end_date)
// {
// $user_filter = $this->is_admin ? '' : 'AND clients.user_id = '.$this->user->id;
// return DB::select(DB::raw("
// SELECT
// sum(payments.amount - payments.refunded) as paid_to_date,
// IFNULL(CAST(JSON_UNQUOTE(JSON_EXTRACT( clients.settings, '$.currency_id' )) AS SIGNED), :company_currency) AS currency_id
// FROM payments
// JOIN invoices
// on invoices.client_id = clients.id
// WHERE invoices.company_id = :company_id
// AND clients.is_deleted = 0
// {$user_filter}
// AND invoices.is_deleted = 0
// AND invoices.amount > 0
// AND invoices.status_id IN (3,4)
// AND (invoices.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' => $start_date, 'end_date' => $end_date]);
// }
public function getInvoicesQuery($start_date, $end_date) public function getInvoicesQuery($start_date, $end_date)
{ {
$user_filter = $this->is_admin ? '' : 'AND clients.user_id = '.$this->user->id; $user_filter = $this->is_admin ? '' : 'AND clients.user_id = '.$this->user->id;