Adding a page to list all non executed sentences

This commit is contained in:
2023-07-08 02:47:23 +02:00
parent 545f7facaf
commit 2e6c6a8f97
10 changed files with 381 additions and 3 deletions

View File

@@ -19,4 +19,22 @@ class CriminalRepository extends DocumentRepositoriesExtension
parent::__construct($registry, Criminal::class);
$this->fields = ['amountMoney', 'amountTime', 'content']; //with title, list fields we can search in
}
public function limitUnsettled(string $type) {
if ($type == Criminal::TYPE_FINE) {
$column = 'd.amountMoney';
} elseif ($type == Criminal::TYPE_JAIL) {
$column = 'd.amountTime';
} elseif ($type == Criminal::TYPE_COMMUNITY_WORK) {
$column = 'd.amountCommunityWork';
} else {
throw new \OutOfRangeException($type);
}
$settledColumn = $column . 'Settled';
$this->qb->where("$column <> $settledColumn OR ($column IS NOT NULL AND $settledColumn IS NULL)");
return $this;
}
}