desktop修正
This commit is contained in:
19
backend/app/core/fiscal_lock.py
Normal file
19
backend/app/core/fiscal_lock.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from fastapi import HTTPException
|
||||
from app.core.database import get_connection
|
||||
|
||||
def check_fiscal_year_unlocked(journal_date):
|
||||
fiscal_year = journal_date.year
|
||||
|
||||
with get_connection() as conn, conn.cursor() as cur:
|
||||
cur.execute("""
|
||||
SELECT is_locked
|
||||
FROM fiscal_year_locks
|
||||
WHERE fiscal_year = %s
|
||||
""", (fiscal_year,))
|
||||
row = cur.fetchone()
|
||||
|
||||
if row and row["is_locked"]:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="この会計年度は既に確定されているため、仕訳を変更できません。"
|
||||
)
|
||||
Reference in New Issue
Block a user