diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 77dd2bbf5f8..7a43aa43d60 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -833,7 +833,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200); $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201); $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202); - $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ModelList"), 1, $user->rights->ficheinter->lire, '', '', '', 203); + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ModelList"), 1, $user->rights->ficheinter->lire, '', '', '', 203); $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); } } diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 62e16c0e483..a3ef52483e1 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -25,9 +25,9 @@ */ /** - * \file fichinter/card-rec.php - * \ingroup fichinter - * \brief Page to show predefined fichinter + * \file fichinter/card-rec.php + * \ingroup intervention + * \brief Page to show predefined fichinter */ require '../main.inc.php'; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 9ffcef5b6b2..c7ae3234680 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -69,8 +69,9 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) { - if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sortfield="fd.date"; - else $sortfield="f.ref"; + //if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sortfield="fd.date"; + //else + $sortfield="f.ref"; } $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); @@ -101,17 +102,17 @@ if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall[ // Definition of fields for list $arrayfields=array( - 'f.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), - 'f.fk_project'=>array('label'=>$langs->trans("Project"), 'checked'=>1), - 'f.fk_contrat'=>array('label'=>$langs->trans("Contract"), 'checked'=>1), - 'f.description'=>array('label'=>$langs->trans("Description"), 'checked'=>1), - 'fd.description'=>array('label'=>"xx", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), - 'fd.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), - 'fd.duree'=>array('label'=>$langs->trans("Duration"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), - 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'f.ref'=>array('label'=>'Ref', 'checked'=>1), + 's.nom'=>array('label'=>'ThirdParty', 'checked'=>1), + 'f.fk_project'=>array('label'=>'Project', 'checked'=>1), + 'f.fk_contrat'=>array('label'=>'Contract', 'checked'=>1), + 'f.description'=>array('label'=>'Description', 'checked'=>1), + 'f.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>500), + 'f.tms'=>array('label'=>'DateModificationShort', 'checked'=>0, 'position'=>500), + 'f.fk_statut'=>array('label'=>'Status', 'checked'=>1, 'position'=>1000), + 'fd.description'=>array('label'=>"DescriptionOfLine", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'fd.date'=>array('label'=>'DateOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), + 'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), ); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -177,10 +178,22 @@ $companystatic=new Societe($db); $title=$langs->trans("ListOfInterventions"); llxHeader('', $title); +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + +$atleastonefieldinlines=0; +foreach($arrayfields as $tmpkey => $tmpval) +{ + if (preg_match('/^fd\./', $tmpkey) && ! empty($arrayfields[$tmpkey]['checked'])) + { + $atleastonefieldinlines++; + break; + } +} $sql = "SELECT"; $sql.= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,"; -if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " fd.description as descriptiondetail, fd.date as dp, fd.duree,"; +if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql.= "fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,"; $sql.= " s.nom as name, s.rowid as socid, s.client"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); @@ -190,7 +203,7 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinter_extrafields as ef on (f.rowid = ef.fk_object)"; -if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; +if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE f.entity IN (".getEntity('intervention').")"; @@ -254,16 +267,16 @@ if ($resql) } $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($sall) $urlparam.="&sall=".$sall; - if ($socid) $param.="&socid=".$socid; - if ($search_ref) $param.="&search_ref=".urlencode($search_ref); + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sall) $param.="&sall=".urlencode($sall); + if ($socid) $param.="&socid=".urlencode($socid); + if ($search_ref) $param.="&search_ref=".urlencode($search_ref); if ($search_company) $param.="&search_company=".urlencode($search_company); - if ($search_desc) $param.="&search_desc=".urlencode($search_desc); + if ($search_desc) $param.="&search_desc=".urlencode($search_desc); if ($search_status != '' && $search_status > -1) $param.="&search_status=".urlencode($search_status); - if ($show_files) $param.='&show_files=' .$show_files; - if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($show_files) $param.='&show_files='.urlencode($show_files); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -324,8 +337,6 @@ if ($resql) print ''; } - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '