[ 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/ -> dict.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   * Copyright (C) 2004      Benoit Mortier       <benoit.mortier@opensides.be>
   5   *
   6   * This program is free software; you can redistribute it and/or modify
   7   * it under the terms of the GNU General Public License as published by
   8   * the Free Software Foundation; either version 2 of the License, or
   9   * (at your option) any later version.
  10   *
  11   * This program is distributed in the hope that it will be useful,
  12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14   * GNU General Public License for more details.
  15   *
  16   * You should have received a copy of the GNU General Public License
  17   * along with this program; if not, write to the Free Software
  18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19   *
  20   * $Id: dict.php,v 1.40.2.2 2006/01/19 22:24:47 eldy Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/dict.php,v $
  22   */
  23  
  24  /**
  25          \file       htdocs/admin/dict.php
  26          \ingroup    setup
  27          \brief      Page d'administration des dictionnaires de données
  28          \version    $Revision: 1.40.2.2 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  
  33  $langs->load("main");
  34  $langs->load("other");
  35  $langs->load("admin");
  36  $langs->load("companies");
  37  
  38  if (!$user->admin)
  39    accessforbidden();
  40  
  41  
  42  $acts[0] = "activate";
  43  $acts[1] = "disable";
  44  $actl[0] = $langs->trans("Activate");
  45  $actl[1] = $langs->trans("Disable");
  46  
  47  $active = 1;
  48  
  49  
  50  // Cette page est une page d'édition générique des dictionnaires de données
  51  // Mettre ici tous les caractéristiques des dictionnaires
  52  
  53  // Ordres d'affichage des dictionnaires (0 pour espace)
  54  $taborder=array(9,0,4,3,2,0,1,8,0,5,11,0,6,0,10,12,0,7);
  55  
  56  // Nom des tables des dictionnaires
  57  $tabname[1] = MAIN_DB_PREFIX."c_forme_juridique";
  58  $tabname[2] = MAIN_DB_PREFIX."c_departements";
  59  $tabname[3] = MAIN_DB_PREFIX."c_regions";
  60  $tabname[4] = MAIN_DB_PREFIX."c_pays";
  61  $tabname[5] = MAIN_DB_PREFIX."c_civilite";
  62  $tabname[6] = MAIN_DB_PREFIX."c_actioncomm";
  63  $tabname[7] = MAIN_DB_PREFIX."c_chargesociales";
  64  $tabname[8] = MAIN_DB_PREFIX."c_typent";
  65  $tabname[9] = MAIN_DB_PREFIX."c_currencies";
  66  $tabname[10]= MAIN_DB_PREFIX."c_tva";
  67  $tabname[11]= MAIN_DB_PREFIX."c_type_contact";
  68  $tabname[12]= MAIN_DB_PREFIX."cond_reglement";
  69  
  70  // Libellé des dictionnaires
  71  $tablib[1] = $langs->trans("DictionnaryCompanyJuridicalType");
  72  $tablib[2] = $langs->trans("DictionnaryCanton");
  73  $tablib[3] = $langs->trans("DictionnaryRegion");
  74  $tablib[4] = $langs->trans("DictionnaryCountry");
  75  $tablib[5] = $langs->trans("DictionnaryCivility");
  76  $tablib[6] = $langs->trans("DictionnaryActions");
  77  $tablib[7] = $langs->trans("DictionnarySocialContributions");
  78  $tablib[8] = $langs->trans("DictionnaryCompanyType");
  79  $tablib[9] = $langs->trans("DictionnaryCurrency");
  80  $tablib[10]= $langs->trans("DictionnaryVAT");
  81  $tablib[11]= $langs->trans("DictionnaryTypeContact");
  82  $tablib[12]= $langs->trans("DictionnaryPaymentConditions");
  83  
  84  // Requete pour extraction des données des dictionnaires
  85  $tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, p.libelle as pays, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_pays as p WHERE f.fk_pays=p.rowid";
  86  $tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code , d.nom as libelle, r.nom as region, p.libelle as pays, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE d.fk_region=r.code_region and r.fk_pays=p.rowid and r.active=1 and p.active=1";
  87  $tabsql[3] = "SELECT r.rowid as rowid, code_region as code , nom as libelle, p.libelle as pays, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_pays as p WHERE r.fk_pays=p.rowid and p.active=1";
  88  $tabsql[4] = "SELECT rowid   as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_pays";
  89  $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.civilite AS libelle, c.active FROM ".MAIN_DB_PREFIX."c_civilite AS c";
  90  $tabsql[6] = "SELECT a.id    as rowid, a.code as code, a.libelle AS libelle, a.type, a.active FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
  91  $tabsql[7] = "SELECT a.id    as rowid, a.id as code, a.libelle AS libelle, a.deductible, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a";
  92  $tabsql[8] = "SELECT id      as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent";
  93  $tabsql[9] = "SELECT code, code_iso, label as libelle, active FROM ".MAIN_DB_PREFIX."c_currencies";
  94  $tabsql[10]= "SELECT t.rowid, t.taux, p.libelle as pays, t.recuperableonly, t.note, t.active FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
  95  $tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
  96  $tabsql[12]= "SELECT rowid   as rowid, code, sortorder, c.libelle, c.libelle_facture, nbjour, fdm, active FROM ".MAIN_DB_PREFIX."cond_reglement AS c";
  97  
  98  // Tri par defaut
  99  $tabsqlsort[1] ="pays, code ASC";
 100  $tabsqlsort[2] ="pays, code ASC";
 101  $tabsqlsort[3] ="pays, code ASC";
 102  $tabsqlsort[4] ="libelle ASC";
 103  $tabsqlsort[5] ="libelle ASC";
 104  $tabsqlsort[6] ="a.type ASC, a.code ASC";
 105  $tabsqlsort[7] ="a.libelle ASC";
 106  $tabsqlsort[8] ="libelle ASC";
 107  $tabsqlsort[9] ="code ASC";
 108  $tabsqlsort[10]="pays ASC, taux ASC, recuperableonly ASC";
 109  $tabsqlsort[11]="element ASC, source ASC, code ASC";
 110  $tabsqlsort[12]="sortorder ASC, code ASC";
 111   
 112  // Nom des champs en resultat de select pour affichage du dictionnaire
 113  $tabfield[1] = "code,libelle,pays";
 114  $tabfield[2] = "code,libelle,region";   // "code,libelle,region"
 115  $tabfield[3] = "code,libelle,pays";
 116  $tabfield[4] = "code,libelle";
 117  $tabfield[5] = "code,libelle";
 118  $tabfield[6] = "code,libelle,type";
 119  $tabfield[7] = "libelle,deductible";
 120  $tabfield[8] = "code,libelle";
 121  $tabfield[9] = "code,code_iso,libelle";
 122  $tabfield[10]= "pays,taux,recuperableonly,note";
 123  $tabfield[11]= "element,source,code,libelle";
 124  $tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm";
 125  
 126  // Nom des champs dans la table pour insertion d'un enregistrement
 127  $tabfieldinsert[1] = "code,libelle,fk_pays";
 128  $tabfieldinsert[2] = "code_departement,nom,fk_region";
 129  $tabfieldinsert[3] = "code_region,nom,fk_pays";
 130  $tabfieldinsert[4] = "code,libelle";
 131  $tabfieldinsert[5] = "code,civilite";
 132  $tabfieldinsert[6] = "code,libelle,type";
 133  $tabfieldinsert[7] = "libelle,deductible";
 134  $tabfieldinsert[8] = "code,libelle";
 135  $tabfieldinsert[9] = "code_iso,label";
 136  $tabfieldinsert[10]= "fk_pays,taux,recuperableonly,note";
 137  $tabfieldinsert[11]= "element,source,code,libelle";
 138  $tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm";
 139  
 140  // Nom du rowid si le champ n'est pas de type autoincrément
 141  $tabrowid[1] = "";
 142  $tabrowid[2] = "";
 143  $tabrowid[3] = "";
 144  $tabrowid[4] = "rowid";
 145  $tabrowid[5] = "rowid";
 146  $tabrowid[6] = "id";
 147  $tabrowid[7] = "id";
 148  $tabrowid[8] = "id";
 149  $tabrowid[9] = "code";
 150  $tabrowid[10]= "";
 151  $tabrowid[11]= "rowid";
 152  $tabrowid[12]= "rowid";
 153  
 154  
 155  $msg='';
 156  
 157  
 158  $sortfield=$_GET["sortfield"];
 159  
 160  /*
 161   * Actions ajout d'une entrée dans un dictionnaire de donnée
 162   */
 163  if ($_POST["actionadd"])
 164  {
 165      $listfield=split(',',$tabfield[$_POST["id"]]);
 166  
 167      // Verifie que tous les champs sont renseignés
 168      $ok=1;
 169      foreach ($listfield as $f => $value) {
 170          if (! isset($_POST[$value]) || $_POST[$value]=='') {
 171              $ok=0;
 172              $msg.=$langs->trans("ErrorFieldRequired",$listfield[$f]).'<br>';
 173          }
 174      }
 175      // Autres verif
 176      if (isset($_POST["code"]) && $_POST["code"]=='0') {
 177          $ok=0;
 178          $msg.="Le Code ne peut avoir la valeur 0<br>";
 179      }
 180      if (isset($_POST["pays"]) && $_POST["pays"]=='0') {
 181          $ok=0;
 182          $msg.=$langs->trans("ErrorFieldRequired",$langs->trans("Country")).'<br>';
 183      }
 184      
 185      // Si verif ok, on ajoute la ligne
 186      if ($ok) {
 187          if ($tabrowid[$_POST["id"]]) {
 188              // Recupere id libre pour insertion
 189              $newid=0;
 190              $sql = "SELECT max(".$tabrowid[$_POST["id"]].") newid from ".$tabname[$_POST["id"]];
 191              $result = $db->query($sql);
 192              if ($result)
 193              {
 194                  $obj = $db->fetch_object($result);
 195                  $newid=($obj->newid + 1);
 196                          
 197              } else {
 198                  dolibarr_print_error($db);
 199              }
 200          }
 201      
 202          // Add new entry
 203          $sql = "INSERT INTO ".$tabname[$_POST["id"]]." (";
 204          if ($tabrowid[$_POST["id"]]) $sql.= $tabrowid[$_POST["id"]].",";
 205          $sql.= $tabfieldinsert[$_POST["id"]];
 206          $sql.=",active)";
 207          $sql.= " VALUES(";
 208          // Ajoute valeur des champs
 209          if ($tabrowid[$_POST["id"]] &&
 210              ! in_array($tabrowid[$_POST["id"]],$listfield)) $sql.= $newid.",";
 211          $i=0;
 212          foreach ($listfield as $f => $value) {
 213              if ($i) $sql.=",";
 214              $sql.="'".$_POST[$value]."'";
 215              $i++;
 216          }
 217          $sql.=",1)";
 218  
 219          $result = $db->query($sql);
 220          if (!$result)
 221          {
 222              if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
 223                  $msg=$langs->trans("ErrorRecordAlreadyExists").'<br>';
 224              }
 225              else {
 226                  dolibarr_print_error($db);
 227              }
 228          }
 229      }
 230  
 231      if ($msg) $msg='<div class="error">'.$msg.'</div>';
 232      $_GET["id"]=$_POST["id"];       // Force affichage dictionnaire en cours d'edition
 233  }
 234  
 235  if ($_GET["action"] == 'delete')       // delete
 236  {
 237      if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; }
 238      else { $rowidcol="rowid"; }
 239  
 240      $sql = "DELETE from ".$tabname[$_GET["id"]]." WHERE $rowidcol='".$_GET["rowid"]."'";
 241  
 242      $result = $db->query($sql);
 243      if (! $result)
 244      {
 245          if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
 246          {
 247              $msg='<div class="error">'.$langs->trans("ErrorRecordIsUsedByChild").'</div>';
 248          }
 249          else 
 250          {
 251              dolibarr_print_error($db);
 252          }
 253      }
 254  }
 255  
 256  if ($_GET["action"] == $acts[0])       // activate
 257  {
 258      if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; }
 259      else { $rowidcol="rowid"; }
 260  
 261      if ($_GET["rowid"]) {
 262          $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 1 WHERE $rowidcol='".$_GET["rowid"]."'";
 263      }
 264      elseif ($_GET["code"]) {
 265          $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 1 WHERE code='".$_GET["code"]."'";
 266      }
 267  
 268      $result = $db->query($sql);
 269      if (!$result)
 270      {
 271          dolibarr_print_error($db);
 272      }
 273  }
 274  
 275  if ($_GET["action"] == $acts[1])       // disable
 276  {
 277      if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; }
 278      else { $rowidcol="rowid"; }
 279  
 280      if ($_GET["rowid"]) {
 281          $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 0 WHERE $rowidcol='".$_GET["rowid"]."'";
 282      }
 283      elseif ($_GET["code"]) {
 284          $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 0 WHERE code='".$_GET["code"]."'";
 285      }
 286  
 287      $result = $db->query($sql);
 288      if (!$result)
 289      {
 290          dolibarr_print_error($db);
 291      }
 292  }
 293  
 294  
 295  
 296  llxHeader();
 297  
 298  
 299  
 300  /*
 301   * Affichage d'un dictionnaire particulier
 302   */
 303  if ($_GET["id"])
 304  {
 305      print_fiche_titre($langs->trans("DictionnarySetup").' - '.$tablib[$_GET["id"]]);
 306  
 307      if ($msg) {
 308          print $msg.'<br>';
 309      }
 310  
 311      // Complète requete recherche valeurs avec critere de tri
 312      $sql=$tabsql[$_GET["id"]];
 313      if ($_GET["sortfield"]) {
 314          $sql .= " ORDER BY ".$_GET["sortfield"];
 315          if ($_GET["sortorder"]) {
 316              $sql.=" ".$_GET["sortorder"];
 317          }
 318          $sql.=", ";
 319      }
 320      else {
 321          $sql.=" ORDER BY ";   
 322      }
 323      $sql.=$tabsqlsort[$_GET["id"]];
 324      
 325      $fieldlist=split(',',$tabfield[$_GET["id"]]);
 326      print '<table class="noborder" width="100%">';
 327  
 328      // Ligne d'ajout
 329      if ($tabname[$_GET["id"]]) {
 330          $alabelisused=0;
 331          $var=false;
 332          
 333          $fieldlist=split(',',$tabfield[$_GET["id"]]);
 334          print '<table class="noborder" width="100%">';
 335  
 336          print '<form action="dict.php" method="post">';
 337          print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
 338  
 339          // Ligne de titre d'ajout
 340          print '<tr class="liste_titre">';
 341          foreach ($fieldlist as $field => $value) {
 342              // Determine le nom du champ par rapport aux noms possibles
 343              // dans les dictionnaires de données
 344              $valuetoshow=ucfirst($fieldlist[$field]);   // Par defaut
 345              if ($fieldlist[$field]=='source')          $valuetoshow=$langs->trans("Contact");
 346              if ($fieldlist[$field]=='lang')            $valuetoshow=$langs->trans("Language");
 347              if ($fieldlist[$field]=='type')            $valuetoshow=$langs->trans("Type");
 348              if ($fieldlist[$field]=='code')            $valuetoshow=$langs->trans("Code");
 349              if ($fieldlist[$field]=='libelle')         $valuetoshow=$langs->trans("Label")."*"; 
 350              if ($fieldlist[$field]=='libelle_facture') $valuetoshow=$langs->trans("LabelOnDocuments")."*"; 
 351              if ($fieldlist[$field]=='pays')            $valuetoshow=$langs->trans("Country");
 352              if ($fieldlist[$field]=='recuperableonly') $valuetoshow=MENTION_NPR;
 353              if ($fieldlist[$field]=='nbjour')          $valuetoshow=$langs->trans("NbOfDays");
 354              if ($fieldlist[$field]=='fdm')             $valuetoshow=$langs->trans("AtEndOfMonth");
 355              print '<td>';
 356              print $valuetoshow;
 357              print '</td>';
 358  
 359              if ($fieldlist[$field]=='libelle') $alabelisused=1; 
 360          }
 361          print '<td>&nbsp;</td>';
 362          print '<td>&nbsp;</td>';
 363          print '</td>';
 364  
 365          // Ligne d'ajout
 366          print "<tr $bc[$var] class=\"value\">";
 367          $html = new Form($db);
 368          foreach ($fieldlist as $field => $value) {
 369              if ($fieldlist[$field] == 'pays') {
 370                  print '<td>';
 371                  $html->select_pays('','pays');
 372                  print '</td>';
 373              }
 374              elseif ($fieldlist[$field] == 'region') {
 375                  print '<td>';
 376                  $html->select_region('','region');
 377                  print '</td>';
 378              }
 379              elseif ($fieldlist[$field] == 'lang') {
 380                  print '<td>';
 381                  $html->select_lang(MAIN_LANG_DEFAULT,'lang');
 382                  print '</td>';
 383              }
 384              // Le type de l'element (pour les type de contact).'
 385              elseif ($fieldlist[$field] == 'element')
 386              {
 387                  $langs->load("orders");
 388                  $langs->load("contracts");
 389                  $langs->load("project");
 390                  $langs->load("propal");
 391                  $langs->load("bills");
 392                  print '<td>';
 393                  $elementList = array("commande"=>$langs->trans("Order"),
 394                                       "contrat"=>$langs->trans("Contract"),
 395                                       "projet"=>$langs->trans("Project"),
 396                                       "propal"=>$langs->trans("Propal"),
 397                                       "facture"=>$langs->trans("Bill"));
 398                  $html->select_array('element', $elementList);
 399                  print '</td>';
 400              }
 401              // La source de l'element (pour les type de contact).'
 402              elseif ($fieldlist[$field] == 'source') {
 403                  print '<td>';
 404                  $elementList = array("internal"=>$langs->trans("Internal"),
 405                                       "external"=>$langs->trans("External"));
 406                  $html->select_array('source', $elementList);
 407                  print '</td>';
 408              }
 409              elseif ($fieldlist[$field] == 'type') {
 410                  print '<td>';
 411                  print 'user<input type="hidden" name="type" value="user">';
 412                  print '</td>';
 413              }
 414              elseif ($fieldlist[$field] == 'recuperableonly') {
 415                  print '<td>';
 416                  $html->selectyesno('recuperableonly','',1);
 417                  print '</td>';
 418              }
 419              elseif ($fieldlist[$field] == 'nbjour') {
 420                  print '<td><input type="text" class="flat" value="" size="3" name="'.$fieldlist[$field].'"></td>';
 421              }
 422              elseif ($fieldlist[$field] == 'fdm') {
 423                  print '<td>';
 424                  $html->selectyesno('fdm','',1);
 425                  print '</td>';
 426              }
 427              else {
 428                  print '<td><input type="text" class="flat" value="" name="'.$fieldlist[$field].'"></td>';
 429              }
 430          }
 431          print '<td colspan=3><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>';
 432          print "</tr>";
 433  
 434          if ($alabelisused)  // Si un des champs est un libellé
 435          {
 436              print '<tr><td colspan="'.(count($fieldlist)+2).'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
 437          }
 438          print '<tr><td colspan="'.(count($fieldlist)+2).'">&nbsp;</td></tr>';
 439  
 440          print '</form>';
 441      }
 442  
 443      // Affiche table des valeurs
 444      if ($db->query($sql))
 445      {
 446          $num = $db->num_rows();
 447          $i = 0;
 448          $var=true;
 449          if ($num)
 450          {
 451              // Ligne de titre
 452              print '<tr class="liste_titre">';
 453              foreach ($fieldlist as $field => $value) {
 454                  // Determine le nom du champ par rapport aux noms possibles
 455                  // dans les dictionnaires de données
 456                  $valuetoshow=ucfirst($fieldlist[$field]);   // Par defaut
 457                  if ($fieldlist[$field]=='source')          $valuetoshow=$langs->trans("Contact");
 458                  if ($fieldlist[$field]=='lang')            $valuetoshow=$langs->trans("Language");
 459                  if ($fieldlist[$field]=='type')            $valuetoshow=$langs->trans("Type");
 460                  if ($fieldlist[$field]=='code')            $valuetoshow=$langs->trans("Code");
 461                  if ($fieldlist[$field]=='libelle')         $valuetoshow=$langs->trans("Label")."*"; 
 462                  if ($fieldlist[$field]=='libelle_facture') $valuetoshow=$langs->trans("LabelOnDocuments")."*"; 
 463                  if ($fieldlist[$field]=='pays')            $valuetoshow=$langs->trans("Country");
 464                  if ($fieldlist[$field]=='recuperableonly') $valuetoshow=MENTION_NPR;
 465                  if ($fieldlist[$field]=='nbjour')          $valuetoshow=$langs->trans("NbOfDays");
 466                  if ($fieldlist[$field]=='fdm')             $valuetoshow=$langs->trans("AtEndOfMonth");
 467                  // Affiche nom du champ
 468                  print_liste_field_titre($valuetoshow,"dict.php",$fieldlist[$field],"&id=".$_GET["id"],"","",$sortfield);
 469              }
 470              print_liste_field_titre($langs->trans("Activate")."/".$langs->trans("Disable"),"dict.php","active","&id=".$_GET["id"],"","",$sortfield);
 471              print '<td>&nbsp;</td>';
 472              print '</tr>';
 473  
 474              // Lignes de valeurs
 475              while ($i < $num)
 476              {
 477                  $obj = $db->fetch_object();
 478                  $var=!$var;
 479  
 480                  print "<tr $bc[$var] class=\"value\">";
 481                  foreach ($fieldlist as $field => $value) {
 482                      $valuetoshow=$obj->$fieldlist[$field];
 483  
 484                      if ($valuetoshow=='all') {
 485                          $valuetoshow=$langs->trans('All');
 486                      }
 487                      if ($fieldlist[$field]=='recuperableonly') {
 488                          $valuetoshow=yn($valuetoshow);
 489                      }
 490                      if ($fieldlist[$field]=='fdm') {
 491                          $valuetoshow=yn($valuetoshow);
 492                      }
 493                      print '<td>'.$valuetoshow.'</td>';
 494  
 495                  }
 496                  print '<td>';
 497  
 498                  // Est-ce une entrée du dictionnaire qui peut etre désactivée ?
 499                  $iserasable=1;  // Oui par defaut
 500                  if (isset($obj->code) && ($obj->code == '0' || $obj->code == '' || eregi('unknown',$obj->code))) $iserasable=0;
 501                  if ($obj->type && $obj->type == 'system') $iserasable=0;
 502  
 503                  if ($iserasable) {
 504                      print '<a href="'."dict.php".'?sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.($obj->rowid?$obj->rowid:$obj->code).'&amp;code='.$obj->code.'&amp;id='.$_GET["id"].'&amp;action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
 505                  } else {
 506                      print $langs->trans("AlwaysActive");
 507                  }
 508                  print "</td>";
 509                  if ($iserasable) {
 510                      print '<td><a href="dict.php?sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.($obj->rowid?$obj->rowid:$obj->code).'&amp;code='.$obj->code.'&amp;id='.$_GET["id"].'&amp;action=delete"'.img_delete().'</a></td>';
 511                  } else {
 512                      print '<td>&nbsp;</td>';   
 513                  }
 514                  print "</tr>\n";
 515                  $i++;
 516              }
 517          }
 518      }
 519      else {
 520          dolibarr_print_error($db);
 521      }
 522  
 523      print '</table>';
 524  }
 525  else
 526  {
 527      /*
 528       * Affichage de la liste des dictionnaires
 529       */
 530      print_fiche_titre($langs->trans("DictionnarySetup"));
 531  
 532      $var=true;
 533      print '<table class="noborder" width="100%">';
 534      print '<tr class="liste_titre"><td>'.$langs->trans("Dictionnary").'</td><td>'.$langs->trans("Table").'</td></tr>';
 535  
 536      foreach ($taborder as $i) {
 537          $var=!$var;
 538          if ($i) {
 539              $value=$tabname[$i];
 540              print '<tr '.$bc[$var].'><td width="30%"><a href="dict.php?id='.$i.'">'.$tablib[$i].'</a></td><td>'.$tabname[$i].'</td></tr>';
 541  
 542          }
 543          else
 544          {
 545              print '<tr '.$bc[$var].'><td width="30%">&nbsp;</td><td>&nbsp;</td></tr>';
 546          }
 547      }
 548      print '</table>';
 549  }
 550  
 551  print '<br>';
 552  
 553  $db->close();
 554  
 555  llxFooter();
 556  
 557  
 558  ?>


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