Add option FACTURE_CAN_BE_REMOVED

This commit is contained in:
Laurent Destailleur 2011-04-08 08:15:33 +00:00
parent e7fd3247d8
commit eac83150bc

View File

@ -2566,16 +2566,19 @@ class Facture extends CommonObject
/** /**
* Renvoi si une facture peut etre supprimee completement. * Return if an invoice can be deleted
* La regle est la suivante: * Rule is:
* Si facture derniere, non provisoire, sans paiement et non exporte en compta -> oui fin de regle * If hidden option FACTURE_CAN_BE_REMOVED is on, we can
* Si facture brouillon et provisoire -> oui * 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 * @return int <0 if KO, 0=no, 1=yes
*/ */
function is_erasable() function is_erasable()
{ {
global $conf; global $conf;
if (! empty($conf->global->FACTURE_CAN_BE_REMOVED)) return 1;
// on verifie si la facture est en numerotation provisoire // on verifie si la facture est en numerotation provisoire
$facref = substr($this->ref, 1, 4); $facref = substr($this->ref, 1, 4);