[FIX] 捐贈發票排除列印並補上不可列印提示
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) <noreply@anthropic.com>
This commit is contained in:
parent
e81756833c
commit
02e4e99308
@ -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'));
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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": "扉が開きました",
|
||||
|
||||
@ -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": "機門已開啟",
|
||||
|
||||
@ -292,6 +292,8 @@
|
||||
'void' => ['label' => __('Void'), 'color' => 'slate'],
|
||||
];
|
||||
$invBadge = $invStatusMap[$invStatus] ?? ['label' => $invStatus, 'color' => 'slate'];
|
||||
// 捐贈發票依法無紙本、不可列印(綠界 InvoicePrint 會回查無資料)
|
||||
$invPrintable = empty($order->invoice->love_code);
|
||||
@endphp
|
||||
<div class="relative flex flex-col sm:flex-row sm:items-center justify-between gap-6">
|
||||
<div class="space-y-3">
|
||||
@ -309,12 +311,16 @@
|
||||
|
||||
@if($invStatus === 'issued')
|
||||
<div class="flex items-center gap-3">
|
||||
@if($invPrintable)
|
||||
<form method="POST" action="{{ route('admin.sales.invoices.print', $order->invoice) }}" target="_blank">
|
||||
@csrf
|
||||
<button type="submit" class="flex-1 sm:flex-none px-6 py-3 rounded-xl bg-white dark:bg-slate-800 text-slate-600 dark:text-slate-300 font-bold text-xs border border-slate-200 dark:border-slate-700 hover:bg-indigo-500 hover:text-white hover:border-indigo-500 transition-all duration-300 shadow-sm">
|
||||
{{ __('Print Invoice') }}
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<span class="text-[11px] font-bold text-slate-400 dark:text-slate-500 px-2">{{ __('Donation invoices cannot be printed') }}</span>
|
||||
@endif
|
||||
<form method="POST" action="{{ route('admin.sales.invoices.void', $order->invoice) }}"
|
||||
onsubmit="return confirm('{{ __('Void this invoice?') }}')">
|
||||
@csrf
|
||||
|
||||
Loading…
Reference in New Issue
Block a user