From 96d087c99dcda3a0cd0344618d80fcbbb7fad95a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Apr 2020 02:59:33 +0200 Subject: [PATCH] Fix clean event report --- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/core/modules/action/rapport.pdf.php | 30 +++++++++++-------- htdocs/theme/eldy/info-box.inc.php | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 03a78a95f9f..66df0ea1ae3 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1397,7 +1397,7 @@ class ActionComm extends CommonObject if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL'); } - $tooltip = ''.$langs->trans('ShowAction').''; + $tooltip = ''.$langs->trans('Action').''; if (!empty($this->ref)) $tooltip .= '
'.$langs->trans('Ref').': '.$this->ref; if (!empty($label)) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9cad793ba3d..7f52195297b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1295,7 +1295,7 @@ class Contact extends CommonObject $label .= '
'; } - $label .= ''.$langs->trans("ShowContact").''; + $label .= ''.$langs->trans("Contact").''; $label .= '
'.$langs->trans("Name").': '.$this->getFullName($langs); //if ($this->civility_id) $label.= '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code if (!empty($this->poste)) $label .= '
'.$langs->trans("Poste").': '.$this->poste; diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 25b8d8e9788..b8b458c4b2a 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -141,8 +141,11 @@ class CommActionRapport $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); - $parameters = array('file'=>$file, 'outputlangs'=>$outputlangs); + global $action; + $object = new stdClass(); + + $parameters = array('file'=>$file, 'outputlangs'=>$outputlangs); $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $pdf = pdf_getInstance($this->format); @@ -171,7 +174,7 @@ class CommActionRapport $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right - $nbpage = $this->_pages($pdf, $outputlangs); + $nbpage = $this->_pages($pdf, $outputlangs); // Write content if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); @@ -258,21 +261,23 @@ class CommActionRapport // Calculate height of text $text = ''; - if (!preg_match('/^'.preg_quote($obj->label).'/', $obj->note)) $text = $obj->label."\n"; - $text .= $obj->note; - $text = dol_trunc(dol_htmlentitiesbr_decode($text), 150); + if (!preg_match('/^'.preg_quote($obj->label, '/').'/', $obj->note)) $text = $obj->label."\n"; + $text .= dolGetFirstLineOfText(dol_string_nohtmltag($obj->note), 2); // Add status to text $text .= "\n"; - $status = dol_htmlentitiesbr_decode($eventstatic->getLibStatut(1, 1)); + $status = $outputlangs->trans("Status").': '.dol_htmlentitiesbr_decode($eventstatic->getLibStatut(1, 1)); $text .= $status; if ($obj->fk_project > 0) { $projectstatic->fetch($obj->fk_project); - $text .= ($status ? ' - ' : '').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode($projectstatic->getNomUrl(0, 'nolink')); + if ($projectstatic->ref) { + $text .= ($status ? ' - ' : '').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode($projectstatic->ref); + } } //print 'd'.$text; exit; $nboflines = dol_nboflines($text); + $heightlinemax = max(2 * $height, $nboflines * $height); // Check if there is enough space to print record if ((1 + $y + $heightlinemax) >= ($this->page_hauteur - $this->marge_haute)) @@ -294,12 +299,13 @@ class CommActionRapport else $textdate .= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour"); } - $pdf->MultiCell(22, $height, $textdate, 0, 'L', 0); + $textdate = $outputlangs->trans("ID").' '.$obj->id.' - '.$textdate; + $pdf->MultiCell(45 - $this->marge_gauche, $height, $textdate, 0, 'L', 0); $y0 = $pdf->GetY(); // Third party - $pdf->SetXY(26, $y); - $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->thirdparty), 32), 0, 'L', 0); + $pdf->SetXY(45, $y); + $pdf->MultiCell(28, $height, dol_trunc($outputlangs->convToOutputCharset($obj->thirdparty), 28), 0, 'L', 0); $y1 = $pdf->GetY(); // Action code @@ -309,7 +315,7 @@ class CommActionRapport if ($code == 'AC_OTH') $code = 'AC_MANUAL'; if ($code == 'AC_OTH_AUTO') $code = 'AC_AUTO'; } - $pdf->SetXY(60, $y); + $pdf->SetXY(73, $y); $labelactiontype = $outputlangs->transnoentitiesnoconv("Action".$code); $labelactiontypeshort = $outputlangs->transnoentitiesnoconv("Action".$code.'Short'); $pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($labelactiontypeshort == "Action".$code.'Short' ? $labelactiontype : $labelactiontypeshort), 32), 0, 'L', 0); @@ -317,7 +323,7 @@ class CommActionRapport // Description of event $pdf->SetXY(106, $y); - $pdf->MultiCell(94, $height, $outputlangs->convToOutputCharset($text), 0, 'L', 0); + $pdf->MultiCell(94, $height, $outputlangs->convToOutputCharset(dol_string_nohtmltag($text, 0)), 0, 'L', 0); $y3 = $pdf->GetY(); $i++; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 312521fe829..05657e3d850 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -208,7 +208,7 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infoxbox-action{ - color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; + color: global->THEME_AGRESSIVENESS_RATIO); ?> !important; } .bg-infoxbox-propal, .bg-infoxbox-facture,