From fdce9453bc2a06da49dc6438f4f9dda9c1e7dd4d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Feb 2026 18:40:36 +0100 Subject: [PATCH] Make array of dispute status a shared constant --- htdocs/compta/facture/card.php | 4 ++-- htdocs/compta/facture/list.php | 6 +++--- htdocs/core/class/commoninvoice.class.php | 7 +++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 58a8e1ca11e..08fce200645 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5601,10 +5601,10 @@ if ($action == 'create') { } print ''; print ''; - $liststatus = array('0' => "None", '1' => "DisputeOpen", '8' => "DisputeLost", '9' => "DisputeWon"); + $liststatus = Facture::ARRAY_OF_DISPUTE_STATUS; if ($action != 'editdispute_status') { if ($object->dispute_status) { - print $langs->trans($liststatus[$object->dispute_status]); + print $langs->trans($liststatus[$object->dispute_status]['label']); } } else { print '
'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 179288e36e5..48dbc0b54d5 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1961,7 +1961,7 @@ if (!empty($arrayfields['f.import_key']['checked'])) { // Dispute status if (!empty($arrayfields['f.dispute_status']['checked'])) { print ''; - $liststatus = array('0' => "None", '1' => "DisputeOpen", '8' => "DisputeLost", '9' => "DisputeWon"); + $liststatus = Facture::ARRAY_OF_DISPUTE_STATUS; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print $form->selectarray('search_dispute_status', $liststatus, $search_dispute_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status width100 onrightofpage', 1); print ''; @@ -3094,8 +3094,8 @@ if ($num > 0) { if (!empty($arrayfields['f.dispute_status']['checked'])) { print ''; if ($facturestatic->dispute_status) { - $liststatus = array('0' => "None", '1' => "DisputeOpen", '8' => "DisputeLost", '9' => "DisputeWon"); - print $langs->trans($liststatus[$facturestatic->dispute_status]); + $liststatus = Facture::ARRAY_OF_DISPUTE_STATUS; + print $langs->trans($liststatus[$facturestatic->dispute_status]['label']); } print ""; if (!$i) { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 12f4b8e23f6..a0cda142714 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -291,6 +291,13 @@ abstract class CommonInvoice extends CommonObject const CLOSECODE_ABANDONED = 'abandon'; // Abandoned (no payment at all) - other const CLOSECODE_REPLACED = 'replaced'; // Abandoned (no payment at all) - replacedby another invoice (feature disabled by default) + const ARRAY_OF_DISPUTE_STATUS = array( + 0 => array('label' => "None"), + 1 => array('label' => "DisputeOpen"), + 8 => array('label' => "DisputeLost"), + 9 => array('label' => "DisputeWon") + ); + /** * Return remain amount to pay. Property ->id and ->total_ttc must be set.