mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Remove encrypted amounts because it stinks.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user