Skip to content

Commit

Permalink
Merge pull request #5132 from chihiro-adachi/fix-change-order-status
Browse files Browse the repository at this point in the history
一括ステータス更新を同期処理に変更
  • Loading branch information
Kiyotaka Oku authored Sep 1, 2021
2 parents 01f0ff2 + 7fb0206 commit 8201802
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions codeception/acceptance/EA04OrderCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ public function order_ー括受注のステータス変更(AcceptanceTester $I)
->一覧_全選択()
->受注ステータス変更('発送済み');

$I->waitForElementVisible(['id' => 'bulkChangeComplete']);

OrderManagePage::go($I)->受注ステータス検索(OrderStatus::DELIVERED);
$I->comment('発送済みに変更した件数を確認します。新規受付: '.count($NewOrders).'件 + 発送済み: '.count($DeliveredOrders).'');
$I->see('検索結果:'.(count($DeliveredOrders) + count($NewOrders)).'件が該当しました', OrderManagePage::$検索結果_メッセージ);
Expand Down
24 changes: 20 additions & 4 deletions src/Eccube/Resource/template/admin/Order/confirmationModal_js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,27 @@
},
getPromises: {
value: function (progress) {
return $('input[data-id]:checked').map(function () {
var url = $(this).data('update-status-url');
var data = {'order_status': $('#option_bulk_status').val()};
return ConfirmationModal.prototype.getPromises.call(this, progress, url, data);
var statuses = [];
$('input[data-id]:checked').each(function () {
statuses.push({
'url': $(this).data('update-status-url'),
'data': {'order_status': $('#option_bulk_status').val()}
});
});
// ポイントや在庫の加算・減算は非同期で実行できないため、同期処理で実行
var callback = function () {
var status = statuses.shift();
var url = status.url;
var data = status.data;
ConfirmationModal.prototype.getPromises.call(this, progress, url, data)
.done(function () {
if (statuses.length) {
callback();
}
})
}
callback();
}
}
});
Expand Down

0 comments on commit 8201802

Please sign in to comment.