Dbut ajout module "Phenix"

This commit is contained in:
Regis Houssin
2007-10-02 13:54:34 +00:00
parent de2a2fb2ac
commit 7b37eba3ae
9 changed files with 75 additions and 24 deletions

View File

@@ -54,6 +54,7 @@ if ($actionsave)
$i+=dolibarr_set_const($db,'PHPPHENIX_DBNAME',trim($_POST["phpphenix_dbname"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPPHENIX_USER',trim($_POST["phpphenix_user"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPPHENIX_PASS',trim($_POST["phpphenix_pass"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPPHENIX_COOKIE',trim($_POST["phpphenix_cookie"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPPHENIX_SYNCRO',trim($_POST["phpphenix_syncro"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPPHENIX_COMPANYCREATE',trim($_POST["phpphenix_companycreate"]),'chaine',0);
@@ -206,6 +207,13 @@ print '<td>';
print '&nbsp;</td>';
print "</tr>";
print "<tr class=\"pair\">";
print "<td>".$langs->trans("PhenixCookie")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"phpphenix_cookie\" value=\"". ($_POST["phpphenix_cookie"]?$_POST["phpphenix_cookie"]:$conf->global->PHPPHENIX_COOKIE) . "\" size=\"30\"></td>";
print "<td>PXlogin";
print "</td>";
print "</tr>";
print "</table>";
print "<br>";

View File

@@ -291,6 +291,7 @@ class Conf
$this->phenix->db->user=defined('PHPPHENIX_USER')?PHPPHENIX_USER:'';
$this->phenix->db->pass=defined('PHPPHENIX_PASS')?PHPPHENIX_PASS:'';
$this->phenix->db->name=defined('PHPPHENIX_DBNAME')?PHPPHENIX_DBNAME:'';
$this->phenix->cookie=defined('PHPPHENIX_COOKIE')?PHPPHENIX_COOKIE:'';
// Module mantis
$this->mantis->enabled=defined('MAIN_MODULE_MANTIS')?MAIN_MODULE_MANTIS:0;
$this->mantis->db->type=defined('PHPMANTIS_TYPE')?PHPMANTIS_TYPE:'__dolibarr_main_db_type__';

View File

@@ -23,6 +23,12 @@ function barcode_coder_save(formNameID)
formName.submit();
}
function formSubmit(formNameID)
{
var formName = parent.document.frames['main'].document.getElementById(formNameID);
formName.submit();
}
/*=================================================================
Purpose: Pour la fonction de saisie auto des villes
Input: postalcode,objectville

View File

@@ -470,6 +470,15 @@ if (! isset($_SESSION["dol_login"]))
$user->update_last_login_date();
}
// Module Phenix
if ($conf->phenix->enabled && $user->phenix_login != "" && $conf->phenix->cookie)
{
// Cr<43>ation du cookie permettant la connexion automatique, valide jusqu'<27> la fermeture du browser
if (!isset($HTTP_COOKIE_VARS[$conf->phenix->cookie]))
{
setcookie($conf->phenix->cookie, $user->phenix_login.":".$user->phenix_pass_crypted.":1", 0, "/", "", 0);
}
}
// Si user admin, on force droits sur les modules base
if ($user->admin)

View File

@@ -74,6 +74,8 @@ class User
var $fk_member;
var $webcal_login;
var $phenix_login;
var $phenix_pass;
var $phenix_pass_crypted;
var $datelastlogin;
var $datepreviouslogin;
@@ -124,7 +126,7 @@ class User
// Recupere utilisateur
$sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.office_phone, u.office_fax, u.user_mobile,";
$sql.= " u.admin, u.login, u.webcal_login, u.phenix_login, u.note,";
$sql.= " u.admin, u.login, u.webcal_login, u.phenix_login, u.phenix_pass, u.note,";
$sql.= " u.pass, u.pass_crypted, u.pass_temp,";
$sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,";
$sql.= " u.statut, u.lang,";
@@ -183,6 +185,7 @@ class User
$this->webcal_login = $obj->webcal_login;
$this->phenix_login = $obj->phenix_login;
$this->phenix_pass_crypted = $obj->phenix_pass;
$this->societe_id = $obj->fk_societe;
$this->contact_id = $obj->fk_socpeople;
$this->fk_member = $obj->fk_member;
@@ -933,6 +936,10 @@ class User
$this->note = addslashes(trim($this->note));
$this->webcal_login = addslashes(trim($this->webcal_login));
$this->phenix_login = addslashes(trim($this->phenix_login));
if ($this->phenix_pass != $this->phenix_pass_crypted)
{
$this->phenix_pass = md5(trim($this->phenix_pass));
}
$this->admin = $this->admin?$this->admin:0;
$this->db->begin();
@@ -949,6 +956,7 @@ class User
$sql.= ", email = '".$this->email."'";
$sql.= ", webcal_login = '".$this->webcal_login."'";
$sql.= ", phenix_login = '".$this->phenix_login."'";
$sql.= ", phenix_pass = '".$this->phenix_pass."'";
$sql.= ", note = '".$this->note."'";
$sql.= " WHERE rowid = ".$this->id;
@@ -961,8 +969,7 @@ class User
// Mise a jour mot de passe
if ($this->pass)
{
if ($this->pass != $this->pass_indatabase &&
$this->pass != $this->pass_indatabase_crypted)
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted)
{
// Si mot de passe saisi et diff<66>rent de celui en base
$this->password($user,$this->pass,$conf->password_encrypted);

View File

@@ -152,6 +152,7 @@ if ($_POST["action"] == 'add' && $canadduser)
$edituser->email = $_POST["email"];
$edituser->webcal_login = $_POST["webcal_login"];
$edituser->phenix_login = $_POST["phenix_login"];
$edituser->phenix_pass = $_POST["phenix_pass"];
$edituser->note = $_POST["note"];
$edituser->ldap_sid = $_POST["ldap_sid"];
@@ -244,6 +245,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $caneditfield)
$edituser->email = $_POST["email"];
$edituser->webcal_login = $_POST["webcal_login"];
$edituser->phenix_login = $_POST["phenix_login"];
$edituser->phenix_pass = $_POST["phenix_pass"];
$ret=$edituser->update($user);
if ($ret < 0)
@@ -679,6 +681,8 @@ if (($action == 'create') || ($action == 'adduserldap'))
{
print "<tr>".'<td valign="top">'.$langs->trans("LoginPenix").'</td>';
print '<td><input size="30" type="text" name="phenix_login" value=""></td></tr>';
print "<tr>".'<td valign="top">'.$langs->trans("PassPenix").'</td>';
print '<td><input size="30" type="text" name="phenix_pass" value=""></td></tr>';
}
print "<tr>".'<td align="center" colspan="2"><input class="button" value="'.$langs->trans("CreateUser").'" type="submit"></td></tr>';
@@ -954,6 +958,9 @@ else
print '<tr><td width="25%" valign="top">'.$langs->trans("LoginPhenix").'</td>';
print '<td colspan="2">'.$fuser->phenix_login.'&nbsp;</td>';
print "</tr>\n";
print '<tr><td width="25%" valign="top">'.$langs->trans("PassPhenix").'</td>';
print '<td colspan="2">'.eregi_replace('.','*',$fuser->phenix_pass_crypted).'&nbsp;</td>';
print "</tr>\n";
}
// Module Adh<64>rent
@@ -1392,6 +1399,11 @@ else
if ($caneditfield) print '<input size="30" type="text" class="flat" name="phenix_login" value="'.$fuser->phenix_login.'">';
else print $fuser->phenix_login;
print '</td></tr>';
print "<tr>".'<td valign="top">'.$langs->trans("PassPhenix").'</td>';
print '<td colspan="2">';
if ($caneditfield) print '<input size="30" type="password" class="flat" name="phenix_pass" value="'.$fuser->phenix_pass_crypted.'">';
else print eregi_replace('.','*',$fuser->phenix_pass_crypted);
print '</td></tr>';
}
print '<tr><td align="center" colspan="3">';

View File

@@ -34,6 +34,12 @@ include_once("../conf/conf.php");
require_once("../master.inc.php");
require_once(PEAR_PATH."/Auth/Auth.php");
// Module Phenix
if ($conf->phenix->enabled && $conf->phenix->cookie)
{
// Destruction du cookie
setcookie($conf->phenix->cookie, '', 1, "/");
}
dolibarr_syslog("End session in DOLSESSID_".$dolibarr_main_db_name);

View File

@@ -932,3 +932,4 @@ INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active)
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (9, 'A6', 'Format A6', '105', '148', 'mm', 1);
ALTER TABLE llx_user ADD COLUMN phenix_login varchar(25) after webcal_login;
ALTER TABLE llx_user ADD COLUMN phenix_pass varchar(128) after phenix_login;

View File

@@ -40,6 +40,7 @@ create table llx_user
admin smallint DEFAULT 0,
webcal_login varchar(25),
phenix_login varchar(25),
phenix_pass varchar(128),
module_comm smallint DEFAULT 1,
module_compta smallint DEFAULT 1,
fk_societe integer,