diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 259918c5aa9..1edb0b1d3c3 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -474,13 +474,16 @@ class Contact extends CommonObject * * @param int $id Id of contact * @param User $user User asking to change alert or birthday + * @param int $notrigger 0=no, 1=yes * @return int <0 if KO, >=0 if OK */ - function update_perso($id, $user=null) + function update_perso($id, $user=null, $notrigger=0) { $error=0; $result=false; + $this->db->begin(); + // Mis a jour contact $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET"; $sql.= " birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); @@ -531,6 +534,26 @@ class Contact extends CommonObject } } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('CONTACT_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers + } + + if (! $error) + { + $this->db->commit(); + return 1; + } + else + { + dol_syslog(get_class($this)."::update Error ".$this->error,LOG_ERR); + $this->db->rollback(); + return -$error; + } + return $result; } diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index da70bc3e007..5feafcbb6b3 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -135,11 +135,9 @@ $object->fetch($id, $user); $head = contact_prepare_head($object); -dol_fiche_head($head, 'perso', $title, 0, 'contact'); - if ($action == 'edit') { - /* + /* * Fiche en mode edition */ @@ -148,6 +146,8 @@ if ($action == 'edit') print ''; print ''; + dol_fiche_head($head, 'perso', $title, 0, 'contact'); + print '