mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-27 11:20:39 -06:00
Remove encrypted amounts because it stinks.
This commit is contained in:
parent
80d845fdf2
commit
5c55fa5fbb
@ -117,6 +117,7 @@ class Account extends Model
|
||||
/**
|
||||
*
|
||||
* @param $fieldName
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string|null
|
||||
@ -153,16 +154,17 @@ class Account extends Model
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return float|int
|
||||
*/
|
||||
public function getVirtualBalanceAttribute($value)
|
||||
{
|
||||
if (is_null($this->virtual_balance_encrypted)) {
|
||||
return $value;
|
||||
}
|
||||
$value = intval(Crypt::decrypt($this->virtual_balance_encrypted));
|
||||
$value = $value / 100;
|
||||
// if (is_null($this->virtual_balance_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = intval(Crypt::decrypt($this->virtual_balance_encrypted));
|
||||
// $value = $value / 100;
|
||||
|
||||
return $value;
|
||||
}
|
||||
@ -222,14 +224,15 @@ class Account extends Model
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setVirtualBalanceAttribute($value)
|
||||
{
|
||||
// save in cents:
|
||||
$value = intval($value * 100);
|
||||
$this->attributes['virtual_balance_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['virtual_balance'] = ($value / 100);
|
||||
// $value = intval($value * 100);
|
||||
// $this->attributes['virtual_balance_encrypted'] = Crypt::encrypt($value);
|
||||
// $this->attributes['virtual_balance'] = ($value / 100);
|
||||
$this->attributes['virtual_balance'] = round($value, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,11 +24,11 @@ class Bill extends Model
|
||||
*/
|
||||
public function getAmountMaxAttribute($value)
|
||||
{
|
||||
if (is_null($this->amount_max_encrypted)) {
|
||||
return $value;
|
||||
}
|
||||
$value = intval(Crypt::decrypt($this->amount_max_encrypted));
|
||||
$value = $value / 100;
|
||||
// if (is_null($this->amount_max_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = intval(Crypt::decrypt($this->amount_max_encrypted));
|
||||
// $value = $value / 100;
|
||||
|
||||
return $value;
|
||||
}
|
||||
@ -41,11 +41,11 @@ class Bill extends Model
|
||||
*/
|
||||
public function getAmountMinAttribute($value)
|
||||
{
|
||||
if (is_null($this->amount_min_encrypted)) {
|
||||
return $value;
|
||||
}
|
||||
$value = intval(Crypt::decrypt($this->amount_min_encrypted));
|
||||
$value = $value / 100;
|
||||
// if (is_null($this->amount_min_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = intval(Crypt::decrypt($this->amount_min_encrypted));
|
||||
// $value = $value / 100;
|
||||
|
||||
return $value;
|
||||
}
|
||||
@ -94,9 +94,10 @@ class Bill extends Model
|
||||
public function setAmountMaxAttribute($value)
|
||||
{
|
||||
// save in cents:
|
||||
$value = intval($value * 100);
|
||||
$this->attributes['amount_max_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['amount_max'] = ($value / 100);
|
||||
// $value = intval($value * 100);
|
||||
// $this->attributes['amount_max_encrypted'] = Crypt::encrypt($value);
|
||||
// $this->attributes['amount_max'] = ($value / 100);
|
||||
$this->attributes['amount_max'] = round($value, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,9 +106,10 @@ class Bill extends Model
|
||||
public function setAmountMinAttribute($value)
|
||||
{
|
||||
// save in cents:
|
||||
$value = intval($value * 100);
|
||||
$this->attributes['amount_min_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['amount_min'] = ($value / 100);
|
||||
// $value = intval($value * 100);
|
||||
// $this->attributes['amount_min_encrypted'] = Crypt::encrypt($value);
|
||||
// $this->attributes['amount_min'] = ($value / 100);
|
||||
$this->attributes['amount_min'] = round($value, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace FireflyIII\Models;
|
||||
|
||||
use Crypt;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
@ -29,11 +28,11 @@ class BudgetLimit extends Model
|
||||
*/
|
||||
public function getAmountAttribute($value)
|
||||
{
|
||||
if (is_null($this->amount_encrypted)) {
|
||||
return $value;
|
||||
}
|
||||
$value = intval(Crypt::decrypt($this->amount_encrypted));
|
||||
$value = $value / 100;
|
||||
// if (is_null($this->amount_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = intval(Crypt::decrypt($this->amount_encrypted));
|
||||
// $value = $value / 100;
|
||||
|
||||
return $value;
|
||||
}
|
||||
@ -60,9 +59,10 @@ class BudgetLimit extends Model
|
||||
public function setAmountAttribute($value)
|
||||
{
|
||||
// save in cents:
|
||||
$value = intval($value * 100);
|
||||
$this->attributes['amount_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['amount'] = ($value / 100);
|
||||
// $value = intval($value * 100);
|
||||
// $this->attributes['amount_encrypted'] = Crypt::encrypt($value);
|
||||
// $this->attributes['amount'] = ($value / 100);
|
||||
$this->attributes['amount'] = round($value, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace FireflyIII\Models;
|
||||
|
||||
use Crypt;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
@ -30,11 +29,11 @@ class LimitRepetition extends Model
|
||||
*/
|
||||
public function getAmountAttribute($value)
|
||||
{
|
||||
if (is_null($this->amount_encrypted)) {
|
||||
return $value;
|
||||
}
|
||||
$value = intval(Crypt::decrypt($this->amount_encrypted));
|
||||
$value = $value / 100;
|
||||
// if (is_null($this->amount_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = intval(Crypt::decrypt($this->amount_encrypted));
|
||||
// $value = $value / 100;
|
||||
|
||||
return $value;
|
||||
}
|
||||
@ -53,9 +52,10 @@ class LimitRepetition extends Model
|
||||
public function setAmountAttribute($value)
|
||||
{
|
||||
// save in cents:
|
||||
$value = intval($value * 100);
|
||||
$this->attributes['amount_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['amount'] = ($value / 100);
|
||||
// $value = intval($value * 100);
|
||||
// $this->attributes['amount_encrypted'] = Crypt::encrypt($value);
|
||||
// $this->attributes['amount'] = ($value / 100);
|
||||
$this->attributes['amount'] = round($value, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -96,11 +96,11 @@ class PiggyBank extends Model
|
||||
*/
|
||||
public function getTargetamountAttribute($value)
|
||||
{
|
||||
if (is_null($this->targetamount_encrypted)) {
|
||||
return $value;
|
||||
}
|
||||
$value = intval(Crypt::decrypt($this->targetamount_encrypted));
|
||||
$value = $value / 100;
|
||||
// if (is_null($this->targetamount_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = intval(Crypt::decrypt($this->targetamount_encrypted));
|
||||
// $value = $value / 100;
|
||||
|
||||
return $value;
|
||||
}
|
||||
@ -137,8 +137,9 @@ class PiggyBank extends Model
|
||||
public function setTargetamountAttribute($value)
|
||||
{
|
||||
// save in cents:
|
||||
$value = intval($value * 100);
|
||||
$this->attributes['targetamount_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['targetamount'] = ($value / 100);
|
||||
// $value = intval($value * 100);
|
||||
// $this->attributes['targetamount_encrypted'] = Crypt::encrypt($value);
|
||||
// $this->attributes['targetamount'] = ($value / 100);
|
||||
$this->attributes['targetamount'] = round($value, 2);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace FireflyIII\Models;
|
||||
|
||||
use Crypt;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
@ -23,11 +22,11 @@ class PiggyBankEvent extends Model
|
||||
*/
|
||||
public function getAmountAttribute($value)
|
||||
{
|
||||
if (is_null($this->amount_encrypted)) {
|
||||
return $value;
|
||||
}
|
||||
$value = intval(Crypt::decrypt($this->amount_encrypted));
|
||||
$value = $value / 100;
|
||||
// if (is_null($this->amount_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = intval(Crypt::decrypt($this->amount_encrypted));
|
||||
// $value = $value / 100;
|
||||
|
||||
return $value;
|
||||
}
|
||||
@ -54,9 +53,10 @@ class PiggyBankEvent extends Model
|
||||
public function setAmountAttribute($value)
|
||||
{
|
||||
// save in cents:
|
||||
$value = intval($value * 100);
|
||||
$this->attributes['amount_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['amount'] = ($value / 100);
|
||||
// $value = intval($value * 100);
|
||||
// $this->attributes['amount_encrypted'] = Crypt::encrypt($value);
|
||||
// $this->attributes['amount'] = ($value / 100);
|
||||
$this->attributes['amount'] = round($value, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
@ -17,6 +16,22 @@ class PiggyBankRepetition extends Model
|
||||
protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount'];
|
||||
protected $hidden = ['currentamount_encrypted'];
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return float|int
|
||||
*/
|
||||
public function getCurrentamountAttribute($value)
|
||||
{
|
||||
// if (is_null($this->currentamount_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = intval(Crypt::decrypt($this->currentamount_encrypted));
|
||||
// $value = $value / 100;
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@ -68,31 +83,16 @@ class PiggyBankRepetition extends Model
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return float|int
|
||||
*/
|
||||
public function getCurrentamountAttribute($value)
|
||||
{
|
||||
if (is_null($this->currentamount_encrypted)) {
|
||||
return $value;
|
||||
}
|
||||
$value = intval(Crypt::decrypt($this->currentamount_encrypted));
|
||||
$value = $value / 100;
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*/
|
||||
public function setCurrentamountAttribute($value)
|
||||
{
|
||||
// save in cents:
|
||||
$value = intval($value * 100);
|
||||
$this->attributes['currentamount_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['currentamount'] = ($value / 100);
|
||||
// $value = intval($value * 100);
|
||||
// $this->attributes['currentamount_encrypted'] = Crypt::encrypt($value);
|
||||
// $this->attributes['currentamount'] = ($value / 100);
|
||||
$this->attributes['currentamount'] = round($value, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
@ -43,12 +42,12 @@ class Transaction extends Model
|
||||
public function getAmountAttribute($value)
|
||||
{
|
||||
return $value;
|
||||
// if (is_null($this->amount_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = floatval(Crypt::decrypt($this->amount_encrypted));
|
||||
//
|
||||
// return $value;
|
||||
// if (is_null($this->amount_encrypted)) {
|
||||
// return $value;
|
||||
// }
|
||||
// $value = floatval(Crypt::decrypt($this->amount_encrypted));
|
||||
//
|
||||
// return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,8 +86,8 @@ class Transaction extends Model
|
||||
public function setAmountAttribute($value)
|
||||
{
|
||||
// save in cents:
|
||||
$this->attributes['amount_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['amount'] = $value;
|
||||
// $this->attributes['amount_encrypted'] = Crypt::encrypt($value);
|
||||
$this->attributes['amount'] = round($value, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user