From 8a4041e534fd00af052aebbeaaad72bf4b05840f Mon Sep 17 00:00:00 2001 From: lalaina rasamoelina <lalaina.rasamoelina@biblibre.com> Date: Thu, 22 Aug 2013 10:06:57 +0200 Subject: [PATCH] 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 '<span class="hideonsmartphone">'.$langs->trans('Disabled').' </span>'.img_picto($langs->trans('StatusContactDraftShort'),'statut0'); + if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans('Disabled').' </span>'.img_picto($langs->trans('StatusContactDraftShort'),'statut0'); else return '<span class="hideonsmartphone">'.$langs->trans('Enabled').' </span>'.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 '<a class="butActionDelete" href="fiche.php?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>'; } // Activer - if ($object->statut == 1 && $user->rights->societe->contact->creer) + if ($object->statut == 0 && $user->rights->societe->contact->creer) { print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable">'.$langs->trans("Reactivate").'</a>'; } // Desactiver - if ($object->statut == 0 && $user->rights->societe->contact->creer) + if ($object->statut == 1 && $user->rights->societe->contact->creer) { print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&id='.$object->id.'">'.$langs->trans("DisableUser").'</a>'; } 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 "<tr ".$bc[$var].">"; 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 '</td>'; - if ($obj->statut==1) print '<td>'.$langs->trans('Disabled').' </span>'.img_picto($langs->trans('StatusContactDraftShort'),'statut0').'</td>'; - elseif ($obj->statut==0) print '<td>'.$langs->trans('Enabled').' </span>'.img_picto($langs->trans('StatusContactValidatedShort'),'statut1').'</td>'; + if ($obj->statut==0) print '<td>'.$langs->trans('Disabled').' </span>'.img_picto($langs->trans('StatusContactDraftShort'),'statut0').'</td>'; + elseif ($obj->statut==1) print '<td>'.$langs->trans('Enabled').' </span>'.img_picto($langs->trans('StatusContactValidatedShort'),'statut1').'</td>'; if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print '<td align="center">'; 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.">"; -- GitLab