mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup should trigger scan.
This commit is contained in:
parent
333c348117
commit
742c84269b
@ -107,17 +107,16 @@ class RecurrenceController extends Controller
|
|||||||
$repetition->weekend = (int)$request->get('weekend');
|
$repetition->weekend = (int)$request->get('weekend');
|
||||||
$actualEnd = clone $end;
|
$actualEnd = clone $end;
|
||||||
|
|
||||||
if('until_date' === $endsAt) {
|
if ('until_date' === $endsAt) {
|
||||||
$actualEnd = $endDate ?? clone $end;
|
$actualEnd = $endDate ?? clone $end;
|
||||||
$occurrences = $this->recurring->getOccurrencesInRange($repetition, $actualStart, $actualEnd);
|
$occurrences = $this->recurring->getOccurrencesInRange($repetition, $actualStart, $actualEnd);
|
||||||
}
|
}
|
||||||
if('times' === $endsAt) {
|
if ('times' === $endsAt) {
|
||||||
$occurrences = $this->recurring->getXOccurrences($repetition, $actualStart, $repetitions);
|
$occurrences = $this->recurring->getXOccurrences($repetition, $actualStart, $repetitions);
|
||||||
}
|
}
|
||||||
if('times' !== $endsAt && 'until_date' !== $endsAt) {
|
if ('times' !== $endsAt && 'until_date' !== $endsAt) {
|
||||||
// 'forever'
|
// 'forever'
|
||||||
$occurrences = $this->recurring->getOccurrencesInRange($repetition, $actualStart, $actualEnd);
|
$occurrences = $this->recurring->getOccurrencesInRange($repetition, $actualStart, $actualEnd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var Carbon $current */
|
/** @var Carbon $current */
|
||||||
|
@ -315,22 +315,22 @@ class RecurrenceFormRequest extends FormRequest
|
|||||||
// TODO either use 'withdrawal' or the strtolower() variant, not both.
|
// TODO either use 'withdrawal' or the strtolower() variant, not both.
|
||||||
$type = $this->convertString('transaction_type');
|
$type = $this->convertString('transaction_type');
|
||||||
$throwError = true;
|
$throwError = true;
|
||||||
if('withdrawal' === $type) {
|
if ('withdrawal' === $type) {
|
||||||
$throwError = false;
|
$throwError = false;
|
||||||
$sourceId = (int)$data['source_id'];
|
$sourceId = (int)$data['source_id'];
|
||||||
$destinationId = (int)$data['withdrawal_destination_id'];
|
$destinationId = (int)$data['withdrawal_destination_id'];
|
||||||
}
|
}
|
||||||
if('deposit' === $type) {
|
if ('deposit' === $type) {
|
||||||
$throwError = false;
|
$throwError = false;
|
||||||
$sourceId = (int)$data['deposit_source_id'];
|
$sourceId = (int)$data['deposit_source_id'];
|
||||||
$destinationId = (int)$data['destination_id'];
|
$destinationId = (int)$data['destination_id'];
|
||||||
}
|
}
|
||||||
if('transfer' === $type) {
|
if ('transfer' === $type) {
|
||||||
$throwError = false;
|
$throwError = false;
|
||||||
$sourceId = (int)$data['source_id'];
|
$sourceId = (int)$data['source_id'];
|
||||||
$destinationId = (int)$data['destination_id'];
|
$destinationId = (int)$data['destination_id'];
|
||||||
}
|
}
|
||||||
if(true === $throwError) {
|
if (true === $throwError) {
|
||||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
|
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (null !== $dbNote) {
|
if (null !== $dbNote) {
|
||||||
$dbNote->delete();
|
$dbNote->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,6 @@ class BillDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(Bill $bill): void
|
public function destroy(Bill $bill): void
|
||||||
{
|
{
|
||||||
$bill->delete();
|
$bill->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class BudgetDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(Budget $budget): void
|
public function destroy(Budget $budget): void
|
||||||
{
|
{
|
||||||
$budget->delete();
|
$budget->delete();
|
||||||
|
|
||||||
// also delete auto budget:
|
// also delete auto budget:
|
||||||
foreach ($budget->autoBudgets()->get() as $autoBudget) {
|
foreach ($budget->autoBudgets()->get() as $autoBudget) {
|
||||||
|
@ -39,7 +39,7 @@ class CategoryDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(Category $category): void
|
public function destroy(Category $category): void
|
||||||
{
|
{
|
||||||
$category->delete();
|
$category->delete();
|
||||||
|
|
||||||
// also delete all relations between categories and transaction journals:
|
// also delete all relations between categories and transaction journals:
|
||||||
DB::table('category_transaction_journal')->where('category_id', (int)$category->id)->delete();
|
DB::table('category_transaction_journal')->where('category_id', (int)$category->id)->delete();
|
||||||
|
@ -38,6 +38,6 @@ class CurrencyDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(TransactionCurrency $currency): void
|
public function destroy(TransactionCurrency $currency): void
|
||||||
{
|
{
|
||||||
$currency->delete();
|
$currency->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ trait RecurringTransactionTrait
|
|||||||
if ('' === $note) {
|
if ('' === $note) {
|
||||||
$dbNote = $recurrence->notes()->first();
|
$dbNote = $recurrence->notes()->first();
|
||||||
if (null !== $dbNote) {
|
if (null !== $dbNote) {
|
||||||
$dbNote->delete();
|
$dbNote->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -373,8 +373,7 @@ trait RecurringTransactionTrait
|
|||||||
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
||||||
$transaction->recurrenceTransactionMeta()->delete();
|
$transaction->recurrenceTransactionMeta()->delete();
|
||||||
|
|
||||||
$transaction->delete();
|
$transaction->delete();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,9 +153,7 @@ class CategoryUpdateService
|
|||||||
if ('' === $note) {
|
if ('' === $note) {
|
||||||
$dbNote = $category->notes()->first();
|
$dbNote = $category->notes()->first();
|
||||||
if (null !== $dbNote) {
|
if (null !== $dbNote) {
|
||||||
|
$dbNote->delete();
|
||||||
$dbNote->delete();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -132,7 +132,7 @@ class RecurrenceUpdateService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (null !== $dbNote && '' === $text) {
|
if (null !== $dbNote && '' === $text) {
|
||||||
$dbNote->delete();
|
$dbNote->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class FireflyConfig
|
|||||||
if (Cache::has($fullName)) {
|
if (Cache::has($fullName)) {
|
||||||
Cache::forget($fullName);
|
Cache::forget($fullName);
|
||||||
}
|
}
|
||||||
Configuration::where('name', $name)->forceDelete();
|
Configuration::where('name', $name)->forceDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,7 +113,7 @@ class Preferences
|
|||||||
if (Cache::has($fullName)) {
|
if (Cache::has($fullName)) {
|
||||||
Cache::forget($fullName);
|
Cache::forget($fullName);
|
||||||
}
|
}
|
||||||
Preference::where('user_id', auth()->user()->id)->where('name', $name)->delete();
|
Preference::where('user_id', auth()->user()->id)->where('name', $name)->delete();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ class Preferences
|
|||||||
$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
|
$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
|
||||||
|
|
||||||
if (null !== $pref && null === $value) {
|
if (null !== $pref && null === $value) {
|
||||||
$pref->delete();
|
$pref->delete();
|
||||||
|
|
||||||
return new Preference();
|
return new Preference();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user