diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 21f059fd20..cdbbde9253 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -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']), diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index d4661a42e4..376079afbc 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -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'), ]; diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php index 88e0895673..6c0e44da66 100644 --- a/app/Http/Requests/JournalFormRequest.php +++ b/app/Http/Requests/JournalFormRequest.php @@ -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'), diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index 912e3c0482..b81c09e039 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -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 */ diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 189a34e01b..778c91e608 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -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. diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 8a9b5f0896..56d965ede9 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -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', diff --git a/resources/lang/en_US/form.php b/resources/lang/en_US/form.php index a94ffaa9e7..62c4971ac6 100644 --- a/resources/lang/en_US/form.php +++ b/resources/lang/en_US/form.php @@ -149,5 +149,6 @@ return [ 'due_date' => 'Due date', 'payment_date' => 'Payment date', + 'invoice_date' => 'Invoice date', 'internal_reference' => 'Internal reference', ]; diff --git a/resources/lang/en_US/list.php b/resources/lang/en_US/list.php index 4c4743126f..c150b284b2 100644 --- a/resources/lang/en_US/list.php +++ b/resources/lang/en_US/list.php @@ -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', diff --git a/resources/views/preferences/index.twig b/resources/views/preferences/index.twig index e42f578825..3b5ad89453 100644 --- a/resources/views/preferences/index.twig +++ b/resources/views/preferences/index.twig @@ -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'|_ }) }}
{{ trans('firefly.hidden_fields_preferences', {link: route('preferences')})|raw }}
{% endif %} - {% 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 + %}@@ -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'] %} + + {{ ExpandedForm.date('invoice_date',data['invoice_date']) }} + {% endif %} + {% endif %} diff --git a/resources/views/transactions/show.twig b/resources/views/transactions/show.twig index 57d9d785bb..bd78503b9b 100644 --- a/resources/views/transactions/show.twig +++ b/resources/views/transactions/show.twig @@ -56,6 +56,13 @@ {% endif %} + {% if journal.getMeta('invoice_date') %} +