mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Update source account detection.
This commit is contained in:
parent
9222c82af0
commit
2564470197
@ -83,7 +83,7 @@ class TransactionController extends Controller
|
|||||||
|
|
||||||
// collect transactions:
|
// collect transactions:
|
||||||
/** @var GroupCollectorInterface $collector */
|
/** @var GroupCollectorInterface $collector */
|
||||||
$collector = app(GroupCollectorInterface::class);
|
$collector = app(GroupCollectorInterface::class);
|
||||||
$collector->setUserGroup(auth()->user()->userGroup)
|
$collector->setUserGroup(auth()->user()->userGroup)
|
||||||
->withAPIInformation()
|
->withAPIInformation()
|
||||||
->setStartRow($request->getStartRow())
|
->setStartRow($request->getStartRow())
|
||||||
@ -92,8 +92,8 @@ class TransactionController extends Controller
|
|||||||
->setSorting($instructions)
|
->setSorting($instructions)
|
||||||
;
|
;
|
||||||
|
|
||||||
$start = $this->parameters->get('start');
|
$start = $this->parameters->get('start');
|
||||||
$end = $this->parameters->get('end');
|
$end = $this->parameters->get('end');
|
||||||
if (null !== $start) {
|
if (null !== $start) {
|
||||||
$collector->setStart($start);
|
$collector->setStart($start);
|
||||||
}
|
}
|
||||||
@ -101,8 +101,8 @@ class TransactionController extends Controller
|
|||||||
$collector->setEnd($end);
|
$collector->setEnd($end);
|
||||||
}
|
}
|
||||||
|
|
||||||
$paginator = $collector->getPaginatedGroups();
|
$paginator = $collector->getPaginatedGroups();
|
||||||
$params = $request->buildParams();
|
$params = $request->buildParams();
|
||||||
$paginator->setPath(
|
$paginator->setPath(
|
||||||
sprintf(
|
sprintf(
|
||||||
'%s?%s',
|
'%s?%s',
|
||||||
|
@ -88,26 +88,28 @@ class InfiniteListRequest extends FormRequest
|
|||||||
return 0 === $page || $page > 65536 ? 1 : $page;
|
return 0 === $page || $page > 65536 ? 1 : $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSortInstructions(): array {
|
public function getSortInstructions(): array
|
||||||
|
{
|
||||||
$allowed = config('firefly.sorting.allowed.transactions');
|
$allowed = config('firefly.sorting.allowed.transactions');
|
||||||
$set = $this->get('sorting', []);
|
$set = $this->get('sorting', []);
|
||||||
$result= [];
|
$result = [];
|
||||||
if(0 === count($set)) {
|
if (0 === count($set)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
foreach($set as $info) {
|
foreach ($set as $info) {
|
||||||
$column = $info['column'] ?? 'NOPE';
|
$column = $info['column'] ?? 'NOPE';
|
||||||
$direction = $info['direction'] ?? 'NOPE';
|
$direction = $info['direction'] ?? 'NOPE';
|
||||||
if('asc' !== $direction && 'desc' !== $direction) {
|
if ('asc' !== $direction && 'desc' !== $direction) {
|
||||||
// skip invalid direction
|
// skip invalid direction
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(in_array($column, $allowed, true) === false) {
|
if (false === in_array($column, $allowed, true)) {
|
||||||
// skip invalid column
|
// skip invalid column
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$result[$column] = $direction;
|
$result[$column] = $direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
*/
|
*/
|
||||||
trait CollectorProperties
|
trait CollectorProperties
|
||||||
{
|
{
|
||||||
|
|
||||||
public array $sorting;
|
public array $sorting;
|
||||||
public const string TEST = 'Test';
|
public const string TEST = 'Test';
|
||||||
private ?int $endRow;
|
private ?int $endRow;
|
||||||
|
@ -61,15 +61,15 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->sorting = [];
|
$this->sorting = [];
|
||||||
$this->postFilters = [];
|
$this->postFilters = [];
|
||||||
$this->tags = [];
|
$this->tags = [];
|
||||||
$this->user = null;
|
$this->user = null;
|
||||||
$this->userGroup = null;
|
$this->userGroup = null;
|
||||||
$this->limit = null;
|
$this->limit = null;
|
||||||
$this->page = null;
|
$this->page = null;
|
||||||
$this->startRow = null;
|
$this->startRow = null;
|
||||||
$this->endRow = null;
|
$this->endRow = null;
|
||||||
|
|
||||||
$this->hasAccountInfo = false;
|
$this->hasAccountInfo = false;
|
||||||
$this->hasCatInformation = false;
|
$this->hasCatInformation = false;
|
||||||
@ -291,7 +291,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
if (is_int($param)) {
|
if (is_int($param)) {
|
||||||
$replace = (string)$param;
|
$replace = (string)$param;
|
||||||
}
|
}
|
||||||
$pos = strpos($query, '?');
|
$pos = strpos($query, '?');
|
||||||
if (false !== $pos) {
|
if (false !== $pos) {
|
||||||
$query = substr_replace($query, $replace, $pos, 1);
|
$query = substr_replace($query, $replace, $pos, 1);
|
||||||
}
|
}
|
||||||
@ -459,16 +459,16 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
// add to query:
|
// add to query:
|
||||||
$this->query->orWhereIn('transaction_journals.transaction_group_id', $groupIds);
|
$this->query->orWhereIn('transaction_journals.transaction_group_id', $groupIds);
|
||||||
}
|
}
|
||||||
$result = $this->query->get($this->fields);
|
$result = $this->query->get($this->fields);
|
||||||
|
|
||||||
// now to parse this into an array.
|
// now to parse this into an array.
|
||||||
$collection = $this->parseArray($result);
|
$collection = $this->parseArray($result);
|
||||||
|
|
||||||
// filter the array using all available post filters:
|
// filter the array using all available post filters:
|
||||||
$collection = $this->postFilterCollection($collection);
|
$collection = $this->postFilterCollection($collection);
|
||||||
|
|
||||||
// sort the collection, if sort instructions are present.
|
// sort the collection, if sort instructions are present.
|
||||||
$collection = $this->sortCollection($collection);
|
$collection = $this->sortCollection($collection);
|
||||||
|
|
||||||
// count it and continue:
|
// count it and continue:
|
||||||
$this->total = $collection->count();
|
$this->total = $collection->count();
|
||||||
@ -501,12 +501,12 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
|
|
||||||
/** @var TransactionJournal $augumentedJournal */
|
/** @var TransactionJournal $augumentedJournal */
|
||||||
foreach ($collection as $augumentedJournal) {
|
foreach ($collection as $augumentedJournal) {
|
||||||
$groupId = (int)$augumentedJournal->transaction_group_id;
|
$groupId = (int)$augumentedJournal->transaction_group_id;
|
||||||
|
|
||||||
if (!array_key_exists($groupId, $groups)) {
|
if (!array_key_exists($groupId, $groups)) {
|
||||||
// make new array
|
// make new array
|
||||||
$parsedGroup = $this->parseAugmentedJournal($augumentedJournal);
|
$parsedGroup = $this->parseAugmentedJournal($augumentedJournal);
|
||||||
$groupArray = [
|
$groupArray = [
|
||||||
'id' => (int)$augumentedJournal->transaction_group_id,
|
'id' => (int)$augumentedJournal->transaction_group_id,
|
||||||
'user_id' => $augumentedJournal->user_id,
|
'user_id' => $augumentedJournal->user_id,
|
||||||
'user_group_id' => $augumentedJournal->user_group_id,
|
'user_group_id' => $augumentedJournal->user_group_id,
|
||||||
@ -578,7 +578,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// try to process meta date value (if present)
|
// try to process meta date value (if present)
|
||||||
$dates = ['interest_date', 'payment_date', 'invoice_date', 'book_date', 'due_date', 'process_date'];
|
$dates = ['interest_date', 'payment_date', 'invoice_date', 'book_date', 'due_date', 'process_date'];
|
||||||
if (array_key_exists('meta_name', $result) && in_array($result['meta_name'], $dates, true)) {
|
if (array_key_exists('meta_name', $result) && in_array($result['meta_name'], $dates, true)) {
|
||||||
$name = $result['meta_name'];
|
$name = $result['meta_name'];
|
||||||
if (array_key_exists('meta_data', $result) && '' !== (string)$result['meta_data']) {
|
if (array_key_exists('meta_data', $result) && '' !== (string)$result['meta_data']) {
|
||||||
@ -587,15 +587,15 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convert values to integers:
|
// convert values to integers:
|
||||||
$result = $this->convertToInteger($result);
|
$result = $this->convertToInteger($result);
|
||||||
|
|
||||||
// convert back to strings because SQLite is dumb like that.
|
// convert back to strings because SQLite is dumb like that.
|
||||||
$result = $this->convertToStrings($result);
|
$result = $this->convertToStrings($result);
|
||||||
|
|
||||||
$result['reconciled'] = 1 === (int)$result['reconciled'];
|
$result['reconciled'] = 1 === (int)$result['reconciled'];
|
||||||
if (array_key_exists('tag_id', $result) && null !== $result['tag_id']) { // assume the other fields are present as well.
|
if (array_key_exists('tag_id', $result) && null !== $result['tag_id']) { // assume the other fields are present as well.
|
||||||
$tagId = (int)$augumentedJournal['tag_id'];
|
$tagId = (int)$augumentedJournal['tag_id'];
|
||||||
$tagDate = null;
|
$tagDate = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$tagDate = Carbon::parse($augumentedJournal['tag_date']);
|
$tagDate = Carbon::parse($augumentedJournal['tag_date']);
|
||||||
@ -659,9 +659,9 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
{
|
{
|
||||||
$newArray = $newJournal->toArray();
|
$newArray = $newJournal->toArray();
|
||||||
if (array_key_exists('tag_id', $newArray)) { // assume the other fields are present as well.
|
if (array_key_exists('tag_id', $newArray)) { // assume the other fields are present as well.
|
||||||
$tagId = (int)$newJournal['tag_id'];
|
$tagId = (int)$newJournal['tag_id'];
|
||||||
|
|
||||||
$tagDate = null;
|
$tagDate = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$tagDate = Carbon::parse($newArray['tag_date']);
|
$tagDate = Carbon::parse($newArray['tag_date']);
|
||||||
@ -684,7 +684,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
{
|
{
|
||||||
$newArray = $newJournal->toArray();
|
$newArray = $newJournal->toArray();
|
||||||
if (array_key_exists('attachment_id', $newArray)) {
|
if (array_key_exists('attachment_id', $newArray)) {
|
||||||
$attachmentId = (int)$newJournal['attachment_id'];
|
$attachmentId = (int)$newJournal['attachment_id'];
|
||||||
|
|
||||||
$existingJournal['attachments'][$attachmentId] = [
|
$existingJournal['attachments'][$attachmentId] = [
|
||||||
'id' => $attachmentId,
|
'id' => $attachmentId,
|
||||||
@ -703,7 +703,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
foreach ($groups as $groudId => $group) {
|
foreach ($groups as $groudId => $group) {
|
||||||
/** @var array $transaction */
|
/** @var array $transaction */
|
||||||
foreach ($group['transactions'] as $transaction) {
|
foreach ($group['transactions'] as $transaction) {
|
||||||
$currencyId = (int)$transaction['currency_id'];
|
$currencyId = (int)$transaction['currency_id'];
|
||||||
if (null === $transaction['amount']) {
|
if (null === $transaction['amount']) {
|
||||||
throw new FireflyException(sprintf('Amount is NULL for a transaction in group #%d, please investigate.', $groudId));
|
throw new FireflyException(sprintf('Amount is NULL for a transaction in group #%d, please investigate.', $groudId));
|
||||||
}
|
}
|
||||||
@ -719,7 +719,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['amount']);
|
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['amount']);
|
||||||
|
|
||||||
if (null !== $transaction['foreign_amount'] && null !== $transaction['foreign_currency_id']) {
|
if (null !== $transaction['foreign_amount'] && null !== $transaction['foreign_currency_id']) {
|
||||||
$currencyId = (int)$transaction['foreign_currency_id'];
|
$currencyId = (int)$transaction['foreign_currency_id'];
|
||||||
|
|
||||||
// set default:
|
// set default:
|
||||||
if (!array_key_exists($currencyId, $groups[$groudId]['sums'])) {
|
if (!array_key_exists($currencyId, $groups[$groudId]['sums'])) {
|
||||||
@ -752,7 +752,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
*/
|
*/
|
||||||
foreach ($this->postFilters as $function) {
|
foreach ($this->postFilters as $function) {
|
||||||
app('log')->debug('Applying filter...');
|
app('log')->debug('Applying filter...');
|
||||||
$nextCollection = new Collection();
|
$nextCollection = new Collection();
|
||||||
|
|
||||||
// loop everything in the current collection
|
// loop everything in the current collection
|
||||||
// and save it (or not) in the new collection.
|
// and save it (or not) in the new collection.
|
||||||
@ -988,7 +988,8 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
'transactions as source',
|
'transactions as source',
|
||||||
static function (JoinClause $join): void {
|
static function (JoinClause $join): void {
|
||||||
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->where('source.amount', '<', 0);
|
->where('source.amount', '<', 0)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// join destination transaction
|
// join destination transaction
|
||||||
@ -996,7 +997,8 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
'transactions as destination',
|
'transactions as destination',
|
||||||
static function (JoinClause $join): void {
|
static function (JoinClause $join): void {
|
||||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->where('destination.amount', '>', 0);
|
->where('destination.amount', '>', 0)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// left join transaction type.
|
// left join transaction type.
|
||||||
@ -1011,7 +1013,8 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
->orderBy('transaction_journals.order', 'ASC')
|
->orderBy('transaction_journals.order', 'ASC')
|
||||||
->orderBy('transaction_journals.id', 'DESC')
|
->orderBy('transaction_journals.id', 'DESC')
|
||||||
->orderBy('transaction_journals.description', 'DESC')
|
->orderBy('transaction_journals.description', 'DESC')
|
||||||
->orderBy('source.amount', 'DESC');
|
->orderBy('source.amount', 'DESC')
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1042,7 +1045,8 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
'transactions as source',
|
'transactions as source',
|
||||||
static function (JoinClause $join): void {
|
static function (JoinClause $join): void {
|
||||||
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->where('source.amount', '<', 0);
|
->where('source.amount', '<', 0)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// join destination transaction
|
// join destination transaction
|
||||||
@ -1050,7 +1054,8 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
'transactions as destination',
|
'transactions as destination',
|
||||||
static function (JoinClause $join): void {
|
static function (JoinClause $join): void {
|
||||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->where('destination.amount', '>', 0);
|
->where('destination.amount', '>', 0)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// left join transaction type.
|
// left join transaction type.
|
||||||
@ -1065,7 +1070,8 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
->orderBy('transaction_journals.order', 'ASC')
|
->orderBy('transaction_journals.order', 'ASC')
|
||||||
->orderBy('transaction_journals.id', 'DESC')
|
->orderBy('transaction_journals.id', 'DESC')
|
||||||
->orderBy('transaction_journals.description', 'DESC')
|
->orderBy('transaction_journals.description', 'DESC')
|
||||||
->orderBy('source.amount', 'DESC');
|
->orderBy('source.amount', 'DESC')
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1076,23 +1082,22 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
// include source + destination account name and type.
|
// include source + destination account name and type.
|
||||||
$this->withAccountInformation()
|
$this->withAccountInformation()
|
||||||
// include category ID + name (if any)
|
// include category ID + name (if any)
|
||||||
->withCategoryInformation()
|
->withCategoryInformation()
|
||||||
// include budget ID + name (if any)
|
// include budget ID + name (if any)
|
||||||
->withBudgetInformation()
|
->withBudgetInformation()
|
||||||
// include bill ID + name (if any)
|
// include bill ID + name (if any)
|
||||||
->withBillInformation();
|
->withBillInformation()
|
||||||
|
;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[\Override]
|
||||||
* @inheritDoc
|
public function sortCollection(Collection $collection): Collection
|
||||||
*/
|
|
||||||
#[\Override] public function sortCollection(Collection $collection): Collection
|
|
||||||
{
|
{
|
||||||
foreach ($this->sorting as $field => $direction) {
|
foreach ($this->sorting as $field => $direction) {
|
||||||
$func = $direction === 'ASC' ? 'sortBy' : 'sortByDesc';
|
$func = 'ASC' === $direction ? 'sortBy' : 'sortByDesc';
|
||||||
$collection = $collection->$func(function (array $product, int $key) use ($field, $direction) {
|
$collection = $collection->{$func}(function (array $product, int $key) use ($field) {
|
||||||
// depends on $field:
|
// depends on $field:
|
||||||
if ('description' === $field) {
|
if ('description' === $field) {
|
||||||
if (1 === count($product['transactions'])) {
|
if (1 === count($product['transactions'])) {
|
||||||
@ -1101,22 +1106,22 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
if (count($product['transactions']) > 1) {
|
if (count($product['transactions']) > 1) {
|
||||||
return $product['title'];
|
return $product['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'zzz';
|
return 'zzz';
|
||||||
}
|
}
|
||||||
die('here we are');
|
|
||||||
|
exit('here we are');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $collection;
|
return $collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[\Override]
|
||||||
* @inheritDoc
|
public function setSorting(array $instructions): GroupCollectorInterface
|
||||||
*/
|
|
||||||
#[\Override] public function setSorting(array $instructions): GroupCollectorInterface
|
|
||||||
{
|
{
|
||||||
$this->sorting = $instructions;
|
$this->sorting = $instructions;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,22 +285,10 @@ interface GroupCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function getPaginatedGroups(): LengthAwarePaginator;
|
public function getPaginatedGroups(): LengthAwarePaginator;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param array $instructions
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setSorting(array $instructions): self;
|
public function setSorting(array $instructions): self;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the collection on a column.
|
* Sort the collection on a column.
|
||||||
*
|
|
||||||
* @param Collection $collection
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
*/
|
||||||
public function sortCollection(Collection $collection): Collection;
|
public function sortCollection(Collection $collection): Collection;
|
||||||
|
|
||||||
|
@ -115,12 +115,12 @@ class DebugController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$table = $this->generateTable();
|
$table = $this->generateTable();
|
||||||
$table = str_replace(["\n", "\t", ' '], '', $table);
|
$table = str_replace(["\n", "\t", ' '], '', $table);
|
||||||
$now = now(config('app.timezone'))->format('Y-m-d H:i:s');
|
$now = now(config('app.timezone'))->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
// get latest log file:
|
// get latest log file:
|
||||||
$logger = Log::driver();
|
$logger = Log::driver();
|
||||||
// PHPstan doesn't recognize the method because of its polymorphic nature.
|
// PHPstan doesn't recognize the method because of its polymorphic nature.
|
||||||
$handlers = $logger->getHandlers(); // @phpstan-ignore-line
|
$handlers = $logger->getHandlers(); // @phpstan-ignore-line
|
||||||
$logContent = '';
|
$logContent = '';
|
||||||
@ -134,7 +134,7 @@ class DebugController extends Controller
|
|||||||
}
|
}
|
||||||
if ('' !== $logContent) {
|
if ('' !== $logContent) {
|
||||||
// last few lines
|
// last few lines
|
||||||
$logContent = 'Truncated from this point <----|' . substr((string)$logContent, -16384);
|
$logContent = 'Truncated from this point <----|'.substr((string)$logContent, -16384);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('debug', compact('table', 'now', 'logContent'));
|
return view('debug', compact('table', 'now', 'logContent'));
|
||||||
@ -214,7 +214,7 @@ class DebugController extends Controller
|
|||||||
|
|
||||||
private function getAppInfo(): array
|
private function getAppInfo(): array
|
||||||
{
|
{
|
||||||
$userGuard = config('auth.defaults.guard');
|
$userGuard = config('auth.defaults.guard');
|
||||||
|
|
||||||
$config = app('fireflyconfig')->get('last_rt_job', 0);
|
$config = app('fireflyconfig')->get('last_rt_job', 0);
|
||||||
$lastTime = (int)$config->data;
|
$lastTime = (int)$config->data;
|
||||||
@ -239,24 +239,24 @@ class DebugController extends Controller
|
|||||||
// any of the cron jobs will do, they always run at the same time.
|
// any of the cron jobs will do, they always run at the same time.
|
||||||
// but this job is the oldest, so the biggest chance it ran once
|
// but this job is the oldest, so the biggest chance it ran once
|
||||||
|
|
||||||
'last_cronjob' => $lastCronjob,
|
'last_cronjob' => $lastCronjob,
|
||||||
'last_cronjob_ago' => $lastCronjobAgo,
|
'last_cronjob_ago' => $lastCronjobAgo,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getuserInfo(): array
|
private function getuserInfo(): array
|
||||||
{
|
{
|
||||||
$userFlags = $this->getUserFlags();
|
$userFlags = $this->getUserFlags();
|
||||||
|
|
||||||
// user info
|
// user info
|
||||||
$userAgent = request()->header('user-agent');
|
$userAgent = request()->header('user-agent');
|
||||||
|
|
||||||
// set languages, see what happens:
|
// set languages, see what happens:
|
||||||
$original = setlocale(LC_ALL, '0');
|
$original = setlocale(LC_ALL, '0');
|
||||||
$localeAttempts = [];
|
$localeAttempts = [];
|
||||||
$parts = app('steam')->getLocaleArray(app('steam')->getLocale());
|
$parts = app('steam')->getLocaleArray(app('steam')->getLocale());
|
||||||
foreach ($parts as $code) {
|
foreach ($parts as $code) {
|
||||||
$code = trim($code);
|
$code = trim($code);
|
||||||
app('log')->debug(sprintf('Trying to set %s', $code));
|
app('log')->debug(sprintf('Trying to set %s', $code));
|
||||||
$result = setlocale(LC_ALL, $code);
|
$result = setlocale(LC_ALL, $code);
|
||||||
$localeAttempts[$code] = $result === $code;
|
$localeAttempts[$code] = $result === $code;
|
||||||
@ -280,7 +280,7 @@ class DebugController extends Controller
|
|||||||
$flags = [];
|
$flags = [];
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
// has liabilities
|
// has liabilities
|
||||||
if ($user->accounts()->accountTypeIn([AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE])->count() > 0) {
|
if ($user->accounts()->accountTypeIn([AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE])->count() > 0) {
|
||||||
@ -293,7 +293,7 @@ class DebugController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// has stored reconciliations
|
// has stored reconciliations
|
||||||
$type = TransactionType::whereType(TransactionType::RECONCILIATION)->first();
|
$type = TransactionType::whereType(TransactionType::RECONCILIATION)->first();
|
||||||
if ($user->transactionJournals()->where('transaction_type_id', $type->id)->count() > 0) {
|
if ($user->transactionJournals()->where('transaction_type_id', $type->id)->count() > 0) {
|
||||||
$flags[] = '<span title="Has reconciled">:ledger:</span>';
|
$flags[] = '<span title="Has reconciled">:ledger:</span>';
|
||||||
}
|
}
|
||||||
|
@ -914,9 +914,9 @@ return [
|
|||||||
'preselected_accounts' => ['all', 'assets', 'liabilities'],
|
'preselected_accounts' => ['all', 'assets', 'liabilities'],
|
||||||
|
|
||||||
// allowed sort columns for API's
|
// allowed sort columns for API's
|
||||||
'sorting' => [
|
'sorting' => [
|
||||||
'allowed' => [
|
'allowed' => [
|
||||||
'transactions' => ['description','amount'],
|
'transactions' => ['description', 'amount'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
1
public/build/assets/create-0e590bfb.js
Normal file
1
public/build/assets/create-0e590bfb.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -121,7 +121,7 @@
|
|||||||
"integrity": "sha384-ptHLIPXakGRWe8dWim7Qxgub4wolfi5rktBj2EjNw5tyt8hLq+8p+lTsBKZe5Vay"
|
"integrity": "sha384-ptHLIPXakGRWe8dWim7Qxgub4wolfi5rktBj2EjNw5tyt8hLq+8p+lTsBKZe5Vay"
|
||||||
},
|
},
|
||||||
"resources/assets/v2/pages/transactions/create.js": {
|
"resources/assets/v2/pages/transactions/create.js": {
|
||||||
"file": "assets/create-6dc4ec8c.js",
|
"file": "assets/create-0e590bfb.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_format-money-2cbd3c32.js",
|
"_format-money-2cbd3c32.js",
|
||||||
"_create-empty-split-c1e678fd.js",
|
"_create-empty-split-c1e678fd.js",
|
||||||
@ -131,7 +131,7 @@
|
|||||||
],
|
],
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"src": "resources/assets/v2/pages/transactions/create.js",
|
"src": "resources/assets/v2/pages/transactions/create.js",
|
||||||
"integrity": "sha384-OUiIH870uiZ8Y+/Gl2WLNSLwS8bi6mFgbixL18oCvpeSSN3pLbbmO9M+kzLlXNc9"
|
"integrity": "sha384-E0yymaxo99O2vsNgsuJ2KZD4tBnB+ly/ZlpuS9gJakCJIWWHGxK5z7G1wayhnrK3"
|
||||||
},
|
},
|
||||||
"resources/assets/v2/pages/transactions/edit.js": {
|
"resources/assets/v2/pages/transactions/edit.js": {
|
||||||
"file": "assets/edit-0910e359.js",
|
"file": "assets/edit-0910e359.js",
|
||||||
|
@ -180,6 +180,12 @@ let transactions = function () {
|
|||||||
console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
|
console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ('Expense account' === sourceType && ['Asset account', 'Debt', 'Loan', 'Mortgage'].includes(destType)) {
|
||||||
|
this.groupProperties.transactionType = 'deposit';
|
||||||
|
console.warn('FORCE transaction type to be "' + this.groupProperties.transactionType + '".');
|
||||||
|
this.entries[0].source_account.id = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Asset account' === destType) {
|
if (['Debt', 'Loan', 'Mortgage'].includes(sourceType) && 'Asset account' === destType) {
|
||||||
this.groupProperties.transactionType = 'deposit';
|
this.groupProperties.transactionType = 'deposit';
|
||||||
console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
|
console.log('Transaction type is detected to be "' + this.groupProperties.transactionType + '".');
|
||||||
|
Loading…
Reference in New Issue
Block a user