Skip to content
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

注文番号のフォーマットに半角英字大文字を追加 #6078

Merged
merged 1 commit into from
Jan 17, 2024
Merged
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
1 change: 1 addition & 0 deletions app/config/eccube/packages/eccube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ parameters:
# {id,桁数}: dtb_order.idの桁数分0埋め(桁数を超えたらそのまま表示)
# {random,桁数}: ランダムな数値を桁数分作成
# {random_alnum,桁数} : ランダムな半角英数大文字を桁数分作成
# {random_alpha,桁数} : ランダムな半角英字大文字を桁数分作成
eccube_order_no_format: ''
eccube_order_pdf_message_len: 30
eccube_news_start_year: 2000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Eccube\Service\PurchaseFlow\ItemHolderPreprocessor;
use Eccube\Service\PurchaseFlow\PurchaseContext;
use Eccube\Util\StringUtil;
use Symfony\Component\String\ByteString;

class OrderNoProcessor implements ItemHolderPreprocessor
{
Expand Down Expand Up @@ -90,6 +91,8 @@ public function process(ItemHolderInterface $itemHolder, PurchaseContext $contex
return sprintf("%0{$res[1]}d", $random);
} elseif ($res[0] === 'random_alnum') {
return strtoupper(StringUtil::random($res[1]));
} elseif ($res[0] === 'random_alpha') {
return strtoupper(ByteString::fromRandom($res[1], implode('', range('A', 'Z')))->toString());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function processDataProvider()
['{random_alnum}', '/^123$/'],
['{random_alnum,1}', '/^[[:alnum:]]{1}$/'],
['{random_alnum,10}', '/^[[:alnum:]]{10}$/'],
['{random_alpha,10}', '/^[[:alpha:]]{10}$/'],
['order_no', '/order_no/'],
['{hoge}', '/123/'],
['ORDER_{yy}_{mm}_{dd}_{id,5}_{random,5}_{random_alnum,10}',
Expand Down
Loading