diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index cc8f142135b..30810edde44 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -28,15 +28,6 @@ \ingroup ldap \brief Page d'administration/configuration du module Ldap \version $Revision$ - \remarks Exemple configuration : - LDAP_SERVER_HOST Serveur LDAP 192.168.1.50 - LDAP_SERVER_PORT Port LDAP 389 - LDAP_ADMIN_DN Administrateur LDAP cn=adminldap,dc=societe,dc=com - LDAP_ADMIN_PASS Mot de passe xxxxxxxx - LDAP_USER_DN DN des utilisateurs ou=users,dc=societe,dc=com - LDAP_GROUP_DN DN des groupes ou=groups,dc=societe,dc=com - LDAP_CONTACT_DN DN des contacts ou=contacts,dc=societe,dc=com - LDAP_SERVER_TYPE Type Openldap */ require("./pre.inc.php"); @@ -251,8 +242,8 @@ print ''.$langs->trans("LDAPServerUseTLSExample").''; - -print ''; +$var=!$var; +print ''; print ''; print ''; diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 035aee4d0ac..57947006c89 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -28,19 +28,11 @@ \ingroup ldap \brief Page d'administration/configuration du module Ldap \version $Revision$ - \remarks Exemple configuration : - LDAP_SERVER_HOST Serveur LDAP 192.168.1.50 - LDAP_SERVER_PORT Port LDAP 389 - LDAP_ADMIN_DN Administrateur LDAP cn=adminldap,dc=societe,dc=com - LDAP_ADMIN_PASS Mot de passe xxxxxxxx - LDAP_USER_DN DN des utilisateurs ou=users,dc=societe,dc=com - LDAP_GROUP_DN DN des groupes ou=groups,dc=societe,dc=com - LDAP_CONTACT_DN DN des contacts ou=contacts,dc=societe,dc=com - LDAP_SERVER_TYPE Type Openldap */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/authldap.lib.php"); +require_once (DOL_DOCUMENT_ROOT."/contact.class.php"); $langs->load("admin"); @@ -137,13 +129,13 @@ $html=new Form($db); // DN Pour les contacts $var=!$var; -print ''.$langs->trans("LDAPContactDn").''; +print ''.$langs->trans("LDAPContactDn").picto_required().''; print ''; print ''.$langs->trans("LDAPContactDnExample").''; // Name $var=!$var; -print ''.$langs->trans("LDAPFieldName").''; +print ''.$langs->trans("LDAPFieldName").picto_required().''; print ''; print ''.$langs->trans("LDAPFieldNameExample").''; @@ -179,7 +171,8 @@ print ''; -print ''; +$var=!$var; +print ''; print ''; print ''; @@ -188,6 +181,44 @@ print ''; print info_admin($langs->trans("LDAPDescValues")); +/* + * Test de la connexion + */ +if (function_exists("ldap_connect")) +{ + if ($conf->global->LDAP_SERVER_HOST) + { + print '
'; + print ''.$langs->trans("LDAPTestSynchroContact").'

'; + } + + if ($_GET["action"] == 'test') + { + // Creation contact + $contact=new Contact($db); + $contact->initAsSpecimen(); + + // Test synchro + $result1=$contact->delete_ldap($user); + $result2=$contact->update_ldap($user); + $result3=$contact->delete_ldap($user); + + if ($result2 > 0) + { + print img_picto('','info').' '; + print ''.$langs->trans("LDAPSynchroOK").'
'; + } + else + { + print img_picto('','error').' '; + print ''.$langs->trans("LDAPSynchroKO"); + print ': '.$contact->error; + print '
'; + } + + } +} + $db->close(); llxFooter('$Date$ - $Revision$'); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 8ad0b85ae10..88c40e9850d 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -28,15 +28,6 @@ \ingroup ldap \brief Page d'administration/configuration du module Ldap \version $Revision$ - \remarks Exemple configuration : - LDAP_SERVER_HOST Serveur LDAP 192.168.1.50 - LDAP_SERVER_PORT Port LDAP 389 - LDAP_ADMIN_DN Administrateur LDAP cn=adminldap,dc=societe,dc=com - LDAP_ADMIN_PASS Mot de passe xxxxxxxx - LDAP_USER_DN DN des utilisateurs ou=users,dc=societe,dc=com - LDAP_GROUP_DN DN des groupes ou=groups,dc=societe,dc=com - LDAP_CONTACT_DN DN des contacts ou=contacts,dc=societe,dc=com - LDAP_SERVER_TYPE Type Openldap */ require("./pre.inc.php"); @@ -141,19 +132,19 @@ print "\n"; // DN Pour les utilisateurs $var=!$var; -print ''.$langs->trans("LDAPUserDn").''; +print ''.$langs->trans("LDAPUserDn").picto_required().''; print ''; print ''.$langs->trans("LDAPUserDnExample").''; // DN pour les groupes $var=!$var; -print ''.$langs->trans("LDAPGroupDn").''; +print ''.$langs->trans("LDAPGroupDn").picto_required().''; print ''; print ''.$langs->trans("LDAPGroupDnExample").''; // Filtre de connexion $var=!$var; -print ''.$langs->trans("LDAPFilterConnection").''; +print ''.$langs->trans("LDAPFilterConnection").picto_required().''; print ''; print ''.$langs->trans("LDAPFilterConnectionExample").''; @@ -171,7 +162,7 @@ print ''.$langs->trans("LDAPFieldLoginSambaExample").''; // Name $var=!$var; -print ''.$langs->trans("LDAPFieldName").''; +print ''.$langs->trans("LDAPFieldName").picto_required().''; print ''; print ''.$langs->trans("LDAPFieldNameExample").''; @@ -205,8 +196,8 @@ print ''.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").''; - -print ''; +$var=!$var; +print ''; print ''; print ''; diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php index eac0cf5b2df..fcbaad2c0f1 100644 --- a/htdocs/contact.class.php +++ b/htdocs/contact.class.php @@ -53,6 +53,7 @@ class Contact var $cp; var $ville; var $fk_pays; + var $fk_soc; var $code; var $email; @@ -83,49 +84,60 @@ class Contact */ function create($user) { + // Nettoyage parametres $this->name=trim($this->name); - if (! $this->socid) - { - $this->socid = 0; - } + if (! $this->socid)$this->socid = 0; $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (datec, fk_soc, name, fk_user)"; $sql.= " VALUES (now(),"; if ($this->socid > 0) $sql.= " $this->socid,"; else $sql.= "null,"; $sql.= "'$this->name',$user->id)"; - - if ($this->db->query($sql) ) + dolibarr_syslog("Contact.class::create sql=".$sql); + + $resql=$this->db->query($sql); + if ($resql) { - $id = $this->db->last_insert_id(MAIN_DB_PREFIX."socpeople"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."socpeople"); - $ret=$this->update($id, $user); - if ($ret < 0) + $result=$this->update($this->id, $user, 0); + if ($result < 0) { $this->error=$this->db->error(); return -2; - } - return $id; + } + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('CONTACT_CREATE',$this,$user,$langs,$conf); + // Fin appel triggers + + // \todo Mettre en trigger + $this->create_ldap($user); + + return $this->id; } else { $this->error=$this->db->error(); + dolibarr_syslog("Contact.class::create ".$this->error); return -1; } } /* * \brief Mise à jour des infos - * \param id id du contact à mettre à jour - * \param user Utilisateur qui effectue la mise à jour - * \return int <0 si erreur, >0 si ok + * \param id Id du contact à mettre à jour + * \param user Objet utilisateur qui effectue la mise à jour + * \param call_trigger 0=non, 1=oui + * \return int <0 si erreur, >0 si ok */ - function update($id, $user=0) + function update($id, $user=0, $call_trigger=1) { - dolibarr_syslog("Contact::Update id=".$id,LOG_DEBUG); - $this->id = $id; + // Nettoyage parametres $this->name=trim($this->name); $this->firstname=trim($this->firstname); $this->email=trim($this->email); @@ -158,6 +170,7 @@ class Contact $sql .= ", jabberid = '".addslashes($this->jabberid)."'"; if ($user) $sql .= ", fk_user_modif=".$user->id; $sql .= " WHERE idp=".$id; + dolibarr_syslog("Contact.class::update sql=".$sql,LOG_DEBUG); $result = $this->db->query($sql); if (! $result) @@ -165,32 +178,99 @@ class Contact $this->error=$this->db->error().' sql='.$sql; return -1; } - - if ($conf->ldap->enabled) - { - if ($conf->global->LDAP_CONTACT_ACTIVE) - { - $this->update_ldap($user); - } - - } + + if ($call_trigger) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('CONTACT_UPDATE',$this,$user,$langs,$conf); + // Fin appel triggers + + // \todo Mettre en trigger + $this->update_ldap($user); + } + + return 1; } + /** - * \brief Mise à jour de l'arbre LDAP + * \brief Mise à jour de l'arbre LDAP + * \param user Utilisateur qui efface + * \return int <0 si ko, >0 si ok + */ + function delete_ldap($user) + { + global $conf, $langs; + + if (! $conf->ldap->enabled || ! $conf->global->LDAP_CONTACT_ACTIVE) return 0; + + dolibarr_syslog("Contact.class::delete_ldap this->id=".$this->id,LOG_DEBUG); + + $ldap=new AuthLdap(); + $result=$ldap->connect(); + if ($result) + { + $bind=''; + if ($conf->global->LDAP_ADMIN_DN && $conf->global->LDAP_ADMIN_PASS) + { + dolibarr_syslog("Contact.class::delete_ldap authBind user=".$conf->global->LDAP_ADMIN_DN,LOG_DEBUG); + $bind=$ldap->authBind($conf->global->LDAP_ADMIN_DN,$conf->global->LDAP_ADMIN_PASS); + } + else + { + dolibarr_syslog("Contact.class::delete_ldap bind",LOG_DEBUG); + $bind=$ldap->bind(); + } + + if ($bind) + { + $info["cn"] = utf8_encode(trim($this->firstname." ".$this->name)); + $dn = "cn=".$info["cn"].",".$conf->global->LDAP_CONTACT_DN; + + $result=$ldap->delete($dn); + + return $result; + } + } + else + { + $this->error="Failed to connect to LDAP server !"; + dolibarr_syslog("Contact.class::update_ldap Connexion failed",LOG_DEBUG); + return -1; + } + } + + + /** + * \brief Creation d'un contact dans l'arbre LDAP + * \param user Utilisateur qui effectue la creation + * \return int <0 si ko, >0 si ok + */ + function create_ldap($user) + { + dolibarr_syslog("Contact.class::create_ldap this->id=".$this->id,LOG_DEBUG); + return $this->update_ldap($user); + } + + + /** + * \brief Mise à jour du contact dans l'arbre LDAP * \param user Utilisateur qui effectue la mise à jour * \return int <0 si ko, >0 si ok */ function update_ldap($user) { global $conf, $langs; + + if (! $conf->ldap->enabled || ! $conf->global->LDAP_CONTACT_ACTIVE) return 0; + $info = array(); - dolibarr_syslog("Contact.class::update_ldap",LOG_DEBUG); + dolibarr_syslog("Contact.class::update_ldap this->id=".$this->id,LOG_DEBUG); - $this->fetch($this->id); - $ldap=new AuthLdap(); $result=$ldap->connect(); if ($result) @@ -211,19 +291,24 @@ class Contact if ($conf->global->LDAP_SERVER_TYPE == 'activedirectory') { // Pas de conversion utf8 pour etre compatible Windows - - $info["objectclass"][0] = "top"; - $info["objectclass"][1] = "person"; - $info["objectclass"][2] = "organizationalPerson"; - //$info["objectclass"][3] = "inetOrgPerson"; - $info["objectclass"][3] = "user"; + $info["objectclass"]=array("top", + "person", + "organizationalPerson", + "user"); + // Champs obligatoires $info["cn"] = trim($this->firstname." ".$this->name); - $info["sn"] = $this->name; - $info["givenName"] = $this->firstname; - + if ($this->name) $info[$conf->global->LDAP_FIELD_NAME] = $this->name; + else + { + $langs->load("other"); + $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Name")); + return -1; + } + + // Champs optionnels + if ($this->firstname && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = utf8_encode($this->firstname); if ($this->poste) $info["title"] = $this->poste; - if ($this->socid > 0) { $soc = new Societe($this->db); @@ -259,45 +344,16 @@ class Contact $info["l"] = $soc->ville; } } - - if ($this->phone_pro) - $info["telephoneNumber"] = dolibarr_print_phone($this->phone_pro); - - if ($this->phone_perso) - $info["homePhone"] = dolibarr_print_phone($this->phone_perso); - - if ($this->phone_mobile) - $info["mobile"] = dolibarr_print_phone($this->phone_mobile); - - if ($this->fax) - $info["facsimileTelephoneNumber"] = dolibarr_print_phone($this->fax); - - if ($this->note) - $info["description"] = $this->note; - - if ($this->email) - $info["mail"] = $this->email; - - $dn = "cn=".$info["cn"].",".$conf->global->LDAP_CONTACT_DN; - - // On supprime et on insère - dolibarr_syslog("Contact.class::update_ldap dn=".$dn." info=".$info); - $r = @ldap_delete($ldap->connection, $dn); - if (! @ldap_add($ldap->connection, $dn, $info)) - { - $this->error = ldap_err2str(ldap_errno($ldap->connection)); - dolibarr_syslog("Contact.class::update_ldap ldap_add ".$this->error); - return -1; - } - else - { - dolibarr_syslog("Contact.class::update_ldap rowid=".$this->rowid." added in LDAP"); - } + if ($this->phone_pro && $conf->global->LDAP_FIELD_PHONE) $info[$conf->global->LDAP_FIELD_PHONE] = $this->phone_pro; + if ($this->phone_perso) $info["homePhone"] = $this->phone_perso; + if ($this->phone_mobile && $conf->global->LDAP_FIELD_MOBILE) $info[$conf->global->LDAP_FIELD_MOBILE] = $this->phone_mobile; + if ($this->fax && $conf->global->LDAP_FIELD_FAX) $info[$conf->global->LDAP_FIELD_FAX] = $this->fax; + if ($this->note) $info["description"] = $this->note; + if ($this->email && $conf->global->LDAP_FIELD_MAIL) $info[$conf->global->LDAP_FIELD_MAIL] = $this->email; } else { // OpenLDAP. On encode les param en utf8 - $info["objectclass"]=array("top", "person", "organizationalPerson", @@ -314,10 +370,8 @@ class Contact } // Champs optionnels - if ($this->firstname) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = utf8_encode($this->firstname); - + if ($this->firstname && $conf->global->LDAP_FIELD_FIRSTNAME) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = utf8_encode($this->firstname); if ($this->poste) $info["title"] = utf8_encode($this->poste); - if ($this->socid > 0) { $soc = new Societe($this->db); @@ -332,18 +386,12 @@ class Contact if ($soc->cp) $info["postalCode"] = utf8_encode($soc->cp); if ($soc->ville) $info["l"] = utf8_encode($soc->ville); } - - if ($this->phone_pro) $info[$conf->global->LDAP_FIELD_PHONE] = utf8_encode($this->phone_pro); - + if ($this->phone_pro && $conf->global->LDAP_FIELD_PHONE) $info[$conf->global->LDAP_FIELD_PHONE] = utf8_encode($this->phone_pro); if ($this->phone_perso) $info["homePhone"] = utf8_encode($this->phone_perso); - - if ($this->phone_mobile) $info[$conf->global->LDAP_FIELD_MOBILE] = utf8_encode($this->phone_mobile); - - if ($this->fax) $info[$conf->global->LDAP_FIELD_FAX] = utf8_encode($this->fax); - + if ($this->phone_mobile && $conf->global->LDAP_FIELD_MOBILE) $info[$conf->global->LDAP_FIELD_MOBILE] = utf8_encode($this->phone_mobile); + if ($this->fax && $conf->global->LDAP_FIELD_FAX) $info[$conf->global->LDAP_FIELD_FAX] = utf8_encode($this->fax); if ($this->note) $info["description"] = utf8_encode($this->note); - - if ($this->email) $info[$conf->global->LDAP_FIELD_MAIL] = utf8_encode($this->email); + if ($this->email && $conf->global->LDAP_FIELD_MAIL) $info[$conf->global->LDAP_FIELD_MAIL] = utf8_encode($this->email); if ($conf->global->LDAP_SERVER_TYPE == 'egroupware') { @@ -374,23 +422,23 @@ class Contact $info["uid"] = "Dolibarr ".$this->id. ": ".utf8_encode(trim($this->firstname." ".$this->name)); - $dn = "cn=".$info["cn"].",".$conf->global->LDAP_CONTACT_DN; - - // On supprime et on insère - dolibarr_syslog("Contact.class::update_ldap dn=".$dn." info=".$info); - $result = $ldap->delete($dn); - $result = $ldap->add($dn, $info); - if ($result <= 0) - { - $this->error = $ldap->error." ".ldap_errno($ldap->connection)." ".ldap_error($ldap->connection); - dolibarr_syslog("Contact.class::update_ldap ".$this->error); - print_r($info); - return -1; - } - else - { - dolibarr_syslog("Contact.class::update_ldap rowid=".$this->rowid." added in LDAP"); - } + } + + // On supprime et on insère + $dn = "cn=".$info["cn"].",".$conf->global->LDAP_CONTACT_DN; + dolibarr_syslog("Contact.class::update_ldap dn=".$dn." info=".$info); + $result = $ldap->delete($dn); + $result = $ldap->add($dn, $info); + if ($result <= 0) + { + $this->error = $ldap->error." ".ldap_errno($ldap->connection)." ".ldap_error($ldap->connection); + dolibarr_syslog("Contact.class::update_ldap ".$this->error); + //print_r($info); + return -1; + } + else + { + dolibarr_syslog("Contact.class::update_ldap rowid=".$this->id." added in LDAP"); } $ldap->unbind(); @@ -407,7 +455,7 @@ class Contact else { $this->error="Failed to connect to LDAP server !"; - dolibarr_syslog("Contact::update_ldap Connexion failed",LOG_DEBUG); + dolibarr_syslog("Contact.class::update_ldap Connexion failed",LOG_DEBUG); return -1; } } @@ -608,7 +656,7 @@ class Contact $sql.=" AND fk_socpeople = ". $this->id; $sql.=" GROUP BY tc.element"; - dolibarr_syslog("Contact::load_ref_elements sql=".$sql); + dolibarr_syslog("Contact.class::load_ref_elements sql=".$sql); $resql=$this->db->query($sql); if ($resql) @@ -629,7 +677,7 @@ class Contact else { $this->error=$this->db->error()." - ".$sql; - dolibarr_syslog("Contact::load_ref_elements Error ".$this->error); + dolibarr_syslog("Contact.class::load_ref_elements Error ".$this->error); return -1; } } @@ -660,50 +708,32 @@ class Contact $sql .= " WHERE idp=$id"; $result = $this->db->query($sql); - - if (!$result) + if (! $result) { - print $this->db->error() . '
' . $sql; + $this->error=$this->db->error().' sql='.$sql; + return -1; } - if ($conf->ldap->enabled) - { - if (defined('LDAP_CONTACT_ACTIVE') && LDAP_CONTACT_ACTIVE == 1) - { - $ldap = New AuthLdap(); - - if ($ldap->connect()) - { - if ($ldap->bind()) - { - // delete from ldap directory - if (LDAP_SERVER_TYPE == 'activedirectory') - { - $userdn = $this->old_firstname." ".$this->old_name; //enlever utf8 pour etre compatible Windows - } - else - { - $userdn = utf8_encode($this->old_firstname." ".$this->old_name); - } - - $dn = "cn=".$userdn.",".$conf->global->LDAP_CONTACT_DN; - $r = @ldap_delete($ldap->connection, $dn); - } - else - { - echo "LDAP bind failed..."; - } - - $ldap->close(); - } - else - { - echo "Unable to connect to LDAP server"; - } - - return $result; - } - } + + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('CONTACT_DELETE',$this,$user,$langs,$conf); + // Fin appel triggers + + + // \todo Mettre en trigger + + // On modifie contact avec anciens noms + $savname=$this->name; + $savfirstname=$this->firstname; + $this->name=$this->old_name; + $this->firstname=$this->old_firstname; + + $this->delete_ldap($user); + + $this->name=$savname; + $this->firstname=$savfirstname; } @@ -805,5 +835,47 @@ class Contact return $result; } + + /** + * \brief Initialise le contact avec valeurs fictives aléatoire + */ + function initAsSpecimen() + { + global $user,$langs; + + // Charge tableau des id de société socids + $socids = array(); + $sql = "SELECT idp FROM ".MAIN_DB_PREFIX."societe LIMIT 10"; + $resql = $this->db->query($sql); + if ($resql) + { + $num_socs = $this->db->num_rows($resql); + $i = 0; + while ($i < $num_socs) + { + $i++; + + $row = $this->db->fetch_row($resql); + $socids[$i] = $row[0]; + } + } + + // Initialise paramètres + $this->id=0; + $this->specimen=1; + $this->fullname = 'DOLIBARR SPECIMEN'; + $this->nom = 'DOLIBARR'; + $this->name = $this->nom; + $this->prenom = 'SPECIMEN'; + $this->firstname = $this->prenom; + $this->address = '61 jump street'; + $this->cp = '75000'; + $this->ville = 'Paris'; + $this->fk_pays = 1; + $this->email = 'specimen@specimen.com'; + $socid = rand(1, $num_socs); + $this->fk_soc = $socids[$socid]; + } + } ?> diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 2825ac96dd3..429fa697c57 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -30,6 +30,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/vcard/vcard.class.php"); @@ -608,7 +609,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit') // Historique des actions sur ce contact - print_titre ($langs->trans("TasksHistoryForThisContact")); + print_titre($langs->trans("TasksHistoryForThisContact")); $histo=array(); $numaction = 0 ; @@ -680,11 +681,12 @@ if ($_GET["id"] && $_GET["action"] != 'edit') print ''; print ''.$langs->trans("Date").''; - print ''.$langs->trans("Status").''; print ''.$langs->trans("Actions").''; print ''.$langs->trans("Comments").''; - print ''.$langs->trans("Author").''; - + print ''.$langs->trans("Author").''; + print ''.$langs->trans("Status").''; + print ''; + foreach ($histo as $key=>$value) { $var=!$var; @@ -693,14 +695,6 @@ if ($_GET["id"] && $_GET["action"] != 'edit') // Date print "". dolibarr_print_date($histo[$key]['date'],"%d %b %Y %H:%M") .""; - // Status/Percent - if ($histo[$key]['percent'] < 100) { - print "".$histo[$key]['percent']."%"; - } - else { - print "".$langs->trans("Done").""; - } - // Action print ''; if ($histo[$key]['type']=='action') @@ -732,6 +726,13 @@ if ($_GET["id"] && $_GET["action"] != 'edit') } else print " "; print ""; + + // Status/Percent + print ''; + $actionstatic=new ActionComm($db); + print $actionstatic->LibStatut($histo[$key]['percent'],5); + print ''; + print "\n"; } print ""; diff --git a/htdocs/docsoc.php b/htdocs/docsoc.php index a3d043a3200..ebac5e0e8d0 100644 --- a/htdocs/docsoc.php +++ b/htdocs/docsoc.php @@ -168,7 +168,7 @@ if ($socid > 0) // Affiche formulaire upload $html=new Form($db); - $html->form_attach_new_file('docsoc.php?socid='.$socid,$langs->trans("AddPhoto"),1); + $html->form_attach_new_file('docsoc.php?socid='.$socid,$langs->trans("AddPhoto"),0); // Affiche liste des documents existant print_titre($langs->trans("AttachedFiles")); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7b7ee85314b..636b68808b0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -527,6 +527,11 @@ LDAPDnContactActiveExample=Activated/Unactivated synchronization LDAPContactDn=Dolibarr contacts' DN LDAPContactDnExample=Complete DN (ex: ou=contacts,dc=society,dc=com) LDAPTestConnect=Test LDAP connection +LDAPTestSynchroContact=Test contact's synchronization +LDAPTestSynchroUser=Test user's synchronization +LDAPTestSynchroMember=Test member's synchronization +LDAPSynchroOK=Synchronization test successful +LDAPSynchroKO=Failed synchronization test LDAPTCPConnectOK=TCP connect to LDAP server successful (Server=%s, Port=%s) LDAPTCPConnectKO=TCP connect to LDAP server failed (Server=%s, Port=%s) LDAPBindOK=Connect/Authentificate to LDAP server sucessfull (Server=%s, Port=%s, Admin=%s) diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index a3d7045a756..a7a275a79d1 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -47,7 +47,7 @@ NoRecordedProspects=No prospect recorded StatusActionToDo=To do StatusActionDone=Done StatusActionInProcess=In process -TasksHistoryForThisContact=Actions history for this contact +TasksHistoryForThisContact=Actions for this contact LastProspectDoNotContact=Do not contact LastProspectNeverContacted=Never contacted LastProspectToContact=To contact diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1f62463fab3..a104d861849 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -105,7 +105,7 @@ Note=Note CurrentNote=Current note Title=Title Label=Label -Info=Info +Info=Log Family=Family Description=Description Designation=Description diff --git a/htdocs/langs/fr_BE/commercial.lang b/htdocs/langs/fr_BE/commercial.lang index 7581d3bfc0b..641b172485f 100644 --- a/htdocs/langs/fr_BE/commercial.lang +++ b/htdocs/langs/fr_BE/commercial.lang @@ -47,7 +47,7 @@ NoRecordedProspects=Pas de prospect enregistr StatusActionToDo=À faire StatusActionDone=Accompli StatusActionInProcess=En cours -TasksHistoryForThisContact=Historique des actions pour ce contact +TasksHistoryForThisContact=Actions vis à vis de ce contact LastProspectDoNotContact=Ne pas contacter LastProspectNeverContacted=Jamais contacté LastProspectToContact=À contacter diff --git a/htdocs/langs/fr_BE/companies.lang b/htdocs/langs/fr_BE/companies.lang index d2a48b2514e..7c15318a7e8 100644 --- a/htdocs/langs/fr_BE/companies.lang +++ b/htdocs/langs/fr_BE/companies.lang @@ -98,7 +98,7 @@ DefaultContact=Contact par d AddCompany=Créer société AddThirdParty=Ajouter un tiers DeleteACompany=Supprimer une société -PersonalInformations=Informations personnelles +PersonalInformations=Infos personnelles AccountancyCode=Code compta CustomerCode=Code client SupplierCode=Code fournisseur diff --git a/htdocs/langs/fr_BE/main.lang b/htdocs/langs/fr_BE/main.lang index 70f297fd8ac..63555df343c 100644 --- a/htdocs/langs/fr_BE/main.lang +++ b/htdocs/langs/fr_BE/main.lang @@ -105,7 +105,7 @@ Note=Note CurrentNote=Note actuelle Title=Titre Label=Libellé -Info=Info +Info=Suivi Family=Famille Description=Description Designation=Désignation diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index a4e5899e6da..b3cd803d905 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -527,6 +527,11 @@ LDAPDnContactActiveExample=Synchronisation activ LDAPContactDn=DN des contacts Dolibarr LDAPContactDnExample=DN complet (ex: ou=contacts,dc=my-domain,dc=com) LDAPTestConnect=Tester la connexion LDAP +LDAPTestSynchroContact=Tester synchronisation contacts +LDAPTestSynchroUser=Tester synchronisation utilisateur +LDAPTestSynchroMember=Tester synchronisation adhérent +LDAPSynchroOK=Test de synchronisation réalisé avec succès +LDAPSynchroKO=Echec du test de synchronisation LDAPTCPConnectOK=Connexion TCP au serveur LDAP réussie (Serveur=%s, Port=%s) LDAPTCPConnectKO=Connexion TCP au serveur LDAP échouée (Serveur=%s, Port=%s) LDAPBindOK=Connection/Authentification au serveur LDAP réussie (Serveur=%s, Port=%s, Admin=%s) diff --git a/htdocs/langs/fr_FR/commercial.lang b/htdocs/langs/fr_FR/commercial.lang index 641ca0896f3..46c87589272 100644 --- a/htdocs/langs/fr_FR/commercial.lang +++ b/htdocs/langs/fr_FR/commercial.lang @@ -47,7 +47,7 @@ NoRecordedProspects=Aucun prospect enregistr StatusActionToDo=À faire StatusActionDone=Réalisé StatusActionInProcess=En cours -TasksHistoryForThisContact=Historique des actions pour ce contact +TasksHistoryForThisContact=Actions vis à vis de contact LastProspectDoNotContact=A ne pas contacter LastProspectNeverContacted=Non contactés LastProspectToContact=A contacter diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 888c45dc5a6..011af6f8819 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -98,7 +98,7 @@ DefaultContact=Contact par d AddCompany=Créer société AddThirdParty=Créer tiers DeleteACompany=Supprimer une société -PersonalInformations=Informations personnelles +PersonalInformations=Infos personnelles AccountancyCode=Code compta CustomerCode=Code client SupplierCode=Code fournisseur diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 9161b1ff1e9..5e60a74e0be 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -105,7 +105,7 @@ Note=Note CurrentNote=Note actuelle Title=Titre Label=Libellé -Info=Info +Info=Suivi Family=Famille Description=Description Designation=Désignation diff --git a/htdocs/langs/nl_BE/main.lang b/htdocs/langs/nl_BE/main.lang index ade5bc99409..4427f60cd89 100644 --- a/htdocs/langs/nl_BE/main.lang +++ b/htdocs/langs/nl_BE/main.lang @@ -50,7 +50,7 @@ Type=Het type Language=Taal Note=Aantekening Label=Het etiket -Info=de info +Info=Log Family=Famille Description=De beschrijving Action=Actie diff --git a/htdocs/langs/pt_PT/main.lang b/htdocs/langs/pt_PT/main.lang index 8d3cc254839..10096228b88 100644 --- a/htdocs/langs/pt_PT/main.lang +++ b/htdocs/langs/pt_PT/main.lang @@ -69,7 +69,7 @@ Language=Idioma Note=Nota CurrentNote=Nota currente Label=Rótulo -Info=Info +Info=Log Family=Família Description=Descrição Designation=Designação diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index de453727f39..6fc9dba44fe 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -2107,8 +2107,8 @@ function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $exclu /** * \brief Retourne le numéro de la semaine par rapport a une date - * \param time date au format 'timestamp' - * \return Numéro de semaine + * \param time Date au format 'timestamp' + * \return int Numéro de semaine */ function numero_semaine($time) { @@ -2185,4 +2185,14 @@ function numero_semaine($time) return sprintf("%02d",$numeroSemaine); } + +/** + * \brief Retourne le picto champ obligatoire + * \return string Chaine avec picto obligatoire + */ +function picto_required() +{ + return '*'; +} + ?> diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php index a1ad74fc1fb..207508923fd 100644 --- a/scripts/company/sync_contacts_dolibarr2ldap.php +++ b/scripts/company/sync_contacts_dolibarr2ldap.php @@ -66,8 +66,9 @@ if ($resql) print $langs->trans("UpdateContact")." rowid=".$obj->rowid; $contact = new Contact($db); - $contact->id = $obj->rowid; + $contact->fetch($contact->id); + $result=$contact->update_ldap($user); if ($result > 0) {