diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index 584d3915430..41fe096d974 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -983,7 +983,7 @@ if ($action == 'create')
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
$langs->load('projects');
print '
| ' . $langs->trans('Project') . ' | ';
- $numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, $forceaddid=0, $morecss='');
+ $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
print ' thirdparty->id.(!empty($id)?'&id='.$id:'')).'">' . $langs->trans("AddProject") . '';
print ' |
';
}
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 849a466e18d..6c6b55ee949 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -272,7 +272,7 @@ $sql.= " state.code_departement, state.nom";
// Add where from extra fields
foreach ($extrafields->attribute_label as $key => $val)
{
- $sql .= ', ef.'.$val;
+ $sql .= ', ef.'.$key;
}
// Add where from hooks
$parameters=array();
diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php
index 2cf93493739..6e418e2e649 100644
--- a/htdocs/resource/class/dolresource.class.php
+++ b/htdocs/resource/class/dolresource.class.php
@@ -460,7 +460,7 @@ class Dolresource extends CommonObject
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
if (is_array($extralabels) && count($extralabels)>0) {
- foreach($extralabels as $label=>$code) {
+ foreach($extralabels as $code=>$label) {
$sql.= " ef.".$code." as extra_".$code.",";
}
}
diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php
index b2ef82cf8c1..2c97b68f7ed 100644
--- a/htdocs/resource/list.php
+++ b/htdocs/resource/list.php
@@ -119,12 +119,15 @@ $arrayfields = array(
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
foreach ( $extrafields->attribute_label as $key => $val ) {
- $arrayfields["ef." . $key] = array(
- 'label' => $extrafields->attribute_label[$key],
- 'checked' => $extrafields->attribute_list[$key],
- 'position' => $extrafields->attribute_pos[$key],
- 'enabled' => $extrafields->attribute_perms[$key]
- );
+ $typeofextrafield=$extrafields->attribute_type[$key];
+ if ($typeofextrafield!='separate') {
+ $arrayfields["ef." . $key] = array(
+ 'label' => $extrafields->attribute_label[$key],
+ 'checked' => $extrafields->attribute_list[$key],
+ 'position' => $extrafields->attribute_pos[$key],
+ 'enabled' => $extrafields->attribute_perms[$key]
+ );
+ }
}
}