mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #2796
This commit is contained in:
parent
adc4b00f5d
commit
97c8594dc4
@ -70,6 +70,8 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
private $total;
|
private $total;
|
||||||
/** @var User The user object. */
|
/** @var User The user object. */
|
||||||
private $user;
|
private $user;
|
||||||
|
/** @var array */
|
||||||
|
private $integerFields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Group collector constructor.
|
* Group collector constructor.
|
||||||
@ -84,7 +86,23 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
$this->hasBudgetInformation = false;
|
$this->hasBudgetInformation = false;
|
||||||
$this->hasBillInformation = false;
|
$this->hasBillInformation = false;
|
||||||
$this->hasJoinedTagTables = false;
|
$this->hasJoinedTagTables = false;
|
||||||
|
$this->integerFields = [
|
||||||
|
'transaction_group_id',
|
||||||
|
'user_id',
|
||||||
|
'transaction_journal_id',
|
||||||
|
'transaction_type_id',
|
||||||
|
'order',
|
||||||
|
'source_transaction_id',
|
||||||
|
'source_account_id',
|
||||||
|
'currency_id',
|
||||||
|
'currency_decimal_places',
|
||||||
|
'foreign_currency_id',
|
||||||
|
'foreign_currency_decimal_places',
|
||||||
|
'destination_transaction_id',
|
||||||
|
'destination_account_id',
|
||||||
|
'category_id',
|
||||||
|
'budget_id'
|
||||||
|
];
|
||||||
$this->total = 0;
|
$this->total = 0;
|
||||||
$this->fields = [
|
$this->fields = [
|
||||||
# group
|
# group
|
||||||
@ -903,6 +921,22 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a selected set of fields to arrays.
|
||||||
|
*
|
||||||
|
* @param array $array
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function convertToInteger(array $array): array
|
||||||
|
{
|
||||||
|
foreach ($this->integerFields as $field) {
|
||||||
|
$array[$field] = isset($array[$field]) ? (int)$array[$field] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join table to get tag information.
|
* Join table to get tag information.
|
||||||
*/
|
*/
|
||||||
@ -965,9 +999,9 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
// make new array
|
// make new array
|
||||||
$parsedGroup = $this->parseAugmentedGroup($augumentedJournal);
|
$parsedGroup = $this->parseAugmentedGroup($augumentedJournal);
|
||||||
$groupArray = [
|
$groupArray = [
|
||||||
'id' => $augumentedJournal->transaction_group_id,
|
'id' => (int)$augumentedJournal->transaction_group_id,
|
||||||
'user_id' => $augumentedJournal->user_id,
|
'user_id' => (int)$augumentedJournal->user_id,
|
||||||
'title' => $augumentedJournal->transaction_group_title,
|
'title' => (int)$augumentedJournal->transaction_group_title,
|
||||||
'transaction_type' => $parsedGroup['transaction_type_type'],
|
'transaction_type' => $parsedGroup['transaction_type_type'],
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
'sums' => [],
|
'sums' => [],
|
||||||
@ -1014,6 +1048,10 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert values to integers:
|
||||||
|
$result = $this->convertToInteger($result);
|
||||||
|
|
||||||
$result['reconciled'] = 1 === (int)$result['reconciled'];
|
$result['reconciled'] = 1 === (int)$result['reconciled'];
|
||||||
if (isset($augumentedJournal['tag_id'])) { // assume the other fields are present as well.
|
if (isset($augumentedJournal['tag_id'])) { // assume the other fields are present as well.
|
||||||
$tagId = (int)$augumentedJournal['tag_id'];
|
$tagId = (int)$augumentedJournal['tag_id'];
|
||||||
|
Loading…
Reference in New Issue
Block a user