Adding a page to list all non executed sentences
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user