[ 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/ -> compta.php (source)

   1  <?php
   2  /* Copyright (C) 2004      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   *
  19   * $Id: compta.php,v 1.10 2005/06/17 09:46:41 marc_ocebo Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/compta.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/admin/compta.php
  25          \ingroup    comptabilite
  26          \brief      Page de configuration du module comptabilité
  27          \version    $Revision: 1.10 $
  28  */
  29  
  30  require ('./pre.inc.php');
  31  
  32  $langs->load('admin');
  33  $langs->load('compta');
  34  
  35  if (!$user->admin)
  36    accessforbidden();
  37  
  38  
  39  llxHeader();
  40  
  41  
  42  $compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES';
  43  
  44  if ($_POST['action'] == 'setcomptamode')
  45  {
  46    $compta_mode = $_POST['compta_mode'];
  47    if (! dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode)) { print $db->error(); }
  48  }
  49  
  50  
  51  $form = new Form($db);
  52  $typeconst=array('yesno','texte','chaine');
  53  
  54  
  55  if ($_POST['action'] == 'update' || $_POST['action'] == 'add')
  56  {
  57      if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : ''));
  58      {
  59            print $db->error();
  60      }
  61  }
  62  
  63  
  64  if ($_GET['action'] == 'delete')
  65  {
  66      if (! dolibarr_del_const($db, $_GET['constname']));
  67      {
  68            print $db->error();
  69      }
  70  }
  71  
  72  
  73  print_titre($langs->trans('ComptaSetup'));
  74  
  75  
  76  print '<br>';
  77  
  78  print '<table class="noborder" width="100%">';
  79  
  80  // Cas du paramètre COMPTA_MODE
  81  print '<form action="compta.php" method="post">';
  82  print '<input type="hidden" name="action" value="setcomptamode">';
  83  print '<tr class="liste_titre">';
  84  print '<td>'.$langs->trans('OptionMode').'</td><td>'.$langs->trans('Description').'</td>';
  85  print '<td><input type="submit" value="'.$langs->trans('Modify').'"></td>';
  86  print "</tr>\n";
  87  print '<tr '.$bc[false].'><td width="200"><input type="radio" name="compta_mode" value="RECETTES-DEPENSES"'.($compta_mode != 'CREANCES-DETTES' ? ' checked' : '').'> '.$langs->trans('OptionModeTrue').'</td>';
  88  print '<td colspan="2">'.nl2br($langs->trans('OptionModeTrueDesc'))."</td></tr>\n";
  89  print '<tr '.$bc[true].'><td width="200"><input type="radio" name="compta_mode" value="CREANCES-DETTES"'.($compta_mode == 'CREANCES-DETTES' ? ' checked' : '').'> '.$langs->trans('OptionModeVirtual').'</td>';
  90  print '<td colspan="2">'.$langs->trans('OptionModeVirtualDesc')."</td></tr>\n";
  91  print '</form>';
  92  
  93  print "</table>\n";
  94  
  95  print "<br>\n";
  96  
  97  // Cas des autres paramètres COMPTA_*
  98  $sql ="SELECT rowid, name, value, type, note";
  99  $sql.=" FROM llx_const";
 100  $sql.=" WHERE name like 'COMPTA_%' and name not in ('COMPTA_MODE')";
 101  $result = $db->query($sql);
 102  if ($result) 
 103  {
 104      $num = $db->num_rows($result);
 105      $i = 0;
 106      $var=true;
 107  
 108      if ($num)
 109      {
 110          print '<table class="noborder" width="100%">';
 111          print '<tr class="liste_titre">';
 112          print '<td colspan="3">'.$langs->trans('OtherOptions').'</td>';
 113          print "</tr>\n";
 114      }
 115  
 116      while ($i < $num)
 117      {
 118          $obj = $db->fetch_object($result);
 119          $var=!$var;
 120  
 121          print '<form action="compta.php" method="POST">';
 122          print '<input type="hidden" name="action" value="update">';
 123          print '<input type="hidden" name="rowid" value="'.$rowid.'">';
 124          print '<input type="hidden" name="constname" value="'.$obj->name.'">';
 125  
 126          print '<tr '.$bc[$var].' class="value">';
 127          print '<td>'.stripslashes(nl2br($obj->note))."</td>\n";
 128  
 129          print '<td>';
 130          if ($obj->type == 'yesno')
 131          {
 132              $form->selectyesnonum('constvalue',$obj->value);
 133          }
 134          elseif ($obj->type == 'texte')
 135          {
 136              print '<textarea name="constvalue" cols="35" rows="5" wrap="soft">';
 137              print $obj->value;
 138              print "</textarea>\n";
 139          }
 140          else
 141          {
 142              print '<input type="text" size="30" name="constvalue" value="'.stripslashes($obj->value).'">';
 143          }
 144          print '</td><td>';
 145          print '<input type="submit" value="'.$langs->trans('Modify').'" name="button"> &nbsp; ';
 146          print "</td></tr>\n";
 147  
 148          print '</form>';
 149  
 150          $i++;
 151      }
 152      
 153      if ($num)
 154      {
 155          print "</table>\n";
 156      }
 157  
 158  }
 159  
 160  $db->close();
 161  
 162  
 163  llxFooter('$Date: 2005/06/17 09:46:41 $ - $Revision: 1.10 $');
 164  
 165  ?>


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