Master data review: spec updates and C1/C2/M3-M6 fixes
This commit is contained in:
@@ -71,10 +71,17 @@ class DepartmentManager
|
||||
public function delete(int $id): void
|
||||
{
|
||||
$sth = $this->pdo->prepare(
|
||||
"SELECT COUNT(*) FROM td_gl_item WHERE department_id = :id LIMIT 1"
|
||||
);
|
||||
$sth->execute([':id' => $id]);
|
||||
if ((int)$sth->fetchColumn() > 0) {
|
||||
throw new Exception('Cannot deactivate — this department has GL journal entries.');
|
||||
}
|
||||
|
||||
$this->pdo->prepare(
|
||||
"UPDATE md_department SET status = 0
|
||||
WHERE company_id = :cid AND id = :id"
|
||||
);
|
||||
$sth->execute([':cid' => $this->companyId, ':id' => $id]);
|
||||
)->execute([':cid' => $this->companyId, ':id' => $id]);
|
||||
}
|
||||
|
||||
public function getStats(): array
|
||||
|
||||
Reference in New Issue
Block a user