[ 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/includes/modules/fichinter/ -> modules_fichinter.php (source)

   1  <?php
   2  /* Copyright (C) 2003      Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   * or see http://www.gnu.org/
  19   *
  20   * $Id: modules_fichinter.php,v 1.11 2005/11/11 20:11:58 eldy Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/modules/fichinter/modules_fichinter.php,v $
  22   *
  23   */
  24  
  25  /**    
  26          \file       htdocs/includes/modules/fichinter/modules_fichinter.php
  27          \ingroup    ficheinter
  28          \brief      Fichier contenant la classe mère de generation des fiches interventions en PDF
  29                      et la classe mère de numérotation des fiches interventions
  30          \version    $Revision: 1.11 $
  31  */
  32  
  33  require_once(FPDF_PATH.'fpdf.php');
  34  
  35  /**
  36          \class      ModelePDFFicheinter
  37          \brief      Classe mère des modèles de fiche intervention
  38  */
  39  
  40  class ModelePDFFicheinter extends FPDF
  41  {
  42      var $error='';
  43  
  44      /**
  45          \brief      Constructeur
  46       */
  47      function ModelePDFFicheinter()
  48      {
  49      
  50      }
  51  
  52      /** 
  53          \brief      Renvoi le dernier message d'erreur de création de fiche intervention
  54       */
  55      function pdferror()
  56      {
  57          return $this->error;
  58      }
  59  
  60      /** 
  61       *      \brief      Renvoi la liste des modèles actifs
  62       */
  63      function liste_modeles($db)
  64      {
  65          $liste=array();
  66          $sql ="";
  67          
  68          $resql = $db->query($sql);
  69          if ($resql)
  70          {
  71              $num = $db->num_rows($resql);
  72              $i = 0;
  73              while ($i < $num)
  74              {
  75                  $row = $db->fetch_row($resql);
  76                  $liste[$row[0]]=$row[1];
  77                  $i++;
  78              }
  79          }
  80          else
  81          {
  82              return -1;
  83          }
  84          return $liste;
  85      }
  86  
  87  }
  88  
  89  
  90  /**
  91          \class      ModeleNumRefFicheinter
  92          \brief      Classe mère des modèles de numérotation des références de fiches d'intervention
  93  */
  94  
  95  class ModeleNumRefFicheinter
  96  {
  97      var $error='';
  98  
  99      /**     \brief      Renvoi la description par defaut du modele de numérotation
 100       *      \return     string      Texte descripif
 101       */
 102      function info()
 103      {
 104          global $langs;
 105          $langs->load("ficheinter");
 106          return $langs->trans("NoDescription");
 107      }
 108  
 109      /**     \brief      Renvoi un exemple de numérotation
 110       *      \return     string      Example
 111       */
 112      function getExample()
 113      {
 114          global $langs;
 115          $langs->load("ficheinter");
 116          return $langs->trans("NoExample");
 117      }
 118  
 119      /**     \brief      Test si les numéros déjà en vigueur dans la base ne provoquent pas de
 120       *                  de conflits qui empechera cette numérotation de fonctionner.
 121       *      \return     boolean     false si conflit, true si ok
 122       */
 123      function canBeActivated()
 124      {
 125          return true;
 126      }
 127  
 128      /**     \brief      Renvoi prochaine valeur attribuée
 129       *      \return     string      Valeur
 130       */
 131      function getNextValue()
 132      {
 133          global $langs;
 134          return $langs->trans("NotAvailable");
 135      }
 136  
 137  }
 138  
 139  
 140  /**
 141          \brief      Crée une fiche intervention sur disque en fonction du modèle de FICHEINTER_ADDON_PDF
 142          \param        db          objet base de donnée
 143          \param        facid        id de la facture à créer
 144          \return     int         0 si KO, 1 si OK
 145  */
 146  function fichinter_pdf_create($db, $facid)
 147  {
 148    global $langs;
 149    $langs->load("ficheinter");
 150    
 151    $dir = DOL_DOCUMENT_ROOT."/includes/modules/fichinter/";
 152  
 153    if (defined("FICHEINTER_ADDON_PDF") && FICHEINTER_ADDON_PDF)
 154      {
 155  
 156        $file = "pdf_".FICHEINTER_ADDON_PDF.".modules.php";
 157  
 158        $classname = "pdf_".FICHEINTER_ADDON_PDF;
 159        require_once($dir.$file);
 160  
 161        $obj = new $classname($db);
 162  
 163        if ( $obj->write_pdf_file($facid) > 0)
 164      {
 165        return 1;
 166      }
 167        else
 168      {
 169        dolibarr_print_error($db,$obj->pdferror());
 170        return 0;
 171      }
 172      }
 173    else
 174      {
 175        print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined");
 176        return 0;
 177      }
 178  }
 179  
 180  ?>


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