diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index adb54c7434f..eb432b0dc72 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -393,7 +393,7 @@ print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine=0; -foreach ($extrafields->attribute_computed as $key => $val) +foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object } diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 697f3becd9b..8ea4f46c89d 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -407,7 +407,7 @@ print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine=0; -foreach ($extrafields->attribute_computed as $key => $val) +foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object } diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 7913d1f8dea..7faa2727ae4 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -117,8 +117,6 @@ if (GETPOST("orphelins", "alpha")) $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code"; - // Add fields for extrafields - foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook @@ -139,8 +137,6 @@ else $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,"; $sql.= " s.rowid as socid, s.nom as name, s.email"; - // Add fields for extrafields - foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 9b3304560d9..6a9bc0c9f29 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -596,7 +596,7 @@ abstract class CommonDocGenerator $line->fetch_optionals(); $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs); - + // Check if the current line belongs to a supplier order if (get_class($line) == 'CommandeFournisseurLigne') { @@ -606,7 +606,7 @@ abstract class CommonDocGenerator $columns = ""; foreach ($extralabels as $key => $value) $columns .= "$key, "; - + if ($columns != "") { $columns = substr($columns, 0, strlen($columns) - 2); @@ -843,7 +843,7 @@ abstract class CommonDocGenerator $id = $object->array_options['options_'.$key]; if ($id != "") { - $param = $extrafields->attribute_param[$key]; + $param = $extrafields->attributes[$object->table_element]['param'][$key]; $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath' $InfoFieldList = explode(":", $param_list[0]); $classname=$InfoFieldList[0]; diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index d1b1dfe1093..976b571081e 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -302,10 +302,10 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { ); print '' . "\n"; } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) { - print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); + print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key]); print '' . "\n"; } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) { - print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); + print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key]); print '' . "\n"; } else { print ''; @@ -499,10 +499,10 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { ); print '
' . "\n"; } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) { - print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); + print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key . '_cnct']); print '' . "\n"; } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) { - print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); + print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key . '_cnct']); print '' . "\n"; } else { print ''; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index fd2a7c70c13..3be66f6acfe 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -216,7 +216,9 @@ $sql.= " p.ref as product_ref,"; $sql.= " p.label as product_label,"; $sql.= " p.tobatch"; // Add fields for extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$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.' as options_'.$key.', ' : ''); +} // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index a7d7c51b7b1..a2d2f494fc3 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -473,7 +473,7 @@ foreach ($search_array_options as $key => $val) { $crit=$val; $tmpkey=preg_replace('/search_options_/', '', $key); - $typ=$extrafields->attribute_type[$tmpkey]; + $typ=$extrafields->attributes[$object->table_element]['type'][$tmpkey]; $mode=0; if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 0f003f05eb6..ae1b4ffb7f7 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -71,7 +71,7 @@ foreach ($search_array_options as $key => $val) { $crit=$val; $tmpkey=preg_replace('/search_options_/', '', $key); - $typ=$extrafields->attribute_type[$tmpkey]; + $typ=$extrafields->attributes[$object->table_element]['type'][$tmpkey]; if ($val != '') { $param.='&search_options_'.$tmpkey.'='.urlencode($val); } diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 6878ea8ed44..5e199722961 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -428,14 +428,6 @@ print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', print ''."\n"; -// Detect if we need a fetch on each output line -$needToFetchEachLine=0; -foreach ($extrafields->attribute_computed as $key => $val) -{ - if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object -} - - // Detect if we need a fetch on each output line $needToFetchEachLine=0; if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)