Skip to content

Commit

Permalink
Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 1, 2019
2 parents 3fc49a9 + a2ab634 commit 9d03f4b
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 69 deletions.
2 changes: 1 addition & 1 deletion htdocs/core/menus/standard/eldy.lib.php
Expand Up @@ -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);
}
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/fichinter/card-rec.php
Expand Up @@ -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';
Expand Down
141 changes: 76 additions & 65 deletions htdocs/fichinter/list.php
Expand Up @@ -69,8 +69,9 @@
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'));
Expand Down Expand Up @@ -101,17 +102,17 @@

// 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))
Expand Down Expand Up @@ -177,10 +178,22 @@
$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 : '');
Expand All @@ -190,7 +203,7 @@
$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').")";
Expand Down Expand Up @@ -254,16 +267,16 @@
}

$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';

Expand Down Expand Up @@ -324,8 +337,6 @@
print '</div>';
}

$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 '<div class="div-table-responsive">';
Expand All @@ -350,19 +361,6 @@
print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">';
print '</td>';
}
if (! empty($arrayfields['fd.description']['checked']))
{
// Desc of line
print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['fd.date']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['fd.duree']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';

Expand Down Expand Up @@ -392,6 +390,19 @@
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1);
print '</td>';
}
// Fields of detail line
if (! empty($arrayfields['fd.description']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['fd.date']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['fd.duree']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
Expand All @@ -400,21 +411,21 @@
print "</tr>\n";

print '<tr class="liste_titre">';
if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre("Description",$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre('',$_SERVER["PHP_SELF"],'');
if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre("Duration",$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'] ,$_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'] ,$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($arrayfields['f.description']['label'] ,$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre("DateCreationShort",$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre("DateModificationShort",$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'] ,$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'] ,$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre($arrayfields['fd.description']['label'],$_SERVER["PHP_SELF"],'');
if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($arrayfields['fd.date']['label'] ,$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre($arrayfields['fd.duree']['label'] ,$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";

Expand Down Expand Up @@ -483,24 +494,6 @@
print '<td>'.dol_trunc(dolGetFirstLineOfText($obj->description),48).'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['fd.description']['checked']))
{
//print '<td>'.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($obj->descriptiondetail)),48).'</td>';
print '<td>'.dolGetFirstLineOfText($obj->descriptiondetail).'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['fd.date']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'dayhour')."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['fd.duree']['checked']))
{
print '<td align="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield'];
$totalarray['totalduration']+=$obj->duree;
}

// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
Expand Down Expand Up @@ -530,6 +523,24 @@
print '<td align="right">'.$objectstatic->LibStatut($obj->fk_statut,5).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Fields of detail of line
if (! empty($arrayfields['fd.description']['checked']))
{
print '<td>'.dolGetFirstLineOfText($obj->descriptiondetail).'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['fd.date']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'dayhour')."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['fd.duree']['checked']))
{
print '<td align="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield'];
$totalarray['totalduration']+=$obj->duree;
}
// Action column
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
Expand Down
3 changes: 3 additions & 0 deletions htdocs/langs/en_US/main.lang
Expand Up @@ -222,6 +222,9 @@ Info=Log
Family=Family
Description=Description
Designation=Description
DescriptionOfLine=Description of line
DateOfLine=Date of line
DurationOfLine=Duration of line
Model=Doc template
DefaultModel=Default doc template
Action=Event
Expand Down

0 comments on commit 9d03f4b

Please sign in to comment.