Lots of todo's [skip ci]

This commit is contained in:
James Cole 2016-03-02 13:51:56 +01:00
parent 500243b0b3
commit 9b69a6addd
18 changed files with 25 additions and 25 deletions

View File

@ -80,7 +80,7 @@ class Entry
$entry = new self;
$entry->setDescription($journal->description);
$entry->setDate($journal->date->format('Y-m-d'));
$entry->setAmount($journal->amount);
$entry->setAmount($journal->amount); // TODO TransactionJournal cannot deliver "amount".
/** @var Budget $budget */
$budget = $journal->budgets->first();
@ -102,14 +102,14 @@ class Entry
}
/** @var Account $sourceAccount */
$sourceAccount = $journal->source_account;
$sourceAccount = $journal->source_account; // TODO TransactionJournal cannot deliver "source_account"
$entry->setFromAccountId($sourceAccount->id);
$entry->setFromAccountName($sourceAccount->name);
$entry->setFromAccountIban($sourceAccount->iban);
$entry->setFromAccountType($sourceAccount->accountType->type);
/** @var Account $destination */
$destination = $journal->destination_account;
$destination = $journal->destination_account; // TODO TransactionJournal cannot deliver "destination_account"
$entry->setToAccountId($destination->id);
$entry->setToAccountName($destination->name);
$entry->setToAccountIban($destination->iban);

View File

@ -44,9 +44,9 @@ class ConnectJournalToPiggyBank
}
bcscale(2);
$amount = $journal->amount_positive;
$amount = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive".
// if piggy account matches source account, the amount is positive
if ($piggyBank->account_id == $journal->source_account->id) {
if ($piggyBank->account_id == $journal->source_account->id) {// TODO TransactionJournal cannot deliver "source_account"
$amount = bcmul($amount, '-1');
}

View File

@ -44,7 +44,7 @@ class UpdateJournalConnection
}
bcscale(2);
$amount = $journal->amount;
$amount = $journal->amount; // TODO TransactionJournal cannot deliver "amount".
$diff = bcsub($amount, $event->amount); // update current repetition
$repetition->currentamount = bcadd($repetition->currentamount, $diff);

View File

@ -183,7 +183,7 @@ class TransactionController extends Controller
$preFilled['piggy_bank_id'] = $journal->piggyBankEvents()->orderBy('date', 'DESC')->first()->piggy_bank_id;
}
$preFilled['amount'] = $journal->amount_positive;
$preFilled['amount'] = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive".
if ($journal->isWithdrawal()) {
$preFilled['account_id'] = $journal->source_account_id;

View File

@ -211,7 +211,7 @@ class AccountRepository implements AccountRepositoryInterface
$offset = ($page - 1) * 50;
$query = Auth::user()
->transactionJournals()
->withRelevantData()
->withRelevantData() // TODO firefly will crash here.
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->orderBy('transaction_journals.date', 'DESC')

View File

@ -414,7 +414,7 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
public function getJournals(Budget $budget, LimitRepetition $repetition = null, int $take = 50)
{
$offset = intval(Input::get('page')) > 0 ? intval(Input::get('page')) * $take : 0;
$setQuery = $budget->transactionjournals()->withRelevantData()->take($take)->offset($offset)
$setQuery = $budget->transactionjournals()->withRelevantData()->take($take)->offset($offset) // TODO firefly will crash here.
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC');

View File

@ -129,8 +129,8 @@ class TagRepository implements TagRepositoryInterface
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
if ($journal->destination_account->id == $account->id) {
$amount = bcadd($amount, $journal->amount);
if ($journal->destination_account->id == $account->id) { // TODO TransactionJournal cannot deliver "destination_account"
$amount = bcadd($amount, $journal->amount); // TODO TransactionJournal cannot deliver "amount".
}
}
}
@ -376,10 +376,10 @@ class TagRepository implements TagRepositoryInterface
foreach ($tag->transactionjournals as $check) {
// $checkAccount is the source_account for a withdrawal
// $checkAccount is the destination_account for a deposit
if ($check->isWithdrawal() && $check->source_account->id != $journal->destination_account->id) {
if ($check->isWithdrawal() && $check->source_account->id != $journal->destination_account->id) { // TODO TransactionJournal cannot deliver "source_account"
$match = false;
}
if ($check->isDeposit() && $check->destination_account->id != $journal->destination_account->id) {
if ($check->isDeposit() && $check->destination_account->id != $journal->destination_account->id) { // TODO TransactionJournal cannot deliver "destination_account"
$match = false;
}

View File

@ -54,7 +54,7 @@ final class AmountExactly extends AbstractTrigger implements TriggerInterface
*/
public function triggered(TransactionJournal $journal)
{
$amount = $journal->amount_positive;
$amount = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive".
$compare = $this->triggerValue;
$result = bccomp($amount, $compare, 4);
if ($result === 0) {

View File

@ -54,7 +54,7 @@ final class AmountLess extends AbstractTrigger implements TriggerInterface
*/
public function triggered(TransactionJournal $journal)
{
$amount = $journal->amount_positive;
$amount = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive".
$compare = $this->triggerValue;
$result = bccomp($amount, $compare, 4);
if ($result === -1) {

View File

@ -54,7 +54,7 @@ final class AmountMore extends AbstractTrigger implements TriggerInterface
*/
public function triggered(TransactionJournal $journal)
{
$amount = $journal->amount_positive;
$amount = $journal->amount_positive; // TODO TransactionJournal cannot deliver "amount_positive".
$compare = $this->triggerValue;
$result = bccomp($amount, $compare, 4);
if ($result === 1) {

View File

@ -53,7 +53,7 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf
*/
public function triggered(TransactionJournal $journal)
{
$fromAccountName = strtolower($journal->source_account->name);
$fromAccountName = strtolower($journal->source_account->name);// TODO TransactionJournal cannot deliver "source_account"
$search = strtolower($this->triggerValue);
$strpos = strpos($fromAccountName, $search);

View File

@ -53,7 +53,7 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface
*/
public function triggered(TransactionJournal $journal)
{
$name = strtolower($journal->source_account->name);
$name = strtolower($journal->source_account->name);// TODO TransactionJournal cannot deliver "source_account"
$nameLength = strlen($name);
$search = strtolower($this->triggerValue);
$searchLength = strlen($search);

View File

@ -53,7 +53,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac
*/
public function triggered(TransactionJournal $journal)
{
$fromAccountName = strtolower($journal->source_account->name);
$fromAccountName = strtolower($journal->source_account->name);// TODO TransactionJournal cannot deliver "source_account"
$search = strtolower($this->triggerValue);
$part = substr($fromAccountName, 0, strlen($search));

View File

@ -53,7 +53,7 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac
*/
public function triggered(TransactionJournal $journal)
{
$toAccountName = strtolower($journal->destination_account->name);
$toAccountName = strtolower($journal->destination_account->name); // TODO TransactionJournal cannot deliver "destination_account"
$search = strtolower($this->triggerValue);
$strpos = strpos($toAccountName, $search);

View File

@ -53,7 +53,7 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface
*/
public function triggered(TransactionJournal $journal)
{
$toAccountName = strtolower($journal->destination_account->name);
$toAccountName = strtolower($journal->destination_account->name); // TODO TransactionJournal cannot deliver "destination_account"
$toAccountNameLength = strlen($toAccountName);
$search = strtolower($this->triggerValue);
$searchLength = strlen($search);

View File

@ -53,7 +53,7 @@ final class ToAccountIs extends AbstractTrigger implements TriggerInterface
*/
public function triggered(TransactionJournal $journal)
{
$toAccountName = strtolower($journal->destination_account->name);
$toAccountName = strtolower($journal->destination_account->name); // TODO TransactionJournal cannot deliver "destination_account"
$search = strtolower($this->triggerValue);
if ($toAccountName == $search) {

View File

@ -53,7 +53,7 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface
*/
public function triggered(TransactionJournal $journal)
{
$toAccountName = strtolower($journal->destination_account->name);
$toAccountName = strtolower($journal->destination_account->name); // TODO TransactionJournal cannot deliver "destination_account"
$search = strtolower($this->triggerValue);
$part = substr($toAccountName, 0, strlen($search));

View File

@ -103,7 +103,7 @@ class Search implements SearchInterface
public function searchTransactions(array $words): Collection
{
// decrypted transaction journals:
$decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where(
$decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where( // TODO firefly will crash here.
function (EloquentBuilder $q) use ($words) {
foreach ($words as $word) {
$q->orWhere('description', 'LIKE', '%' . e($word) . '%');
@ -112,7 +112,7 @@ class Search implements SearchInterface
)->get();
// encrypted
$all = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 1)->get();
$all = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 1)->get(); // TODO firefly will crash here.
$set = $all->filter(
function (TransactionJournal $journal) use ($words) {
foreach ($words as $word) {