From eac83150bcf39db616a28afc08ee3d4c16e4a9b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Apr 2011 08:15:33 +0000 Subject: [PATCH] Add option FACTURE_CAN_BE_REMOVED --- htdocs/compta/facture/class/facture.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8ab2a9c35c2..63bc87074f1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2566,16 +2566,19 @@ class Facture extends CommonObject /** - * Renvoi si une facture peut etre supprimee completement. - * La regle est la suivante: - * Si facture derniere, non provisoire, sans paiement et non exporte en compta -> oui fin de regle - * Si facture brouillon et provisoire -> oui + * Return if an invoice can be deleted + * Rule is: + * If hidden option FACTURE_CAN_BE_REMOVED is on, we can + * If invoice has a definitive ref, is last, without payment and not dipatched into accountancy -> yes end of rule + * If invoice is draft and ha a temporary ref -> yes * @return int <0 if KO, 0=no, 1=yes */ function is_erasable() { global $conf; + if (! empty($conf->global->FACTURE_CAN_BE_REMOVED)) return 1; + // on verifie si la facture est en numerotation provisoire $facref = substr($this->ref, 1, 4);