commit
ba29eef9d6
@ -35,6 +35,7 @@ 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/contact.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.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/lib/images.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.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/extrafields.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
@ -277,12 +278,72 @@ if (empty($reshook))
|
|||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$contactid=GETPOST("contactid",'int');
|
$contactid=GETPOST("contactid",'int');
|
||||||
|
|
||||||
$object->fetch($contactid);
|
$object->fetch($contactid);
|
||||||
|
|
||||||
|
// Photo save
|
||||||
|
$dir = $conf->societe->dir_output."/contact/".$object->id."/photos";
|
||||||
|
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
|
||||||
|
if ($file_OK)
|
||||||
|
{
|
||||||
|
if (GETPOST('deletephoto'))
|
||||||
|
{
|
||||||
|
$fileimg=$dir.'/'.$object->photo;
|
||||||
|
$dirthumbs=$dir.'/thumbs';
|
||||||
|
dol_delete_file($fileimg);
|
||||||
|
dol_delete_dir_recursive($dirthumbs);
|
||||||
|
$object->photo = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image_format_supported($_FILES['photo']['name']) > 0)
|
||||||
|
{
|
||||||
|
dol_mkdir($dir);
|
||||||
|
|
||||||
|
if (@is_dir($dir))
|
||||||
|
{
|
||||||
|
$newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']);
|
||||||
|
$result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1);
|
||||||
|
|
||||||
|
if (! $result > 0)
|
||||||
|
{
|
||||||
|
$errors[] = "ErrorFailedToSaveFile";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
|
||||||
|
// Create small thumbs for company (Ratio is near 16/9)
|
||||||
|
// Used on logon for example
|
||||||
|
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||||
|
|
||||||
|
// Create mini thumbs for company (Ratio is near 16/9)
|
||||||
|
// Used on menu or for setup page for example
|
||||||
|
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errors[] = "ErrorBadImageFormat";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch($_FILES['photo']['error'])
|
||||||
|
{
|
||||||
|
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
|
||||||
|
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
|
||||||
|
$errors[] = "ErrorFileSizeTooLarge";
|
||||||
|
break;
|
||||||
|
case 3: //uploaded file was only partially uploaded
|
||||||
|
$errors[] = "ErrorFilePartiallyUploaded";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$object->oldcopy = clone$object;
|
$object->oldcopy = clone$object;
|
||||||
|
|
||||||
$object->old_lastname = GETPOST("old_lastname");
|
$object->old_lastname = GETPOST("old_lastname");
|
||||||
@ -699,7 +760,7 @@ else
|
|||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" name="formsoc">';
|
print '<form enctype="multipart/form-data" method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" name="formsoc">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
@ -906,6 +967,23 @@ else
|
|||||||
else print $langs->trans("NoDolibarrAccess");
|
else print $langs->trans("NoDolibarrAccess");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Photo
|
||||||
|
print '<tr class="hideonsmartphone">';
|
||||||
|
print '<td>'.fieldLabel('Photo','photoinput').'</td>';
|
||||||
|
print '<td colspan="3">';
|
||||||
|
if ($object->photo) {
|
||||||
|
print $form->showphoto('contact',$object);
|
||||||
|
print "<br>\n";
|
||||||
|
}
|
||||||
|
print '<table class="nobordernopadding">';
|
||||||
|
if ($object->photo) print '<tr><td><input type="checkbox" class="flat" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
|
||||||
|
//print '<tr><td>'.$langs->trans("PhotoFile").'</td></tr>';
|
||||||
|
print '<tr><td><input type="file" class="flat" name="photo" id="photoinput"></td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print dol_fiche_end();
|
print dol_fiche_end();
|
||||||
@ -973,12 +1051,12 @@ else
|
|||||||
|
|
||||||
// Name
|
// Name
|
||||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
|
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
|
||||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
|
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td>';
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="2">';
|
||||||
if ($object->socid > 0)
|
if ($object->socid > 0)
|
||||||
{
|
{
|
||||||
$objsoc->fetch($object->socid);
|
$objsoc->fetch($object->socid);
|
||||||
@ -988,30 +1066,44 @@ else
|
|||||||
{
|
{
|
||||||
print $langs->trans("ContactNotLinkedToCompany");
|
print $langs->trans("ContactNotLinkedToCompany");
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Photo
|
||||||
|
if ($object->photo)
|
||||||
|
{
|
||||||
|
print '<td rowspan="6" style="text-align: center;" width="25%">';
|
||||||
|
print $form->showphoto('contact',$object);
|
||||||
|
print '</td>';
|
||||||
|
} else {
|
||||||
|
print '<td rowspan="6" style="text-align: center;" width="25%">';
|
||||||
|
print ' ';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Civility
|
// Civility
|
||||||
print '<tr><td width="15%">'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
print '<tr><td width="15%">'.$langs->trans("UserTitle").'</td><td colspan="2">';
|
||||||
print $object->getCivilityLabel();
|
print $object->getCivilityLabel();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Role
|
// Role
|
||||||
print '<tr><td>'.$langs->trans("PostOrFunction").'</td><td colspan="3">'.$object->poste.'</td>';
|
print '<tr><td>'.$langs->trans("PostOrFunction").'</td><td colspan="2">'.$object->poste.'</td>';
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="2">';
|
||||||
dol_print_address($object->address,'gmap','contact',$object->id);
|
dol_print_address($object->address,'gmap','contact',$object->id);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Zip/Town
|
// Zip/Town
|
||||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="2">';
|
||||||
print $object->zip;
|
print $object->zip;
|
||||||
if ($object->zip) print ' ';
|
if ($object->zip) print ' ';
|
||||||
print $object->town.'</td></tr>';
|
print $object->town.'</td></tr>';
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="2">';
|
||||||
$img=picto_from_langcode($object->country_code);
|
$img=picto_from_langcode($object->country_code);
|
||||||
if ($img) print $img.' ';
|
if ($img) print $img.' ';
|
||||||
print $object->country;
|
print $object->country;
|
||||||
@ -1020,7 +1112,7 @@ else
|
|||||||
// State
|
// State
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'.$object->state.'</td>';
|
print '<tr><td>'.$langs->trans('State').'</td><td colspan="2">'.$object->state.'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Phone
|
// Phone
|
||||||
|
|||||||
@ -73,6 +73,7 @@ class Contact extends CommonObject
|
|||||||
var $code;
|
var $code;
|
||||||
var $email;
|
var $email;
|
||||||
var $skype;
|
var $skype;
|
||||||
|
var $photo;
|
||||||
var $jabberid;
|
var $jabberid;
|
||||||
var $phone_pro;
|
var $phone_pro;
|
||||||
var $phone_perso;
|
var $phone_perso;
|
||||||
@ -240,6 +241,7 @@ class Contact extends CommonObject
|
|||||||
$this->phone_mobile=trim($this->phone_mobile);
|
$this->phone_mobile=trim($this->phone_mobile);
|
||||||
$this->jabberid=trim($this->jabberid);
|
$this->jabberid=trim($this->jabberid);
|
||||||
$this->skype=trim($this->skype);
|
$this->skype=trim($this->skype);
|
||||||
|
$this->photo=trim($this->photo);
|
||||||
$this->fax=trim($this->fax);
|
$this->fax=trim($this->fax);
|
||||||
$this->zip=(empty($this->zip)?'':$this->zip);
|
$this->zip=(empty($this->zip)?'':$this->zip);
|
||||||
$this->town=(empty($this->town)?'':$this->town);
|
$this->town=(empty($this->town)?'':$this->town);
|
||||||
@ -264,6 +266,7 @@ class Contact extends CommonObject
|
|||||||
$sql .= ", fax='".$this->db->escape($this->fax)."'";
|
$sql .= ", fax='".$this->db->escape($this->fax)."'";
|
||||||
$sql .= ", email='".$this->db->escape($this->email)."'";
|
$sql .= ", email='".$this->db->escape($this->email)."'";
|
||||||
$sql .= ", skype='".$this->db->escape($this->skype)."'";
|
$sql .= ", skype='".$this->db->escape($this->skype)."'";
|
||||||
|
$sql .= ", photo='".$this->db->escape($this->photo)."'";
|
||||||
$sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
$sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
$sql .= ", note_public = ".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
$sql .= ", note_public = ".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
||||||
$sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null");
|
$sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null");
|
||||||
@ -518,6 +521,7 @@ class Contact extends CommonObject
|
|||||||
$sql.= " c.fk_departement,";
|
$sql.= " c.fk_departement,";
|
||||||
$sql.= " c.birthday,";
|
$sql.= " c.birthday,";
|
||||||
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype,";
|
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype,";
|
||||||
|
$sql.= " c.photo,";
|
||||||
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,";
|
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,";
|
||||||
$sql.= " c.import_key,";
|
$sql.= " c.import_key,";
|
||||||
$sql.= " co.label as country, co.code as country_code,";
|
$sql.= " co.label as country, co.code as country_code,";
|
||||||
@ -573,6 +577,7 @@ class Contact extends CommonObject
|
|||||||
$this->email = $obj->email;
|
$this->email = $obj->email;
|
||||||
$this->jabberid = $obj->jabberid;
|
$this->jabberid = $obj->jabberid;
|
||||||
$this->skype = $obj->skype;
|
$this->skype = $obj->skype;
|
||||||
|
$this->photo = $obj->photo;
|
||||||
$this->priv = $obj->priv;
|
$this->priv = $obj->priv;
|
||||||
$this->mail = $obj->email;
|
$this->mail = $obj->email;
|
||||||
|
|
||||||
@ -909,12 +914,12 @@ class Contact extends CommonObject
|
|||||||
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
||||||
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
|
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
|
||||||
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
|
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
|
||||||
$label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
|
if (! empty($this->poste)) $label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
|
||||||
$label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
|
if (! empty($this->email)) $label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
|
||||||
$phonelist=array();
|
$phonelist=array();
|
||||||
if ($this->phone_pro) $phonelist[]=$this->phone_pro;
|
if ($this->phone_pro) $phonelist[]=$this->phone_pro;
|
||||||
if ($this->phone_mobile) $phonelist[]=$this->phone_mobile;
|
if ($this->phone_mobile) $phonelist[]=$this->phone_mobile;
|
||||||
if ($this->phone_pesro) $phonelist[]=$this->phone_perso;
|
if ($this->phone_perso) $phonelist[]=$this->phone_perso;
|
||||||
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
|
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
|
||||||
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
|
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
|
||||||
|
|
||||||
|
|||||||
@ -5155,6 +5155,11 @@ class Form
|
|||||||
$smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile);
|
$smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile);
|
||||||
if ($object->logo) $file=$id.'/logos/thumbs/'.$smallfile;
|
if ($object->logo) $file=$id.'/logos/thumbs/'.$smallfile;
|
||||||
}
|
}
|
||||||
|
if ($modulepart=='contact')
|
||||||
|
{
|
||||||
|
$dir=$conf->societe->multidir_output[$entity].'/contact';
|
||||||
|
$file=$id.'/photos/'.$object->photo;
|
||||||
|
}
|
||||||
else if ($modulepart=='userphoto')
|
else if ($modulepart=='userphoto')
|
||||||
{
|
{
|
||||||
$dir=$conf->user->dir_output;
|
$dir=$conf->user->dir_output;
|
||||||
|
|||||||
@ -1926,6 +1926,16 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
|||||||
$sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe', 1).")";
|
$sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe', 1).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapping for contact
|
||||||
|
else if ($modulepart == 'contact')
|
||||||
|
{
|
||||||
|
if ($fuser->rights->societe->lire)
|
||||||
|
{
|
||||||
|
$accessallowed=1;
|
||||||
|
}
|
||||||
|
$original_file=$conf->societe->multidir_output[$entity].'/contact/'.$original_file;
|
||||||
|
}
|
||||||
|
|
||||||
// Wrapping for invoices
|
// Wrapping for invoices
|
||||||
else if ($modulepart == 'facture' || $modulepart == 'invoice')
|
else if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,5 +52,6 @@ ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user_creat fk_user_author intege
|
|||||||
|
|
||||||
ALTER TABLE llx_adherent ADD COLUMN pass_crypted varchar(128) after pass;
|
ALTER TABLE llx_adherent ADD COLUMN pass_crypted varchar(128) after pass;
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL AFTER rowid;
|
ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL AFTER rowid;
|
||||||
|
|
||||||
|
ALTER TABLE llx_socpeople ADD COLUMN photo varchar(255) AFTER skype;
|
||||||
|
|||||||
@ -43,6 +43,7 @@ create table llx_socpeople
|
|||||||
email varchar(255),
|
email varchar(255),
|
||||||
jabberid varchar(255),
|
jabberid varchar(255),
|
||||||
skype varchar(255),
|
skype varchar(255),
|
||||||
|
photo varchar(255),
|
||||||
no_email smallint NOT NULL DEFAULT 0,
|
no_email smallint NOT NULL DEFAULT 0,
|
||||||
priv smallint NOT NULL DEFAULT 0,
|
priv smallint NOT NULL DEFAULT 0,
|
||||||
fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement
|
fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user