Arhived fixed
This commit is contained in:
parent
932bbdc294
commit
6108028942
|
|
@ -1343,7 +1343,7 @@ public function archiveContract(ClientCase $clientCase, string $uuid, Request $r
|
|||
$overall = [];
|
||||
$hadAnyEffect = false;
|
||||
foreach ($settings as $setting) {
|
||||
dd($setting);
|
||||
|
||||
$res = $executor->executeSetting($setting, $context, optional($request->user())->id);
|
||||
foreach ($res as $table => $count) {
|
||||
$overall[$table] = ($overall[$table] ?? 0) + $count;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,16 @@ protected function applyContextFilters(Builder $query, ?array $context, string $
|
|||
if ($value === null) {
|
||||
continue;
|
||||
}
|
||||
if (Schema::hasColumn($query->from, $key)) {
|
||||
// Special precedence: for contracts table, if contract_id provided, always scope to that single id
|
||||
if ($table === 'contracts' && $key === 'contract_id') {
|
||||
$query->where('id', $value);
|
||||
$applied = true;
|
||||
|
||||
// Do NOT allow broader filters (e.g., client_case_id) to widen the scope afterward
|
||||
continue;
|
||||
}
|
||||
if (Schema::hasColumn($query->from, $key) && ! ($table === 'contracts' && $key === 'client_case_id' && isset($context['contract_id']))) {
|
||||
// For contracts table: if contract_id present, skip client_case_id to avoid capturing all contracts of the case
|
||||
$query->where($key, $value);
|
||||
$applied = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user