mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
API fixes for mobile app
This commit is contained in:
parent
e82c259cfa
commit
4746ca830d
@ -361,7 +361,7 @@ if (! defined('APP_NAME')) {
|
||||
define('NINJA_APP_URL', env('NINJA_APP_URL', 'https://app.invoiceninja.com'));
|
||||
define('NINJA_DOCS_URL', env('NINJA_DOCS_URL', 'https://invoice-ninja.readthedocs.io/en/latest'));
|
||||
define('NINJA_DATE', '2000-01-01');
|
||||
define('NINJA_VERSION', '4.5.4' . env('NINJA_VERSION_SUFFIX'));
|
||||
define('NINJA_VERSION', '4.5.5' . env('NINJA_VERSION_SUFFIX'));
|
||||
define('NINJA_TERMS_VERSION', '1.0.1');
|
||||
|
||||
define('SOCIAL_LINK_FACEBOOK', env('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja'));
|
||||
|
@ -24,24 +24,24 @@ class DashboardApiController extends BaseAPIController
|
||||
$defaultCurrency = $user->account->currency_id;
|
||||
|
||||
$dashboardRepo = $this->dashboardRepo;
|
||||
$activities = $dashboardRepo->activities($accountId, $userId, $viewAll);
|
||||
|
||||
// optimization for new mobile app
|
||||
if (request()->only_activity) {
|
||||
return $this->response([
|
||||
'id' => 1,
|
||||
'activities' => $this->createCollection($activities, new ActivityTransformer(), ENTITY_ACTIVITY),
|
||||
]);
|
||||
}
|
||||
|
||||
$metrics = $dashboardRepo->totals($accountId, $userId, $viewAll);
|
||||
$paidToDate = $dashboardRepo->paidToDate($user->account, $userId, $viewAll);
|
||||
$averageInvoice = $dashboardRepo->averages($user->account, $userId, $viewAll);
|
||||
$balances = $dashboardRepo->balances($accountId, $userId, $viewAll);
|
||||
$activities = $dashboardRepo->activities($accountId, $userId, $viewAll);
|
||||
$balances = $dashboardRepo->balances($user->account, $userId, $viewAll);
|
||||
$pastDue = $dashboardRepo->pastDue($accountId, $userId, $viewAll);
|
||||
$upcoming = $dashboardRepo->upcoming($accountId, $userId, $viewAll);
|
||||
$payments = $dashboardRepo->payments($accountId, $userId, $viewAll);
|
||||
|
||||
$hasQuotes = false;
|
||||
foreach ([$upcoming, $pastDue] as $data) {
|
||||
foreach ($data as $invoice) {
|
||||
if ($invoice->invoice_type_id == INVOICE_TYPE_QUOTE) {
|
||||
$hasQuotes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'id' => 1,
|
||||
'paidToDate' => (float) ($paidToDate->count() && $paidToDate[0]->value ? $paidToDate[0]->value : 0),
|
||||
|
@ -1820,6 +1820,17 @@ class Account extends Eloquent
|
||||
return $this->company->accounts()->orderBy('id')->first();
|
||||
}
|
||||
|
||||
public function financialYearStartMonth()
|
||||
{
|
||||
if (! $this->financial_year_start) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
$yearStart = Carbon::parse($this->financial_year_start);
|
||||
|
||||
return $yearStart ? $yearStart->month : 1;
|
||||
}
|
||||
|
||||
public function financialYearStart()
|
||||
{
|
||||
if (! $this->financial_year_start) {
|
||||
|
@ -176,7 +176,7 @@ class UserAccountTransformer extends EntityTransformer
|
||||
'show_currency_code' => (bool) $account->show_currency_code,
|
||||
'enable_second_tax_rate' => (bool) $account->enable_second_tax_rate,
|
||||
'start_of_week' => (int) $account->start_of_week,
|
||||
'financial_year_start' => (int) $account->financial_year_start,
|
||||
'financial_year_start' => (int) $account->financialYearStartMonth(),
|
||||
'enabled_modules' => (int) $account->enabled_modules,
|
||||
'payment_terms' => (int) $account->payment_terms,
|
||||
'payment_type_id' => (int) $account->payment_type_id,
|
||||
|
@ -59,7 +59,7 @@ author = u'Invoice Ninja'
|
||||
# The short X.Y version.
|
||||
version = u'4.5'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = u'4.5.4'
|
||||
release = u'4.5.5'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
Loading…
x
Reference in New Issue
Block a user