From 898aebdbf8a1a3fb861d3495a5190c2102cffda3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Mar 2024 12:06:57 +0100 Subject: [PATCH] Fix missing tooltip --- htdocs/compta/facture/card.php | 29 ++++++++++++----------- htdocs/core/class/commoninvoice.class.php | 1 - 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 66afe9fcb73..89a8fe99d84 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5954,23 +5954,24 @@ if ($action == 'create') { // Delete $isErasable = $object->is_erasable(); + $htmltooltip = ''; + if ($isErasable == -4) { + $htmltooltip = $langs->trans('DisabledBecausePayments'); + } elseif ($isErasable == -3) { + $htmltooltip = $langs->trans('DisabledBecauseNotLastSituationInvoice'); + } elseif ($isErasable == -2) { + $htmltooltip = $langs->trans('DisabledBecauseNotLastInvoice'); + } elseif ($isErasable == -1) { + $htmltooltip = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); + } elseif ($isErasable <= 0) { // Any other cases + $htmltooltip = $langs->trans('DisabledBecauseNotErasable'); + } elseif ($objectidnext) { + $htmltooltip = $langs->trans('DisabledBecauseReplacedInvoice'); + } if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions) $enableDelete = false; $deleteHref = '#'; - $htmltooltip = ''; - if ($isErasable == -4) { - $htmltooltip = $langs->trans('DisabledBecausePayments'); - } elseif ($isErasable == -3) { - $htmltooltip = $langs->trans('DisabledBecauseNotLastSituationInvoice'); - } elseif ($isErasable == -2) { - $htmltooltip = $langs->trans('DisabledBecauseNotLastInvoice'); - } elseif ($isErasable == -1) { - $htmltooltip = $langs->trans('DisabledBecauseDispatchedInBookkeeping'); - } elseif ($isErasable <= 0) { // Any other cases - $htmltooltip = $langs->trans('DisabledBecauseNotErasable'); - } elseif ($objectidnext) { - $htmltooltip = $langs->trans('DisabledBecauseReplacedInvoice'); - } else { + if ($isErasable > 0 && ! $objectidnext) { $deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken(); $enableDelete = true; } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 708e198ac98..a32425ceef4 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -551,7 +551,6 @@ abstract class CommonInvoice extends CommonObject public function is_erasable() { // phpcs:enable - global $conf; // We check if invoice is a temporary number (PROVxxxx) $tmppart = substr($this->ref, 1, 4);