fix: [journal] 계좌 출처 전표 일반전표에서 수정 허용

- 카드/세금계산서 출처 → 잠금 유지 (원본에서 수정)
- 계좌(bank_transaction) 출처 → 일반전표에서 수정 허용
- 프론트엔드 UI + 백엔드 update 메서드 동시 수정
This commit is contained in:
김보곤
2026-03-04 12:42:35 +09:00
parent fc63ea80ff
commit d77b9615b3
2 changed files with 15 additions and 7 deletions

View File

@@ -239,11 +239,13 @@ public function update(Request $request, int $id): JsonResponse
$tenantId = session('selected_tenant_id', 1);
$entry = JournalEntry::forTenant($tenantId)->findOrFail($id);
// 출처 연결 전표 수정 불가 (카드/은행/홈택스 등)
if ($entry->source_type && $entry->source_type !== 'manual') {
// 출처 연결 전표 수정 제한 (카드/홈택스는 원본에서 수정, 계좌는 허용)
if ($entry->source_type && ! in_array($entry->source_type, ['manual', 'bank_transaction'])) {
$sourceLabel = $entry->source_type === 'ecard_transaction' ? '카드사용내역' : '홈택스 매출/매입';
return response()->json([
'success' => false,
'message' => '카드/은행/홈택스 출처 전표는 직접 수정할 수 없습니다. 원본 거래에서 분개를 수정해주세요.',
'message' => "이 전표는 {$sourceLabel}에서 수정해주세요.",
], 403);
}

View File

@@ -1330,10 +1330,15 @@ className={`px-2.5 py-1 text-xs rounded-full font-medium transition-colors ${vie
className="px-2.5 py-1 text-xs font-medium bg-amber-100 text-amber-700 rounded-full hover:bg-amber-200 transition-colors">
분개
</button>
) : (row.type === 'bank' || row.type === 'card') && row.hasJournal ? (
<span className="p-1 text-stone-300" title="카드/은행 출처 전표는 원본에서 수정하세요">
) : row.type === 'card' && row.hasJournal ? (
<span className="p-1 text-stone-300" title="카드 출처 전표는 카드사용내역에서 수정하세요">
<Lock className="w-4 h-4" />
</span>
) : row.type === 'bank' && row.hasJournal ? (
<button onClick={() => onEdit(row.journalId)}
className="p-1 text-stone-300 group-hover:text-emerald-500 hover:bg-emerald-50 rounded transition-colors" title="수정">
<Edit3 className="w-4 h-4" />
</button>
) : row.type === 'manual' && row.hasJournal ? (
<button onClick={() => onEdit(row.journalId)}
className="p-1 text-stone-300 group-hover:text-emerald-500 hover:bg-emerald-50 rounded transition-colors" title="수정">
@@ -2618,8 +2623,9 @@ function App() {
try {
const res = await fetch(`/finance/journal-entries/${entryId}`);
const data = await res.json();
if (data.success && data.data.source_type && data.data.source_type !== 'manual') {
notify('카드/은행/홈택스 출처 전표는 원본에서 수정해주세요.', 'warning');
if (data.success && data.data.source_type && !['manual', 'bank_transaction'].includes(data.data.source_type)) {
const sourceLabel = data.data.source_type === 'ecard_transaction' ? '카드사용내역' : '홈택스 매출/매입';
notify(`이 전표는 ${sourceLabel}에서 수정해주세요.`, 'warning');
return;
}
} catch (e) {