Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Additional fix for #2629 with API
Geoffrey “Frogeye” Preud'hommef8cb5ca21c9a
diff --git a/app/Api/V1/Requests/AccountUpdateRequest.php b/app/Api/V1/Requests/AccountUpdateRequest.phpindex 36e974b77c..81777c5af2 100644--- a/app/Api/V1/Requests/AccountUpdateRequest.php+++ b/app/Api/V1/Requests/AccountUpdateRequest.php@@ -76,7 +76,7 @@ class AccountUpdateRequest extends Request'opening_balance_date' => $this->date('opening_balance_date'),'cc_type' => $this->nullableString('credit_card_type'),'cc_Monthly_payment_date' => $this->nullableString('monthly_payment_date'),- 'notes' => $this->nullableString('notes'),+ 'notes' => $this->nullableNlString('notes'),'interest' => $this->nullableString('interest'),'interest_period' => $this->nullableString('interest_period'),];diff --git a/app/Api/V1/Requests/AttachmentStoreRequest.php b/app/Api/V1/Requests/AttachmentStoreRequest.phpindex 63047134f2..464319a3ad 100644--- a/app/Api/V1/Requests/AttachmentStoreRequest.php+++ b/app/Api/V1/Requests/AttachmentStoreRequest.php@@ -56,7 +56,7 @@ class AttachmentStoreRequest extends Requestreturn ['filename' => $this->string('filename'),'title' => $this->string('title'),- 'notes' => $this->string('notes'),+ 'notes' => $this->nlString('notes'),'model' => $this->string('model'),'model_id' => $this->integer('model_id'),];diff --git a/app/Api/V1/Requests/AttachmentUpdateRequest.php b/app/Api/V1/Requests/AttachmentUpdateRequest.phpindex 0bc823b402..f3e148f0f0 100644--- a/app/Api/V1/Requests/AttachmentUpdateRequest.php+++ b/app/Api/V1/Requests/AttachmentUpdateRequest.php@@ -51,7 +51,7 @@ class AttachmentUpdateRequest extends Requestreturn ['filename' => $this->string('filename'),'title' => $this->string('title'),- 'notes' => $this->string('notes'),+ 'notes' => $this->nlString('notes'),'model' => $this->string('model'),'model_id' => $this->integer('model_id'),];diff --git a/app/Api/V1/Requests/BillRequest.php b/app/Api/V1/Requests/BillRequest.phpindex dba2b93e7b..c2da7be3e6 100644--- a/app/Api/V1/Requests/BillRequest.php+++ b/app/Api/V1/Requests/BillRequest.php@@ -70,7 +70,7 @@ class BillRequest extends Request'repeat_freq' => $this->string('repeat_freq'),'skip' => $this->integer('skip'),'active' => $active,- 'notes' => $this->string('notes'),+ 'notes' => $this->nlString('notes'),];return $data;diff --git a/app/Api/V1/Requests/PiggyBankRequest.php b/app/Api/V1/Requests/PiggyBankRequest.phpindex 7fad9502e8..cff1691703 100644--- a/app/Api/V1/Requests/PiggyBankRequest.php+++ b/app/Api/V1/Requests/PiggyBankRequest.php@@ -62,7 +62,7 @@ class PiggyBankRequest extends Request'current_amount' => $this->string('current_amount'),'startdate' => $this->date('start_date'),'targetdate' => $this->date('target_date'),- 'notes' => $this->string('notes'),+ 'notes' => $this->nlString('notes'),];}diff --git a/app/Api/V1/Requests/RecurrenceUpdateRequest.php b/app/Api/V1/Requests/RecurrenceUpdateRequest.phpindex dbf71745b9..ecefab906c 100644--- a/app/Api/V1/Requests/RecurrenceUpdateRequest.php+++ b/app/Api/V1/Requests/RecurrenceUpdateRequest.php@@ -69,7 +69,7 @@ class RecurrenceUpdateRequest extends Request'title' => $this->nullableString('title'),'description' => $this->nullableString('description'),'first_date' => $this->date('first_date'),- 'notes' => $this->nullableString('notes'),+ 'notes' => $this->nullableNlString('notes'),'repeat_until' => $this->date('repeat_until'),'nr_of_repetitions' => $this->nullableInteger('nr_of_repetitions'),'apply_rules' => $applyRules,diff --git a/app/Api/V1/Requests/Request.php b/app/Api/V1/Requests/Request.phpindex 45e85a5553..3312b7eed5 100644--- a/app/Api/V1/Requests/Request.php+++ b/app/Api/V1/Requests/Request.php@@ -65,7 +65,7 @@ class Request extends FireflyIIIRequest'opening_balance_date' => $this->date('opening_balance_date'),'cc_type' => $this->string('credit_card_type'),'cc_Monthly_payment_date' => $this->string('monthly_payment_date'),- 'notes' => $this->string('notes'),+ 'notes' => $this->nlString('notes'),'interest' => $this->string('interest'),'interest_period' => $this->string('interest_period'),];diff --git a/app/Api/V1/Requests/TransactionLinkRequest.php b/app/Api/V1/Requests/TransactionLinkRequest.phpindex a5d37e70ea..02f1cbe91b 100644--- a/app/Api/V1/Requests/TransactionLinkRequest.php+++ b/app/Api/V1/Requests/TransactionLinkRequest.php@@ -57,7 +57,7 @@ class TransactionLinkRequest extends Request'link_type_name' => $this->string('link_type_name'),'inward_id' => $this->integer('inward_id'),'outward_id' => $this->integer('outward_id'),- 'notes' => $this->string('notes'),+ 'notes' => $this->nlString('notes'),];}diff --git a/app/Api/V1/Requests/TransactionStoreRequest.php b/app/Api/V1/Requests/TransactionStoreRequest.phpindex 97dc307a20..69954ff8f1 100644--- a/app/Api/V1/Requests/TransactionStoreRequest.php+++ b/app/Api/V1/Requests/TransactionStoreRequest.php@@ -242,7 +242,7 @@ class TransactionStoreRequest extends Request// some other interesting properties'reconciled' => $this->convertBoolean((string)$object['reconciled']),- 'notes' => $this->stringFromValue($object['notes']),+ 'notes' => $this->nlStringFromValue($object['notes']),'tags' => $this->arrayFromValue($object['tags']),// all custom fields:diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.phpindex c95ff77255..627e3b1e3c 100644--- a/app/Http/Requests/Request.php+++ b/app/Http/Requests/Request.php@@ -237,6 +237,21 @@ class Request extends FormRequest}+ /**+ * Return string value, but keep newlines, or NULL if empty.+ *+ * @param string $field+ *+ * @return string+ */+ public function nullableNlString(string $field): string+ {+ if (!$this->has($field)) {+ return null;+ }+ return app('steam')->nlCleanString((string)($this->get($field) ?? ''));+ }+/*** Parse and clean a string.*