Added invoice date

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole 2016-09-10 18:36:52 +02:00
parent 29a930dae5
commit 629baf9de5
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
12 changed files with 44 additions and 2 deletions

View File

@ -175,6 +175,7 @@ class PreferencesController extends Controller
'process_date' => isset($setOptions['process_date']),
'due_date' => isset($setOptions['due_date']),
'payment_date' => isset($setOptions['payment_date']),
'invoice_date' => isset($setOptions['invoice_date']),
'internal_reference' => isset($setOptions['internal_reference']),
'notes' => isset($setOptions['notes']),
'attachments' => isset($setOptions['attachments']),

View File

@ -177,6 +177,7 @@ class TransactionController extends Controller
// new custom fields:
'due_date' => TransactionJournal::dateAsString($journal, 'due_date'),
'payment_date' => TransactionJournal::dateAsString($journal, 'payment_date'),
'invoice_date' => TransactionJournal::dateAsString($journal, 'invoice_date'),
'interal_reference' => $journal->getMeta('internal_reference'),
'notes' => $journal->getMeta('notes'),
];

View File

@ -64,6 +64,7 @@ class JournalFormRequest extends Request
// new custom fields here:
'due_date' => $this->get('due_date') ? new Carbon($this->get('due_date')) : null,
'payment_date' => $this->get('payment_date') ? new Carbon($this->get('payment_date')) : null,
'invoice_date' => $this->get('invoice_date') ? new Carbon($this->get('invoice_date')) : null,
'internal_reference' => $this->get('internal_reference'),
'notes' => $this->get('notes'),

View File

@ -237,6 +237,16 @@ class TransactionJournal extends TransactionJournalSupport
return $value;
}
/**
* @param string $name
*
* @return bool
*/
public function hasMeta(string $name): bool
{
return !is_null($this->getMeta($name));
}
/**
* @return bool
*/

View File

@ -42,7 +42,7 @@ class JournalRepository implements JournalRepositoryInterface
private $user;
/** @var array */
private $validMetaFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'internal_reference', 'notes'];
private $validMetaFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', 'internal_reference', 'notes'];
/**
* JournalRepository constructor.

View File

@ -285,6 +285,7 @@ return [
'pref_optional_tj_process_date' => 'Processing date',
'pref_optional_tj_due_date' => 'Due date',
'pref_optional_tj_payment_date' => 'Payment date',
'pref_optional_tj_invoice_date' => 'Invoice date',
'pref_optional_tj_internal_reference' => 'Internal reference',
'pref_optional_tj_notes' => 'Notes',
'pref_optional_tj_attachments' => 'Attachments',

View File

@ -149,5 +149,6 @@ return [
'due_date' => 'Due date',
'payment_date' => 'Payment date',
'invoice_date' => 'Invoice date',
'internal_reference' => 'Internal reference',
];

View File

@ -41,6 +41,8 @@ return [
'process_date' => 'Processing date',
'due_date' => 'Due date',
'payment_date' => 'Payment date',
'invoice_date' => 'Invoice date',
'interal_reference' => 'Internal reference',
'notes' => 'Notes',
'from' => 'From',
'piggy_bank' => 'Piggy bank',

View File

@ -63,6 +63,7 @@
{{ ExpandedForm.checkbox('tj[process_date]','1', tjOptionalFields.process_date,{ 'label' : 'pref_optional_tj_process_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[due_date]','1', tjOptionalFields.due_date,{ 'label' : 'pref_optional_tj_due_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[payment_date]','1', tjOptionalFields.payment_date,{ 'label' : 'pref_optional_tj_payment_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[invoice_date]','1', tjOptionalFields.invoice_date,{ 'label' : 'pref_optional_tj_invoice_date'|_ }) }}
<h4>{{ 'optional_tj_business_fields'|_ }}</h4>
{{ ExpandedForm.checkbox('tj[internal_reference]','1', tjOptionalFields.internal_reference,{ 'label' : 'pref_optional_tj_internal_reference'|_ }) }}

View File

@ -90,6 +90,7 @@
not optionalFields.process_date or
not optionalFields.due_date or
not optionalFields.payment_date or
not optionalFields.invoice_date or
not optionalFields.internal_reference or
not optionalFields.notes or
not optionalFields.attachments
@ -97,7 +98,11 @@
<p class="text-center text-success"><i class="fa fa-info-circle" aria-hidden="true"></i> <em>{{ trans('firefly.hidden_fields_preferences', {link: route('preferences')})|raw }}</em></p>
{% endif %}
<!-- box for dates -->
{% if optionalFields.interest_date or optionalFields.book_date or optionalFields.process_date or optionalFields.due_date or optionalFields.payment_date %}
{% if
optionalFields.interest_date or optionalFields.book_date or optionalFields.process_date
or optionalFields.due_date or optionalFields.payment_date
or optionalFields.invoice_date
%}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'optional_field_meta_dates'|_ }}</h3>
@ -129,6 +134,11 @@
{{ ExpandedForm.date('payment_date') }}
{% endif %}
{% if optionalFields.invoice_date %}
<!-- INVOICE DATE -->
{{ ExpandedForm.date('invoice_date') }}
{% endif %}
</div>
</div>
{% endif %}

View File

@ -103,6 +103,7 @@
not optionalFields.due_date or
not optionalFields.payment_date or
not optionalFields.internal_reference or
not optionalFields.invoice_date or
not optionalFields.notes or
not optionalFields.attachments %}
<p class="text-center text-success"><i class="fa fa-info-circle" aria-hidden="true"></i>
@ -117,6 +118,7 @@
optionalFields.process_date or
optionalFields.due_date or
optionalFields.payment_date or
optionalFields.invoice_date or
data.interest_date or
data.book_date or
data.process_date or
@ -154,6 +156,11 @@
{{ ExpandedForm.date('payment_date',data['payment_date']) }}
{% endif %}
{% if optionalFields.invoice_date or data['invoice_date'] %}
<!-- INVOICE DATE -->
{{ ExpandedForm.date('invoice_date',data['invoice_date']) }}
{% endif %}
</div>
</div>
{% endif %}

View File

@ -56,6 +56,13 @@
</tr>
{% endif %}
{% if journal.getMeta('invoice_date') %}
<tr>
<td>{{ trans('list.invoice_date') }}</td>
<td>{{ journal.getMeta('invoice_date').formatLocalized(monthAndDayFormat) }}</td>
</tr>
{% endif %}
<tr>
<td>{{ trans('list.type') }}</td>
<td>{{ journal.transactiontype.type|_ }}</td>