From 7de1091bb476af1b8c24e04082b79326775111ea Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 1 Mar 2005 16:08:01 +0000 Subject: [PATCH] Nouveau fichier --- .../prelevement/ligne-prelevement.class.php | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 htdocs/compta/prelevement/ligne-prelevement.class.php diff --git a/htdocs/compta/prelevement/ligne-prelevement.class.php b/htdocs/compta/prelevement/ligne-prelevement.class.php new file mode 100644 index 00000000000..0b50433469a --- /dev/null +++ b/htdocs/compta/prelevement/ligne-prelevement.class.php @@ -0,0 +1,106 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +/* + \file htdocs/compta/prelevement/prelevement.class.php + \ingroup prelevement + \brief Fichier de la classe des prelevements + \version $Revision$ +*/ + + +/*! + \class Prelevement + \brief Classe permettant la gestion des prelevements +*/ + +class LignePrelevement +{ + var $id; + var $db; + + + /** + * \brief Constructeur de la classe + * \param DB handler accès base de données + */ + function LignePrelevement($DB, $user) + { + $this->db = $DB ; + $this->user = $user; + + $this->statuts = array(); + $this->statuts[0] = "En attente"; + $this->statuts[2] = "Crédité"; + $this->statuts[3] = "Rejeté"; + } + + /** + * \brief Recupére l'objet prelevement + * \param rowid id de la facture a récupérer + * \param societe_id id de societe + */ + function fetch($rowid) + { + $result = 0; + + $sql = "SELECT pl.rowid, pl.amount, p.ref, p.rowid as bon_rowid"; + $sql .= ", pl.statut, pl.fk_soc"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; + $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as p"; + $sql .= " WHERE pl.rowid=".$rowid; + $sql .= " AND p.rowid = pl.fk_prelevement_bons"; + + if ($this->db->query($sql)) + { + if ($this->db->num_rows()) + { + $obj = $this->db->fetch_object(); + + $this->id = $obj->rowid; + $this->amount = $obj->amount; + $this->socid = $obj->fk_soc; + $this->statut = $obj->statut; + $this->bon_ref = $obj->ref; + $this->bon_rowid = $obj->bon_rowid; + } + else + { + $result++; + dolibarr_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0"); + } + + $this->db->free(); + } + else + { + $result++; + dolibarr_syslog("LignePrelevement::Fetch rowid=$rowid"); + dolibarr_syslog($this->db->error()); + } + + return $result; + + } +} + +?>