Fix: [ bug #404 ] Impossible d'ajouter un contact lorsque le module LDAP
est actif (erreur Array 1)
This commit is contained in:
parent
13ea9c91fd
commit
04ee415879
@ -131,7 +131,7 @@ class Contact extends CommonObject
|
||||
$sql.= "'".$this->db->idate($now)."',";
|
||||
if ($this->socid > 0) $sql.= " ".$this->socid.",";
|
||||
else $sql.= "null,";
|
||||
$sql.= "'".$this->db->escape($this->name)."',";
|
||||
$sql.= "'".$this->db->escape($this->lastname)."',";
|
||||
$sql.= "'".$this->db->escape($this->firstname)."',";
|
||||
$sql.= " ".($user->id > 0 ? "'".$user->id."'":"null").",";
|
||||
$sql.= " ".$this->priv.",";
|
||||
@ -330,7 +330,7 @@ class Contact extends CommonObject
|
||||
|
||||
// Fields
|
||||
if ($this->fullname && $conf->global->LDAP_CONTACT_FIELD_FULLNAME) $info[$conf->global->LDAP_CONTACT_FIELD_FULLNAME] = $this->fullname;
|
||||
if ($this->name && $conf->global->LDAP_CONTACT_FIELD_NAME) $info[$conf->global->LDAP_CONTACT_FIELD_NAME] = $this->name;
|
||||
if ($this->lastname && $conf->global->LDAP_CONTACT_FIELD_NAME) $info[$conf->global->LDAP_CONTACT_FIELD_NAME] = $this->lastname;
|
||||
if ($this->firstname && $conf->global->LDAP_CONTACT_FIELD_FIRSTNAME) $info[$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME] = $this->firstname;
|
||||
|
||||
if ($this->poste) $info["title"] = $this->poste;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
@ -159,13 +159,13 @@ if (empty($reshook))
|
||||
$error++; $errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label"));
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$id = $object->create($user);
|
||||
if ($id <= 0)
|
||||
{
|
||||
$error++; $errors[]=($object->error?array($object->error):$object->errors);
|
||||
$error++; $errors=array_merge($errors,($object->error?array($object->error):$object->errors));
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
$error=$object->error; $errors[]=$object->errors;
|
||||
$error=$object->error; $errors=$object->errors;
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ else
|
||||
print_fiche_titre($title);
|
||||
|
||||
// Affiche les erreurs
|
||||
dol_htmloutput_errors($error,$errors);
|
||||
dol_htmloutput_errors(is_numeric($error)?'':$error,$errors);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
@ -689,7 +689,7 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($id) && $action != 'edit')
|
||||
if (! empty($id) && $action != 'edit' && $action != 'create')
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
|
||||
|
||||
@ -32,6 +32,8 @@ $langs->load("companies");
|
||||
$langs->load("ldap");
|
||||
$langs->load("admin");
|
||||
|
||||
$action=GETPOST('action');
|
||||
|
||||
// Security check
|
||||
$contactid = isset($_GET["id"])?$_GET["id"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
@ -45,7 +47,7 @@ $contact->fetch($_GET["id"], $user);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_GET["action"] == 'dolibarr2ldap')
|
||||
if ($action == 'dolibarr2ldap')
|
||||
{
|
||||
$message="";
|
||||
|
||||
@ -133,7 +135,7 @@ print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($message) { print $message; }
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -411,7 +411,7 @@ class Ldap
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog("Ldap::add dn=".$dn." info=".join(',',$info));
|
||||
dol_syslog(get_class($this)."::add dn=".$dn." info=".join(',',$info));
|
||||
|
||||
// Check parameters
|
||||
if (! $this->connection)
|
||||
@ -439,13 +439,14 @@ class Ldap
|
||||
|
||||
if ($result)
|
||||
{
|
||||
dol_syslog("Ldap::add successfull", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::add successfull", LOG_DEBUG);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=@ldap_error($this->connection);
|
||||
dol_syslog("Ldap::add failed: ".$this->error, LOG_ERR);
|
||||
$this->errno=@ldap_errno($this->connection);
|
||||
dol_syslog(get_class($this)."::add failed: ".$this->errno." ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user