Skip to content

Commit dbc2536

Browse files
set default retention period to 1 year
1 parent f3d2573 commit dbc2536

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

ProcessMaker/Console/Commands/EvaluateCaseRetention.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function handle()
3030
$this->info('Evaluating and deleting cases past their retention period');
3131

3232
// Process all processes when retention policy is enabled
33-
// Processes without retention_period will default to 6 months
33+
// Processes without retention_period will default to 1_year
3434
Process::chunkById(100, function ($processes) {
3535
foreach ($processes as $process) {
3636
dispatch(new EvaluateProcessRetentionJob($process->id));

ProcessMaker/Jobs/EvaluateProcessRetentionJob.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ public function __construct(public int $processId)
2727
public function handle(): void
2828
{
2929
// Only run if case retention policy is enabled
30-
// Use getenv() to read directly from environment (works better in tests)
31-
$enabled = getenv('CASE_RETENTION_POLICY_ENABLED');
32-
if ($enabled === false || $enabled === 'false' || $enabled === '0' || $enabled === '') {
30+
$enabled = config('app.case_retention_policy_enabled');
31+
if (!$enabled) {
3332
return;
3433
}
3534

@@ -40,14 +39,14 @@ public function handle(): void
4039
return;
4140
}
4241

43-
// Default to 6 months if retention_period is not set
44-
$retentionPeriod = $process->properties['retention_period'] ?? '6_months';
42+
// Default to 1_year if retention_period is not set
43+
$retentionPeriod = $process->properties['retention_period'] ?? '1_year';
4544
$retentionMonths = match ($retentionPeriod) {
4645
'6_months' => 6,
4746
'1_year' => 12,
4847
'3_years' => 36,
4948
'5_years' => 60,
50-
default => 6, // Default to 6 months
49+
default => 12, // Default to 1_year
5150
};
5251

5352
// Default retention_updated_at to now if not set

0 commit comments

Comments
 (0)