diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php
index b4ff4ebac68..b0ab945f543 100644
--- a/htdocs/asset/card.php
+++ b/htdocs/asset/card.php
@@ -203,7 +203,7 @@ if (($id || $ref) && $action == 'edit')
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
{
- $res = $object->fetch_optionals($object->id);
+ $res = $object->fetch_optionals();
$head = asset_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("Asset"), -1, 'generic');
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 279f72896f5..7533abcb893 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -726,7 +726,7 @@ if (empty($reshook))
$originLine = new $lineClassName($db);
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
{
- $originLine->fetch_optionals($lineId);
+ $originLine->fetch_optionals();
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
@@ -1523,7 +1523,7 @@ if ($action == 'create')
$dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice);
// Replicate extrafields
- $objectsrc->fetch_optionals($originid);
+ $objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
if (!empty($conf->multicurrency->enabled))
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 10ba69601c1..93bab6e674d 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -385,7 +385,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used
{
- $lines[$i]->fetch_optionals($lines[$i]->rowid);
+ $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
@@ -1362,7 +1362,7 @@ if (empty($reshook))
$originLine = new $lineClassName($db);
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
{
- $originLine->fetch_optionals($lineId);
+ $originLine->fetch_optionals();
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
@@ -1549,7 +1549,7 @@ if ($action == 'create' && $usercancreate)
$objectsrc->fetch_thirdparty();
// Replicate extrafields
- $objectsrc->fetch_optionals($originid);
+ $objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
$projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index b1b7b3c8fe5..b2d1c09bd25 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1381,7 +1381,7 @@ class Commande extends CommonOrder
$this->origin_id = $object->id;
// get extrafields from original line
- $object->fetch_optionals($object->id);
+ $object->fetch_optionals();
$e = new ExtraFields($this->db);
$element_extrafields = $e->fetch_name_optionals_label($this->table_element);
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index a473ccbb993..764b31ad0f6 100644
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -287,7 +287,7 @@ if (($action == 'create' || $action == 'add') && !$error)
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
- $lines[$i]->fetch_optionals($lines[$i]->rowid);
+ $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index fced3c4d84a..55b16368469 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -1608,7 +1608,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
- $lines[$i]->fetch_optionals($lines[$i]->rowid);
+ $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
@@ -1749,7 +1749,7 @@ if (empty($reshook))
$line->origin = $object->origin;
$line->origin_id = $line->id;
$line->fk_prev_id = $line->id;
- $line->fetch_optionals($line->id);
+ $line->fetch_optionals();
$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
// Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée
@@ -2555,7 +2555,7 @@ if (empty($reshook))
$originLine = new $lineClassName($db);
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
{
- $originLine->fetch_optionals($lineId);
+ $originLine->fetch_optionals();
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
@@ -2810,7 +2810,7 @@ if ($action == 'create')
$remise_absolue = (!empty($expesrc->remise_absolue) ? $expesrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
//Replicate extrafields
- $expesrc->fetch_optionals($expeoriginid);
+ $expesrc->fetch_optionals();
$object->array_options = $expesrc->array_options;
}
else
@@ -2828,7 +2828,7 @@ if ($action == 'create')
}
// Replicate extrafields
- $objectsrc->fetch_optionals($originid);
+ $objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
}
}
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index fdffc320880..524d553effd 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -677,7 +677,7 @@ class FactureRec extends CommonInvoice
$line->price = $objp->price;
$line->remise = $objp->remise;
- $line->fetch_optionals($line->id);
+ $line->fetch_optionals();
// Multicurrency
$line->fk_multicurrency = $objp->fk_multicurrency;
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 7f499149034..606d84b256b 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1317,7 +1317,7 @@ class Facture extends CommonInvoice
$this->origin_id = $object->id;
// get extrafields from original line
- $object->fetch_optionals($object->id);
+ $object->fetch_optionals();
foreach ($object->array_options as $options_key => $value)
$this->array_options[$options_key] = $value;
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 4e0e5cb5865..9bcae25badd 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -317,7 +317,7 @@ if (empty($reshook))
$array_options = array();
// For avoid conflicts if trigger used
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
- $lines[$i]->fetch_optionals($lines[$i]->rowid);
+ $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
@@ -1128,12 +1128,12 @@ if ($action == 'create')
$classname = ucfirst($subelement);
$objectsrc = new $classname($db);
- $objectsrc->fetch(GETPOST('originid'));
+ $objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) $objectsrc->fetch_lines();
$objectsrc->fetch_thirdparty();
// Replicate extrafields
- $objectsrc->fetch_optionals($originid);
+ $objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
$projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
@@ -1703,7 +1703,8 @@ else
// Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines) > 0) {
$line = new ContratLigne($db);
- $line->fetch_optionals($objp->rowid);
+ $line->id = $objp->rowid;
+ $line->fetch_optionals();
print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1);
}
}
@@ -1793,7 +1794,8 @@ else
if (is_array($extralabelslines) && count($extralabelslines) > 0) {
$line = new ContratLigne($db);
- $line->fetch_optionals($objp->rowid);
+ $line->id = $objp->rowid;
+ $line->fetch_optionals();
print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1);
}
}
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 17e063244df..419296b7341 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -744,7 +744,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
- $lines[$i]->fetch_optionals($lines[$i]->rowid);
+ $lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index eb0f0eac94b..12eb1c62e8c 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -87,6 +87,11 @@ abstract class CommonObject
*/
public $array_options = array();
+ /**
+ * @var mixed Array to store alternative languages values of object
+ */
+ public $array_languages = null; // Value is array() when load already tried
+
/**
* @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked
*/
@@ -5041,6 +5046,72 @@ abstract class CommonObject
}
+ /* Functions for data in other language */
+
+
+ /**
+ * Function to get alternative languages of a data into $this->array_languages
+ * This method is NOT called by method fetch of objects but must be called separately.
+ *
+ * @return int <0 if error, 0 if no values of alternative languages to find nor found, 1 if a value was found and loaded
+ */
+ public function fetchValueForAlternateLanguages()
+ {
+ // To avoid SQL errors. Probably not the better solution though
+ if (!$this->element) {
+ return 0;
+ }
+ if (! ($this->id > 0)) {
+ return 0;
+ }
+
+ $this->array_languages = array();
+
+ $element = $this->element;
+ if ($element == 'categorie') $element = 'categories'; // For compatibility
+
+ // Request to get translation values for object
+ $sql = "SELECT rowid, property, lang , value";
+ $sql .= " FROM ".MAIN_DB_PREFIX."object_lang";
+ $sql .= " WHERE type_object = '".$element."'";
+ $sql .= " AND fk_object = ".$this->id;
+
+ //dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); // Too verbose
+ $resql = $this->db->query($sql);
+ if ($resql)
+ {
+ $numrows = $this->db->num_rows($resql);
+ if ($numrows)
+ {
+ $tab = $this->db->fetch_array($resql);
+
+ foreach ($tab as $key => $value)
+ {
+ // we can add this attribute to object
+ if (preg_match('/date/', $key))
+ {
+ $this->array_languages[$key] = $this->db->jdate($value);
+ }
+ else
+ {
+ $this->array_languages[$key] = $value;
+ }
+ }
+ }
+
+ $this->db->free($resql);
+
+ if ($numrows) return $numrows;
+ else return 0;
+ }
+ else
+ {
+ dol_print_error($this->db);
+ return -1;
+ }
+ }
+
+
/* Functions for extrafields */
@@ -5059,6 +5130,7 @@ abstract class CommonObject
global $extrafields;
if (empty($rowid)) $rowid = $this->id;
+ if (empty($rowid)) $rowid = $this->rowid;
// To avoid SQL errors. Probably not the better solution though
if (!$this->table_element) {
@@ -5110,7 +5182,6 @@ abstract class CommonObject
$resql = $this->db->query($sql);
if ($resql)
{
- $this->array_options = array();
$numrows = $this->db->num_rows($resql);
if ($numrows)
{
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 1a42c9816b9..37897738c38 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -323,21 +323,44 @@ class Form
* @param object $object Object
* @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field.
* @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)
+ * @param string $check Same coe than $check parameter of GETPOST()
+ * @param string $morecss More CSS
* @return string HTML code for the edit of alternative language
*/
- public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string')
+ public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string', $check = '', $morecss = '')
{
global $conf, $langs;
$result = '';
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) {
- $result ='
';
+ $langcode = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
- $s=picto_from_langcode($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
+ $result .='
';
+ $s=img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang');
$result .= $s;
-
$result .= '
';
+
+ $result .='
';
+
+ $valuetoshow = GETPOSTISSET($fieldname."-".$langcode) ? GETPOST($fieldname."-".$langcode, $check) : '';
+ if (empty($valuetoshow)) {
+ $object->fetchValueForAlternateLanguages();
+ //var_dump($object->array_languages);
+ $valuetoshow = $object->array_languages[$fieldname][$langcode];
+ }
+
+ $s=picto_from_langcode($conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'class="pictoforlang"');
+ $result .= $s;
+ if ($typeofdata == 'textarea') {
+ $result .= '';
+ } else {
+ $result .= ' ';
+ }
+ $result .= '
';
+ $result .= '';
}
return $result;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index e623e92e1c7..09c7c3f420e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3127,11 +3127,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
} else {
$pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
- //if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'address', 'barcode', 'bank', 'bookmark', 'building', 'cash-register', 'check', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
- 'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
+ 'filter', 'file-code', 'grip', 'grip_title', 'language', 'list', 'listlight', 'note',
'object_bookmark', 'object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index 488938a725b..9cfc52fc1de 100644
--- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -190,7 +190,7 @@ class doc_generic_project_odt extends ModelePDFProjects
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($task->table_element, true);
- $task->fetch_optionals($task->id);
+ $task->fetch_optionals();
$resarray = $this->fill_substitutionarray_with_extrafields($task, $resarray, $extrafields, 'task', $outputlangs);
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index d539835d309..485e8733ffa 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1574,8 +1574,8 @@ if ($action == 'create')
$expLine = new ExpeditionLigne($db);
$srcLine = new OrderLine($db);
- $srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline
- //$line->fetch_optionals($line->id);
+ $srcLine->id = $line->id;
+ $srcLine->fetch_optionals(); // fetch extrafields also available in orderline
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1);
@@ -2460,7 +2460,7 @@ elseif ($id || $ref)
if (!empty($conf->stock->enabled)) $colspan++;
$line = $lines[$i];
- $line->fetch_optionals($line->id);
+ $line->fetch_optionals();
if ($action == 'editline' && $line->id == $line_id)
{
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index d78ac9e6261..5b15863cc28 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -399,7 +399,7 @@ class ExpenseReport extends CommonObject
// get extrafields so they will be clone
//foreach($this->lines as $line)
- //$line->fetch_optionals($line->rowid);
+ //$line->fetch_optionals();
// Load source object
$objFrom = clone $this;
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 7738538fb6b..118e21a841c 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -1183,7 +1183,7 @@ class Fichinter extends CommonObject
// get extrafields so they will be clone
foreach ($this->lines as $line)
- $line->fetch_optionals($line->rowid);
+ $line->fetch_optionals();
// Load source object
$objFrom = clone $this;
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 302cf3b47b7..164b3d2152b 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1192,7 +1192,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
{
- $lines[$i]->fetch_optionals($lines[$i]->rowid);
+ $lines[$i]->fetch_optionals();
$array_option = $lines[$i]->array_options;
}
@@ -1514,7 +1514,7 @@ if ($action == 'create')
$objectsrc->fetch_thirdparty();
// Replicate extrafields
- $objectsrc->fetch_optionals($originid);
+ $objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
$projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 329ee266362..dba8f430a08 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -905,6 +905,12 @@ if (empty($reshook))
$objectsrc->fetch($originid);
$objectsrc->fetch_thirdparty();
+ if (!empty($object->origin) && !empty($object->origin_id))
+ {
+ $object->linkedObjectsIds[$object->origin] = $object->origin_id;
+ }
+
+ // Add also link with order if object is reception
if ($object->origin == 'reception')
{
$objectsrc->fetchObjectLinked();
@@ -913,14 +919,10 @@ if (empty($reshook))
{
foreach ($objectsrc->linkedObjectsIds['order_supplier'] as $key => $value)
{
- $object->linked_objects['order_supplier'] = $value;
+ $object->linkedObjectsIds['order_supplier'] = $value;
}
}
}
- elseif (!empty($object->origin) && !empty($object->origin_id))
- {
- $object->linkedObjectsIds[$object->origin] = $object->origin_id;
- }
$id = $object->create($user);
@@ -950,7 +952,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
- $lines[$i]->fetch_optionals($lines[$i]->rowid);
+ $lines[$i]->fetch_optionals();
}
// Dates
@@ -1750,7 +1752,7 @@ if ($action == 'create')
$datedue = ($datetmp == '' ?-1 : $datetmp);
// Replicate extrafields
- $objectsrc->fetch_optionals($originid);
+ $objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
}
else
diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
index 892c2a94f5f..fade1208c9c 100644
--- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
+++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
@@ -122,7 +122,7 @@ create table llx_object_lang
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_object integer DEFAULT 0 NOT NULL,
- type_object varchar(32) NOT NULL,
+ type_object varchar(32) NOT NULL, -- value found into $object->element
property varchar(32) NOT NULL,
lang varchar(5) DEFAULT 0 NOT NULL,
value text,
diff --git a/htdocs/install/mysql/tables/llx_object_lang.sql b/htdocs/install/mysql/tables/llx_object_lang.sql
index 9bbc296d27c..cc4352f3acc 100644
--- a/htdocs/install/mysql/tables/llx_object_lang.sql
+++ b/htdocs/install/mysql/tables/llx_object_lang.sql
@@ -23,8 +23,8 @@ create table llx_object_lang
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_object integer DEFAULT 0 NOT NULL,
- type_object varchar(32) NOT NULL, -- 'thirdparty', 'contact', '...'
- property varchar(32) NOT NULL,
+ type_object varchar(32) NOT NULL, -- value found into $object->element: 'thirdparty', 'contact', '...'
+ property varchar(32) NOT NULL, -- name of property
lang varchar(5) DEFAULT 0 NOT NULL,
value text,
import_key varchar(14) DEFAULT NULL
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 867f73af887..e5233479571 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -1021,4 +1021,5 @@ StatisticsOn=Statistics on
SelectYourGraphOptionsFirst=Select your graph options to build a graph
Measures=Measures
XAxis=X-Axis
-YAxis=Y-Axis
\ No newline at end of file
+YAxis=Y-Axis
+StatusOfRefMustBe=Status of %s must be %s
diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang
index 505fd0a97db..ad91e1eef63 100644
--- a/htdocs/langs/en_US/orders.lang
+++ b/htdocs/langs/en_US/orders.lang
@@ -146,6 +146,7 @@ PDFEratostheneDescription=A complete order model
PDFEdisonDescription=A simple order model
PDFProformaDescription=A complete Proforma invoice template
CreateInvoiceForThisCustomer=Bill orders
+CreateInvoiceForThisSupplier=Bill orders
NoOrdersToInvoice=No orders billable
CloseProcessedOrdersAutomatically=Classify "Processed" all selected orders.
OrderCreation=Order creation
diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php
index b879f3d740f..8102db49f28 100644
--- a/htdocs/livraison/card.php
+++ b/htdocs/livraison/card.php
@@ -515,9 +515,8 @@ else // View
// Other attributes
if ($action == 'create_delivery') {
// copy from expedition
- $expeditionExtrafields = new Extrafields($db);
- $expeditionExtrafieldLabels = $expeditionExtrafields->fetch_name_optionals_label($expedition->table_element);
- if ($expedition->fetch_optionals($object->origin_id) > 0) {
+ $extrafields->fetch_name_optionals_label($expedition->table_element);
+ if ($expedition->fetch_optionals() > 0) {
$object->array_options = array_merge($object->array_options, $expedition->array_options);
}
}
@@ -625,12 +624,14 @@ else // View
$colspan = 2;
$mode = ($object->statut == 0) ? 'edit' : 'view';
- $object->lines[$i]->fetch_optionals($object->lines[$i]->id);
+ $object->lines[$i]->fetch_optionals();
+
if ($action == 'create_delivery') {
$srcLine = new ExpeditionLigne($db);
$extrafields->fetch_name_optionals_label($srcLine->table_element);
- $srcLine->fetch_optionals($expedition->lines[$i]->id);
+ $srcLine->id = $expedition->lines[$i]->id;
+ $srcLine->fetch_optionals();
$object->lines[$i]->array_options = array_merge($object->lines[$i]->array_options, $srcLine->array_options);
}
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index 0b145c7ca10..39f42575e25 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -369,7 +369,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
-print '
'."\n";
+print ''."\n";
// Fields title search
// --------------------------------------------------------------------
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index 83a28d55f48..c67dc9a3aeb 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -1175,8 +1175,9 @@ if ($action == 'create')
$extrafields->fetch_name_optionals_label($srcLine->table_element);
$extrafields->fetch_name_optionals_label($line->table_element);
- $srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline
- $line->fetch_optionals($object->id);
+ $srcLine->id = $line->id;
+ $srcLine->fetch_optionals(); // fetch extrafields also available in orderline
+ $line->fetch_optionals();
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
@@ -1231,7 +1232,7 @@ elseif ($id || $ref)
$soc = new Societe($db);
$soc->fetch($object->socid);
- $res = $object->fetch_optionals($object->id);
+ $res = $object->fetch_optionals();
$head = reception_prepare_head($object);
dol_fiche_head($head, 'reception', $langs->trans("Reception"), -1, 'reception');
@@ -1986,7 +1987,8 @@ elseif ($id || $ref)
{
$colspan = empty($conf->productbatch->enabled) ? 8 : 9;
$line = new CommandeFournisseurDispatch($db);
- $line->fetch_optionals($lines[$i]->id);
+ $line->id = $lines[$i]->id;
+ $line->fetch_optionals();
if ($action == 'editline' && $lines[$i]->id == $line_id)
{
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 0381892d9e3..2814b7e1d11 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -477,7 +477,7 @@ class Reception extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($this->table_element, true);
- $this->fetch_optionals($this->id);
+ $this->fetch_optionals();
/*
* Lines
diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php
index 769f67db44b..b10c2ffe295 100644
--- a/htdocs/reception/index.php
+++ b/htdocs/reception/index.php
@@ -122,7 +122,7 @@ if ($resql)
}
}
else {
- print ''.$langs->trans("None").' ';
+ print ''.$langs->trans("None").' ';
}
print "
";
@@ -196,7 +196,7 @@ else dol_print_error($db);
/*
- * Supplier orders to process
+ * Open pruchase orders to process
*/
$sql = "SELECT c.rowid, c.ref, c.ref_supplier as ref_supplier, c.fk_statut as status, c.billed as billed, s.nom as name, s.rowid as socid";
@@ -221,7 +221,7 @@ if ($resql)
print '';
print '
';
print '';
- print ''.$langs->trans("SuppliersOrdersToProcess").' ';
+ print ''.$langs->trans("SuppliersOrdersToProcess").' '.$num.' ';
while ($i < $num)
{
$obj = $db->fetch_object($resql);
diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php
index de558a6bee4..7b2ce169d33 100644
--- a/htdocs/reception/list.php
+++ b/htdocs/reception/list.php
@@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
-$langs->loadLangs(array("sendings", "receptions", "deliveries", 'companies', 'bills'));
+$langs->loadLangs(array("sendings", "receptions", "deliveries", 'companies', 'bills', 'orders'));
$socid = GETPOST('socid', 'int');
$massaction = GETPOST('massaction', 'alpha');
@@ -172,7 +172,7 @@ if (empty($reshook))
$rcp = new Reception($db);
// On ne facture que les réceptions validées
if ($rcp->fetch($id_reception) <= 0 || $rcp->statut != 1) {
- $errors[] = $langs->trans('StatusMustBeValidate', $rcp->ref);
+ $errors[] = $langs->trans('StatusOfRefMustBe', $rcp->ref, $langs->transnoentities("StatusSupplierOrderValidatedShort"));
$error++;
continue;
}
@@ -184,12 +184,12 @@ if (empty($reshook))
if (!empty($object->rowid))$object->fetchObjectLinked();
$rcp->fetchObjectLinked();
- if (count($rcp->linkedObjectsIds['order_supplier']) > 0)
+ if (count($rcp->linkedObjectsIds['reception']) > 0)
{
- foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value)
+ foreach ($rcp->linkedObjectsIds['reception'] as $key => $value)
{
- if (empty($object->linkedObjectsIds['order_supplier']) || !in_array($value, $object->linkedObjectsIds['order_supplier']))//Dont try to link if already linked
- $object->add_object_linked('order_supplier', $value); // add supplier order linked object
+ if (empty($object->linkedObjectsIds['reception']) || !in_array($value, $object->linkedObjectsIds['reception']))//Dont try to link if already linked
+ $object->add_object_linked('reception', $value); // add supplier order linked object
}
}
}
@@ -216,11 +216,11 @@ if (empty($reshook))
$object->origin_id = $id_reception;
$rcp->fetchObjectLinked();
- if (count($rcp->linkedObjectsIds['order_supplier']) > 0)
+ if (count($rcp->linkedObjectsIds['reception']) > 0)
{
- foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value)
+ foreach ($rcp->linkedObjectsIds['reception'] as $key => $value)
{
- $object->linked_objects['order_supplier'] = $value;
+ $object->linked_objects['reception'] = $value;
}
}
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 22da0cd0545..b3fb0f4c0b7 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -1193,7 +1193,7 @@ else
print '';
// Name, firstname
- print '';
+ print ' ';
if ($object->particulier || $private)
{
print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').' ';
@@ -1204,7 +1204,7 @@ else
}
print ' global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>';
print ' ';
- print $form->widgetForTranslation("name", $object, $permissiontoadd);
+ print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300');
print ' ';
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
@@ -1304,10 +1304,11 @@ else
print '';
print $form->editfieldkey('Address', 'address', '', $object, 0);
print ' ';
- print ' ';
// Zip / Town
@@ -1315,9 +1316,9 @@ else
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent');
print '';
if ($conf->browser->layout == 'phone') print '';
- print ''.$form->editfieldkey('Town', 'town', '', $object, 0).' ';
+ print ' '.$form->editfieldkey('Town', 'town', '', $object, 0).' ';
print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent');
- print $form->widgetForTranslation("town", $object, $permissiontoadd);
+ print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent');
print ' ';
// Country
diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php
index c961b04d8ce..2b362268c4b 100644
--- a/htdocs/societe/contact.php
+++ b/htdocs/societe/contact.php
@@ -141,7 +141,7 @@ llxHeader('', $title, $help_url);
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
-if (!empty($object->id)) $res = $object->fetch_optionals($object->id, null);
+if (!empty($object->id)) $res = $object->fetch_optionals();
//if ($res < 0) { dol_print_error($db); exit; }
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index 2c23f578fb4..9d50d98e243 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -1106,7 +1106,7 @@ if ($action == 'create')
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
// Replicate extrafields
- $objectsrc->fetch_optionals($originid);
+ $objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
if (!empty($conf->multicurrency->enabled))
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 2be4ec32f0b..26117632dcd 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -638,10 +638,10 @@ body[class*="colorblind-"] .text-success{
color :
}
-.editfielda span.fa-pencil-alt, .editfielda span.fa-trash {
+.editfielda span.fa-pencil-alt, .editfielda span.fa-trash, .editfieldlang {
color: #ccc !important;
}
-.editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover {
+.editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover, .editfieldlang:hover {
color: var(--colortexttitle) !important;
}
@@ -2819,7 +2819,7 @@ div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border
}
div .tdtop {
vertical-align: top !important;
- /* padding-top: 8px !important; */
+ padding-top: 10px !important;
padding-bottom: 2px !important;
padding-bottom: 0px;
}