mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-03 19:16:51 +00:00
fix various phpstan errors
This commit is contained in:
@@ -34,7 +34,6 @@ use Hash;
|
|||||||
use Illuminate\Contracts\Validation\Validator as ValidatorContract;
|
use Illuminate\Contracts\Validation\Validator as ValidatorContract;
|
||||||
use Illuminate\Routing\Route;
|
use Illuminate\Routing\Route;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use InvalidArgumentException;
|
|
||||||
use Psr\Container\ContainerExceptionInterface;
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
use Psr\Container\NotFoundExceptionInterface;
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
use Route as RouteFacade;
|
use Route as RouteFacade;
|
||||||
@@ -171,21 +170,15 @@ trait RequestInformation
|
|||||||
{
|
{
|
||||||
$attributes['location'] = $attributes['location'] ?? '';
|
$attributes['location'] = $attributes['location'] ?? '';
|
||||||
$attributes['accounts'] = AccountList::routeBinder($attributes['accounts'] ?? '', new Route('get', '', []));
|
$attributes['accounts'] = AccountList::routeBinder($attributes['accounts'] ?? '', new Route('get', '', []));
|
||||||
try {
|
|
||||||
$date = Carbon::createFromFormat('Ymd', $attributes['startDate']);
|
$date = Carbon::createFromFormat('Ymd', $attributes['startDate']);
|
||||||
} catch (InvalidArgumentException $e) {
|
if (false === $date) {
|
||||||
app('log')->debug(sprintf('Not important error message: %s', $e->getMessage()));
|
|
||||||
$date = today(config('app.timezone'));
|
$date = today(config('app.timezone'));
|
||||||
|
|
||||||
}
|
}
|
||||||
$date->startOfMonth();
|
$date->startOfMonth();
|
||||||
$attributes['startDate'] = $date;
|
$attributes['startDate'] = $date;
|
||||||
unset($date);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$date2 = Carbon::createFromFormat('Ymd', $attributes['endDate']);
|
$date2 = Carbon::createFromFormat('Ymd', $attributes['endDate']);
|
||||||
} catch (InvalidArgumentException $e) {
|
if (false === $date2) {
|
||||||
app('log')->debug(sprintf('Not important error message: %s', $e->getMessage()));
|
|
||||||
$date2 = today(config('app.timezone'));
|
$date2 = today(config('app.timezone'));
|
||||||
}
|
}
|
||||||
$date2->endOfDay();
|
$date2->endOfDay();
|
||||||
|
@@ -43,7 +43,7 @@ class AuditProcessor
|
|||||||
if (auth()->check()) {
|
if (auth()->check()) {
|
||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
'AUDIT: %s (%s (%s) -> %s:%s)',
|
'AUDIT: %s (%s (%s) -> %s:%s)',
|
||||||
$record['message'],
|
$record['message'], // @phpstan-ignore-line
|
||||||
app('request')->ip(),
|
app('request')->ip(),
|
||||||
auth()->user()->email,
|
auth()->user()->email,
|
||||||
request()->method(),
|
request()->method(),
|
||||||
@@ -54,7 +54,7 @@ class AuditProcessor
|
|||||||
|
|
||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
'AUDIT: %s (%s -> %s:%s)',
|
'AUDIT: %s (%s -> %s:%s)',
|
||||||
$record['message'],
|
$record['message'], // @phpstan-ignore-line
|
||||||
app('request')->ip(),
|
app('request')->ip(),
|
||||||
request()->method(),
|
request()->method(),
|
||||||
request()->url()
|
request()->url()
|
||||||
|
@@ -456,7 +456,11 @@ class Navigation
|
|||||||
*/
|
*/
|
||||||
public function getViewRange(bool $correct): string
|
public function getViewRange(bool $correct): string
|
||||||
{
|
{
|
||||||
$range = (string)app('preferences')->get('viewRange', '1M')?->data ?? '1M';
|
$range = app('preferences')->get('viewRange', '1M')?->data ?? '1M';
|
||||||
|
if (is_array($range)) {
|
||||||
|
$range = '1M';
|
||||||
|
}
|
||||||
|
$range = (string)$range;
|
||||||
if (!$correct) {
|
if (!$correct) {
|
||||||
return $range;
|
return $range;
|
||||||
}
|
}
|
||||||
|
@@ -88,7 +88,7 @@ class ParseDateString
|
|||||||
|
|
||||||
// if regex for YYYY-MM-DD:
|
// if regex for YYYY-MM-DD:
|
||||||
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
|
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
|
||||||
if (preg_match($pattern, $date)) {
|
if (false !== preg_match($pattern, $date)) {
|
||||||
return $this->parseDefaultDate($date);
|
return $this->parseDefaultDate($date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +151,11 @@ class ParseDateString
|
|||||||
*/
|
*/
|
||||||
protected function parseDefaultDate(string $date): Carbon
|
protected function parseDefaultDate(string $date): Carbon
|
||||||
{
|
{
|
||||||
return Carbon::createFromFormat('Y-m-d', $date);
|
$result = Carbon::createFromFormat('Y-m-d', $date);
|
||||||
|
if(false === $result) {
|
||||||
|
$result = today(config('app.timezone'))->startOfDay();
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -254,7 +258,7 @@ class ParseDateString
|
|||||||
{
|
{
|
||||||
// if regex for xxxx-xx-DD:
|
// if regex for xxxx-xx-DD:
|
||||||
$pattern = '/^xxxx-xx-(0[1-9]|[12]\d|3[01])$/';
|
$pattern = '/^xxxx-xx-(0[1-9]|[12]\d|3[01])$/';
|
||||||
if (preg_match($pattern, $date)) {
|
if (false !== preg_match($pattern, $date)) {
|
||||||
app('log')->debug(sprintf('"%s" is a day range.', $date));
|
app('log')->debug(sprintf('"%s" is a day range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -289,7 +293,7 @@ class ParseDateString
|
|||||||
{
|
{
|
||||||
// if regex for xxxx-MM-xx:
|
// if regex for xxxx-MM-xx:
|
||||||
$pattern = '/^xxxx-(0[1-9]|1[012])-xx$/';
|
$pattern = '/^xxxx-(0[1-9]|1[012])-xx$/';
|
||||||
if (preg_match($pattern, $date)) {
|
if (false !== preg_match($pattern, $date)) {
|
||||||
app('log')->debug(sprintf('"%s" is a month range.', $date));
|
app('log')->debug(sprintf('"%s" is a month range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -325,7 +329,7 @@ class ParseDateString
|
|||||||
{
|
{
|
||||||
// if regex for YYYY-xx-xx:
|
// if regex for YYYY-xx-xx:
|
||||||
$pattern = '/^(19|20)\d\d-xx-xx$/';
|
$pattern = '/^(19|20)\d\d-xx-xx$/';
|
||||||
if (preg_match($pattern, $date)) {
|
if (false !== preg_match($pattern, $date)) {
|
||||||
app('log')->debug(sprintf('"%s" is a year range.', $date));
|
app('log')->debug(sprintf('"%s" is a year range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -361,7 +365,7 @@ class ParseDateString
|
|||||||
{
|
{
|
||||||
// if regex for xxxx-MM-DD:
|
// if regex for xxxx-MM-DD:
|
||||||
$pattern = '/^xxxx-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
|
$pattern = '/^xxxx-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
|
||||||
if (preg_match($pattern, $date)) {
|
if (false !== preg_match($pattern, $date)) {
|
||||||
app('log')->debug(sprintf('"%s" is a month/day range.', $date));
|
app('log')->debug(sprintf('"%s" is a month/day range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -398,7 +402,7 @@ class ParseDateString
|
|||||||
{
|
{
|
||||||
// if regex for YYYY-xx-DD:
|
// if regex for YYYY-xx-DD:
|
||||||
$pattern = '/^(19|20)\d\d-xx-(0[1-9]|[12]\d|3[01])$/';
|
$pattern = '/^(19|20)\d\d-xx-(0[1-9]|[12]\d|3[01])$/';
|
||||||
if (preg_match($pattern, $date)) {
|
if (false !== preg_match($pattern, $date)) {
|
||||||
app('log')->debug(sprintf('"%s" is a day/year range.', $date));
|
app('log')->debug(sprintf('"%s" is a day/year range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -435,7 +439,7 @@ class ParseDateString
|
|||||||
{
|
{
|
||||||
// if regex for YYYY-MM-xx:
|
// if regex for YYYY-MM-xx:
|
||||||
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-xx$/';
|
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-xx$/';
|
||||||
if (preg_match($pattern, $date)) {
|
if (false !== preg_match($pattern, $date)) {
|
||||||
app('log')->debug(sprintf('"%s" is a month/year range.', $date));
|
app('log')->debug(sprintf('"%s" is a month/year range.', $date));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -168,7 +168,7 @@ class Preferences
|
|||||||
}
|
}
|
||||||
if (null === $pref) {
|
if (null === $pref) {
|
||||||
$pref = new Preference();
|
$pref = new Preference();
|
||||||
$pref->user_id = $user->id;
|
$pref->user_id = (int) $user->id;
|
||||||
$pref->name = $name;
|
$pref->name = $name;
|
||||||
}
|
}
|
||||||
$pref->data = $value;
|
$pref->data = $value;
|
||||||
@@ -286,7 +286,7 @@ class Preferences
|
|||||||
$lastActivity = implode(',', $lastActivity);
|
$lastActivity = implode(',', $lastActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hash('sha256', $lastActivity);
|
return hash('sha256', (string) $lastActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -45,7 +45,7 @@ trait FiltersWeekends
|
|||||||
protected function filterWeekends(RecurrenceRepetition $repetition, array $dates): array
|
protected function filterWeekends(RecurrenceRepetition $repetition, array $dates): array
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||||
if ((int)$repetition->weekend === RecurrenceRepetition::WEEKEND_DO_NOTHING) {
|
if ($repetition->weekend === RecurrenceRepetition::WEEKEND_DO_NOTHING) {
|
||||||
app('log')->debug('Repetition will not be filtered on weekend days.');
|
app('log')->debug('Repetition will not be filtered on weekend days.');
|
||||||
|
|
||||||
return $dates;
|
return $dates;
|
||||||
|
@@ -1593,43 +1593,59 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle key "%s" in setExactParameters()', $key));
|
throw new FireflyException(sprintf('Cannot handle key "%s" in setExactParameters()', $key));
|
||||||
case 'exact':
|
case 'exact':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
app('log')->debug(sprintf('Set date_is_exact value "%s"', $value->format('Y-m-d')));
|
app('log')->debug(sprintf('Set date_is_exact value "%s"', $value->format('Y-m-d')));
|
||||||
$this->collector->setRange($value, $value);
|
$this->collector->setRange($value, $value);
|
||||||
$this->operators->push(['type' => 'date_on', 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => 'date_on', 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'exact_not':
|
case 'exact_not':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
$this->collector->excludeRange($value, $value);
|
$this->collector->excludeRange($value, $value);
|
||||||
$this->operators->push(['type' => 'not_date_on', 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => 'not_date_on', 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_exact YEAR value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_exact YEAR value "%s"', $value));
|
||||||
$this->collector->yearIs($value);
|
$this->collector->yearIs($value);
|
||||||
$this->operators->push(['type' => 'date_on_year', 'value' => $value,]);
|
$this->operators->push(['type' => 'date_on_year', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year_not':
|
case 'year_not':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_exact_not YEAR value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_exact_not YEAR value "%s"', $value));
|
||||||
$this->collector->yearIsNot($value);
|
$this->collector->yearIsNot($value);
|
||||||
$this->operators->push(['type' => 'not_date_on_year', 'value' => $value,]);
|
$this->operators->push(['type' => 'not_date_on_year', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_exact MONTH value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_exact MONTH value "%s"', $value));
|
||||||
$this->collector->monthIs($value);
|
$this->collector->monthIs($value);
|
||||||
$this->operators->push(['type' => 'date_on_month', 'value' => $value,]);
|
$this->operators->push(['type' => 'date_on_month', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month_not':
|
case 'month_not':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_exact not MONTH value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_exact not MONTH value "%s"', $value));
|
||||||
$this->collector->monthIsNot($value);
|
$this->collector->monthIsNot($value);
|
||||||
$this->operators->push(['type' => 'not_date_on_month', 'value' => $value,]);
|
$this->operators->push(['type' => 'not_date_on_month', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_exact DAY value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_exact DAY value "%s"', $value));
|
||||||
$this->collector->dayIs($value);
|
$this->collector->dayIs($value);
|
||||||
$this->operators->push(['type' => 'date_on_day', 'value' => $value,]);
|
$this->operators->push(['type' => 'date_on_day', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day_not':
|
case 'day_not':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set not date_is_exact DAY value "%s"', $value));
|
app('log')->debug(sprintf('Set not date_is_exact DAY value "%s"', $value));
|
||||||
$this->collector->dayIsNot($value);
|
$this->collector->dayIsNot($value);
|
||||||
$this->operators->push(['type' => 'not_date_on_day', 'value' => $value,]);
|
$this->operators->push(['type' => 'not_date_on_day', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1651,23 +1667,31 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle key "%s" in setDateBeforeParams()', $key));
|
throw new FireflyException(sprintf('Cannot handle key "%s" in setDateBeforeParams()', $key));
|
||||||
case 'exact':
|
case 'exact':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
$this->collector->setBefore($value);
|
$this->collector->setBefore($value);
|
||||||
$this->operators->push(['type' => 'date_before', 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => 'date_before', 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_before YEAR value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_before YEAR value "%s"', $value));
|
||||||
$this->collector->yearBefore($value);
|
$this->collector->yearBefore($value);
|
||||||
$this->operators->push(['type' => 'date_before_year', 'value' => $value,]);
|
$this->operators->push(['type' => 'date_before_year', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_before MONTH value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_before MONTH value "%s"', $value));
|
||||||
$this->collector->monthBefore($value);
|
$this->collector->monthBefore($value);
|
||||||
$this->operators->push(['type' => 'date_before_month', 'value' => $value,]);
|
$this->operators->push(['type' => 'date_before_month', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_before DAY value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_before DAY value "%s"', $value));
|
||||||
$this->collector->dayBefore($value);
|
$this->collector->dayBefore($value);
|
||||||
$this->operators->push(['type' => 'date_before_day', 'value' => $value,]);
|
$this->operators->push(['type' => 'date_before_day', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1689,23 +1713,31 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle key "%s" in setDateAfterParams()', $key));
|
throw new FireflyException(sprintf('Cannot handle key "%s" in setDateAfterParams()', $key));
|
||||||
case 'exact':
|
case 'exact':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
$this->collector->setAfter($value);
|
$this->collector->setAfter($value);
|
||||||
$this->operators->push(['type' => 'date_after', 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => 'date_after', 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_after YEAR value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_after YEAR value "%s"', $value));
|
||||||
$this->collector->yearAfter($value);
|
$this->collector->yearAfter($value);
|
||||||
$this->operators->push(['type' => 'date_after_year', 'value' => $value,]);
|
$this->operators->push(['type' => 'date_after_year', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_after MONTH value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_after MONTH value "%s"', $value));
|
||||||
$this->collector->monthAfter($value);
|
$this->collector->monthAfter($value);
|
||||||
$this->operators->push(['type' => 'date_after_month', 'value' => $value,]);
|
$this->operators->push(['type' => 'date_after_month', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_after DAY value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_after DAY value "%s"', $value));
|
||||||
$this->collector->dayAfter($value);
|
$this->collector->dayAfter($value);
|
||||||
$this->operators->push(['type' => 'date_after_day', 'value' => $value,]);
|
$this->operators->push(['type' => 'date_after_day', 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1727,44 +1759,60 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle key "%s" in setExactMetaDateParams()', $key));
|
throw new FireflyException(sprintf('Cannot handle key "%s" in setExactMetaDateParams()', $key));
|
||||||
case 'exact':
|
case 'exact':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
app('log')->debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
|
app('log')->debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
|
||||||
$this->collector->setMetaDateRange($value, $value, $field);
|
$this->collector->setMetaDateRange($value, $value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'exact_not':
|
case 'exact_not':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
app('log')->debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
|
app('log')->debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
|
||||||
$this->collector->excludeMetaDateRange($value, $value, $field);
|
$this->collector->excludeMetaDateRange($value, $value, $field);
|
||||||
$this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
|
||||||
$this->collector->metaYearIs($value, $field);
|
$this->collector->metaYearIs($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year_not':
|
case 'year_not':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
|
||||||
$this->collector->metaYearIsNot($value, $field);
|
$this->collector->metaYearIsNot($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
|
||||||
$this->collector->metaMonthIs($value, $field);
|
$this->collector->metaMonthIs($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month_not':
|
case 'month_not':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
|
||||||
$this->collector->metaMonthIsNot($value, $field);
|
$this->collector->metaMonthIsNot($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
|
||||||
$this->collector->metaDayIs($value, $field);
|
$this->collector->metaDayIs($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day_not':
|
case 'day_not':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
|
||||||
$this->collector->metaDayIsNot($value, $field);
|
$this->collector->metaDayIsNot($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1785,23 +1833,31 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle key "%s" in setMetaDateBeforeParams()', $key));
|
throw new FireflyException(sprintf('Cannot handle key "%s" in setMetaDateBeforeParams()', $key));
|
||||||
case 'exact':
|
case 'exact':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
$this->collector->setMetaBefore($value, $field);
|
$this->collector->setMetaBefore($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_before YEAR value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_before YEAR value "%s"', $field, $value));
|
||||||
$this->collector->metaYearBefore($value, $field);
|
$this->collector->metaYearBefore($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_before MONTH value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_before MONTH value "%s"', $field, $value));
|
||||||
$this->collector->metaMonthBefore($value, $field);
|
$this->collector->metaMonthBefore($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_before DAY value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_before DAY value "%s"', $field, $value));
|
||||||
$this->collector->metaDayBefore($value, $field);
|
$this->collector->metaDayBefore($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1822,23 +1878,31 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle key "%s" in setMetaDateAfterParams()', $key));
|
throw new FireflyException(sprintf('Cannot handle key "%s" in setMetaDateAfterParams()', $key));
|
||||||
case 'exact':
|
case 'exact':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
$this->collector->setMetaAfter($value, $field);
|
$this->collector->setMetaAfter($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_after YEAR value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_after YEAR value "%s"', $field, $value));
|
||||||
$this->collector->metaYearAfter($value, $field);
|
$this->collector->metaYearAfter($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_after MONTH value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_after MONTH value "%s"', $field, $value));
|
||||||
$this->collector->metaMonthAfter($value, $field);
|
$this->collector->metaMonthAfter($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_after DAY value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_after DAY value "%s"', $field, $value));
|
||||||
$this->collector->metaDayAfter($value, $field);
|
$this->collector->metaDayAfter($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1859,44 +1923,60 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle key "%s" in setExactObjectDateParams()', $key));
|
throw new FireflyException(sprintf('Cannot handle key "%s" in setExactObjectDateParams()', $key));
|
||||||
case 'exact':
|
case 'exact':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
app('log')->debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
|
app('log')->debug(sprintf('Set %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
|
||||||
$this->collector->setObjectRange($value, clone $value, $field);
|
$this->collector->setObjectRange($value, clone $value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => sprintf('%s_on', $field), 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'exact_not':
|
case 'exact_not':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
app('log')->debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
|
app('log')->debug(sprintf('Set NOT %s_is_exact value "%s"', $field, $value->format('Y-m-d')));
|
||||||
$this->collector->excludeObjectRange($value, clone $value, $field);
|
$this->collector->excludeObjectRange($value, clone $value, $field);
|
||||||
$this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => sprintf('not_%s_on', $field), 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_exact YEAR value "%s"', $field, $value));
|
||||||
$this->collector->objectYearIs($value, $field);
|
$this->collector->objectYearIs($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_on_year', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year_not':
|
case 'year_not':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set NOT %s_is_exact YEAR value "%s"', $field, $value));
|
||||||
$this->collector->objectYearIsNot($value, $field);
|
$this->collector->objectYearIsNot($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('not_%s_on_year', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_exact MONTH value "%s"', $field, $value));
|
||||||
$this->collector->objectMonthIs($value, $field);
|
$this->collector->objectMonthIs($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_on_month', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month_not':
|
case 'month_not':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set NOT %s_is_exact MONTH value "%s"', $field, $value));
|
||||||
$this->collector->objectMonthIsNot($value, $field);
|
$this->collector->objectMonthIsNot($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('not_%s_on_month', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set %s_is_exact DAY value "%s"', $field, $value));
|
||||||
$this->collector->objectDayIs($value, $field);
|
$this->collector->objectDayIs($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_on_day', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day_not':
|
case 'day_not':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
|
app('log')->debug(sprintf('Set NOT %s_is_exact DAY value "%s"', $field, $value));
|
||||||
$this->collector->objectDayIsNot($value, $field);
|
$this->collector->objectDayIsNot($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('not_%s_on_day', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1918,23 +1998,31 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle key "%s" in setObjectDateBeforeParams()', $key));
|
throw new FireflyException(sprintf('Cannot handle key "%s" in setObjectDateBeforeParams()', $key));
|
||||||
case 'exact':
|
case 'exact':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
$this->collector->setObjectBefore($value, $field);
|
$this->collector->setObjectBefore($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_before YEAR value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_before YEAR value "%s"', $value));
|
||||||
$this->collector->objectYearBefore($value, $field);
|
$this->collector->objectYearBefore($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_before_year', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_before MONTH value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_before MONTH value "%s"', $value));
|
||||||
$this->collector->objectMonthBefore($value, $field);
|
$this->collector->objectMonthBefore($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_before_month', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_before DAY value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_before DAY value "%s"', $value));
|
||||||
$this->collector->objectDayBefore($value, $field);
|
$this->collector->objectDayBefore($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_before_day', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1956,23 +2044,31 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('Cannot handle key "%s" in setObjectDateAfterParams()', $key));
|
throw new FireflyException(sprintf('Cannot handle key "%s" in setObjectDateAfterParams()', $key));
|
||||||
case 'exact':
|
case 'exact':
|
||||||
|
if ($value instanceof Carbon) {
|
||||||
$this->collector->setObjectAfter($value, $field);
|
$this->collector->setObjectAfter($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d'),]);
|
$this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d'),]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'year':
|
case 'year':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_after YEAR value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_after YEAR value "%s"', $value));
|
||||||
$this->collector->objectYearAfter($value, $field);
|
$this->collector->objectYearAfter($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_after_year', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'month':
|
case 'month':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_after MONTH value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_after MONTH value "%s"', $value));
|
||||||
$this->collector->objectMonthAfter($value, $field);
|
$this->collector->objectMonthAfter($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_after_month', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'day':
|
case 'day':
|
||||||
|
if (is_string($value)) {
|
||||||
app('log')->debug(sprintf('Set date_is_after DAY value "%s"', $value));
|
app('log')->debug(sprintf('Set date_is_after DAY value "%s"', $value));
|
||||||
$this->collector->objectDayAfter($value, $field);
|
$this->collector->objectDayAfter($value, $field);
|
||||||
$this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value,]);
|
$this->operators->push(['type' => sprintf('%s_after_day', $field), 'value' => $value,]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -152,7 +152,7 @@ class Steam
|
|||||||
->orderBy('transaction_journals.date', 'ASC')
|
->orderBy('transaction_journals.date', 'ASC')
|
||||||
->whereNull('transaction_journals.deleted_at')
|
->whereNull('transaction_journals.deleted_at')
|
||||||
->get(
|
->get(
|
||||||
[
|
[ // @phpstan-ignore-line
|
||||||
'transaction_journals.date',
|
'transaction_journals.date',
|
||||||
'transactions.transaction_currency_id',
|
'transactions.transaction_currency_id',
|
||||||
DB::raw('SUM(transactions.amount) AS modified'),
|
DB::raw('SUM(transactions.amount) AS modified'),
|
||||||
@@ -296,6 +296,9 @@ class Steam
|
|||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$day = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date'], config('app.timezone'));
|
$day = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date'], config('app.timezone'));
|
||||||
|
if (false === $day) {
|
||||||
|
$day = today(config('app.timezone'));
|
||||||
|
}
|
||||||
$format = $day->format('Y-m-d');
|
$format = $day->format('Y-m-d');
|
||||||
// if the transaction is in the expected currency, change nothing.
|
// if the transaction is in the expected currency, change nothing.
|
||||||
if ((int)$transaction['transaction_currency_id'] === $native->id) {
|
if ((int)$transaction['transaction_currency_id'] === $native->id) {
|
||||||
@@ -449,6 +452,9 @@ class Steam
|
|||||||
foreach ($new as $index => $set) {
|
foreach ($new as $index => $set) {
|
||||||
foreach ($set as $transaction) {
|
foreach ($set as $transaction) {
|
||||||
$date = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date']);
|
$date = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date']);
|
||||||
|
if(false === $date) {
|
||||||
|
$date = today(config('app.timezone'));
|
||||||
|
}
|
||||||
$rate = $converter->getCurrencyRate($currency, $native, $date);
|
$rate = $converter->getCurrencyRate($currency, $native, $date);
|
||||||
$convertedAmount = bcmul($transaction['amount'], $rate);
|
$convertedAmount = bcmul($transaction['amount'], $rate);
|
||||||
$balance = bcadd($balance, $convertedAmount);
|
$balance = bcadd($balance, $convertedAmount);
|
||||||
@@ -598,7 +604,7 @@ class Steam
|
|||||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||||
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
|
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
|
||||||
->groupBy('transactions.transaction_currency_id');
|
->groupBy('transactions.transaction_currency_id');
|
||||||
$balances = $query->get(['transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) as sum_for_currency')]);
|
$balances = $query->get(['transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) as sum_for_currency')]); // @phpstan-ignore-line
|
||||||
$return = [];
|
$return = [];
|
||||||
/** @var stdClass $entry */
|
/** @var stdClass $entry */
|
||||||
foreach ($balances as $entry) {
|
foreach ($balances as $entry) {
|
||||||
@@ -717,7 +723,7 @@ class Steam
|
|||||||
} catch (Exception $e) { // intentional generic exception
|
} catch (Exception $e) { // intentional generic exception
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
return $hostName;
|
return (string)$hostName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -732,7 +738,7 @@ class Steam
|
|||||||
$set = auth()->user()->transactions()
|
$set = auth()->user()->transactions()
|
||||||
->whereIn('transactions.account_id', $accounts)
|
->whereIn('transactions.account_id', $accounts)
|
||||||
->groupBy(['transactions.account_id', 'transaction_journals.user_id'])
|
->groupBy(['transactions.account_id', 'transaction_journals.user_id'])
|
||||||
->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]);
|
->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]); // @phpstan-ignore-line
|
||||||
|
|
||||||
/** @var Transaction $entry */
|
/** @var Transaction $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
@@ -755,9 +761,14 @@ class Steam
|
|||||||
public function getLocale(): string // get preference
|
public function getLocale(): string // get preference
|
||||||
{
|
{
|
||||||
$locale = app('preferences')->get('locale', config('firefly.default_locale', 'equal'))->data;
|
$locale = app('preferences')->get('locale', config('firefly.default_locale', 'equal'))->data;
|
||||||
|
if (is_array($locale)) {
|
||||||
|
$locale = 'equal';
|
||||||
|
}
|
||||||
if ('equal' === $locale) {
|
if ('equal' === $locale) {
|
||||||
$locale = $this->getLanguage();
|
$locale = $this->getLanguage();
|
||||||
}
|
}
|
||||||
|
$locale = (string)$locale;
|
||||||
|
|
||||||
|
|
||||||
// Check for Windows to replace the locale correctly.
|
// Check for Windows to replace the locale correctly.
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
@@ -879,10 +890,10 @@ class Steam
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$number = substr($value, 0, strpos($value, 'E'));
|
$number = substr($value, 0, (int) strpos($value, 'E'));
|
||||||
if (str_contains($number, '.')) {
|
if (str_contains($number, '.')) {
|
||||||
$post = strlen(substr($number, strpos($number, '.') + 1));
|
$post = strlen(substr($number, (int) strpos($number, '.') + 1));
|
||||||
$mantis = substr($value, strpos($value, 'E') + 1);
|
$mantis = substr($value, (int) strpos($value, 'E') + 1);
|
||||||
if ($mantis < 0) {
|
if ($mantis < 0) {
|
||||||
$post += abs((int)$mantis);
|
$post += abs((int)$mantis);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user