Skip to content

Commit 80f3017

Browse files
authored
Merge pull request #464 from dbarzin/dev
fix cleanup
2 parents 8002daf + 7140d09 commit 80f3017

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/Models/Control.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ public static function cleanup(string $startDate, bool $dryRun)
160160
$documentCount++;
161161
}
162162

163-
// Supprimer les liens dans control_measure
164-
DB::table('control_measure')->where('control_id', $control->id)->delete();
165-
166-
// Supprimer les plans d'action
167-
DB::table('actions')->where('control_id', $control->id)->delete();
168-
169163
// Supprimer le contrôle lui-même
170164
if (! $dryRun) {
165+
// Supprimer les liens dans control_measure
166+
DB::table('control_measure')->where('control_id', $control->id)->delete();
167+
168+
// Supprimer les plans d'action
169+
DB::table('actions')->where('control_id', $control->id)->delete();
170+
171171
// Remove next_id link
172172
Control::where('next_id', $control->id)->update(['next_id' => null]);
173173
// delete control

0 commit comments

Comments
 (0)