-
Notifications
You must be signed in to change notification settings - Fork 719
納品書PDFの店舗情報出力項目を管理者が表示/非表示できるようにする #6953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ttokoro20240902
wants to merge
3
commits into
4.4
Choose a base branch
from
feature/issue-6197-order-pdf-shop-info-visibility
base: 4.4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /* | ||
| * This file is part of EC-CUBE | ||
| * | ||
| * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. | ||
| * | ||
| * http://www.ec-cube.co.jp/ | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| */ | ||
|
|
||
| namespace DoctrineMigrations; | ||
|
|
||
| use Doctrine\DBAL\Schema\Schema; | ||
| use Doctrine\Migrations\AbstractMigration; | ||
|
|
||
| /** | ||
| * dtb_base_info へ納品書PDFの店舗情報出力項目トグルを追加する (#6197). | ||
| * | ||
| * 納品書PDFに出力する店舗情報(店名・住所・会社名・営業時間・メッセージ等)の表示/非表示を | ||
| * 管理者が基本設定画面で切り替えられるようにするための boolean 列。 | ||
| * 既定は「現状出力している項目+インボイス要件の会社名」を ON、新規項目は OFF とし、 | ||
| * 既存インストールのアップグレード時も従来の納品書の見た目を極力維持する。 | ||
| * 列単位で存在を確認する冪等実装(schema:update と重複しても二重追加しない)。 | ||
| */ | ||
| final class Version20260722120000 extends AbstractMigration | ||
| { | ||
| public const NAME = 'dtb_base_info'; | ||
|
|
||
| /** | ||
| * 追加する列名 => 既定値(true/false). | ||
| * | ||
| * @var array<string, bool> | ||
| */ | ||
| private const COLUMNS = [ | ||
| 'order_pdf_visible_shop_name' => true, | ||
| 'order_pdf_visible_shop_kana' => false, | ||
| 'order_pdf_visible_shop_name_eng' => false, | ||
| 'order_pdf_visible_address' => true, | ||
| 'order_pdf_visible_company_name' => true, | ||
| 'order_pdf_visible_company_kana' => false, | ||
| 'order_pdf_visible_phone_number' => true, | ||
| 'order_pdf_visible_business_hour' => false, | ||
| 'order_pdf_visible_email' => true, | ||
| 'order_pdf_visible_invoice_number' => true, | ||
| 'order_pdf_visible_message' => false, | ||
| ]; | ||
|
|
||
| public function up(Schema $schema): void | ||
| { | ||
| if (!$schema->hasTable(self::NAME)) { | ||
| return; | ||
| } | ||
|
|
||
| $table = $schema->getTable(self::NAME); | ||
| foreach (self::COLUMNS as $column => $default) { | ||
| if ($table->hasColumn($column)) { | ||
| continue; | ||
| } | ||
|
|
||
| $defaultSql = $default ? 'true' : 'false'; | ||
| $this->addSql(sprintf('ALTER TABLE dtb_base_info ADD %s BOOLEAN NOT NULL DEFAULT %s', $column, $defaultSql)); | ||
| } | ||
| } | ||
|
|
||
| public function down(Schema $schema): void | ||
| { | ||
| if (!$schema->hasTable(self::NAME)) { | ||
| return; | ||
| } | ||
|
|
||
| $table = $schema->getTable(self::NAME); | ||
| foreach (array_keys(self::COLUMNS) as $column) { | ||
| if (!$table->hasColumn($column)) { | ||
| continue; | ||
| } | ||
|
|
||
| $this->addSql(sprintf('ALTER TABLE dtb_base_info DROP COLUMN %s', $column)); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1325,4 +1325,60 @@ test.describe('Admin Basic Info (EA07)', () => { | |
| await page.waitForLoadState('load'); | ||
| await expect(page.locator('#page_admin_setting_shop_calendar .alert-success')).toContainText('保存しました'); | ||
| }); | ||
|
|
||
| test('basicinfo_納品書PDFの出力項目トグル - EA0701-UC01-T15', async ({ page }) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 テスト ID 結合試験項目書とのひも付けが崩れるので、既存の最大が T17 であることを踏まえて T18 以降を割り当ててください。 |
||
| // dev 環境の Symfony デバッグツールバーが送信ボタンを覆うことがあるため非表示にする | ||
| // (CI の test 環境ではツールバー自体が存在しないため no-op)。 | ||
| const hideDebugToolbar = () => page.addStyleTag({ | ||
| content: '.sf-toolbar, .sf-minitoolbar { display: none !important; }', | ||
| }).catch(() => { /* ツールバーが無い環境では無視 */ }); | ||
|
|
||
| await page.goto(`/${adminRoute}/setting/shop`); | ||
| await page.waitForLoadState('load'); | ||
| await ensureAdminLoggedIn(page); | ||
| if (!page.url().includes('/setting/shop')) { | ||
| await page.goto(`/${adminRoute}/setting/shop`); | ||
| await page.waitForLoadState('load'); | ||
| } | ||
| await hideDebugToolbar(); | ||
|
|
||
| // 納品書PDFの出力項目セクションが表示されていること | ||
| const hourCheckbox = page.locator('#shop_master_order_pdf_visible_business_hour'); | ||
| const invoiceCheckbox = page.locator('#shop_master_order_pdf_visible_invoice_number'); | ||
| await expect(hourCheckbox).toBeAttached(); | ||
| await expect(invoiceCheckbox).toBeAttached(); | ||
|
|
||
| // 初期状態を退避(テスト後に非破壊で復元する) | ||
| const hourInitial = await hourCheckbox.isChecked(); | ||
| const invoiceInitial = await invoiceCheckbox.isChecked(); | ||
|
|
||
| // 既定 OFF の「店舗営業時間」と既定 ON の「インボイス登録番号」を反転して保存 | ||
| await page.locator('label[for="shop_master_order_pdf_visible_business_hour"]').click(); | ||
| await page.locator('label[for="shop_master_order_pdf_visible_invoice_number"]').click(); | ||
| await page.waitForTimeout(500); | ||
| await page.locator('button.ladda-button[type="submit"]').click(); | ||
| await page.waitForLoadState('load'); | ||
| await expect(page.locator('.alert-success')).toContainText('保存しました', { timeout: 30_000 }); | ||
|
|
||
| // 再表示して反転後の状態が保持されていること | ||
| await page.goto(`/${adminRoute}/setting/shop`); | ||
| await page.waitForLoadState('load'); | ||
| await hideDebugToolbar(); | ||
| await expect(page.locator('#shop_master_order_pdf_visible_business_hour')).toBeChecked({ checked: !hourInitial }); | ||
| await expect(page.locator('#shop_master_order_pdf_visible_invoice_number')).toBeChecked({ checked: !invoiceInitial }); | ||
|
|
||
| // 初期状態へ復元して保存 | ||
| const hourNow = await page.locator('#shop_master_order_pdf_visible_business_hour').isChecked(); | ||
| if (hourNow !== hourInitial) { | ||
| await page.locator('label[for="shop_master_order_pdf_visible_business_hour"]').click(); | ||
| } | ||
| const invoiceNow = await page.locator('#shop_master_order_pdf_visible_invoice_number').isChecked(); | ||
| if (invoiceNow !== invoiceInitial) { | ||
| await page.locator('label[for="shop_master_order_pdf_visible_invoice_number"]').click(); | ||
| } | ||
| await page.waitForTimeout(500); | ||
| await page.locator('button.ladda-button[type="submit"]').click(); | ||
| await page.waitForLoadState('load'); | ||
| await expect(page.locator('.alert-success')).toContainText('保存しました', { timeout: 30_000 }); | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.