diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index cd735e3b11c..2131922b8bf 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -22,18 +22,46 @@ require("./pre.inc.php"); llxHeader(); -print_titre("Configuration Dolibarr"); +print_titre("Constantes de configuration Dolibarr"); print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ""; +print "\n"; $db = new Db(); +$form = new Form($db); -if ($HTTP_POST_VARS["action"] == 'update') +if ($HTTP_POST_VARS["action"] == 'update' || $HTTP_POST_VARS["action"] == 'add') { - $sql = "UPDATE llx_const set value = '".$HTTP_POST_VARS["constvalue"]."' where rowid=".$HTTP_POST_VARS["rowid"].";"; + if ($HTTP_POST_VARS["consttype"] == 0){ + $sql = "REPLACE INTO llx_const SET name='".$_POST["constname"]."', value = '".$HTTP_POST_VARS["constvalue"]."',note='".$HTTP_POST_VARS["constnote"]."', type='yesno'"; + }else{ + $sql = "REPLACE INTO llx_const SET name='".$_POST["constname"]."', value = '".$HTTP_POST_VARS["constvalue"]."',note='".$HTTP_POST_VARS["constnote"]."'"; + } + $result = $db->query($sql); + if (!$result) + { + print $db->error(); + } +} + +if ($action == 'delete') +{ + $sql = "DELETE FROM llx_const WHERE rowid='$rowid'"; + + $result = $db->query($sql); + if (!$result) + { + print $db->error(); + } } $sql = "SELECT rowid, name, value, type, note FROM llx_const"; @@ -42,54 +70,67 @@ if ($result) { $num = $db->num_rows(); $i = 0; - + $var=True; + while ($i < $num) { $obj = $db->fetch_object( $i); + $var=!$var; - print '\n"; + + print ''; - print ''; + print ''; + print '\n"; + + print ''; $i++; } } +$var=!$var; +print ''; +print ''; + +print "\n"; + +print '\n"; +print ''; + +print ''; print '
NomValeurTypeNoteAction
'.$obj->name.'' . $obj->value . ''; + print '
'; + print ''; + print ''; + print ''; - if ($rowid == $obj->rowid && $action == 'edit') + print "
$obj->name'; + if ($obj->type == 'yesno') { - print ''; - print ''; - print ''; - - if ($obj->type == 'yesno') - { - print ''; - } - else - { - print ''; - } - - print ''; - print ''; + $form->selectyesnonum('constvalue',$obj->value); + print ''; + $form->select_array('consttype',array('yesno','texte'),0); } - else + else { - print 'edit'; + print ''; + print ''; + $form->select_array('consttype',array('yesno','texte'),1); } + print ''; - print '
'.stripslashes(nl2br($obj->note)).'
'; + print '
'; + print 'Delete'; + print "
'; +print ''; +print ''; + +$form->select_array('consttype',array('yesno','texte'),1); +print ''; + +print ''; +print ''; + +print '
'; +print "
'; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index e164d03dd79..26aaa7ab2f1 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -168,7 +168,19 @@ class Form { } print ''; } - + /* + * + * Checkbox + * + */ + Function checkbox($name,$checked=0,$value=1) + { + if ($checked==1){ + print "\n"; + }else{ + print "\n"; + } + } } ?> diff --git a/htdocs/main.inc.php3 b/htdocs/main.inc.php3 index e07925e7297..74c5bc335fb 100644 --- a/htdocs/main.inc.php3 +++ b/htdocs/main.inc.php3 @@ -196,11 +196,11 @@ Function left_menu($menu) } - if (MAIN_SEARCHFORM_SOCIETE or MAIN_SEARCHFORM_CONTACT) + if (defined(MAIN_SEARCHFORM_SOCIETE) or defined(MAIN_SEARCHFORM_CONTACT)) { print ''; - if (MAIN_SEARCHFORM_SOCIETE) + if (defined(MAIN_SEARCHFORM_SOCIETE) && MAIN_SEARCHFORM_SOCIETE > 0) { print 'Societes'; print '
'; @@ -211,7 +211,7 @@ Function left_menu($menu) print '
'; } - if (MAIN_SEARCHFORM_CONTACT) + if (defined(MAIN_SEARCHFORM_CONTACT) && MAIN_SEARCHFORM_CONTACT > 0) { print 'Contacts'; print '
'; diff --git a/htdocs/public/adherents/pre.inc.php b/htdocs/public/adherents/pre.inc.php index f77893d6066..d0958ff5077 100644 --- a/htdocs/public/adherents/pre.inc.php +++ b/htdocs/public/adherents/pre.inc.php @@ -19,7 +19,7 @@ * $Source$ * */ -require("../../main.inc.php3"); +require($GLOBALS["DOCUMENT_ROOT"]."/main.inc.php3"); function llxHeader($head = "") { global $user, $conf; diff --git a/htdocs/public/password.php b/htdocs/public/password.php index f5305b30da1..90af6bd7f5e 100644 --- a/htdocs/public/password.php +++ b/htdocs/public/password.php @@ -1,5 +1,6 @@ + * Copyright (c) 2002 Jean-Louis Bergamo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +20,7 @@ * $Source$ */ -require("../main.inc.php3"); +require($GLOBALS["DOCUMENT_ROOT"]."/main.inc.php3"); $db = new Db(); @@ -49,7 +50,7 @@ if ($result) $user->id = 1; - $user->password("admin"); + $user->password("admin",$conf->password_encrypted); print "Compte admin/admin créé"; } diff --git a/htdocs/user.class.php3 b/htdocs/user.class.php3 index d7f9995bb58..688bcdd8ece 100644 --- a/htdocs/user.class.php3 +++ b/htdocs/user.class.php3 @@ -1,5 +1,6 @@ + * Copyright (c) 2002-2003 Jean-Louis Bergamo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +32,7 @@ class User { var $email; var $admin; var $login; + var $pass; var $comm; var $compta; var $webcal_login; @@ -56,9 +58,9 @@ class User { Function fetch($login='') { - $sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.code, u.admin, u.module_comm, u.module_compta, u.login, u.webcal_login, u.note"; - $sql .= " FROM llx_user as u"; - + //$sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.code, u.admin, u.module_comm, u.module_compta, u.login, u.pass, u.webcal_login, u.note"; + //$sql .= " FROM llx_user as u"; + $sql = "SELECT * FROM llx_user as u"; if ($this->id) { $sql .= " WHERE u.rowid = $this->id"; } else { @@ -171,6 +173,9 @@ class User { $sql .= ", login = '$this->login'"; $sql .= ", email = '$this->email'"; $sql .= ", admin = $this->admin"; + $sql .= ", webcal_login = '$this->webcal_login'"; + $sql .= ", module_comm = $this->comm"; + $sql .= ", module_compta = $this->compta"; $sql .= ", note = '$this->note'"; $sql .= " WHERE rowid = $this->id"; @@ -210,7 +215,7 @@ class User { { $sqlpass = $password; } - + $this->pass=$password; $sql = "UPDATE llx_user SET pass = '".$sqlpass."'"; $sql .= " WHERE rowid = $this->id"; diff --git a/htdocs/user/fiche.php3 b/htdocs/user/fiche.php3 index 6cefa152a9a..9522d97325a 100644 --- a/htdocs/user/fiche.php3 +++ b/htdocs/user/fiche.php3 @@ -1,5 +1,6 @@ + * Copyright (C) 2002-2003 Jean-Louis Bergamo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,11 +21,12 @@ */ require("./pre.inc.php3"); -require("../service.class.php3"); +require($GLOBALS["DOCUMENT_ROOT"]."/service.class.php3"); llxHeader(); $db = new Db(); +$form = new Form($db); if ($HTTP_POST_VARS["action"] == 'add' && $user->admin) { @@ -35,10 +37,24 @@ if ($HTTP_POST_VARS["action"] == 'add' && $user->admin) $edituser->prenom = $HTTP_POST_VARS["prenom"]; $edituser->login = $HTTP_POST_VARS["login"]; $edituser->email = $HTTP_POST_VARS["email"]; - $edituser->admin = 0; - - $id = $edituser->create($user->id); + $edituser->admin = $HTTP_POST_VARS["admin"]; + $edituser->webcal_login = $HTTP_POST_VARS["webcal_login"]; + if (isset($HTTP_POST_VARS["module_compta"]) && $HTTP_POST_VARS["module_compta"] ==1){ + $edituser->compta = 1; + }else{ + $edituser->compta = 0; + } + if (isset($HTTP_POST_VARS["module_comm"]) && $HTTP_POST_VARS["module_comm"] ==1){ + $edituser->comm = 1; + }else{ + $edituser->comm = 0; + } + //$id = $edituser->create($user->id); + $id = $edituser->create(); + if (isset($_POST['password']) && $_POST['password']!='' ){ + $edituser->password($_POST['password'],$conf->password_encrypted); + } } if ($action == 'update' && $user->admin) @@ -51,11 +67,26 @@ if ($action == 'update' && $user->admin) $edituser->prenom = $prenom; $edituser->login = $login; $edituser->email = $email; + $edituser->admin = $HTTP_POST_VARS["admin"]; + $edituser->webcal_login = $HTTP_POST_VARS["webcal_login"]; + if (isset($HTTP_POST_VARS["module_compta"]) && $HTTP_POST_VARS["module_compta"] ==1){ + $edituser->compta = 1; + }else{ + $edituser->compta = 0; + } + if (isset($HTTP_POST_VARS["module_comm"]) && $HTTP_POST_VARS["module_comm"] ==1){ + $edituser->comm = 1; + }else{ + $edituser->comm = 0; + } if (! $edituser->update($id, $user)) { print $edituser->error(); } + if (isset($password) && $password !='' ){ + $edituser->password($password,$conf->password_encrypted); + } } if ($action == 'password' && $user->admin) @@ -95,7 +126,30 @@ if ($action == 'create') print 'Login'; print ''; + print 'Password'; + print ''; + + print 'Email'; + print ''; + print 'Admin ?'; + print ''; + $form->selectyesnonum('admin',0); + print ''; + + print 'Login Webcal'; + print ''; + + print 'Module Commercial ?'; + print ''; + $form->checkbox('module_comm',0,1); + print ''; + + print 'Module Compta ?'; + print ''; + $form->checkbox('module_compta',0,1); + print ''; + print 'Note'; print ""; @@ -120,23 +174,28 @@ else print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print ''; + print ''; print '
Nom'.$fuser->nom.'Prénom'.$fuser->prenom.'
Nom'.$fuser->nom.'Prénom'.$fuser->prenom.'
Login'.$fuser->login.'Email'.$fuser->email.'
Login'.$fuser->login.'Email'.$fuser->email.'
Webcal Login'.$fuser->webcal_login.' '.$fuser->webcal_login.' Administrateur'.$yn[$fuser->admin].'
'.$yn[$fuser->admin].'
Module Compta'.$yn[$fuser->compta].' Module Commercial'.$yn[$fuser->comm].'
Note'.nl2br($fuser->note).' 
'.nl2br($fuser->note).' 
'; @@ -184,10 +243,30 @@ else print 'Login'; print ''; + print 'Password'; + print ''; + print 'Email'; print ''; + print 'Admin ?'; + print ''; + $form->selectyesnonum('admin',$fuser->admin); + print ''; + + print 'Login Webcal'; + print ''; + print 'Module Commercial ?'; + print ''; + $form->checkbox('module_comm',$fuser->comm,1); + print ''; + + print 'Module Compta ?'; + print ''; + $form->checkbox('module_compta',$fuser->compta,1); + print ''; + print 'Description'; print "