Merge pull request #6336 from atm-florian/5.0_fix

fix : wrong $formproject->select_projects call on model invoice
This commit is contained in:
Laurent Destailleur 2017-01-27 00:21:51 +01:00 committed by GitHub
commit 9281cb9f8a
4 changed files with 12 additions and 9 deletions

View File

@ -983,7 +983,7 @@ if ($action == 'create')
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td>';
$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 ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id)?'&id='.$id:'')).'">' . $langs->trans("AddProject") . '</a>';
print '</td></tr>';
}

View File

@ -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();

View File

@ -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.",";
}
}

View File

@ -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]
);
}
}
}