From 02e4e993084ad775da72a364aa6b33998420c9b3 Mon Sep 17 00:00:00 2001 From: sky121113 Date: Tue, 16 Jun 2026 11:41:17 +0800 Subject: [PATCH] =?UTF-8?q?[FIX]=20=E6=8D=90=E8=B4=88=E7=99=BC=E7=A5=A8?= =?UTF-8?q?=E6=8E=92=E9=99=A4=E5=88=97=E5=8D=B0=E4=B8=A6=E8=A3=9C=E4=B8=8A?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E5=88=97=E5=8D=B0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 訂單詳情發票區塊:新增可列印判斷(love_code 為空才可列印),捐贈發票不顯示列印按鈕,改顯示「捐贈發票無法列印」提示。 2. SalesController::printInvoice() 加入後端守衛,捐贈發票直接回傳明確錯誤訊息,防偽造 POST 呼叫綠界 InvoicePrint 取得查無資料。 3. 三語系新增 key「Donation invoices cannot be printed」,完成 zh_TW/en/ja 對齊排序。 Co-Authored-By: Claude Opus 4.8 (1M context) --- app/Http/Controllers/Admin/SalesController.php | 4 ++++ lang/en.json | 1 + lang/ja.json | 1 + lang/zh_TW.json | 1 + .../views/admin/sales/partials/order-detail-panel.blade.php | 6 ++++++ 5 files changed, 13 insertions(+) diff --git a/app/Http/Controllers/Admin/SalesController.php b/app/Http/Controllers/Admin/SalesController.php index 8b68215..9337f97 100644 --- a/app/Http/Controllers/Admin/SalesController.php +++ b/app/Http/Controllers/Admin/SalesController.php @@ -1155,6 +1155,10 @@ class SalesController extends Controller if ($invoice->status !== Invoice::STATUS_ISSUED || empty($invoice->invoice_no)) { return back()->with('error', __('Only issued invoices can be printed')); } + // 捐贈發票依法無紙本、不可列印(綠界 InvoicePrint 會回查無資料) + if (!empty($invoice->love_code)) { + return back()->with('error', __('Donation invoices cannot be printed')); + } $machine = $invoice->machine; if (!$machine || !$ecpay->configForMachine($machine)) { return back()->with('error', __('This machine has no ECPay invoice settings')); diff --git a/lang/en.json b/lang/en.json index af9f119..375c531 100644 --- a/lang/en.json +++ b/lang/en.json @@ -587,6 +587,7 @@ "Displayed below Logo on the left (defaults to customer name).": "Displayed below Logo on the left (defaults to customer name).", "Displayed below main title on the left.": "Displayed below main title on the left.", "Displaying": "Displaying", + "Donation invoices cannot be printed": "Donation invoices cannot be printed", "Done": "Done", "Door Closed": "Door Closed", "Door Opened": "Door Opened", diff --git a/lang/ja.json b/lang/ja.json index 2b11923..bdb48e8 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -587,6 +587,7 @@ "Displayed below Logo on the left (defaults to customer name).": "左側のロゴの下に表示されるメインタイトル(未設定の場合はデフォルトで顧客名になります)。", "Displayed below main title on the left.": "左側のメインタイトルの下に表示されるサブタイトル。", "Displaying": "表示中", + "Donation invoices cannot be printed": "寄付の領収書は印刷できません", "Done": "完了", "Door Closed": "扉が閉まりました", "Door Opened": "扉が開きました", diff --git a/lang/zh_TW.json b/lang/zh_TW.json index 711715e..42a4430 100644 --- a/lang/zh_TW.json +++ b/lang/zh_TW.json @@ -587,6 +587,7 @@ "Displayed below Logo on the left (defaults to customer name).": "顯示於左側 Logo 下方的主標題(未設定則預設帶入客戶名稱)。", "Displayed below main title on the left.": "顯示於左側主標題下方的副標題/英文名稱。", "Displaying": "目前顯示", + "Donation invoices cannot be printed": "捐贈發票無法列印", "Done": "已完成", "Door Closed": "機門已關閉", "Door Opened": "機門已開啟", diff --git a/resources/views/admin/sales/partials/order-detail-panel.blade.php b/resources/views/admin/sales/partials/order-detail-panel.blade.php index 085fb7b..aa3f391 100644 --- a/resources/views/admin/sales/partials/order-detail-panel.blade.php +++ b/resources/views/admin/sales/partials/order-detail-panel.blade.php @@ -292,6 +292,8 @@ 'void' => ['label' => __('Void'), 'color' => 'slate'], ]; $invBadge = $invStatusMap[$invStatus] ?? ['label' => $invStatus, 'color' => 'slate']; + // 捐贈發票依法無紙本、不可列印(綠界 InvoicePrint 會回查無資料) + $invPrintable = empty($order->invoice->love_code); @endphp
@@ -309,12 +311,16 @@ @if($invStatus === 'issued')
+ @if($invPrintable)
@csrf
+ @else + {{ __('Donation invoices cannot be printed') }} + @endif
@csrf