NEW Show photo of contacts on thirdparty card.

This commit is contained in:
Laurent Destailleur 2016-08-06 00:04:24 +02:00
parent 5c0b02e46d
commit 3f87b0c225
5 changed files with 62 additions and 14 deletions

View File

@ -41,7 +41,8 @@ class Contact extends CommonObject
public $table_element='socpeople';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $civility_id; // In fact we store civility_code
var $civility_id; // In fact we store civility_code
var $civility_code;
var $address;
var $zip;
var $town;
@ -612,6 +613,7 @@ class Contact extends CommonObject
$this->ref = $obj->rowid;
$this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility_id;
$this->civility_code = $obj->civility_id;
$this->lastname = $obj->lastname;
$this->firstname = $obj->firstname;
$this->address = $obj->address;
@ -659,11 +661,7 @@ class Contact extends CommonObject
$this->import_key = $obj->import_key;
// Define gender according to civility
if(in_array($this->civility_id, array('MR'))) {
$this->gender = 'man';
} else if(in_array($this->civility_id, array('MME','MLE'))) {
$this->gender = 'woman';
}
$this->setGenderFromCivility();
// Search Dolibarr user linked to this contact
$sql = "SELECT u.rowid ";
@ -735,6 +733,21 @@ class Contact extends CommonObject
}
/**
* Set property ->gender from property ->civility_id
*
* @return void
*/
function setGenderFromCivility()
{
unset($this->gender);
if (in_array($this->civility_id, array('MR'))) {
$this->gender = 'man';
} else if(in_array($this->civility_id, array('MME','MLE'))) {
$this->gender = 'woman';
}
}
/**
* Load number of elements the contact is used as a link for
* ref_facturation

View File

@ -653,6 +653,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$colspan=9;
print '<tr class="liste_titre">';
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
@ -668,8 +669,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "</tr>\n";
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut ";
$sql .= ", p.civility as civility_id, p.address, p.zip, p.town";
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut, p.photo,";
$sql .= " p.civility as civility_id, p.address, p.zip, p.town";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id;
if ($search_status!='' && $search_status != '-1') $sql .= " AND p.statut = ".$db->escape($search_status);
@ -687,6 +688,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
{
print '<tr class="liste_titre">';
// Photo
print '<td class="liste_titre">';
print '</td>';
// Name - Position
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_name" size="20" value="'.$search_name.'">';
@ -732,6 +737,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$contactstatic->lastname = $obj->lastname;
$contactstatic->firstname = $obj->firstname;
$contactstatic->civility_id = $obj->civility_id;
$contactstatic->civility_code = $obj->civility_id;
$contactstatic->poste = $obj->poste;
$contactstatic->address = $obj->address;
$contactstatic->zip = $obj->zip;
@ -742,15 +748,27 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$contactstatic->email = $obj->email;
$contactstatic->web = $obj->web;
$contactstatic->skype = $obj->skype;
$contactstatic->photo = $obj->photo;
$country_code = getCountry($obj->country_id, 2);
$contactstatic->country_code = $country_code;
$contactstatic->setGenderFromCivility();
print "<tr ".$bc[$var].">";
print '<td>';
print $contactstatic->getNomUrl(1,'',0,'&backtopage='.urlencode($backtopage));
print '</td><td>';
// Photo
print '<td width="50px">';
print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder','small',1,0,1);
print '</td>';
// Name
print '<td>';
print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage));
print '</td>';
// Job position
print '<td>';
if ($obj->poste) print $obj->poste;
print '</td>';

View File

@ -2537,8 +2537,11 @@ else
print '<div class="fichecenter"><br></div>';
// Subsidiaries list
$result=show_subsidiaries($conf,$langs,$db,$object);
if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES))
{
$result=show_subsidiaries($conf,$langs,$db,$object);
}
// Contacts list
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{

View File

@ -913,7 +913,14 @@ img.photoref {
padding: 4px;
height: 80px;
width: 80px;
object-fit: contain
object-fit: contain;
}
img.photorefnoborder {
padding: 2px;
height: 48px;
width: 48px;
object-fit: contain;
border: 1px solid #CCC;
}
.underrefbanner {
}

View File

@ -955,6 +955,13 @@ img.photoref {
-webkit-box-shadow: 3px 3px 4px #DDD;
box-shadow: 3px 3px 4px #DDD;
}
img.photorefnoborder {
padding: 2px;
height: 48px;
width: 48px;
object-fit: contain;
border: 1px solid #CCC;
}
.underrefbanner {
}
.underbanner {