module training - fix by trimming client codes
This commit is contained in:
parent
0361b2746a
commit
f5619c158f
@ -92,7 +92,7 @@ class TrainingBilan
|
||||
|
||||
static function computeLineResult(ArrayExtended $cols)
|
||||
{
|
||||
$code_client = strtolower($cols[self::COL_CODE_CLIENT]);
|
||||
$code_client = strtolower(trim($cols[self::COL_CODE_CLIENT]));
|
||||
$low_module_name = strtolower($cols[self::COL_MODULE_NAME]);
|
||||
|
||||
if (empty($code_client)) {
|
||||
|
@ -51,8 +51,8 @@ class TrainingFixedCodeClient extends ObjectModel
|
||||
$ok = $reader
|
||||
->setExpectedHeader(self::$header)
|
||||
->setOnEachLine(function(ArrayExtended $cols) use (&$imported_codes) {
|
||||
$wrong_code = strtolower((string)$cols[self::CODE_CLIENT_WRONG]);
|
||||
$right_code = strtolower((string)$cols[self::CODE_CLIENT_RIGHT]);
|
||||
$wrong_code = strtolower(trim((string)$cols[self::CODE_CLIENT_WRONG]));
|
||||
$right_code = strtolower(trim((string)$cols[self::CODE_CLIENT_RIGHT]));
|
||||
|
||||
if (empty($wrong_code)) {
|
||||
$wrong_code = self::CODE_EMPTY;
|
||||
@ -68,7 +68,7 @@ class TrainingFixedCodeClient extends ObjectModel
|
||||
|
||||
// load all already saved codes
|
||||
foreach (Db::getInstance()->executeS('
|
||||
SELECT `codeclient_from_results`, `codeclient_fixed`
|
||||
SELECT TRIM(`codeclient_from_results`) as `codeclient_from_results`, TRIM(`codeclient_fixed`) as `codeclient_fixed`
|
||||
FROM `'._DB_PREFIX_.'training_fixedcodeclient`
|
||||
') as $row) {
|
||||
$existing_codes[$row['codeclient_from_results']] = $row['codeclient_fixed'];
|
||||
@ -107,7 +107,7 @@ class TrainingFixedCodeClient extends ObjectModel
|
||||
{
|
||||
$result = new ArrayExtended();
|
||||
|
||||
$sql = 'SELECT `codeclient_from_results`, `codeclient_fixed`
|
||||
$sql = 'SELECT TRIM(`codeclient_from_results`), TRIM(`codeclient_fixed`)
|
||||
FROM `'._DB_PREFIX_.'training_fixedcodeclient`
|
||||
WHERE codeclient_fixed <> \'\'';
|
||||
foreach (Db::getInstance()->executeS($sql) as $row) {
|
||||
@ -122,7 +122,7 @@ class TrainingFixedCodeClient extends ObjectModel
|
||||
// get already saved codes to correct
|
||||
$existing_codes = array();
|
||||
|
||||
$sql = 'SELECT LOWER(`codeclient_from_results`) as `codeclient_from_results`
|
||||
$sql = 'SELECT LOWER(TRIM(`codeclient_from_results`)) as `codeclient_from_results`
|
||||
FROM `'._DB_PREFIX_.'training_fixedcodeclient`';
|
||||
foreach (Db::getInstance()->executeS($sql) as $row) {
|
||||
$existing_codes[] = $row['codeclient_from_results'];
|
||||
@ -142,7 +142,7 @@ class TrainingFixedCodeClient extends ObjectModel
|
||||
// filter new codes not already present in DB (and create the SQL value string)
|
||||
$values = array();
|
||||
foreach(array_diff($unique_pharmacies_not_found, $existing_codes) as $code_client) {
|
||||
$values[] = '\''.pSql((string)$code_client).'\', \'\'';
|
||||
$values[] = '\''.pSql(trim((string)$code_client)).'\', \'\'';
|
||||
}
|
||||
|
||||
// if any new codes, add them
|
||||
|
Loading…
Reference in New Issue
Block a user