Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Removed dead code.
James Colecddc12353903
diff --git a/app/models/BudgetLimit.php b/app/models/BudgetLimit.phpindex 41887e41ed..93f4665d5d 100644--- a/app/models/BudgetLimit.php+++ b/app/models/BudgetLimit.php@@ -31,72 +31,6 @@ class BudgetLimit extends Eloquentreturn $this->belongsTo('Budget');}- /**- * TODO see if this method is still used.- * Create a new repetition for this limit, starting on- * the given date.- *- * @param Carbon $start- */- public function createRepetition(Carbon $start)- {-- $end = clone $start;- // go to end:- switch ($this->repeat_freq) {- case 'daily':- $end->addDay();- break;- case 'weekly':- $end->addWeek();- break;- case 'monthly':- $end->addMonth();- break;- case 'quarterly':- $end->addMonths(3);- break;- case 'half-year':- $end->addMonths(6);- break;- case 'yearly':- $end->addYear();- break;- }- $end->subDay();- $count = $this->limitrepetitions()->where('startdate', $start->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'))->count();-- if ($count == 0) {-- $repetition = new \LimitRepetition();- $repetition->startdate = $start;- $repetition->enddate = $end;- $repetition->amount = $this->amount;- $repetition->budgetLimit()->associate($this);-- try {- $repetition->save();- \Log::debug('Created new repetition with id #' . $repetition->id);- } catch (QueryException $e) {- // do nothing-- \Log::error('Trying to save new Limitrepetition failed!');- \Log::error($e->getMessage());- }- if (isset($repetition->id)) {- \Event::fire('limits.repetition', [$repetition]); // not used, I guess?- }- } else {- if ($count == 1) {- // update this one:- $repetition = $this->limitrepetitions()->where('startdate', $start->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'))->first();- $repetition->amount = $this->amount;- $repetition->save();-- }- }- }-/*** @return \Illuminate\Database\Eloquent\Relations\HasMany*/diff --git a/app/models/LimitRepetition.php b/app/models/LimitRepetition.phpindex e36348f849..9faa85968d 100644--- a/app/models/LimitRepetition.php+++ b/app/models/LimitRepetition.php@@ -33,17 +33,6 @@ class LimitRepetition extends Eloquentreturn ['created_at', 'updated_at', 'startdate', 'enddate'];}- /**- * TODO see if this scope is still used.- *- * How much money is left in this?- */- public function leftInRepetition()- {- return floatval($this->amount - $this->spentInRepetition());-- }-/*** TODO remove this method in favour of something in the FireflyIII libraries.*@@ -64,43 +53,4 @@ class LimitRepetition extends Eloquentreturn floatval($sum);}-- /**- * TODO remove this method in favour of something in the FireflyIII libraries.- *- * Returns a string used to sort this particular repetition- * based on the date and period it falls into. Ie. the limit- * repeats monthly and the start date is 12 dec 2012, this will- * return 2012-12.- */- public function periodOrder()- {- if (is_null($this->repeat_freq)) {- $this->repeat_freq = $this->limit->repeat_freq;- }- switch ($this->repeat_freq) {- default:- throw new FireflyException('No date formats for frequency "' . $this->repeat_freq . '"!');- break;- case 'daily':- return $this->startdate->format('Ymd') . '-5';- break;- case 'weekly':- return $this->startdate->format('Ymd') . '-4';- break;- case 'monthly':- return $this->startdate->format('Ymd') . '-3';- break;- case 'quarterly':- return $this->startdate->format('Ymd') . '-2';- break;- case 'half-year':- return $this->startdate->format('Ymd') . '-1';- break;- case 'yearly':- return $this->startdate->format('Ymd') . '-0';- break;- }- }--}\ No newline at end of file+}\ No newline at end of filediff --git a/app/models/Piggybank.php b/app/models/Piggybank.phpindex 57f497fdac..1af7da7e37 100644--- a/app/models/Piggybank.php+++ b/app/models/Piggybank.php@@ -56,26 +56,6 @@ class PiggyBank extends Eloquentreturn 0;}- /**- * TODO remove this method in favour of something in the FireflyIII libraries.- *- * @param Carbon $start- * @param Carbon $target- *- * @return PiggyBankRepetition- */- public function createRepetition(Carbon $start = null, Carbon $target = null)- {- $rep = new \PiggyBankRepetition;- $rep->piggyBank()->associate($this);- $rep->startdate = $start;- $rep->targetdate = $target;- $rep->currentamount = 0;- $rep->save();-- return $rep;- }-/*** TODO remove this method in favour of something in the FireflyIII libraries.*@@ -168,42 +148,6 @@ class PiggyBank extends Eloquentreturn $this->morphMany('Reminder', 'remindersable');}- /**- * TODO remove this method in favour of something in the FireflyIII libraries.- *- * Same but for specific date.- *- * @param Carbon $date- *- * @returns \PiggyBankRepetition- */- public function repetitionForDate(Carbon $date)- {- $query = $this->piggyBankRepetitions()->where(- function ($q) use ($date) {-- $q->where(- function ($q) use ($date) {- $q->whereNull('startdate');- $q->orWhere('startdate', '<=', $date->format('Y-m-d'));- }- )->where(- function ($q) use ($date) {- $q->whereNull('targetdate');- $q->orWhere('targetdate', '>=', $date->format('Y-m-d'));- }- );- }- )->orWhere(- function ($q) use ($date) {- $q->where('startdate', '>=', $date->format('Y-m-d'));- $q->where('targetdate', '>=', $date->format('Y-m-d'));- }- )->orderBy('startdate', 'ASC');- $result = $query->first();-- return $result;- }/*** @return \Illuminate\Database\Eloquent\Relations\HasManydiff --git a/app/models/PiggybankRepetition.php b/app/models/PiggybankRepetition.phpindex 1b9ca645b0..87caff4452 100644--- a/app/models/PiggybankRepetition.php+++ b/app/models/PiggybankRepetition.php@@ -24,23 +24,6 @@ class PiggyBankRepetition extends Eloquentreturn ['created_at', 'updated_at', 'targetdate', 'startdate'];}- /**- * TODO remove this method in favour of something in the FireflyIII libraries.- *- * @return float|int- */- public function pct()- {- $total = $this->piggyBank->targetamount;- $saved = $this->currentamount;- if ($total == 0) {- return 0;- }- $pct = round(($saved / $total) * 100, 1);-- return $pct;- }-/*** @return \Illuminate\Database\Eloquent\Relations\BelongsTo*/