Better error message
This commit is contained in:
parent
98ebe0cff4
commit
a253938db9
@ -183,6 +183,21 @@ function isASecretKey($keyname)
|
|||||||
return preg_match('/(_pass|password|_pw|_key|securekey|serverkey|secret\d?|p12key|exportkey|_PW_[a-z]+|token)$/i', $keyname);
|
return preg_match('/(_pass|password|_pw|_key|securekey|serverkey|secret\d?|p12key|exportkey|_PW_[a-z]+|token)$/i', $keyname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a numeric value into an Excel like column number. So 1 return 'A', 2 returns 'B'..., 27 return 'AA'
|
||||||
|
*
|
||||||
|
* @param int|string $n Numeric value
|
||||||
|
* @return string Column in Excel format
|
||||||
|
*/
|
||||||
|
function num2Alpha($n)
|
||||||
|
{
|
||||||
|
for ($r = ""; $n >= 0; $n = intval($n / 26) - 1)
|
||||||
|
$r = chr($n % 26 + 0x41) . $r;
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return information about user browser
|
* Return information about user browser
|
||||||
*
|
*
|
||||||
|
|||||||
@ -446,7 +446,7 @@ class ImportXlsx extends ModeleImports
|
|||||||
|
|
||||||
// Is it a required field ?
|
// Is it a required field ?
|
||||||
if (preg_match('/\*/', $objimport->array_import_fields[0][$val]) && ((string) $newval == '')) {
|
if (preg_match('/\*/', $objimport->array_import_fields[0][$val]) && ((string) $newval == '')) {
|
||||||
$this->errors[$error]['lib'] = $langs->trans('ErrorMissingMandatoryValue', $key);
|
$this->errors[$error]['lib'] = $langs->trans('ErrorMissingMandatoryValue', num2Alpha($key));
|
||||||
$this->errors[$error]['type'] = 'NOTNULL';
|
$this->errors[$error]['type'] = 'NOTNULL';
|
||||||
$errorforthistable++;
|
$errorforthistable++;
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -2349,20 +2349,6 @@ function show_elem($fieldssource, $pos, $key, $var, $nostyle = '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a numeric into an Excel like column number
|
|
||||||
*
|
|
||||||
* @param string $n Numeric value
|
|
||||||
* @return string Column in Excel format
|
|
||||||
*/
|
|
||||||
function num2Alpha($n)
|
|
||||||
{
|
|
||||||
for ($r = ""; $n >= 0; $n = intval($n / 26) - 1)
|
|
||||||
$r = chr($n%26 + 0x41) . $r;
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return not used field number
|
* Return not used field number
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user