From 7c11750aa35ca469a44a6a53c6682733d047537e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Wed, 21 Apr 2010 08:35:11 +0000 Subject: [PATCH] Fix: Conditions to reopen closed invoice. --- htdocs/compta/facture.php | 19 ++----------------- htdocs/fourn/facture/fiche.php | 19 +++++++++---------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d22e532d837..9007e0413b1 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3308,24 +3308,9 @@ else } // Reopen a standard paid invoice - if ($fac->type == 1 && $fac->statut == 2) // A paid invoice (partially or completely) + if (($fac->type == 0 || $fac->type == 1) && ($fac->statut == 2 || $fac->statut == 3)) // A paid invoice (partially or completely) { - if (! $facidnext) - { - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>'; - } - else - { - print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>'; - } - } - - // Reopen a classified invoice - if (($fac->statut == 2 || $fac->statut == 3) && // Closed invoice - $fac->getIdReplacingInvoice() == 0 && // Not replaced by another invoice - $fac->close_code != 'replaced') // Not replaced by another invoice - { - if (! $facidnext) + if (! $facidnext && $fac->close_code != 'replaced') // Not replaced by another invoice { print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>'; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 187836a0d8f..3c3da65807f 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1189,17 +1189,16 @@ else print '<div class="tabsAction">'; // Reopen a standard paid invoice - if ($fac->type == 1 && $fac->statut == 2) // A paid invoice (partially or completely) + if (($fac->type == 0 || $fac->type == 1) && ($fac->statut == 2 || $fac->statut == 3)) // A paid invoice (partially or completely) { - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>'; - } - - // Reopen a classified invoice - if (($fac->statut == 2 || $fac->statut == 3) && // Closed invoice - $fac->getIdReplacingInvoice() == 0 && // Not replaced by another invoice - $fac->close_code != 'replaced') // Not replaced by another invoice - { - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>'; + if (! $facidnext && $fac->close_code != 'replaced') // Not replaced by another invoice + { + print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>'; + } + else + { + print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>'; + } } if ($_GET['action'] != 'edit' && $fac->statut <= 1 && $fac->getSommePaiement() <= 0 && $user->rights->fournisseur->facture->creer) -- GitLab