Skip to content

Commit

Permalink
注文番号のフォーマットに半角英字大文字を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Dec 31, 2023
1 parent cae3bf9 commit 5859dcc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
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

0 comments on commit 5859dcc

Please sign in to comment.