From b2aafb37f38aa078ca252ffaff8df4e9574f4bb7 Mon Sep 17 00:00:00 2001 From: UltraViolet33 <93035200+UltraViolet33@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:47:49 +0200 Subject: [PATCH] Fix agenda event type label instead of event type code on actionComm card (#31106) * Fix display agenda event type label instead of event type code when event type code has no translation In a ActionComm card, if we use agenda event types, the type of event displayed is the event code if this event code has no translation. Now, if there is no translation, the label of the event type is displayed instead of the code. * fix for PHPStan * fix for PHPStan * fix for PHPStan * fix for PHPStan --------- Co-authored-by: Ulysse Valdenaire Co-authored-by: Laurent Destailleur --- htdocs/comm/action/card.php | 5 +++-- htdocs/comm/action/class/actioncomm.class.php | 1 + htdocs/product/stock/replenish.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 49051464614..5fffaba8636 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -2336,12 +2336,13 @@ if ($id > 0) { // Type if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { print ''.$langs->trans("Type").''; - $labeltoshow = $langs->trans("Action".$object->type_code); + $labeltype = ($langs->transnoentities("Action".$object->type_code) != "Action".$object->type_code) ? $langs->transnoentities("Action".$object->type_code) : $object->type_label; + $labeltoshow = $labeltype; if ($object->code) { $labeltoshow .= ' ('.$object->code.')'; } print $object->getTypePicto('pictofixedwidth paddingright', $labeltoshow); - print $langs->trans("Action".$object->type_code); + print $labeltype; print ''; } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 5a8db497980..1b253bc5aab 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -845,6 +845,7 @@ class ActionComm extends CommonObject $this->type_color = $obj->type_color; $this->type_picto = $obj->type_picto; $this->type = $obj->type_type; + $this->type_label = $obj->type_label; $this->code = $obj->code; $this->label = $obj->label; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index d3c6406672c..71b076cea98 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -201,7 +201,7 @@ if ($action == 'order' && GETPOST('valid') && $user->hasRight('fournisseur', 'co // If we use multicurrency if (isModEnabled('multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code != $conf->currency) { $line->multicurrency_code = $productsupplier->fourn_multicurrency_code; - $line->fk_multicurrency = $productsupplier->fourn_multicurrency_id; + $line->fk_multicurrency = (int) $productsupplier->fourn_multicurrency_id; $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice; }