Skip to content

Commit

Permalink
PREF_CHECK SC_DB_MasterData を使う
Browse files Browse the repository at this point in the history
都度のDB問い合わせを避ける。
PostgreSQL で発生していた制御文字のDBエラー回避を兼ねる。#1157 (comment)

SC_Helper_Customer::sfCustomerCommonParam() PREF_CHECK を後回しにした。前述の変更により、必然性は低下したが、妥当と考える。
  • Loading branch information
seasoftjapan committed Jan 21, 2025
1 parent eee5772 commit 04af52a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions data/class/SC_CheckError.php
Original file line number Diff line number Diff line change
Expand Up @@ -1861,9 +1861,8 @@ public function PREF_CHECK($value)

$this->createParam($value);

$objQuery = SC_Query_Ex::getSingletonInstance();
$exists = $objQuery->exists('mtb_pref', 'id = ?', [$pref_id]);
if (!$exists) {
$arrPref = (new SC_DB_MasterData_Ex())->getMasterData('mtb_pref');
if (!isset($arrPref[$pref_id])) {
$this->arrErr[$key] = ''.$disp.'が不正な値です。<br />';
}
}
Expand Down
2 changes: 1 addition & 1 deletion data/class/helper/SC_Helper_Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public static function sfCustomerCommonParam(&$objFormParam, $prefix = '')
$objFormParam->addParam('郵便番号1', $prefix.'zip01', ZIP01_LEN, 'n', ['EXIST_CHECK', 'SPTAB_CHECK', 'NUM_CHECK', 'NUM_COUNT_CHECK']);
$objFormParam->addParam('郵便番号2', $prefix.'zip02', ZIP02_LEN, 'n', ['EXIST_CHECK', 'SPTAB_CHECK', 'NUM_CHECK', 'NUM_COUNT_CHECK']);
$objFormParam->addParam('', $prefix.'country_id', INT_LEN, 'n', ['NUM_CHECK']);
$objFormParam->addParam('都道府県', $prefix.'pref', INT_LEN, 'n', ['PREF_CHECK', 'EXIST_CHECK', 'NUM_CHECK']);
$objFormParam->addParam('都道府県', $prefix.'pref', INT_LEN, 'n', ['EXIST_CHECK', 'NUM_CHECK', 'PREF_CHECK']);

Check warning on line 409 in data/class/helper/SC_Helper_Customer.php

View check run for this annotation

Codecov / codecov/patch

data/class/helper/SC_Helper_Customer.php#L409

Added line #L409 was not covered by tests
} else {
$objFormParam->addParam('お名前(フリガナ・姓)', $prefix.'kana01', STEXT_LEN, 'CKV', ['NO_SPTAB', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK', 'KANA_CHECK']);
$objFormParam->addParam('お名前(フリガナ・名)', $prefix.'kana02', STEXT_LEN, 'CKV', ['NO_SPTAB', 'SPTAB_CHECK', 'MAX_LENGTH_CHECK', 'KANA_CHECK']);
Expand Down

0 comments on commit 04af52a

Please sign in to comment.