mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
This prevents constraint errors when the specified category has already been set.
This commit is contained in:
parent
664fde2344
commit
99d14e8cbe
@ -55,7 +55,7 @@ class SetBudget implements ActionInterface
|
||||
)->first();
|
||||
if (!is_null($budget)) {
|
||||
Log::debug('Will set budget "' . $search . '" (#' . $budget->id . ') on journal #' . $this->journal->id . '.');
|
||||
$this->journal->budgets()->save($budget);
|
||||
$this->journal->budgets()->sync([$budget->id]);
|
||||
} else {
|
||||
Log::debug('Could not find budget "' . $search . '". Failed.');
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class SetCategory implements ActionInterface
|
||||
$name = $this->action->action_value;
|
||||
$category = Category::firstOrCreateEncrypted(['name' => $name, 'user_id' => Auth::user()->id]);
|
||||
Log::debug('Will set category "' . $name . '" (#' . $category->id . ') on journal #' . $this->journal->id . '.');
|
||||
$this->journal->categories()->save($category);
|
||||
$this->journal->categories()->sync([$category->id]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -23,10 +23,28 @@
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">app/</directory>
|
||||
<directory suffix=".php">app/Http</directory>
|
||||
</whitelist>
|
||||
<blacklist>
|
||||
<directory>vendor/</directory>
|
||||
<directory>app/Console</directory>
|
||||
<directory>app/Events</directory>
|
||||
<directory>app/Exceptions</directory>
|
||||
<directory>app/Generator</directory>
|
||||
<directory>app/Handlers</directory>
|
||||
<directory>app/Helpers</directory>
|
||||
|
||||
<directory>app/Jobs</directory>
|
||||
<directory>app/Listeners</directory>
|
||||
<directory>app/Models</directory>
|
||||
<directory>app/Policies</directory>
|
||||
<directory>app/Providers</directory>
|
||||
<directory>app/Repositories</directory>
|
||||
<directory>app/Rules</directory>
|
||||
<directory>app/Sql</directory>
|
||||
<directory>app/Support</directory>
|
||||
<directory>app/Validation</directory>
|
||||
|
||||
<!-- and other directories, -->
|
||||
</blacklist>
|
||||
</filter>
|
||||
|
Loading…
Reference in New Issue
Block a user