Finish removing of ->attribute_label

This commit is contained in:
Laurent Destailleur 2019-11-02 17:26:26 +01:00
parent ec9ce1721b
commit 89f1904793
4 changed files with 8 additions and 7 deletions

View File

@ -268,7 +268,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typ
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";

View File

@ -1065,9 +1065,10 @@ if ($resql)
}
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
$element = 'banktransaction';
if (is_array($extrafields->attributes[$element]['label']) && count($extrafields->attributes[$element]['label']))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attributes[$element]['label'] as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{

View File

@ -512,9 +512,8 @@ if (! $sall)
$sql.= " p.rowid, p.ref, p.title";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
{
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
}
}
else

View File

@ -1586,7 +1586,7 @@ class ExtraFields
* @param string $key Key of attribute
* @param string $value Value to show
* @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering)
* @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data
* @param string $extrafieldsobjectkey If defined (for example $object->table_element), function uses the new method to get extrafields data
* @return string Formated value
*/
public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '')
@ -1611,6 +1611,7 @@ class ExtraFields
}
else // Old usage
{
//dol_syslog("Warning: parameter 'extrafieldsobjectkey' is missing", LOG_WARNING);
$label=$this->attribute_label[$key];
$type=$this->attribute_type[$key];
$size=$this->attribute_size[$key];