Merge pull request #1165 from PaulPoulain/975-develop
T975-develop: Don't print the mail of the contact who is gone
This commit is contained in:
commit
903b75c1cd
@ -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()
|
||||
{
|
||||
return $this->LibStatutcontact($this->statut);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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,15 @@ class Contact extends CommonObject
|
||||
elseif ($statut==4) return '<span class="hideonsmartphone">'.$langs->trans('StatusContactValidatedShort').' </span>'.img_picto($langs->trans('StatusContactValidatedShort'),'statut4');
|
||||
elseif ($statut==5) return '<span class="hideonsmartphone">'.$langs->trans('StatusContactValidatedShort').' </span>'.img_picto($langs->trans('StatusContactValidatedShort'),'statut5');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function LibStatutcontact($statut)
|
||||
{
|
||||
global $langs;
|
||||
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');
|
||||
}
|
||||
/**
|
||||
* Return translated label of Public or Private
|
||||
*
|
||||
@ -1020,7 +1033,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('CONTACT_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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -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(0);
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation activation
|
||||
*/
|
||||
if ($action == 'enable')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setstatus(1);
|
||||
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 '</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
|
||||
print '<textarea name="note" cols="70" rows="'.ROWS_3.'">';
|
||||
print isset($_POST["note"])?$_POST["note"]:$object->note;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print $object->getLibStatutcontact();
|
||||
print '</td></tr>';
|
||||
|
||||
// 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 '</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
|
||||
print nl2br($object->note);
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print $object->getLibStatutcontact();
|
||||
print '</td>';
|
||||
print '</tr>'."\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 '<a class="butActionDelete" href="fiche.php?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
// Activer
|
||||
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 == 1 && $user->rights->societe->contact->creer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&id='.$object->id.'">'.$langs->trans("DisableUser").'</a>';
|
||||
}
|
||||
|
||||
print "</div><br>";
|
||||
}
|
||||
|
||||
@ -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 '<td class="liste_titre"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -336,9 +339,10 @@ if ($result)
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
|
||||
if ($obj->statut == 1)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Name
|
||||
@ -395,6 +399,7 @@ if ($result)
|
||||
print '</a></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@ -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 == 1){
|
||||
if ($htmlname != 'none')
|
||||
{
|
||||
$disabled=0;
|
||||
@ -1027,6 +1027,7 @@ class Form
|
||||
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -544,6 +544,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
print '<td>'.$langs->trans("PhoneMobile").'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td>';
|
||||
print '<td>'.$langs->trans("EMail").'</td>';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print "<td> </td>";
|
||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
@ -552,7 +553,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
$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.statut ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " WHERE p.fk_soc = ".$object->id;
|
||||
$sql .= " ORDER by p.datec";
|
||||
@ -569,7 +571,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td>';
|
||||
@ -597,6 +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==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">';
|
||||
@ -611,6 +614,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
print '</a></td>';
|
||||
}
|
||||
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
@ -618,7 +622,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1580,7 +1580,9 @@ 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 +1598,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 == 1)
|
||||
{
|
||||
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">";
|
||||
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user