From 3279ae8df8acc5a74cb673a1ebaf6ba3d31cb4c6 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 2 Aug 2005 12:45:13 +0000 Subject: [PATCH] Ajout methode set_auto --- htdocs/compta/facture/facture-rec.class.php | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/htdocs/compta/facture/facture-rec.class.php b/htdocs/compta/facture/facture-rec.class.php index 220dc547690..025555156b7 100644 --- a/htdocs/compta/facture/facture-rec.class.php +++ b/htdocs/compta/facture/facture-rec.class.php @@ -549,5 +549,37 @@ class FactureRec } } } + /** + * Rend la facture automatique + * + */ + function set_auto($user, $freq, $courant) + { + if ($user->rights->facture->creer) + { + + $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec "; + $sql .= " SET frequency = '".$freq."', last_gen='".$courant."'"; + $sql .= " WHERE rowid = ".$this->facid.";"; + + $resql = $this->db->query($sql); + + if ($resql) + { + $this->frequency = $freq; + $this->last_gen = $courant; + return 0; + } + else + { + print $this->db->error() . ' in ' . $sql; + return -1; + } + } + else + { + return -2; + } + } } ?>