From 9c624bed06d92967946d66c4114a1ddf482c3237 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jul 2008 16:19:51 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Ne=20permet=20pas=20reouverture=20si=20f?= =?UTF-8?q?acture=20remplac=E9e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/facture.php | 41 +++++++++++++++++++++++++++------------ htdocs/facture.class.php | 2 +- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index c82678cdfe6..93a04a4f809 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -450,12 +450,12 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer) $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; } - if (! $_POST['fac_replacement'] > 0) + if (! ($_POST['fac_replacement'] > 0)) { $error=1; $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("ReplaceInvoice")).'
'; } - + if (! $error) { // Si facture remplacement @@ -2792,16 +2792,33 @@ else if ($conf->global->FACTURE_ENABLE_EDITDELETE && $user->rights->facture->modifier && ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0)) { - print ''.$langs->trans('Modify').''; + if (! $facidnext) + { + print ''.$langs->trans('Modify').''; + } + else + { + print ''.$langs->trans('Modify').''; + } } } // Reopen a classified invoice - if ($fac->statut == 3 && ($fac->close_code == 'badcustomer' || $fac->close_code == 'abandon')) + if ($fac->statut == 3 && // A abandonned invoice + $fac->getIdReplacingInvoice() == 0 && // Not replaced by another invoice + ($fac->close_code == 'badcustomer' || $fac->close_code == 'abandon')) { - print ''.$langs->trans('ReOpen').''; + if (! $facidnext) + { + print ''.$langs->trans('ReOpen').''; + } + else + { + print ''.$langs->trans('ReOpen').''; + } } - // Récurrente + + // Récurrente if (! $conf->global->FACTURE_DISABLE_RECUR && $fac->type == 0) { if (! $facidnext) @@ -2844,7 +2861,7 @@ else { if ($facidnext) { - print ''.$langs->trans('SendByMail').''; + print ''.$langs->trans('SendByMail').''; } else { @@ -2857,7 +2874,7 @@ else { if ($facidnext) { - print ''.$langs->trans('SendRemindByMail').''; + print ''.$langs->trans('SendRemindByMail').''; } else { @@ -2870,13 +2887,13 @@ else { if ($facidnext) { - print ''.$langs->trans('DoPayment').''; + print ''.$langs->trans('DoPayment').''; } else { if ($resteapayer == 0) { - print ''.$langs->trans('DoPayment').''; + print ''.$langs->trans('DoPayment').''; } else { @@ -2919,7 +2936,7 @@ else { if ($facidnext) { - print ''.$langs->trans('ClassifyCanceled').''; + print ''.$langs->trans('ClassifyCanceled').''; } else { @@ -2933,7 +2950,7 @@ else { if ($facidnext) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index d697f8a0876..87054929e8b 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -1724,7 +1724,7 @@ class Facture extends CommonObject /** * \brief Renvoie l'id de la facture qui la remplace * \param option filtre sur statut ('', 'validated', ...) - * \return int <0 si ko, 0 si aucune facture ne remplace, id facture sinon + * \return int <0 si KO, 0 si aucune facture ne remplace, id facture sinon */ function getIdReplacingInvoice($option='') {