Fix: Conditions to reopen closed invoice.

This commit is contained in:
Laurent Destailleur 2010-04-21 08:35:11 +00:00
parent de8d2f58ee
commit 7c11750aa3
2 changed files with 11 additions and 27 deletions

View File

@ -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.'&amp;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.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a>';
}

View File

@ -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.'&amp;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.'&amp;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.'&amp;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)