mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Fix issues where data-variable was not initialized properly.
This commit is contained in:
@@ -199,7 +199,7 @@ class UpgradeDatabase extends Command
|
||||
[
|
||||
'rule_id' => $rule->id,
|
||||
'trigger_type' => 'amount_more',
|
||||
'trigger_value' => round($bill->amount_min, $currency->decimal_places),
|
||||
'trigger_value' => round((float)$bill->amount_min, $currency->decimal_places),
|
||||
'active' => 1,
|
||||
'stop_processing' => 0,
|
||||
'order' => 4,
|
||||
@@ -211,7 +211,7 @@ class UpgradeDatabase extends Command
|
||||
[
|
||||
'rule_id' => $rule->id,
|
||||
'trigger_type' => 'amount_exactly',
|
||||
'trigger_value' => round($bill->amount_min, $currency->decimal_places),
|
||||
'trigger_value' => round((float)$bill->amount_min, $currency->decimal_places),
|
||||
'active' => 1,
|
||||
'stop_processing' => 0,
|
||||
'order' => 3,
|
||||
|
@@ -166,8 +166,8 @@ class BillController extends Controller
|
||||
}
|
||||
|
||||
$currency = app('amount')->getDefaultCurrency();
|
||||
$bill->amount_min = round($bill->amount_min, $currency->decimal_places);
|
||||
$bill->amount_max = round($bill->amount_max, $currency->decimal_places);
|
||||
$bill->amount_min = round((float)$bill->amount_min, $currency->decimal_places);
|
||||
$bill->amount_max = round((float)$bill->amount_max, $currency->decimal_places);
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
|
||||
// code to handle active-checkboxes
|
||||
|
@@ -281,7 +281,7 @@ class ReportController extends Controller
|
||||
try {
|
||||
$attributes['endDate'] = Carbon::createFromFormat('Ymd', $attributes['endDate']);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Log::debug('Not important error message: %s', $e->getMessage());
|
||||
Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
|
||||
$date = Carbon::create()->startOfMonth();
|
||||
$attributes['endDate'] = $date;
|
||||
}
|
||||
|
@@ -223,8 +223,8 @@ class CreateController extends Controller
|
||||
$triggers = ['currency_is', 'amount_more', 'amount_less', 'description_contains'];
|
||||
$values = [
|
||||
$bill->transactionCurrency()->first()->name,
|
||||
round($bill->amount_min, 12),
|
||||
round($bill->amount_max, 12),
|
||||
round((float)$bill->amount_min, 12),
|
||||
round((float)$bill->amount_max, 12),
|
||||
$bill->name,
|
||||
];
|
||||
foreach ($triggers as $index => $trigger) {
|
||||
|
@@ -270,6 +270,7 @@ class JournalFormRequest extends Request
|
||||
*/
|
||||
private function validateDeposit(Validator $validator): void
|
||||
{
|
||||
$data = $validator->getData();
|
||||
$selectedCurrency = (int)($data['amount_currency_id_amount'] ?? 0);
|
||||
$accountCurrency = (int)($data['destination_account_currency'] ?? 0);
|
||||
$nativeAmount = (string)($data['native_amount'] ?? '');
|
||||
@@ -289,6 +290,7 @@ class JournalFormRequest extends Request
|
||||
*/
|
||||
private function validateTransfer(Validator $validator): void
|
||||
{
|
||||
$data = $validator->getData();
|
||||
$sourceCurrency = (int)($data['source_account_currency'] ?? 0);
|
||||
$destinationCurrency = (int)($data['destination_account_currency'] ?? 0);
|
||||
$sourceAmount = (string)($data['source_amount'] ?? '');
|
||||
|
@@ -24,8 +24,8 @@ namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use FireflyIII\Support\Models\TransactionJournalTrait;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
@@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Collection;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
|
||||
/**
|
||||
@@ -58,6 +57,8 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
* @property int order
|
||||
* @property int budget_id
|
||||
* @property string period_marker
|
||||
* @property Carbon $date
|
||||
* @property string $transaction_type_type
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
@@ -94,6 +95,27 @@ class TransactionJournal extends Model
|
||||
/** @var array */
|
||||
protected $hidden = ['encrypted'];
|
||||
|
||||
/**
|
||||
* @param Builder $query
|
||||
* @param string $table
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isJoined(Builder $query, string $table): bool
|
||||
{
|
||||
$joins = $query->getQuery()->joins;
|
||||
if (null === $joins) {
|
||||
return false;
|
||||
}
|
||||
foreach ($joins as $join) {
|
||||
if ($join->table === $table) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
@@ -266,27 +288,6 @@ class TransactionJournal extends Model
|
||||
return $query->where('transaction_journals.date', '<=', $date->format('Y-m-d 00:00:00'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder $query
|
||||
* @param string $table
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isJoined(Builder $query, string $table): bool
|
||||
{
|
||||
$joins = $query->getQuery()->joins;
|
||||
if (null === $joins) {
|
||||
return false;
|
||||
}
|
||||
foreach ($joins as $join) {
|
||||
if ($join->table === $table) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
|
@@ -229,8 +229,8 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
|
||||
*/
|
||||
public function storeLink(array $information, TransactionJournal $inward, TransactionJournal $outward): TransactionJournalLink
|
||||
{
|
||||
$linkType = $this->find((int)($information['link_type_id'] ?? 0));
|
||||
if (null === $linkType->id) {
|
||||
$linkType = $this->findNull((int)($information['link_type_id'] ?? 0));
|
||||
if (null === $linkType) {
|
||||
throw new FireflyException(sprintf('Link type #%d cannot be resolved to an actual link type', $information['link_type_id'] ?? 0));
|
||||
}
|
||||
|
||||
|
@@ -267,7 +267,6 @@ class TagRepository implements TagRepositoryInterface
|
||||
public function tagCloud(?int $year): array
|
||||
{
|
||||
// Some vars
|
||||
$return = [];
|
||||
$tags = $this->getTagsInYear($year);
|
||||
$max = $this->getMaxAmount($tags);
|
||||
$min = $this->getMinAmount($tags);
|
||||
|
@@ -28,8 +28,8 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class Steam.
|
||||
*
|
||||
* @method string balance(Account $account, Carbon $date)
|
||||
* @method string balanceIgnoreVirtual(Account $account, Carbon $date)
|
||||
* @method array balanceInRange(Account $account, Carbon $start, Carbon $end)
|
||||
@@ -42,6 +42,7 @@ use Illuminate\Support\Facades\Facade;
|
||||
* @method tryDecrypt($value)
|
||||
* @method string positive(string $amount)
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Steam extends Facade
|
||||
{
|
||||
|
@@ -150,6 +150,7 @@ class General extends Twig_Extension
|
||||
if (null === $account) {
|
||||
return 'NULL';
|
||||
}
|
||||
/** @var Carbon $date */
|
||||
$date = session('end', Carbon::now()->endOfMonth());
|
||||
|
||||
return app('steam')->balance($account, $date);
|
||||
|
@@ -174,8 +174,8 @@ class BillTransformer extends TransformerAbstract
|
||||
'name' => $bill->name,
|
||||
'currency_id' => $bill->transaction_currency_id,
|
||||
'currency_code' => $bill->transactionCurrency->code,
|
||||
'amount_min' => round($bill->amount_min, 2),
|
||||
'amount_max' => round($bill->amount_max, 2),
|
||||
'amount_min' => round((float)$bill->amount_min, 2),
|
||||
'amount_max' => round((float)$bill->amount_max, 2),
|
||||
'date' => $bill->date->format('Y-m-d'),
|
||||
'repeat_freq' => $bill->repeat_freq,
|
||||
'skip' => (int)$bill->skip,
|
||||
|
Reference in New Issue
Block a user