From c9bc40030838973f5e3959b4afdf833c4f06e194 Mon Sep 17 00:00:00 2001 From: Lukas Halbritter Date: Thu, 20 Sep 2018 16:48:16 +0200 Subject: [PATCH] Added isPaid() method to PersonTarget model. --- app/PersonTarget.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/PersonTarget.php b/app/PersonTarget.php index 940047e..cc0722b 100644 --- a/app/PersonTarget.php +++ b/app/PersonTarget.php @@ -9,7 +9,7 @@ class PersonTarget extends Model { /************************************************************************** - * PAYMENT STATES * + * COLLECTIONS FILTERED BY PAYMENT STATES * **************************************************************************/ /* @@ -203,4 +203,13 @@ class PersonTarget extends Model public function difference() { return $this->signedAmount() - $this->actualsSum(); } + + /* + * Return true, if the target is paid and therefore closed. + * + * @return boolean + */ + public function isPaid() { + return $this->difference() == 0; + } }