[ 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/admin/system/ -> update.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004 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   *
  19   * $Id: update.php,v 1.9 2005/08/25 20:27:17 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/system/update.php,v $
  21   *
  22   */
  23  
  24  /*!        \file       htdocs/admin/system/update.php
  25          \brief      Page de mise a jour de données. Seule l'administrateur y a accès.
  26          \version    $Revision: 1.9 $
  27  */
  28  
  29  require ("./pre.inc.php");
  30  
  31  $langs->load("admin");
  32  
  33  if (!$user->admin)
  34    accessforbidden();
  35  
  36  
  37  include_once (DOL_DOCUMENT_ROOT."/facture.class.php");
  38  include_once (DOL_DOCUMENT_ROOT."/propal.class.php");
  39  
  40  
  41  // On appelle pas llxHeader dans le cas de cette page car llxHeader inclus le main.inc.php qui inclut le test
  42  // si il faut faire une mise à jour et on boucle.
  43  //llxHeader();
  44  
  45  
  46  print_titre($langs->trans("SystemUpdate"));
  47  $err = 0;
  48  
  49  
  50  // Mise a jour pour les factures
  51  print "Update facture<br>";
  52  $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture";
  53  if ($db->query($sql))
  54  {
  55    $num = $db->num_rows();
  56    $i = 0;
  57    while ($i < $num)
  58      {
  59        $row = $db->fetch_row($i);
  60        $facture = new Facture($db);
  61        if ( $facture->fetch($row[0]) )
  62      {
  63        if ( $facture->updateprice($row[0]) > 0 )
  64          {
  65            print "(ok $row[0]) ";
  66          }
  67        else
  68          {
  69            print "Erreur #2";
  70            $err++;
  71          }
  72      }
  73        else
  74      {
  75        print "Erreur #3";
  76        $err++;
  77      }
  78        $i++;
  79      }
  80    $db->free();
  81  }
  82  else
  83  {
  84    print "Erreur #1";
  85    $err++;
  86  }
  87  
  88  
  89  
  90  // Fin de mise a jour
  91  $sql = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = 'MAIN_NEED_UPDATE'";
  92  if (! $db->query($sql))
  93  {
  94    print "Erreur #100";
  95    $err++;
  96  }
  97  
  98  $db->close();
  99  
 100  
 101  if ($err == 0)
 102  {
 103    print '<br><b>'.$langs->trans("SystemSuccessfulyUpdated").'</b>';
 104  }
 105  
 106  print '<br><br>';
 107  print '<a href="/">'.$langs->trans("Home").'</a>';
 108  
 109  llxFooter("<em>Derni&egrave;re modification $Date: 2005/08/25 20:27:17 $ r&eacute;vision $Revision: 1.9 $</em>");
 110  
 111  ?>


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