[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/compta/prelevement/ -> ligne-prelevement.class.php (source)

   1  <?php
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: ligne-prelevement.class.php,v 1.3 2005/07/10 20:48:43 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/prelevement/ligne-prelevement.class.php,v $
  20   *
  21   */
  22  
  23  /*
  24          \file       htdocs/compta/prelevement/ligne-prelevement.class.php
  25          \ingroup    prelevement
  26          \brief      Fichier de la classe des lignes de prelevements
  27          \version    $Revision: 1.3 $
  28  */
  29  
  30  
  31  /**
  32          \class      LignePrelevement
  33          \brief      Classe permettant la gestion des prelevements
  34  */
  35  
  36  class LignePrelevement
  37  {
  38    var $id;
  39    var $db;
  40  
  41  
  42    /**
  43     *    \brief      Constructeur de la classe
  44     *    \param      DB          Handler accès base de données
  45     *    \param      user        Objet user
  46     */
  47    function LignePrelevement($DB, $user)
  48    {
  49      $this->db = $DB ;
  50      $this->user = $user;
  51  
  52      $this->statuts = array();
  53      $this->statuts[0] = "En attente";
  54      $this->statuts[2] = "Crédité";
  55      $this->statuts[3] = "Rejeté";
  56    }
  57  
  58    /**
  59     *    \brief      Recupére l'objet prelevement
  60     *    \param      rowid       id de la facture a récupérer
  61     */
  62    function fetch($rowid)
  63    {
  64      $result = 0;
  65      
  66      $sql = "SELECT pl.rowid, pl.amount, p.ref, p.rowid as bon_rowid";
  67      $sql .= ", pl.statut, pl.fk_soc";
  68      $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
  69      $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as p";
  70      $sql .= " WHERE pl.rowid=".$rowid;
  71      $sql .= " AND p.rowid = pl.fk_prelevement_bons";
  72         
  73      if ($this->db->query($sql))
  74        {
  75      if ($this->db->num_rows())
  76        {
  77          $obj = $this->db->fetch_object();
  78          
  79          $this->id              = $obj->rowid;
  80          $this->amount          = $obj->amount;
  81          $this->socid           = $obj->fk_soc;
  82          $this->statut          = $obj->statut;
  83          $this->bon_ref         = $obj->ref;
  84          $this->bon_rowid       = $obj->bon_rowid;
  85        }
  86      else
  87        {
  88          $result++;
  89          dolibarr_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0");
  90        }
  91  
  92      $this->db->free();
  93        }
  94      else
  95        {
  96      $result++;
  97      dolibarr_syslog("LignePrelevement::Fetch rowid=$rowid");
  98      dolibarr_syslog($this->db->error());
  99        }
 100  
 101      return $result;
 102  
 103    }   
 104  }
 105  
 106  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics