diff --git a/src/Eccube/Command/LoadDataFixturesEccubeCommand.php b/src/Eccube/Command/LoadDataFixturesEccubeCommand.php index a6f778f7b42..6da59b19638 100644 --- a/src/Eccube/Command/LoadDataFixturesEccubeCommand.php +++ b/src/Eccube/Command/LoadDataFixturesEccubeCommand.php @@ -125,6 +125,15 @@ protected function execute(InputInterface $input, OutputInterface $output) ); } + $logoPath = '/assets/pdf/logo.png'; + if (!file_exists($this->container->getParameter('eccube_html_dir').'/user_data'.$logoPath)) { + $file = new Filesystem(); + $file->copy( + $this->container->getParameter('eccube_html_admin_dir').$logoPath, + $this->container->getParameter('eccube_html_dir').'/user_data'.$logoPath + ); + } + $output->writeln(sprintf(' > %s', 'Finished Successful!')); } } diff --git a/src/Eccube/Controller/Install/InstallController.php b/src/Eccube/Controller/Install/InstallController.php index e5414b29848..ba8ea2390eb 100644 --- a/src/Eccube/Controller/Install/InstallController.php +++ b/src/Eccube/Controller/Install/InstallController.php @@ -230,6 +230,15 @@ public function step2() ); } + $logoPath = '/assets/pdf/logo.png'; + if (!file_exists($this->getParameter('eccube_html_dir').'/user_data'.$logoPath)) { + $file = new Filesystem(); + $file->copy( + $this->getParameter('eccube_html_admin_dir').$logoPath, + $this->getParameter('eccube_html_dir').'/user_data'.$logoPath + ); + } + return [ 'noWritePermissions' => $noWritePermissions, ]; diff --git a/src/Eccube/Service/OrderPdfService.php b/src/Eccube/Service/OrderPdfService.php index 83bb1de5233..77fb8771b8b 100644 --- a/src/Eccube/Service/OrderPdfService.php +++ b/src/Eccube/Service/OrderPdfService.php @@ -306,8 +306,13 @@ protected function renderShopData() $this->lfText(125, 75, $text, 8); // Email } - // ロゴ画像(app配下のロゴ画像を優先して読み込む) - $logoFile = $this->eccubeConfig->get('eccube_html_admin_dir').'/assets/pdf/logo.png'; + // user_dataにlogo.pngが配置されている場合は優先的に読み込む + $logoFile = $this->eccubeConfig->get('eccube_html_dir').'/user_data/assets/pdf/logo.png'; + + if (!file_exists($logoFile)) { + $logoFile = $this->eccubeConfig->get('eccube_html_admin_dir').'/assets/pdf/logo.png'; + } + $this->Image($logoFile, 124, 46, 40); } diff --git a/tests/Eccube/Tests/Web/Install/InstallControllerTest.php b/tests/Eccube/Tests/Web/Install/InstallControllerTest.php index 457856bde83..0650c847277 100644 --- a/tests/Eccube/Tests/Web/Install/InstallControllerTest.php +++ b/tests/Eccube/Tests/Web/Install/InstallControllerTest.php @@ -112,6 +112,7 @@ public function testStep2() $this->assertArrayHasKey('noWritePermissions', $this->actual); $this->assertFileExists($this->container->getParameter('eccube_html_dir').'/user_data/assets/img/common/favicon.ico'); + $this->assertFileExists($this->container->getParameter('eccube_html_dir').'/user_data/assets/pdf/logo.png'); } public function testStep3()