';
- // Permet d'afficher le compte comptable
- if (empty($displayed_account) || $root_account_description != $displayed_account)
+ if (!empty($show_subgroup))
{
- // Affiche un Sous-Total par compte comptable
- if ($displayed_account != "") {
- print '
';
print '';
- }
- }
- }
-
- return $out;
- }
-
- /**
- * Fill array_options property of object by extrafields value (using for data sent by forms)
- *
- * @param array $extralabels Deprecated (old $array of extrafields, now set this to null)
- * @param object $object Object
- * @param string $onlykey Only the following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must set this to avoid to have other extrafields being reset.
- * @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
- */
- public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
- {
- global $_POST, $langs;
-
- $nofillrequired = 0; // For error when required field left blank
- $error_field_required = array();
-
- if (is_array($this->attributes[$object->table_element]['label'])) $extralabels = $this->attributes[$object->table_element]['label'];
-
- if (is_array($extralabels))
- {
- // Get extra fields
- foreach ($extralabels as $key => $value)
- {
- if (!empty($onlykey) && $key != $onlykey) continue;
-
- $key_type = $this->attributes[$object->table_element]['type'][$key];
- if ($key_type == 'separate') continue;
-
- $enabled = 1;
- if (isset($this->attributes[$object->table_element]['list'][$key]))
- {
- $enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1);
- }
- $perms = 1;
- if (isset($this->attributes[$object->table_element]['perms'][$key]))
- {
- $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1);
- }
- if (empty($enabled)) continue;
- if (empty($perms)) continue;
-
- if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
- {
- // Check if empty without using GETPOST, value can be alpha, int, array, etc...
- if ((!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0')
- || (!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select')
- || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
- {
- //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];
- $nofillrequired++;
- $error_field_required[] = $langs->transnoentitiesnoconv($value);
- }
- }
-
- if (in_array($key_type, array('date')))
- {
- // Clean parameters
- // TODO GMT date in memory must be GMT so we should add gm=true in parameters
- $value_key = dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
- }
- elseif (in_array($key_type, array('datetime')))
- {
- // Clean parameters
- // TODO GMT date in memory must be GMT so we should add gm=true in parameters
- $value_key = dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
- }
- elseif (in_array($key_type, array('checkbox', 'chkbxlst')))
- {
- $value_arr = GETPOST("options_".$key, 'array'); // check if an array
- if (!empty($value_arr)) {
- $value_key = implode($value_arr, ',');
- } else {
- $value_key = '';
- }
- }
- elseif (in_array($key_type, array('price', 'double')))
- {
- $value_arr = GETPOST("options_".$key, 'alpha');
- $value_key = price2num($value_arr);
- }
- else
- {
- $value_key = GETPOST("options_".$key);
- if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = '';
- }
-
- $object->array_options["options_".$key] = $value_key;
- }
-
- if ($nofillrequired) {
- $langs->load('errors');
- setEventMessages($langs->trans('ErrorFieldsRequired').' : '.implode(', ', $error_field_required), null, 'errors');
- return -1;
- }
- else {
- return 1;
- }
- }
- else {
- return 0;
- }
- }
-
- /**
- * return array_options array of data of extrafields value of object sent by a search form
- *
- * @param array|string $extrafieldsobjectkey array of extrafields (old usage) or value of object->table_element (new usage)
- * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
- * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
- * @return array|int array_options set or 0 if no value
- */
- public function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix = '', $keysuffix = '')
- {
- global $_POST;
-
- if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label']))
- {
- $extralabels = $this->attributes[$extrafieldsobjectkey]['label'];
- }
- else
- {
- $extralabels = $extrafieldsobjectkey;
- }
-
- if (is_array($extralabels))
- {
- $array_options = array();
-
- // Get extra fields
- foreach ($extralabels as $key => $value)
- {
- $key_type = '';
- if (is_string($extrafieldsobjectkey))
- {
- $key_type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
- }
-
- if (in_array($key_type, array('date', 'datetime')))
- {
- if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) continue; // Value was not provided, we should not set it.
- // Clean parameters
- $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'));
- }
- elseif (in_array($key_type, array('checkbox', 'chkbxlst')))
- {
- if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
- $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
- // Make sure we get an array even if there's only one checkbox
- $value_arr = (array) $value_arr;
- $value_key = implode(',', $value_arr);
- }
- elseif (in_array($key_type, array('price', 'double', 'int')))
- {
- if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
- $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
- $value_key = price2num($value_arr);
- }
- else
- {
- if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it.
- $value_key = GETPOST($keysuffix."options_".$key.$keyprefix);
- }
-
- $array_options[$keysuffix."options_".$key] = $value_key; // No keyprefix here. keyprefix is used only for read.
- }
-
- return $array_options;
- }
-
- return 0;
- }
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 5fe411c6260..d7e46922f56 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -368,6 +368,8 @@ class Form
$s = picto_from_langcode($langcode, 'class="pictoforlang paddingright"');
$resultforextrlang .= $s;
+
+ // TODO Use the showInputField() method of ExtraLanguages object
if ($typeofdata == 'textarea') {
$resultforextrlang .= '