Skip to content

Commit

Permalink
Merge pull request #4216 from kazumiiiiiiiiiii/move-pdf-logo
Browse files Browse the repository at this point in the history
PDFのロゴ画像をファイル管理から変更できる機能を追加
  • Loading branch information
Chihiro Adachi committed Jul 9, 2019
2 parents 0323829 + b28f6a4 commit e8f2952
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/Eccube/Command/LoadDataFixturesEccubeCommand.php
Expand Up @@ -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(' <comment>></comment> <info>%s</info>', 'Finished Successful!')); $output->writeln(sprintf(' <comment>></comment> <info>%s</info>', 'Finished Successful!'));
} }
} }
9 changes: 9 additions & 0 deletions src/Eccube/Controller/Install/InstallController.php
Expand Up @@ -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 [ return [
'noWritePermissions' => $noWritePermissions, 'noWritePermissions' => $noWritePermissions,
]; ];
Expand Down
9 changes: 7 additions & 2 deletions src/Eccube/Service/OrderPdfService.php
Expand Up @@ -306,8 +306,13 @@ protected function renderShopData()
$this->lfText(125, 75, $text, 8); // Email $this->lfText(125, 75, $text, 8); // Email
} }


// ロゴ画像(app配下のロゴ画像を優先して読み込む) // user_dataにlogo.pngが配置されている場合は優先的に読み込む
$logoFile = $this->eccubeConfig->get('eccube_html_admin_dir').'/assets/pdf/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); $this->Image($logoFile, 124, 46, 40);
} }


Expand Down
1 change: 1 addition & 0 deletions tests/Eccube/Tests/Web/Install/InstallControllerTest.php
Expand Up @@ -112,6 +112,7 @@ public function testStep2()
$this->assertArrayHasKey('noWritePermissions', $this->actual); $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/img/common/favicon.ico');
$this->assertFileExists($this->container->getParameter('eccube_html_dir').'/user_data/assets/pdf/logo.png');
} }


public function testStep3() public function testStep3()
Expand Down

0 comments on commit e8f2952

Please sign in to comment.