領収書宛名入力画面、領収書PDF修正

This commit is contained in:
Yuka Higashide 2026-01-26 17:21:10 +09:00
parent d37de8c61c
commit 22283f957b
3 changed files with 32 additions and 20 deletions

View File

@ -179,24 +179,23 @@ class ReceiptController extends Controller
->where('management_id', $management_id)
->first();
$krgmStoragePath = config('app.krgm_storage_path');
$linkPath = public_path('other-storage');
if (!file_exists($krgmStoragePath)) {
\Log::error('KRGM path not found: ' . $krgmStoragePath);
abort(404, '画像パスが見つかりません。');
}
if (!file_exists($linkPath)) {
$result = symlink($krgmStoragePath, $linkPath);
\Log::info('Symlink result: ' . ($result ? 'success' : 'failed'));
if (!$result) {
\Log::error('Symlink failed');
abort(500, 'リンク作成失敗');
// 社員側の社判画像を参照するため、シンボリックリンクを作成 (company_image_path が存在する場合のみ)
if (!empty($inv_setting->company_image_path)) {
$krgmStoragePath = config('app.krgm_storage_path');
$linkPath = public_path('other-storage');
if (!file_exists($krgmStoragePath)) {
\Log::error("[ERROR] " . now()->format('Y-m-d H:i:s') . " 社判画像保存フォルダ発見不可: " . $krgmStoragePath . ", user_id=" . $user_id . ", contract_id=" . $contract_id);
throw new \Exception();
}
if (!file_exists($linkPath)) {
$result = symlink($krgmStoragePath, $linkPath);
\Log::info("[INFO] " . now()->format('Y-m-d H:i:s') . " 社判画像参照リンク作成。結果: " . ($result ? '成功' : '失敗') . ", user_id=" . $user_id . ", contract_id=" . $contract_id);
if (!$result) {
\Log::error("[ERROR] " . now()->format('Y-m-d H:i:s') . " 社判画像参照リンク作成失敗。user_id=" . $user_id . ", contract_id=" . $contract_id);
throw new \Exception();
}
}
}
if (!file_exists($linkPath)) {
symlink($krgmStoragePath, $linkPath);
}
// ダウンロード回数をカウントアップ
DB::table('inv_publish')
@ -244,7 +243,7 @@ class ReceiptController extends Controller
->header('Content-Disposition', 'attachment; filename="receipt_' . $contract_id . '.pdf"');
} catch (\Exception $e) {
// PDF生成エラーを記録
\Log::error("[ERROR] " . now()->format('Y-m-d H:i:s') . " PDFダウンロードエラー: user_id=" . $user_id . ", contract_id=" . $contract_id . ", error=" . $e->getMessage());
\Log::error("[ERROR] " . now()->format('Y-m-d H:i:s') . " 領収書PDFダウンロードエラー: user_id=" . $user_id . ", contract_id=" . $contract_id . ", error=" . $e->getMessage());
abort(500, '領収書ダウンロードに失敗しました。');
}
}

View File

@ -123,6 +123,16 @@ return [
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
/*
|--------------------------------------------------------------------------
| KRGM Storage Path
|--------------------------------------------------------------------------
|
| This value is the path to the KRGM storage directory for accessing images
| from the other project via symbolic link.
|
*/
'krgm_storage_path' => env('KRGM_STORAGE_PATH'),
];

View File

@ -122,9 +122,12 @@
<td>
<div class="company">
<span style="font-size:20px; font-weight:bold;">{{ $inv_setting->t_name ?? '' }}</span><br>
{{ $inv_setting->zipcode ?? '' }}<br>
{{ $inv_setting->adrs ?? '' }}<br>
適格事業者番号:{{ $inv_setting->t_number ?? '' }}<br>
{{ $inv_setting->zipcode }}<br>
{{ $inv_setting->adrs }}
@if(!empty($inv_setting->bldg))
{{ $inv_setting->bldg }}
@endif
<br>適格事業者番号:{{ $inv_setting->t_number ?? '' }}<br>
@if(!empty($inv_setting->tel_num))
TEL:{{ $inv_setting->tel_num}}<br>
@endif