mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-27 08:46:40 -06:00
Fix bugs.
This commit is contained in:
parent
7d7ff71384
commit
7dd858be39
@ -116,6 +116,24 @@ class MassController extends Controller
|
|||||||
Session::flash('gaEventCategory', 'transactions');
|
Session::flash('gaEventCategory', 'transactions');
|
||||||
Session::flash('gaEventAction', 'mass-edit');
|
Session::flash('gaEventAction', 'mass-edit');
|
||||||
|
|
||||||
|
// set some values to be used in the edit routine:
|
||||||
|
$journals->each(
|
||||||
|
function (TransactionJournal $journal) {
|
||||||
|
$journal->amount = TransactionJournal::amountPositive($journal);
|
||||||
|
$sources = TransactionJournal::sourceAccountList($journal);
|
||||||
|
$destinations = TransactionJournal::destinationAccountList($journal);
|
||||||
|
$journal->transaction_count = $journal->transactions()->count();
|
||||||
|
if (!is_null($sources->first())) {
|
||||||
|
$journal->source_account_id = $sources->first()->id;
|
||||||
|
$journal->source_account_name = $sources->first()->name;
|
||||||
|
}
|
||||||
|
if (!is_null($destinations->first())) {
|
||||||
|
$journal->destination_account_id = $destinations->first()->id;
|
||||||
|
$journal->destination_account_name = $destinations->first()->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return view('transactions.mass-edit', compact('journals', 'subTitle', 'accountList'));
|
return view('transactions.mass-edit', compact('journals', 'subTitle', 'accountList'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,15 +47,15 @@ use Watson\Validating\ValidatingTrait;
|
|||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal after($date)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal after($date)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal before($date)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal before($date)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal transactionTypes($types)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal transactionTypes($types)
|
||||||
* @property-read string $transaction_type_type
|
* @property string $transaction_type_type
|
||||||
* @property-read string $transaction_currency_code
|
* @property-read string $transaction_currency_code
|
||||||
* @property-read string $destination_amount
|
* @property-read string $destination_amount
|
||||||
* @property-read string $destination_account_id
|
* @property string $destination_account_id
|
||||||
* @property-read string $destination_account_name
|
* @property string $destination_account_name
|
||||||
* @property-read string $destination_account_type
|
* @property-read string $destination_account_type
|
||||||
* @property-read string $source_amount
|
* @property-read string $source_amount
|
||||||
* @property-read string $source_account_id
|
* @property string $source_account_id
|
||||||
* @property-read string $source_account_name
|
* @property string $source_account_name
|
||||||
* @property-read string $source_account_type
|
* @property-read string $source_account_type
|
||||||
* @property \Carbon\Carbon $process_date
|
* @property \Carbon\Carbon $process_date
|
||||||
* @property int $account_id
|
* @property int $account_id
|
||||||
@ -178,20 +178,6 @@ class TransactionJournal extends TransactionJournalSupport
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $value
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getDestinationAccountNameAttribute($value)
|
|
||||||
{
|
|
||||||
if (!is_null($value) && strlen(strval($value)) > 0) {
|
|
||||||
return Crypt::decrypt($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $fieldName
|
* @param string $fieldName
|
||||||
@ -209,21 +195,6 @@ class TransactionJournal extends TransactionJournalSupport
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $value
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getSourceAccountNameAttribute($value)
|
|
||||||
{
|
|
||||||
if (!is_null($value) && strlen(strval($value)) > 0) {
|
|
||||||
return Crypt::decrypt($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@ -322,17 +293,6 @@ class TransactionJournal extends TransactionJournalSupport
|
|||||||
return $query->where('transaction_journals.date', '<=', $date->format('Y-m-d 00:00:00'));
|
return $query->where('transaction_journals.date', '<=', $date->format('Y-m-d 00:00:00'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param EloquentBuilder $query
|
|
||||||
*/
|
|
||||||
public function scopeSortCorrectly(EloquentBuilder $query)
|
|
||||||
{
|
|
||||||
$query->orderBy('transaction_journals.date', 'DESC');
|
|
||||||
$query->orderBy('transaction_journals.order', 'ASC');
|
|
||||||
$query->orderBy('transaction_journals.id', 'DESC');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param EloquentBuilder $query
|
* @param EloquentBuilder $query
|
||||||
*/
|
*/
|
||||||
@ -351,6 +311,17 @@ class TransactionJournal extends TransactionJournalSupport
|
|||||||
$query->with(['categories', 'budgets', 'attachments', 'bill', 'transactions']);
|
$query->with(['categories', 'budgets', 'attachments', 'bill', 'transactions']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param EloquentBuilder $query
|
||||||
|
*/
|
||||||
|
public function scopeSortCorrectly(EloquentBuilder $query)
|
||||||
|
{
|
||||||
|
$query->orderBy('transaction_journals.date', 'DESC');
|
||||||
|
$query->orderBy('transaction_journals.order', 'ASC');
|
||||||
|
$query->orderBy('transaction_journals.id', 'DESC');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param EloquentBuilder $query
|
* @param EloquentBuilder $query
|
||||||
|
@ -27,61 +27,58 @@
|
|||||||
<th style="width: 20%;">{{ trans('list.to') }}</th>
|
<th style="width: 20%;">{{ trans('list.to') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for journal in journals %}
|
{% for journal in journals %}
|
||||||
<tr>
|
{% if journal.transaction_count == 2 %}
|
||||||
<td>
|
<tr>
|
||||||
<!-- LINK TO EDIT FORM -->
|
<td>
|
||||||
<a href="{{ route('transactions.edit', journal.id) }}" class="btn btn-xs btn-default">
|
<!-- LINK TO EDIT FORM -->
|
||||||
<i class="fa fa-fw fa-pencil"></i>
|
<a href="{{ route('transactions.edit', journal.id) }}" class="btn btn-xs btn-default">
|
||||||
</a>
|
<i class="fa fa-fw fa-pencil"></i>
|
||||||
<input type="hidden" name="journals[]" value="{{ journal.id }}"/>
|
</a>
|
||||||
</td>
|
<input type="hidden" name="journals[]" value="{{ journal.id }}"/>
|
||||||
<td>
|
</td>
|
||||||
<!-- DESCRIPTION -->
|
<td>
|
||||||
<input
|
<!-- DESCRIPTION -->
|
||||||
class="form-control"
|
<input
|
||||||
id="ffInput_description_{{ journal.id }}" autocomplete="off"
|
class="form-control"
|
||||||
placeholder="Description" name="description[{{ journal.id }}]"
|
id="ffInput_description_{{ journal.id }}" autocomplete="off"
|
||||||
type="text" value="{{ journal.description }}">
|
placeholder="Description" name="description[{{ journal.id }}]"
|
||||||
</td>
|
type="text" value="{{ journal.description }}">
|
||||||
<td>
|
</td>
|
||||||
<!-- AMOUNT -->
|
<td>
|
||||||
{% if journal.destination_amount > 0 %}
|
<!-- AMOUNT -->
|
||||||
{% set amount = journal.destination_amount %}
|
{{ ExpandedForm.amountSmall('amount_'~journal.id, journal.amount, {'name' : 'amount['~journal.id~']', 'currency' : journal.transactionCurrency}) }}
|
||||||
{% else %}
|
</td>
|
||||||
{% set amount = journal.source_amount %}
|
<td>
|
||||||
{% endif %}
|
<!-- DATE -->
|
||||||
|
<input
|
||||||
|
class="form-control" id="ffInput_date_{{ journal.id }}"
|
||||||
|
autocomplete="off" name="date[{{ journal.id }}]" type="date" value="{{ journal.date.format('Y-m-d') }}">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
{{ ExpandedForm.amountSmall('amount_'~journal.id, amount, {'name' : 'amount['~journal.id~']', 'currency' : journal.transactionCurrency}) }}
|
<!-- SOURCE ACCOUNT FOR TRANSFER OR WITHDRAWAL -->
|
||||||
</td>
|
{% if journal.transaction_type_type == 'Transfer' or journal.transaction_type_type == 'Withdrawal' %}
|
||||||
<td>
|
{{ Form.select('source_account_id['~journal.id~']', accountList, journal.source_account_id, {'class': 'form-control'}) }}
|
||||||
<!-- DATE -->
|
{% else %}
|
||||||
<input
|
<!-- if is income -->
|
||||||
class="form-control" id="ffInput_date_{{ journal.id }}"
|
{{ Form.input('text', 'revenue_account['~journal.id~']', journal.source_account_name, {'class': 'form-control', 'placeholder': trans('form.revenue_account')}) }}
|
||||||
autocomplete="off" name="date[{{ journal.id }}]" type="date" value="{{ journal.date.format('Y-m-d') }}">
|
{% endif %}
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<!-- SOURCE ACCOUNT FOR TRANSFER OR WITHDRAWAL -->
|
</td>
|
||||||
{% if journal.transaction_type_type == 'Transfer' or journal.transaction_type_type == 'Withdrawal' %}
|
<td>
|
||||||
{{ Form.select('source_account_id['~journal.id~']', accountList, journal.source_account_id, {'class': 'form-control'}) }}
|
|
||||||
{% else %}
|
|
||||||
<!-- if is income -->
|
|
||||||
{{ Form.input('text', 'revenue_account['~journal.id~']', journal.source_account_name, {'class': 'form-control', 'placeholder': trans('form.revenue_account')}) }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</td>
|
{% if journal.transaction_type_type == 'Transfer' or journal.transaction_type_type == 'Deposit' %}
|
||||||
<td>
|
<!-- is is transfer or income -->
|
||||||
|
{{ Form.select('destination_account_id['~journal.id~']', accountList, journal.destination_account_id, {'class': 'form-control'}) }}
|
||||||
|
{% else %}
|
||||||
|
<!-- if is expense -->
|
||||||
|
|
||||||
{% if journal.transaction_type_type == 'Transfer' or journal.transaction_type_type == 'Deposit' %}
|
{{ Form.input('text', 'expense_account['~journal.id~']', journal.destination_account_name, {'class': 'form-control', 'placeholder': trans('form.expense_account')}) }}
|
||||||
<!-- is is transfer or income -->
|
{% endif %}
|
||||||
{{ Form.select('destination_account_id['~journal.id~']', accountList, journal.destination_account_id, {'class': 'form-control'}) }}
|
|
||||||
{% else %}
|
|
||||||
<!-- if is expense -->
|
|
||||||
{{ Form.input('text', 'expense_account['~journal.id~']', journal.destination_account_name, {'class': 'form-control', 'placeholder': trans('form.expense_account')}) }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user