From 83d5c1a44141391fe9e8a157854c0470389a173f Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina Date: Wed, 10 Jul 2013 12:28:28 +0200 Subject: [PATCH 1/6] Printing of contact --- htdocs/contact/class/contact.class.php | 72 ++++++++++++++++++++++++-- htdocs/contact/fiche.php | 60 ++++++++++++++++++++- htdocs/contact/list.php | 13 +++-- 3 files changed, 136 insertions(+), 9 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 036b99f9ae3..01d8fda91f5 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -58,7 +58,7 @@ class Contact extends CommonObject var $country; // Label of country var $socid; // fk_soc - var $status; // 0=brouillon, 1=4=actif, 5=inactif + var $statut; // 0=brouillon, 1=4=actif, 5=inactif var $code; var $email; @@ -481,8 +481,9 @@ class Contact extends CommonObject $langs->load("companies"); + $sql = "SELECT c.rowid, c.fk_soc, c.civilite as civilite_id, c.lastname, c.firstname,"; - $sql.= " c.address, c.zip, c.town,"; + $sql.= " c.address, c.statut, c.zip, c.town,"; $sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_departement,"; $sql.= " c.birthday,"; @@ -531,6 +532,7 @@ class Contact extends CommonObject $this->socid = $obj->fk_soc; $this->socname = $obj->socname; $this->poste = $obj->poste; + $this->statut = $obj->statut; $this->phone_pro = trim($obj->phone); $this->fax = trim($obj->fax); @@ -896,7 +898,12 @@ class Contact extends CommonObject */ function getLibStatut($mode) { - return $this->LibStatut($this->status,$mode); + return $this->LibStatut($this->statut,$mode); + } + + function getLibStatutcontact($mode) + { + return $this->LibStatutcontact($this->statut,$mode); } /** @@ -906,7 +913,7 @@ class Contact extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function LibStatut($statut, $mode) + function LibStatut($statut) { global $langs; @@ -952,9 +959,14 @@ class Contact extends CommonObject elseif ($statut==4) return ''.$langs->trans('StatusContactValidatedShort').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut4'); elseif ($statut==5) return ''.$langs->trans('StatusContactValidatedShort').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut5'); } + } - + function LibStatutcontact($mode) + { + if ($statut==1) return img_picto($langs->trans('StatusContactDraft'),'statut0').' '.$langs->trans('Disabled'); + else return img_picto($langs->trans('StatusContactValidated'),'statut1').' '.$langs->trans('Enabled'); + } /** * Return translated label of Public or Private * @@ -1020,7 +1032,57 @@ class Contact extends CommonObject $socid = rand(1, $num_socs); $this->socid = $socids[$socid]; + $this->statut=1; } + + /** + * Change status of a user + * + * @param int $statut Status to set + * @return int <0 if KO, 0 if nothing is done, >0 if OK + */ + function setstatus($statut) + { + global $conf,$langs,$user; + + $error=0; + + // Check parameters + if ($this->statut == $statut) return 0; + else $this->statut = $statut; + + $this->db->begin(); + + // Desactive utilisateur + $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople"; + $sql.= " SET statut = ".$this->statut; + $sql.= " WHERE rowid = ".$this->id; + $result = $this->db->query($sql); + + dol_syslog(get_class($this)."::setstatus sql=".$sql); + if ($result) + { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('USER_ENABLEDISABLE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + } + + if ($error) + { + $this->db->rollback(); + return -$error; + } + else + { + $this->db->commit(); + return 1; + } + } + + } ?> diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 7cf032c68b9..3443405ca82 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -31,10 +31,12 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - +require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $langs->load("companies"); $langs->load("users"); $langs->load("other"); @@ -128,7 +130,30 @@ if (empty($reshook)) $error=$object->error; $errors=$object->errors; } } + + /* + * Confirmation desactivation + */ + if ($action == 'disable') + { + $object->fetch($id); + $object->setstatus(1); + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } + + /* + * Confirmation activation + */ + if ($action == 'enable') + { + $object->fetch($id); + $object->setstatus(0); + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + + } // Add contact if ($action == 'add' && $user->rights->societe->contact->creer) { @@ -705,6 +730,18 @@ else print $form->selectarray('priv',$selectarray,$object->priv,0); print ''; + // Note + print ''.$langs->trans("Note").''; + print ''; + + // Statut + print ''.$langs->trans("Status").''; + print ''; + print $object->getLibStatutcontact(); + print ''; + // Other attributes $parameters=array('colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -904,6 +941,17 @@ else print $object->LibPubPriv($object->priv); print ''; + // Note + print ''.$langs->trans("Note").''; + print nl2br($object->note); + print ''; + + // Statut + print ''.$langs->trans("Status").''; + print ''; + print $object->getLibStatutcontact(); + print ''; + print ''."\n"; // Other attributes $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -976,6 +1024,16 @@ else { print ''.$langs->trans('Delete').''; } + // Activer + if ($object->statut == 1 && $user->rights->societe->contact->creer) + { + print ''.$langs->trans("Reactivate").''; + } + // Desactiver + if ($object->statut == 0 && $user->rights->societe->contact->creer) + { + print ''.$langs->trans("DisableUser").''; + } print "
"; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index d7ebb28034a..801eebf606a 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -49,6 +49,8 @@ $search_fax=GETPOST("search_fax"); $search_email=GETPOST("search_email"); $search_priv=GETPOST("search_priv"); $search_categ = GETPOST("search_categ",'int'); +$search_statut=GETPOST("search_statut"); + $type=GETPOST("type"); $view=GETPOST("view"); @@ -114,7 +116,7 @@ $form=new Form($db); $formother=new FormOther($db); $sql = "SELECT s.rowid as socid, s.nom as name,"; -$sql.= " p.rowid as cidp, p.lastname as lastname, p.firstname, p.poste, p.email,"; +$sql.= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.poste, p.email,"; $sql.= " p.phone, p.phone_mobile, p.fax, p.fk_pays, p.priv, p.tms,"; $sql.= " cp.code as country_code"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; @@ -288,6 +290,7 @@ if ($result) print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms", $begin, $param, 'align="center"', $sortfield,$sortorder); print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder); + print ' '; print "\n"; @@ -336,9 +339,12 @@ if ($result) while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); + - $var=!$var; - + + if ($obj->statut == 0) + { + $var=!$var; print ""; // Name @@ -395,6 +401,7 @@ if ($result) print ''; print "\n"; + } $i++; } From 5ed186e1787279cdbedc26aa85c553783ef5ea19 Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina Date: Wed, 10 Jul 2013 14:03:25 +0200 Subject: [PATCH 2/6] Delete the contact who are gone,in the email list --- htdocs/contact/list.php | 2 +- htdocs/core/lib/company.lib.php | 7 +++++-- htdocs/societe/class/societe.class.php | 17 ++++++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 801eebf606a..67ae2266acd 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -340,7 +340,6 @@ if ($result) { $obj = $db->fetch_object($result); - if ($obj->statut == 0) { @@ -402,6 +401,7 @@ if ($result) print "\n"; } + $i++; } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 9ce429a318d..01dc133919c 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -552,7 +552,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') } print ""; - $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email "; + + $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.note "; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " ORDER by p.datec"; @@ -568,6 +569,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') while ($i < $num) { $obj = $db->fetch_object($result); + if($obj->statut == 0) + { $var = !$var; print ""; @@ -618,8 +621,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print img_edit(); print ''; } - print "\n"; + } $i++; } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a225276c3af..ad44e15b4a5 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1580,7 +1580,10 @@ class Societe extends CommonObject { $contact_property = array(); - $sql = "SELECT rowid, email, phone_mobile, lastname, poste, firstname"; + + + $sql = "SELECT rowid, email, statut, phone_mobile, lastname, firstname"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople"; $sql.= " WHERE fk_soc = '".$this->id."'"; @@ -1596,12 +1599,12 @@ class Societe extends CommonObject $obj = $this->db->fetch_object($resql); if ($mode == 'email') $property=$obj->email; else if ($mode == 'mobile') $property=$obj->phone_mobile; - if(!empty($obj->poste)){ - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." (".$obj->poste.")"." <".$property.">"; - } - else - { - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">"; + + + if ($obj->statut == 0) + { + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">"; + } $i++; } From 148abfbe72c988b7db0cd9435bc80f997bb288fb Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina Date: Wed, 10 Jul 2013 14:18:43 +0200 Subject: [PATCH 3/6] Printing the contact in the list --- htdocs/contact/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 67ae2266acd..418b4d4b565 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -401,7 +401,6 @@ if ($result) print "\n"; } - $i++; } From dc3ccf63731cce2a74d03766bb103e370d88a528 Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina Date: Wed, 17 Jul 2013 15:55:18 +0200 Subject: [PATCH 4/6] Style of page --- htdocs/contact/list.php | 1 - htdocs/core/lib/company.lib.php | 3 +-- htdocs/societe/class/societe.class.php | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 418b4d4b565..a3382975929 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -339,7 +339,6 @@ if ($result) while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - if ($obj->statut == 0) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 01dc133919c..ecb8413f810 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -553,7 +553,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ""; - $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.note "; + $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.statut "; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " ORDER by p.datec"; @@ -572,7 +572,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if($obj->statut == 0) { $var = !$var; - print ""; print ''; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ad44e15b4a5..918ff20dd5f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1583,7 +1583,6 @@ class Societe extends CommonObject $sql = "SELECT rowid, email, statut, phone_mobile, lastname, firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople"; $sql.= " WHERE fk_soc = '".$this->id."'"; From 1295c8d27bcd82586240087f0f60cbd4c4aa4218 Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina Date: Thu, 18 Jul 2013 09:41:37 +0200 Subject: [PATCH 5/6] Put the status of contact in the list of contact --- htdocs/contact/class/contact.class.php | 11 ++++++----- htdocs/core/class/html.form.class.php | 5 +++-- htdocs/core/lib/company.lib.php | 10 +++++++--- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 01d8fda91f5..b488949538d 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -901,9 +901,9 @@ class Contact extends CommonObject return $this->LibStatut($this->statut,$mode); } - function getLibStatutcontact($mode) + function getLibStatutcontact() { - return $this->LibStatutcontact($this->statut,$mode); + return $this->LibStatutcontact($this->statut); } /** @@ -962,10 +962,11 @@ class Contact extends CommonObject } - function LibStatutcontact($mode) + function LibStatutcontact($statut) { - if ($statut==1) return img_picto($langs->trans('StatusContactDraft'),'statut0').' '.$langs->trans('Disabled'); - else return img_picto($langs->trans('StatusContactValidated'),'statut1').' '.$langs->trans('Enabled'); + global $langs; + if ($statut==1) return ''.$langs->trans('Disabled').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0'); + else return ''.$langs->trans('Enabled').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1'); } /** * Return translated label of Public or Private diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b63703d5785..5267ad3520b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -951,7 +951,7 @@ class Form $out=''; // On recherche les societes - $sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.poste"; + $sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste"; if ($showsoc > 0) { $sql.= " , s.nom as company"; } @@ -991,7 +991,7 @@ class Form $contactstatic->id=$obj->rowid; $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=$obj->firstname; - + if ($obj->statut == 0){ if ($htmlname != 'none') { $disabled=0; @@ -1027,6 +1027,7 @@ class Form if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')'; } } + } $i++; } } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index ecb8413f810..2d100529a69 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -544,6 +544,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''.$langs->trans("PhoneMobile").''; print ''.$langs->trans("Fax").''; print ''.$langs->trans("EMail").''; + print ''.$langs->trans("Status").''; print " "; if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { @@ -569,8 +570,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') while ($i < $num) { $obj = $db->fetch_object($result); - if($obj->statut == 0) - { $var = !$var; print ""; @@ -599,6 +598,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL'); print ''; + if ($obj->statut==1) print ''.$langs->trans('Disabled').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0').''; + elseif ($obj->statut==0) print ''.$langs->trans('Enabled').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1').''; if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print ''; @@ -613,6 +614,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; } + if ($user->rights->societe->contact->creer) { print ''; @@ -620,8 +622,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print img_edit(); print ''; } + + + print "\n"; - } $i++; } } From 8a4041e534fd00af052aebbeaaad72bf4b05840f Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina Date: Thu, 22 Aug 2013 10:06:57 +0200 Subject: [PATCH 6/6] T975-develop Add an element (statut) in the table llx_socpeople It's used to mark if the contact is gone or no(we can activate or desactivate the contact with this) And if the contact is gone,we don't print her mail in the mail list,where we can send a mail --- htdocs/contact/class/contact.class.php | 4 ++-- htdocs/contact/fiche.php | 8 ++++---- htdocs/contact/list.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/company.lib.php | 4 ++-- htdocs/install/mysql/migration/3.4.0-3.5.0.sql | 2 ++ htdocs/install/mysql/tables/llx_socpeople.sql | 3 ++- htdocs/societe/class/societe.class.php | 2 +- 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index b488949538d..0a25bbf8028 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -965,7 +965,7 @@ class Contact extends CommonObject function LibStatutcontact($statut) { global $langs; - if ($statut==1) return ''.$langs->trans('Disabled').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0'); + if ($statut==0) return ''.$langs->trans('Disabled').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0'); else return ''.$langs->trans('Enabled').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1'); } /** @@ -1066,7 +1066,7 @@ class Contact extends CommonObject // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_ENABLEDISABLE',$this,$user,$langs,$conf); + $result=$interface->run_triggers('CONTACT_ENABLEDISABLE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 3443405ca82..7f587500cbe 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -138,7 +138,7 @@ if (empty($reshook)) if ($action == 'disable') { $object->fetch($id); - $object->setstatus(1); + $object->setstatus(0); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } @@ -149,7 +149,7 @@ if (empty($reshook)) if ($action == 'enable') { $object->fetch($id); - $object->setstatus(0); + $object->setstatus(1); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; @@ -1025,12 +1025,12 @@ else print ''.$langs->trans('Delete').''; } // Activer - if ($object->statut == 1 && $user->rights->societe->contact->creer) + if ($object->statut == 0 && $user->rights->societe->contact->creer) { print ''.$langs->trans("Reactivate").''; } // Desactiver - if ($object->statut == 0 && $user->rights->societe->contact->creer) + if ($object->statut == 1 && $user->rights->societe->contact->creer) { print ''.$langs->trans("DisableUser").''; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a3382975929..19b389cc192 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -340,7 +340,7 @@ if ($result) { $obj = $db->fetch_object($result); - if ($obj->statut == 0) + if ($obj->statut == 1) { $var=!$var; print ""; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5267ad3520b..331ab1c3b98 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -991,7 +991,7 @@ class Form $contactstatic->id=$obj->rowid; $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=$obj->firstname; - if ($obj->statut == 0){ + if ($obj->statut == 1){ if ($htmlname != 'none') { $disabled=0; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2d100529a69..2bd863b263f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -598,8 +598,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL'); print ''; - if ($obj->statut==1) print ''.$langs->trans('Disabled').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0').''; - elseif ($obj->statut==0) print ''.$langs->trans('Enabled').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1').''; + if ($obj->statut==0) print ''.$langs->trans('Disabled').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0').''; + elseif ($obj->statut==1) print ''.$langs->trans('Enabled').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1').''; if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print ''; diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index a87a80d7d52..9afc2da09b0 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -22,6 +22,8 @@ DELETE FROM llx_menu where module='holiday'; ALTER TABLE llx_projet_task ADD COLUMN planned_workload real DEFAULT 0 NOT NULL AFTER duration_effective; +ALTER TABLE llx_socpeople ADD COLUMN statut tinyint(4) DEFAULT 1 NOT NULL after import_key; + create table llx_fichinter_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql index d06e91e5395..04be54ba06c 100644 --- a/htdocs/install/mysql/tables/llx_socpeople.sql +++ b/htdocs/install/mysql/tables/llx_socpeople.sql @@ -50,5 +50,6 @@ create table llx_socpeople note_public text, default_lang varchar(6), canvas varchar(32), -- type of canvas if used (null by default) - import_key varchar(14) + import_key varchar(14), + statut tinyint(4) )ENGINE=innodb; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 918ff20dd5f..9127adc3a8f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1600,7 +1600,7 @@ class Societe extends CommonObject else if ($mode == 'mobile') $property=$obj->phone_mobile; - if ($obj->statut == 0) + if ($obj->statut == 1) { $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">";