mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 14:31:29 +01:00
Fix: Create login from contact
This commit is contained in:
@@ -39,8 +39,8 @@ require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class User
|
* \class User
|
||||||
\brief Classe permettant la gestion d'un utilisateur
|
* \brief Classe permettant la gestion d'un utilisateur
|
||||||
*/
|
*/
|
||||||
class User extends CommonObject
|
class User extends CommonObject
|
||||||
{
|
{
|
||||||
@@ -817,10 +817,12 @@ class User extends CommonObject
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||||
$sql.= " SET fk_socpeople=".$contact->id.", fk_societe=".$contact->societeid;
|
$sql.= " SET fk_socpeople=".$contact->id;
|
||||||
|
if ($contact->societeid) $sql.=", fk_societe=".$contact->societeid;
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
|
dolibarr_syslog("User::create_from_contact sql=".$sql, LOG_DEBUG);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@@ -828,8 +830,8 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error()." - $sql";
|
$this->error=$this->db->error();
|
||||||
dolibarr_syslog("User::create_from_contact - 10 - ".$this->error);
|
dolibarr_syslog("User::create_from_contact ".$this->error, LOG_ERR);
|
||||||
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
@@ -878,6 +880,7 @@ class User extends CommonObject
|
|||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
|
dolibarr_syslog("User::create_from_member sql=".$sql, LOG_DEBUG);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@@ -886,7 +889,7 @@ class User extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error()." - ".$sql;
|
$this->error=$this->db->error()." - ".$sql;
|
||||||
dolibarr_syslog("User::create_from_member - 1 - ".$this->error);
|
dolibarr_syslog("User::create_from_member - ".$this->error, LOG_ERR);
|
||||||
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/user/fiche.php
|
* \file htdocs/user/fiche.php
|
||||||
\brief Onglet user et permissions de la fiche utilisateur
|
* \brief Onglet user et permissions de la fiche utilisateur
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@@ -276,7 +276,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $caneditfield)
|
|||||||
if (is_dir($conf->users->dir_output))
|
if (is_dir($conf->users->dir_output))
|
||||||
{
|
{
|
||||||
$newfile=$conf->users->dir_output . "/" . $edituser->id . ".jpg";
|
$newfile=$conf->users->dir_output . "/" . $edituser->id . ".jpg";
|
||||||
if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1))
|
if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1) > 0)
|
||||||
{
|
{
|
||||||
$message .= '<div class="error">'.$langs->trans("ErrorFailedToSaveFile").'</div>';
|
$message .= '<div class="error">'.$langs->trans("ErrorFailedToSaveFile").'</div>';
|
||||||
}
|
}
|
||||||
@@ -912,17 +912,19 @@ else
|
|||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($fuser->societe_id);
|
$societe->fetch($fuser->societe_id);
|
||||||
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$fuser->societe_id.'">'.img_object($langs->trans("ShowCompany"),'company').' '.dolibarr_trunc($societe->nom,32).'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$fuser->societe_id.'">'.img_object($langs->trans("ShowCompany"),'company').' '.dolibarr_trunc($societe->nom,32).'</a>';
|
||||||
if ($fuser->contact_id)
|
|
||||||
{
|
|
||||||
$contact = new Contact($db);
|
|
||||||
$contact->fetch($fuser->contact_id);
|
|
||||||
print ' / '.'<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$fuser->contact_id.'">'.img_object($langs->trans("ShowContact"),'contact').' '.dolibarr_trunc($contact->getFullName($langs),32).'</a>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("ThisUserIsNot");
|
print $langs->trans("ThisUserIsNot");
|
||||||
}
|
}
|
||||||
|
if ($fuser->contact_id)
|
||||||
|
{
|
||||||
|
$contact = new Contact($db);
|
||||||
|
$contact->fetch($fuser->contact_id);
|
||||||
|
if ($fuser->societe_id > 0) print ' / ';
|
||||||
|
else print '<br>';
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$fuser->contact_id.'">'.img_object($langs->trans("ShowContact"),'contact').' '.dolibarr_trunc($contact->getFullName($langs),32).'</a>';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user