Fix #7845 among other things

This commit is contained in:
James Cole
2023-08-12 17:43:24 +02:00
parent 4c90f66578
commit 1b9d8dd3c3
38 changed files with 120 additions and 123 deletions

View File

@@ -78,7 +78,8 @@ class UpdateController extends Controller
public function update(UpdateRequest $request, TransactionGroup $transactionGroup): JsonResponse
{
Log::debug('Now in update routine for transaction group!');
$data = $request->getAll();
$data = $request->getAll();
$transactionGroup = $this->groupRepository->update($transactionGroup, $data);
$manager = $this->getManager();

View File

@@ -100,7 +100,6 @@ class AccountController extends Controller
$frontPage->data = $defaultSet;
$frontPage->save();
}
/** @var Account $account */
foreach ($accounts as $account) {
$currency = $this->repository->getAccountCurrency($account);

View File

@@ -85,7 +85,7 @@ class CategoryController extends Controller
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->withAccountInformation();
$collector->setXorAccounts($accounts)->withCategoryInformation();
$collector->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::RECONCILIATION]);
$collector->setTypes([TransactionType::WITHDRAWAL, TransactionType::RECONCILIATION]);
$journals = $collector->getExtractedJournals();
/** @var array $journal */

View File

@@ -59,15 +59,18 @@ class TransactionController extends Controller
->setPage($page)
->setTypes($request->getTransactionTypes());
$start = $request->getStartDate();
$end = $request->getEndDate();
$start = $this->parameters->get('start');
$end = $this->parameters->get('end');
if (null !== $start) {
$collector->setStart($start);
}
if (null !== $end) {
$collector->setEnd($start);
$collector->setEnd($end);
}
// $collector->dumpQuery();
// exit;
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(
sprintf(

View File

@@ -143,9 +143,8 @@ class JournalUpdateService
Log::debug(sprintf('Now in %s', __METHOD__));
Log::debug(sprintf('Now in JournalUpdateService for journal #%d.', $this->transactionJournal->id));
if ($this->removeReconciliation()) {
$this->data['reconciled'] = false;
}
$this->data['reconciled'] = array_key_exists('reconciled', $this->data) ? $this->data['reconciled'] : false;
// can we update account data using the new type?
if ($this->hasValidAccounts()) {
@@ -182,21 +181,6 @@ class JournalUpdateService
$this->transactionJournal->refresh();
}
/**
* @return bool
*/
private function removeReconciliation(): bool
{
if (count($this->data) > 1) {
return true;
}
if (1 === count($this->data) && true === array_key_exists('transaction_journal_id', $this->data)) {
return true;
}
return false;
}
/**
* @return bool
*/
@@ -514,9 +498,9 @@ class JournalUpdateService
{
$type = $this->transactionJournal->transactionType->type;
if ((
array_key_exists('bill_id', $this->data)
array_key_exists('bill_id', $this->data)
|| array_key_exists('bill_name', $this->data)
)
)
&& TransactionType::WITHDRAWAL === $type
) {
$billId = (int)($this->data['bill_id'] ?? 0);