Debug v18

This commit is contained in:
Laurent Destailleur
2023-07-04 10:58:53 +02:00
parent 65b5d972d2
commit 7909d2560f
2 changed files with 25 additions and 8 deletions

View File

@@ -199,7 +199,7 @@ class Form
* @param string $value Value to show/edit
* @param object $object Object (that we want to show)
* @param boolean $perm Permission to allow button to edit parameter
* @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...')
* @param string $typeofdata Type of data ('string' by default, 'checkbox', 'email', 'phone', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...')
* @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value, or a select combo). Use '' to use same than $value
* @param object $extObject External object ???
* @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
@@ -257,7 +257,7 @@ class Form
if (empty($notabletag)) {
$ret .= '<tr><td>';
}
if (preg_match('/^(string|safehtmlstring|email|url)/', $typeofdata)) {
if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) {
$tmp = explode(':', $typeofdata);
$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
} elseif (preg_match('/^(integer)/', $typeofdata)) {
@@ -339,13 +339,15 @@ class Form
}
$ret .= '</form>' . "\n";
} else {
if (preg_match('/^(email)/', $typeofdata)) {
if (preg_match('/^email/', $typeofdata)) {
$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
} elseif (preg_match('/^phone/', $typeofdata)) {
$ret .= dol_print_phone($value, '_blank', 32, 1);
} elseif (preg_match('/^url/', $typeofdata)) {
$ret .= dol_print_url($value, '_blank', 32, 1);
} elseif (preg_match('/^(amount|numeric)/', $typeofdata)) {
$ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : '');
} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
} elseif (preg_match('/^checkbox/', $typeofdata)) {
$tmp = explode(':', $typeofdata);
$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
@@ -391,6 +393,7 @@ class Form
}
}
// Custom format if parameter $formatfunc has been provided
if ($formatfunc && method_exists($object, $formatfunc)) {
$ret = $object->$formatfunc($ret);
}