Fix annoying index error.

This commit is contained in:
James Cole
2023-11-14 02:46:04 +01:00
parent 76954f4a13
commit 67ef185a72
3 changed files with 16 additions and 19 deletions

View File

@@ -226,16 +226,16 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v3.38.0", "version": "v3.38.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "7e6070026e76aa09d77a47519625c86593fb8e31" "reference": "d872cdd543797ade030aaa307c0a4954a712e081"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7e6070026e76aa09d77a47519625c86593fb8e31", "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d872cdd543797ade030aaa307c0a4954a712e081",
"reference": "7e6070026e76aa09d77a47519625c86593fb8e31", "reference": "d872cdd543797ade030aaa307c0a4954a712e081",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -307,7 +307,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.38.0" "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.38.2"
}, },
"funding": [ "funding": [
{ {
@@ -315,7 +315,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-11-07T08:44:54+00:00" "time": "2023-11-14T00:19:22+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",

View File

@@ -218,7 +218,7 @@ class CreateController extends Controller
]; ];
// restore actions and triggers from old input: // restore actions and triggers from old input:
if (null !== $request->old()) { if (null !== $request->old() && count($request->old()) > 0) {
$oldTriggers = $this->getPreviousTriggers($request); $oldTriggers = $this->getPreviousTriggers($request);
$oldActions = $this->getPreviousActions($request); $oldActions = $this->getPreviousActions($request);
} }

View File

@@ -166,7 +166,7 @@ trait ModelInformation
*/ */
private function getTriggersForJournal(TransactionJournal $journal): array private function getTriggersForJournal(TransactionJournal $journal): array
{ {
// See reference nr. 40 // TODO duplicated code.
$operators = config('search.operators'); $operators = config('search.operators');
$triggers = []; $triggers = [];
foreach ($operators as $key => $operator) { foreach ($operators as $key => $operator) {
@@ -250,16 +250,14 @@ trait ModelInformation
foreach ($journalTriggers as $ii => $trigger) { foreach ($journalTriggers as $ii => $trigger) {
try { try {
$string = view( $renderInfo = [
'rules.partials.trigger',
[
'oldTrigger' => $trigger, 'oldTrigger' => $trigger,
'oldValue' => $values[$index], 'oldValue' => $values[$ii],
'oldChecked' => false, 'oldChecked' => false,
'count' => $ii + 1, 'count' => $ii + 1,
'triggers' => $triggers, 'triggers' => $triggers,
] ];
)->render(); $string = view('rules.partials.trigger', $renderInfo)->render();
} catch (Throwable $e) { } catch (Throwable $e) {
app('log')->debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage())); app('log')->debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
app('log')->debug($e->getTraceAsString()); app('log')->debug($e->getTraceAsString());
@@ -269,7 +267,6 @@ trait ModelInformation
$result[] = $string; $result[] = $string;
} }
} }
return $result; return $result;
} }
} }