Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
50 changes: 0 additions & 50 deletions e2e/tests/admin-order.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,56 +303,6 @@ test.describe('Admin Order (EA04)', () => {
expect(page.url()).toMatch(/\/admin\/order\/\d+\/edit$/);
});

test('order_受注削除 (EA0401-UC08-T01)', async ({ page }) => {
// First create an order to delete, so we don't affect fixture data
await createOrderViaUI(page, '削除テスト', '太郎');

// Go to order list and search for it
await goOrderList(page);
await searchOrder(page, '削除テスト');
await expect(page.locator(searchResultMsg)).not.toContainText('検索結果:0件が該当しました');

// Get the order number for the first row
const orderNum = await page.locator('#search_result tbody tr:first-child a.action-edit').textContent();

// Select the first order
await page.locator('#search_result > tbody > tr:nth-child(1) > td > input[type=checkbox]').check();
await page.waitForTimeout(500);

// The bulk wrapper should become visible -- but the delete button is in bulkDeleteModal
// Open the delete modal via JS (there's no visible delete button in the bulk wrapper for orders,
// but the modal exists)
// Actually let's find the delete opener
const deleteOpener = page.locator('[data-bs-target="#bulkDeleteModal"]');
const openerCount = await deleteOpener.count();

if (openerCount > 0) {
await deleteOpener.click();
} else {
// If there's no opener button, trigger the modal directly
await page.evaluate(() => {
const modal = document.querySelector('#bulkDeleteModal') as HTMLElement;
if (modal) {
// @ts-ignore
const bsModal = new bootstrap.Modal(modal);
bsModal.show();
}
});
}
await page.waitForTimeout(500);

// Click confirm delete
await page.locator('#btn_bulk_delete').click();
await page.waitForLoadState('load');
await page.waitForTimeout(2000);

// Verify the deleted order is no longer at the top
await goOrderList(page);
await searchOrder(page, '削除テスト');
// After deletion, we expect 0 results for this search
await expect(page.locator(searchResultMsg)).toContainText('検索結果:0件が該当しました');
});

test('order_受注メール通知 (EA0402-UC01-T01)', async ({ page }) => {
// Go to order list and search
await goOrderList(page);
Expand Down
22 changes: 0 additions & 22 deletions src/Eccube/Controller/Admin/Order/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace Eccube\Controller\Admin\Order;

use Eccube\Common\Constant;
use Eccube\Controller\AbstractController;
use Eccube\Entity\ExportCsvRow;
use Eccube\Entity\Master\CsvType;
Expand Down Expand Up @@ -247,27 +246,6 @@ public function index(Request $request, ?int $page_no = null): array
];
}

#[Route(path: '/%eccube_admin_route%/order/bulk_delete', name: 'admin_order_bulk_delete', methods: ['POST'])]
public function bulkDelete(Request $request): RedirectResponse
{
$this->isTokenValid();
$ids = $request->get('ids');
foreach ($ids as $order_id) {
$Order = $this->orderRepository
->find($order_id);
if ($Order) {
$this->entityManager->remove($Order);
log_info('受注削除', [$Order->getId()]);
}
}

$this->entityManager->flush();

$this->addSuccess('admin.common.delete_complete', 'admin');

return $this->redirectToRoute('admin_order', ['resume' => Constant::ENABLED]);
}

/**
* 受注CSVの出力.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Eccube/Resource/locale/messages.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,6 @@ admin.order.shipping_status: Shipping Status
admin.order.delivery: Delivery to
admin.order.not_payment: Unpaid
admin.order.unshipped: Unshipped
admin.order.delete__confirm_title: Deleting Order Info
admin.order.delete__confirm_message: Are you sure to delete the order information?
admin.order.delete_item__confirm_message: "The item will be deleted from the order. Are you sure to delete %name%?"
admin.order.change_payment_method_message: If the payment charge changes, please update it manually.
admin.order.non_member: Non-Member
Expand Down
2 changes: 0 additions & 2 deletions src/Eccube/Resource/locale/messages.ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,6 @@ admin.order.shipping_status: 出荷状況
admin.order.delivery: お届け先
admin.order.not_payment: 未入金
admin.order.unshipped: 未出荷
admin.order.delete__confirm_title: 注文情報を削除します
admin.order.delete__confirm_message: 注文情報を削除してよろしいですか?
admin.order.delete_item__confirm_message: "明細は注文から削除されます。「%name%」を削除してよろしいですか?"
admin.order.change_payment_method_message: お支払方法の変更に伴う手数料の変更は手動にてお願いします
admin.order.non_member: 非会員
Expand Down
30 changes: 0 additions & 30 deletions src/Eccube/Resource/template/admin/Order/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ file that was distributed with this source code.
toggleBtnBulk('input[id^="check_"]', '.btn-bulk-wrapper');
});

$('#btn_bulk_delete').on('click', function(event) {
event.preventDefault();
$('#form_bulk').attr('action', "{{ url('admin_order_bulk_delete') }}").submit();
return false;
});

// PDF出力(複数)
$('#bulkExportPdf').on('click', function(event) {
window.open('', 'newwin', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=700, height=700');
Expand Down Expand Up @@ -402,7 +396,6 @@ file that was distributed with this source code.
{{ 'admin.order.send_mail'|trans }}
</button>
<button type="button" id="bulkExportPdf" class="btn btn-ec-regular me-2">{{ 'admin.order.output_delivery_note_short'|trans }}</button>
{# TODO 削除処理は将来バージョンで対応 <button type="button" class="btn btn-ec-delete" data-bs-toggle="modal" data-bs-target="#bulkDeleteModal">{{ 'admin.common.delete'|trans }}</button> #}
</div>
<div class="col d-none btn-bulk-wrapper">
<div class="d-inline-block me-2">
Expand Down Expand Up @@ -649,29 +642,6 @@ file that was distributed with this source code.
</div>
</div>

<!-- 一括削除の確認モーダル -->
<div class="modal fade" id="bulkDeleteModal" tabindex="-1" role="dialog" aria-labelledby="discontinuance" aria-hidden="true" data-bs-keyboard="false" data-bs-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title fw-bold">{{ 'admin.order.delete__confirm_title'|trans }}</h5>
<button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body text-start">
<p class="text-start">{{ 'admin.order.delete__confirm_message'|trans }}</p>
<ul id="bulkErrors"></ul>
<div class="progress" style="display: none">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-ec-sub" type="button" data-bs-dismiss="modal">{{ 'admin.common.cancel'|trans }}</button>
<button class="btn btn-ec-delete" type="button" id="btn_bulk_delete">{{ 'admin.common.delete' | trans }}</button>
</div>
</div>
</div>
</div>

</div>
</div>
</div>
Expand Down
24 changes: 18 additions & 6 deletions tests/Eccube/Tests/Web/Admin/Order/OrderControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,32 @@ public function testIndexWithNext()
$this->verify();
}

public function testBulkDelete()
/**
* 受注の一括削除は、出荷の ID を受注の ID として扱い別の受注を削除していたため撤去した.
*
* @see https://github.com/EC-CUBE/ec-cube/issues/7208
*/
public function testBulkDeleteIsNotAvailable(): void
{
$Customer = $this->createCustomer();
$NewOrders = $this->createOrders(array_fill(0, 5, $Customer));
$orderIds = array_map(static fn ($o) => $o->getId(), $NewOrders);
$NewOrders = $this->createOrders(array_fill(0, 3, $Customer));
$orderIds = array_map(static fn (Order $Order) => $Order->getId(), $NewOrders);
$shippingIds = array_map(static fn (Order $Order) => $Order->getShippings()->first()->getId(), $NewOrders);

$this->client->request(
Request::METHOD_POST,
$this->generateUrl('admin_order_bulk_delete'),
['ids' => $orderIds]
'/'.static::getContainer()->getParameter('eccube_admin_route').'/order/bulk_delete',
[
'ids' => array_merge($orderIds, $shippingIds),
Constant::TOKEN_NAME => 'dummy',
]
);

$this->assertSame(Response::HTTP_NOT_FOUND, $this->client->getResponse()->getStatusCode(), (string) $this->client->getResponse()->getContent());

$this->entityManager->clear();
$Orders = $this->entityManager->getRepository(Order::class)->findBy(['id' => $orderIds]);
$this->assertCount(0, $Orders);
$this->assertCount(3, $Orders);
}

public function testExportOrder()
Expand Down
Loading