diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d22e532d8373ed91e7388b7604434b2d24c2d033..9007e0413b15efd02f1ed291bc009a126e9fccae 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 187836a0d8fcc4a1ad2f51a3afe8df2e10618da3..3c3da65807fe0d952ed68cec5ef6013c4707865b 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)