Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions app/DoctrineMigrations/Version20260722120000.php
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));
}
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
56 changes: 56 additions & 0 deletions e2e/tests/admin-basicinfo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 テスト ID EA0701-UC01-T15 が重複しています。同ファイル 974 行目の basicinfo_税設定_商品別税率 - EA0701-UC01-T15 が既に使用中です。

結合試験項目書とのひも付けが崩れるので、既存の最大が 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 });
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
});
});
234 changes: 234 additions & 0 deletions src/Eccube/Entity/BaseInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,42 @@ class BaseInfo extends AbstractEntity
#[ORM\Column(name: 'ucp_catalog_requires_auth', type: Types::BOOLEAN, options: ['default' => false])]
private bool $ucp_catalog_requires_auth = false;

// 納品書PDFの店舗情報の出力項目トグル(#6197)。
// 既定は「現状出力している項目+インボイス要件の会社名」を ON、新規項目は OFF とし、
// アップグレード時も既存の納品書の見た目を極力維持する。
#[ORM\Column(name: 'order_pdf_visible_shop_name', type: Types::BOOLEAN, options: ['default' => true])]
private bool $order_pdf_visible_shop_name = true;

#[ORM\Column(name: 'order_pdf_visible_shop_kana', type: Types::BOOLEAN, options: ['default' => false])]
private bool $order_pdf_visible_shop_kana = false;

#[ORM\Column(name: 'order_pdf_visible_shop_name_eng', type: Types::BOOLEAN, options: ['default' => false])]
private bool $order_pdf_visible_shop_name_eng = false;

#[ORM\Column(name: 'order_pdf_visible_address', type: Types::BOOLEAN, options: ['default' => true])]
private bool $order_pdf_visible_address = true;

#[ORM\Column(name: 'order_pdf_visible_company_name', type: Types::BOOLEAN, options: ['default' => true])]
private bool $order_pdf_visible_company_name = true;

#[ORM\Column(name: 'order_pdf_visible_company_kana', type: Types::BOOLEAN, options: ['default' => false])]
private bool $order_pdf_visible_company_kana = false;

#[ORM\Column(name: 'order_pdf_visible_phone_number', type: Types::BOOLEAN, options: ['default' => true])]
private bool $order_pdf_visible_phone_number = true;

#[ORM\Column(name: 'order_pdf_visible_business_hour', type: Types::BOOLEAN, options: ['default' => false])]
private bool $order_pdf_visible_business_hour = false;

#[ORM\Column(name: 'order_pdf_visible_email', type: Types::BOOLEAN, options: ['default' => true])]
private bool $order_pdf_visible_email = true;

#[ORM\Column(name: 'order_pdf_visible_invoice_number', type: Types::BOOLEAN, options: ['default' => true])]
private bool $order_pdf_visible_invoice_number = true;

#[ORM\Column(name: 'order_pdf_visible_message', type: Types::BOOLEAN, options: ['default' => false])]
private bool $order_pdf_visible_message = false;

/**
* Get id.
*
Expand Down Expand Up @@ -937,4 +973,202 @@ public function isUcpCatalogRequiresAuth(): bool
{
return $this->ucp_catalog_requires_auth;
}

/**
* Set orderPdfVisibleShopName.
*/
public function setOrderPdfVisibleShopName(bool $orderPdfVisibleShopName): BaseInfo
{
$this->order_pdf_visible_shop_name = $orderPdfVisibleShopName;

return $this;
}

/**
* Get orderPdfVisibleShopName.
*/
public function isOrderPdfVisibleShopName(): bool
{
return $this->order_pdf_visible_shop_name;
}

/**
* Set orderPdfVisibleShopKana.
*/
public function setOrderPdfVisibleShopKana(bool $orderPdfVisibleShopKana): BaseInfo
{
$this->order_pdf_visible_shop_kana = $orderPdfVisibleShopKana;

return $this;
}

/**
* Get orderPdfVisibleShopKana.
*/
public function isOrderPdfVisibleShopKana(): bool
{
return $this->order_pdf_visible_shop_kana;
}

/**
* Set orderPdfVisibleShopNameEng.
*/
public function setOrderPdfVisibleShopNameEng(bool $orderPdfVisibleShopNameEng): BaseInfo
{
$this->order_pdf_visible_shop_name_eng = $orderPdfVisibleShopNameEng;

return $this;
}

/**
* Get orderPdfVisibleShopNameEng.
*/
public function isOrderPdfVisibleShopNameEng(): bool
{
return $this->order_pdf_visible_shop_name_eng;
}

/**
* Set orderPdfVisibleAddress.
*/
public function setOrderPdfVisibleAddress(bool $orderPdfVisibleAddress): BaseInfo
{
$this->order_pdf_visible_address = $orderPdfVisibleAddress;

return $this;
}

/**
* Get orderPdfVisibleAddress.
*/
public function isOrderPdfVisibleAddress(): bool
{
return $this->order_pdf_visible_address;
}

/**
* Set orderPdfVisibleCompanyName.
*/
public function setOrderPdfVisibleCompanyName(bool $orderPdfVisibleCompanyName): BaseInfo
{
$this->order_pdf_visible_company_name = $orderPdfVisibleCompanyName;

return $this;
}

/**
* Get orderPdfVisibleCompanyName.
*/
public function isOrderPdfVisibleCompanyName(): bool
{
return $this->order_pdf_visible_company_name;
}

/**
* Set orderPdfVisibleCompanyKana.
*/
public function setOrderPdfVisibleCompanyKana(bool $orderPdfVisibleCompanyKana): BaseInfo
{
$this->order_pdf_visible_company_kana = $orderPdfVisibleCompanyKana;

return $this;
}

/**
* Get orderPdfVisibleCompanyKana.
*/
public function isOrderPdfVisibleCompanyKana(): bool
{
return $this->order_pdf_visible_company_kana;
}

/**
* Set orderPdfVisiblePhoneNumber.
*/
public function setOrderPdfVisiblePhoneNumber(bool $orderPdfVisiblePhoneNumber): BaseInfo
{
$this->order_pdf_visible_phone_number = $orderPdfVisiblePhoneNumber;

return $this;
}

/**
* Get orderPdfVisiblePhoneNumber.
*/
public function isOrderPdfVisiblePhoneNumber(): bool
{
return $this->order_pdf_visible_phone_number;
}

/**
* Set orderPdfVisibleBusinessHour.
*/
public function setOrderPdfVisibleBusinessHour(bool $orderPdfVisibleBusinessHour): BaseInfo
{
$this->order_pdf_visible_business_hour = $orderPdfVisibleBusinessHour;

return $this;
}

/**
* Get orderPdfVisibleBusinessHour.
*/
public function isOrderPdfVisibleBusinessHour(): bool
{
return $this->order_pdf_visible_business_hour;
}

/**
* Set orderPdfVisibleEmail.
*/
public function setOrderPdfVisibleEmail(bool $orderPdfVisibleEmail): BaseInfo
{
$this->order_pdf_visible_email = $orderPdfVisibleEmail;

return $this;
}

/**
* Get orderPdfVisibleEmail.
*/
public function isOrderPdfVisibleEmail(): bool
{
return $this->order_pdf_visible_email;
}

/**
* Set orderPdfVisibleInvoiceNumber.
*/
public function setOrderPdfVisibleInvoiceNumber(bool $orderPdfVisibleInvoiceNumber): BaseInfo
{
$this->order_pdf_visible_invoice_number = $orderPdfVisibleInvoiceNumber;

return $this;
}

/**
* Get orderPdfVisibleInvoiceNumber.
*/
public function isOrderPdfVisibleInvoiceNumber(): bool
{
return $this->order_pdf_visible_invoice_number;
}

/**
* Set orderPdfVisibleMessage.
*/
public function setOrderPdfVisibleMessage(bool $orderPdfVisibleMessage): BaseInfo
{
$this->order_pdf_visible_message = $orderPdfVisibleMessage;

return $this;
}

/**
* Get orderPdfVisibleMessage.
*/
public function isOrderPdfVisibleMessage(): bool
{
return $this->order_pdf_visible_message;
}
}
Loading
Loading