diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php
index c6eec8b2d83..97411a27abf 100644
--- a/htdocs/adherents/admin/adherent_emails.php
+++ b/htdocs/adherents/admin/adherent_emails.php
@@ -88,6 +88,7 @@ if ($action == 'update' || $action == 'add') {
$constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
+ $constvalue = preg_replace('/:member$/', '', $constvalue);
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
@@ -100,23 +101,6 @@ if ($action == 'update' || $action == 'add') {
}
}
-// Action to enable a submodule of the adherent module
-if ($action == 'set') {
- $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
- if ($result < 0) {
- print $db->error();
- }
-}
-
-// Action to disable a submodule of the adherent module
-if ($action == 'unset') {
- $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
- if ($result < 0) {
- print $db->error();
- }
-}
-
-
/*
* View
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 5770df78a82..7ed5fe6e919 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -116,7 +116,7 @@ $hookmanager->initHooks(array('orderlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('commande');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"
diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php
index 218cede3efa..400fb3be7ed 100644
--- a/htdocs/compta/facture/invoicetemplate_list.php
+++ b/htdocs/compta/facture/invoicetemplate_list.php
@@ -108,7 +108,7 @@ $hookmanager->initHooks(array('invoicereclist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('facture_rec');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index a0ce91bec86..7d5679b2cff 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -150,7 +150,7 @@ $hookmanager->initHooks(array('invoicelist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('facture');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 574727f6022..ca427fb2794 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -144,7 +144,7 @@ $hookmanager->initHooks(array('contactlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('contact');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 3627661c727..8afc2f0e335 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -100,7 +100,7 @@ $hookmanager->initHooks(array('contractlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('contrat');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"
diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php
index 18a5b561387..38aae136b39 100644
--- a/htdocs/contrat/services_list.php
+++ b/htdocs/contrat/services_list.php
@@ -84,7 +84,7 @@ $hookmanager->initHooks(array('contractservicelist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('contratdet');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 2a97fac2f8d..b2f8905aba9 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -807,7 +807,7 @@ class ExtraFields
/**
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
*
- * @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
+ * @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is status of cache.
* @return array Array of attributes keys+label for all extra fields.
*/
@@ -821,6 +821,7 @@ class ExtraFields
if ($elementtype == 'thirdparty') $elementtype = 'societe';
if ($elementtype == 'contact') $elementtype = 'socpeople';
if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur';
+ if ($elementtype == 'stock_mouvement') $elementtype = 'movement';
$array_name_label = array();
diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
index 2905bfd6b26..5340f33f450 100644
--- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
@@ -183,7 +183,7 @@ class pdf_stdmovement extends ModelePDFMovement
/**
* Function to build a document on disk using the generic odt module.
*
- * @param StockMovements $object Object source to build document
+ * @param MouvementStock $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php
index bb231424396..7ba2c284d39 100644
--- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php
+++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php
@@ -27,6 +27,10 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e
if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') {
print '
| ';
} else {
+ if (! empty($extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key]) && is_object($langs)) {
+ $langs->load($extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key]);
+ }
+
$tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key];
print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align ? 'align="'.$align.'" data-titlekey="'.$key.'"' : 'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', $disablesortlink, $tooltip)."\n";
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index 6b165c1042e..a21ed4d6612 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -109,7 +109,7 @@ $hookmanager->initHooks(array('expensereportlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('expensereport');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 993dd0f3fa4..0204689b9b0 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -85,7 +85,7 @@ $hookmanager->initHooks(array('interventionlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('fichinter');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 4168656d05f..7a50a189e44 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -463,11 +463,26 @@ if (empty($reshook))
if ($idprod > 0)
{
$label = $productsupplier->label;
-
+ // Define output language
+ if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
+ $outputlangs = $langs;
+ $newlang = '';
+ if (empty($newlang) && GETPOST('lang_id', 'aZ09'))
+ $newlang = GETPOST('lang_id', 'aZ09');
+ if (empty($newlang))
+ $newlang = $object->thirdparty->default_lang;
+ if (!empty($newlang)) {
+ $outputlangs = new Translate("", $conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+ $desc = (!empty($productsupplier->multilangs [$outputlangs->defaultlang] ["description"])) ? $productsupplier->multilangs [$outputlangs->defaultlang] ["description"] : $productsupplier->description;
+ } else {
+ $desc = $productsupplier->description;
+ }
// if we use supplier description of the products
if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) {
$desc = $productsupplier->desc_supplier;
- } else $desc = $productsupplier->description;
+ }
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 8ffc6be6c05..a792d68fc6b 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -120,7 +120,7 @@ $hookmanager->initHooks(array('supplierorderlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('commande_fournisseur');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 455f0a3e3d1..457e5f3f7d5 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -310,7 +310,7 @@ class MyObject extends CommonObject
foreach ($object->array_options as $key => $option)
{
$shortkey = preg_replace('/options_/', '', $key);
- if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
+ if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey]))
{
//var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
unset($object->array_options[$key]);
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 02eeac29063..4b74e6b9a0f 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -107,7 +107,7 @@ $extrafields = new ExtraFields($db);
$form = new Form($db);
// fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label('product');
+$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
if (empty($action)) $action = 'list';
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index 869635e02b9..3ffee80362c 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -231,7 +231,7 @@ foreach ($search as $key => $val)
if ($search[$key] == '-1') $search[$key] = '';
$mode_search = 2;
}
- if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : $key), $search[$key], (($key == 'status') ? 2 : $mode_search));
+ if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : 't.' . $key), $search[$key], (($key == 'status') ? 2 : $mode_search));
}
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
// Add where from extra fields
diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php
index 4e5c7b13458..055e3cbefc7 100644
--- a/htdocs/product/traduction.php
+++ b/htdocs/product/traduction.php
@@ -73,11 +73,11 @@ $cancel != $langs->trans("Cancel") &&
$current_lang = $langs->getDefaultLang();
// update de l'objet
- if ($_POST["forcelangprod"] == $current_lang)
- {
+ if ($_POST["forcelangprod"] == $current_lang) {
$object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]);
+ $object->update($object->id, $user);
} else {
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
@@ -85,8 +85,7 @@ $cancel != $langs->trans("Cancel") &&
}
// sauvegarde en base
- if ($object->setMultiLangs($user) > 0)
- {
+ if ($object->setMultiLangs($user) > 0) {
$action = '';
} else {
$action = 'add';
diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php
index f3a68dd979f..437c5934c81 100644
--- a/htdocs/projet/activity/perweek.php
+++ b/htdocs/projet/activity/perweek.php
@@ -119,8 +119,7 @@ $object = new Task($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-//$extrafields->fetch_name_optionals_label('projet');
-$extrafields->fetch_name_optionals_label('projet_task');
+$extrafields->fetch_name_optionals_label($object->table_element);
$arrayfields = array();
/*$arrayfields=array(
diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php
index 60f52838bf6..922cb498c5d 100644
--- a/htdocs/public/ticket/list.php
+++ b/htdocs/public/ticket/list.php
@@ -201,7 +201,7 @@ if ($action == "view_ticketlist")
// fetch optionals attributes and labels
$extrafields = new ExtraFields($db);
- $extrafields->fetch_name_optionals_label('ticket');
+ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php
index 0a6f39c777b..c9e8bd15d9e 100644
--- a/htdocs/zapier/class/hook.class.php
+++ b/htdocs/zapier/class/hook.class.php
@@ -354,10 +354,10 @@ class Hook extends CommonObject
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0) {
- $extrafields->fetch_name_optionals_label($this->element);
+ $extrafields->fetch_name_optionals_label($this->table_element);
foreach ($object->array_options as $key => $option) {
$shortkey = preg_replace('/options_/', '', $key);
- if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) {
+ if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey])) {
// var_dump($key);
// var_dump($clonedObj->array_options[$key]);
// exit;