diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 20b7b23a857..d6e9a7276e0 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -929,7 +929,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) $sql = "SELECT a.id, a.label,"; $sql.= " a.datep as dp,"; - $sql.= " a.datea as da,"; + $sql.= " a.datep2 as dp2,"; $sql.= " a.percent,"; $sql.= " a.fk_user_author, a.fk_contact,"; $sql.= " a.fk_element, a.elementtype,"; @@ -970,10 +970,20 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) $obj = $db->fetch_object($result); $datep=$db->jdate($obj->dp); + $datep2=$db->jdate($obj->dp2); $out.=""; - $out.=''.dol_print_date($datep,'dayhour')."\n"; + $out.=''; + $out.=dol_print_date($datep,'dayhour'); + if ($datep2 && $datep2 != $datep) + { + $tmpa=dol_getdate($datep); + $tmpb=dol_getdate($datep2); + if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out.='-'.dol_print_date($datep2,'hour'); + else $out.='-'.dol_print_date($datep2,'dayhour'); + } + $out.="\n"; // Picto warning $out.=''; @@ -1103,7 +1113,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) 'type'=>'action', 'id'=>$obj->id, 'datestart'=>$db->jdate($obj->dp), - 'date'=>$db->jdate($obj->dp2), + 'dateend'=>$db->jdate($obj->dp2), 'note'=>$obj->label, 'percent'=>$obj->percent, 'acode'=>$obj->acode, @@ -1154,7 +1164,8 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) $histo[$numaction]=array( 'type'=>'mailing', 'id'=>$obj->id, - 'date'=>$db->jdate($obj->da), + 'datestart'=>$db->jdate($obj->da), + 'dateend'=>$db->jdate($obj->da), 'note'=>$obj->note, 'percent'=>$obj->percentage, 'acode'=>$obj->acode, @@ -1217,8 +1228,14 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) // Champ date $out.=''; - if ($histo[$key]['date']) $out.=dol_print_date($histo[$key]['date'],'dayhour'); - else if ($histo[$key]['datestart']) $out.=dol_print_date($histo[$key]['datestart'],'dayhour'); + $out.=dol_print_date($histo[$key]['datestart'],'dayhour'); + if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) + { + $tmpa=dol_getdate($histo[$key]['datestart']); + $tmpb=dol_getdate($histo[$key]['dateend']); + if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out.='-'.dol_print_date($histo[$key]['dateend'],'hour'); + else $out.='-'.dol_print_date($histo[$key]['dateend'],'dayhour'); + } $out.="\n"; // Picto @@ -1251,6 +1268,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) // Objet lie // TODO uniformize $out.=''; + //var_dump($histo[$key]['elementtype']); if (isset($histo[$key]['elementtype'])) { if ($histo[$key]['elementtype'] == 'propal' && ! empty($conf->propal->enabled)) @@ -1259,13 +1277,13 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) $propalstatic->id=$histo[$key]['fk_element']; $out.=$propalstatic->getNomUrl(1); } - elseif ($histo[$key]['elementtype'] == 'commande' && ! empty($conf->commande->enabled)) + elseif (($histo[$key]['elementtype'] == 'order' || $histo[$key]['elementtype'] == 'commande') && ! empty($conf->commande->enabled)) { $orderstatic->ref=$langs->trans("Order"); $orderstatic->id=$histo[$key]['fk_element']; $out.=$orderstatic->getNomUrl(1); } - elseif ($histo[$key]['elementtype'] == 'facture' && ! empty($conf->facture->enabled)) + elseif (($histo[$key]['elementtype'] == 'invoice' || $histo[$key]['elementtype'] == 'facture') && ! empty($conf->facture->enabled)) { $facturestatic->ref=$langs->trans("Invoice"); $facturestatic->id=$histo[$key]['fk_element'];