2
0
forked from Wavyzz/dolibarr

Enhance look for contacts forms of thirdparties.

This commit is contained in:
Laurent Destailleur
2014-12-30 21:04:02 +01:00
parent 8abbac564b
commit d72d056e02
11 changed files with 74 additions and 104 deletions

View File

@@ -374,6 +374,7 @@ else
/*
* Onglets
*/
$head=array();
if ($id > 0)
{
// Si edition contact deja existant
@@ -386,9 +387,6 @@ else
$head = contact_prepare_head($object);
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
dol_fiche_head($head, 'card', $title, 0, 'contact');
dol_htmloutput_events();
}
if ($user->rights->societe->contact->creer)
@@ -438,13 +436,16 @@ else
print '</script>'."\n";
}
print '<br>';
print '<form method="post" name="formsoc" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'card', '', 0, '');
print '<table class="border" width="100%">';
// Name
print '<tr><td width="20%" class="fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>';
print '<td width="30%"><input name="lastname" id="lastname" type="text" size="30" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname")?GETPOST("lastname"):$object->lastname).'" autofocus="autofocus"></td>';
@@ -611,8 +612,9 @@ else
}
print '</tr>';
print "</table><br><br>";
print "</table>";
print dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("Add").'">';
@@ -674,6 +676,8 @@ else
print '<input type="hidden" name="old_firstname" value="'.$object->firstname.'">';
if (! empty($backtopage)) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'card', $title, 0, 'contact');
print '<table class="border" width="100%">';
// Ref
@@ -856,7 +860,9 @@ else
else print $langs->trans("NoDolibarrAccess");
print '</td></tr>';
print '</table><br>';
print '</table>';
print dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
@@ -878,6 +884,8 @@ else
dol_htmloutput_errors($error,$errors);
dol_fiche_head($head, 'card', $title, 0, 'contact');
if ($action == 'create_user')
{
// Full firstname and lastname separated with a dot : firstname.lastname
@@ -1078,7 +1086,7 @@ else
print "</table>";
print "</div>";
print dol_fiche_end();
// Barre d'actions
print '<div class="tabsAction">';
@@ -1113,7 +1121,8 @@ else
}
}
print "</div><br>";
print "</div>";
print "<br>";
if (! empty($conf->agenda->enabled))
{

View File

@@ -561,6 +561,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$search_status = GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
$search_name = GETPOST("search_name",'alpha');
$search_addressphone = GETPOST("search_addressphone",'alpha');
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.lastname";
@@ -603,18 +604,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '<tr class="liste_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("PhonePro"),$_SERVER["PHP_SELF"],"p.phone","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email","",$param,'',$sortfield,$sortorder);
if (! empty($conf->skype->enabled))
{
$colspan++;
print '<td>'.$langs->trans("Skype").'</td>';
}
print_liste_field_titre($langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
// Copy to clipboard
print "<td>&nbsp;</td>";
// Add to agenda
if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create))
{
@@ -627,32 +618,24 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '<tr class="liste_titre">';
// Name - Position
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_name" size="20" value="'.$search_name.'">';
print '</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
// Address / Phone
print '<td>';
//print '<input type="text" class="flat" name="search_addressphone" size="20" value="'.$search_addressphone.'">';
print '</td>';
// Email
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
if (! empty($conf->skype->enabled))
{
$colspan++;
print '<td>&nbsp;</td>';
}
// Status
print '<td class="liste_titre maxwidthonsmartphone">';
print $form->selectarray('search_status', array('-1'=>'','0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status);
print '</td>';
// Copy to clipboard
print "<td>&nbsp;</td>";
// Add to agenda
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{
@@ -668,7 +651,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "</tr>";
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut ";
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.poste, p.phone, 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 .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id;
@@ -680,7 +663,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$result = $db->query($sql);
$num = $db->num_rows($result);
$var=false;
$var=true;
if ($num)
{
$i=0;
@@ -698,74 +681,50 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$contactstatic->firstname = $obj->firstname;
$contactstatic->civility_id = $obj->civility_id;
print $contactstatic->getNomUrl(1,'',0,'&backtopage='.urlencode($backtopage));
print '</td><td>';
if ($obj->poste) print $obj->poste;
print '</td>';
print '<td>'.$obj->poste.'</td>';
$country_code = getCountry($obj->country_id, 'all');
// Lien click to dial
// Address and phone
print '<td>';
print dol_print_phone($obj->phone,$country_code['code'],$obj->rowid,$object->id,'AC_TEL');
print '</td>';
print '<td>';
print dol_print_phone($obj->phone_mobile,$country_code['code'],$obj->rowid,$object->id,'AC_TEL');
print '</td>';
print '<td>';
print dol_print_phone($obj->fax,$country_code['code'],$obj->rowid,$object->id,'AC_FAX');
print '</td>';
print '<td>';
print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL');
print '</td>';
if (! empty($conf->skype->enabled))
{
print '<td>';
print dol_print_skype($obj->skype,$obj->rowid,$object->id,'AC_SKYPE');
print '</td>';
}
// Status
print '<td>'.$contactstatic->getLibStatut(5).'</td>';
print '<td align="center">';
$outdone=0;
$contactstatic->address = $obj->address;
$contactstatic->zip = $obj->zip;
$contactstatic->town = $obj->town;
$contactstatic->country_id = $obj->country_id;
$coords = $contactstatic->getFullAddress(1,', ');
if (! empty($conf->use_javascript_ajax))
{
// Copy to clipboard
$coords = '';
if (!empty($object->name)) $coords .= $object->name."<br>";
$coords .= $contactstatic->getFullName($langs,1).' ';
$coords .= "<br>";
if (!empty($obj->address))
{
$coords .= dol_nl2br($obj->address,1,true)."<br>";
if (!empty($obj->zip)) $coords .= $obj->zip.' ';
if (!empty($obj->town)) $coords .= $obj->town;
if (!empty($obj->country_id)) $coords .= "<br>".$country_code['label'];
}
else if (!empty($object->address))
{
$coords .= dol_nl2br($object->address,1,true)."<br>";
if (!empty($object->zip)) $coords .= $object->zip.' ';
if (!empty($object->town)) $coords .= $object->town;
if (!empty($object->country_id)) $coords .= "<br>".$country_code['label'];
}
$namecoords = $contactstatic->getFullName($langs,1).'<br>'.$coords;
// hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
print '<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($coords).'\',\''.dol_escape_js($langs->trans("HelpCopyToClipboard")).'\');">';
print '<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).'\',\''.dol_escape_js($langs->trans("HelpCopyToClipboard")).'\');">';
print img_picto($langs->trans("Address"), 'object_address.png');
print '</a> ';
}
if ($coords) { print dol_print_address($coords,'address_contact_'.$obj->rowid, 'contact', $obj->rowid); $outdone++; }
if ($obj->phone || $obj->phone_mobile || $obj->phone_perso) print ($outdone?'<br>':'');
if ($obj->phone) { print dol_print_phone($obj->phone,$country_code['code'],$obj->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++; }
if ($obj->phone_mobile) { print dol_print_phone($obj->phone_mobile,$country_code['code'],$obj->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++; }
if ($obj->phone_perso) { print dol_print_phone($obj->phone_perso,$country_code['code'],$obj->rowid,$object->id,'AC_TEL','&nbsp;','phone'); $outdone++; }
if ($obj->fax) { print dol_print_phone($obj->fax,$country_code['code'],$obj->rowid,$object->id,'AC_FAX','&nbsp;','fax'); $outdone++; }
print '<div style="clear: both;"></div>';
$outdone=0;
if ($obj->email) print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL',0,0,1);
if (! empty($conf->skype->enabled))
{
if ($obj->skype) print ($outdone?'<br>':'').dol_print_skype($obj->skype,$obj->rowid,$object->id,'AC_SKYPE');
}
print '</td>';
// Status
print '<td>'.$contactstatic->getLibStatut(5).'</td>';
// Add to agenda
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{
print '<td align="center">';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<a class="hideonsmartphone" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
print img_object($langs->trans("Rendez-Vous"),"action_rdv");
print '</a> ';
}
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
print img_object($langs->trans("Event"),"action");
print '</a></td>';
@@ -787,7 +746,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
}
else
{
print "<tr ".$bc[$var].">";
print "<tr ".$bc[! $var].">";
print '<td colspan="'.$colspan.'">'.$langs->trans("None").'</td>';
print "</tr>\n";
}

View File

@@ -1295,9 +1295,10 @@ function dol_print_url($url,$target='_blank',$max=32)
* @param int $addlink 0=no link, 1=email has a html email link (+ link to create action if constant AGENDA_ADDACTIONFOREMAIL is on)
* @param int $max Max number of characters to show
* @param int $showinvalid Show warning if syntax email is wrong
* @param int $widthpicto Show picto
* @return string HTML Link
*/
function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1)
function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1,$withpicto=0)
{
global $conf,$user,$langs;
@@ -1323,7 +1324,7 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=
{
$type='AC_EMAIL'; $link='';
if (! empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) $link='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$type.'&amp;contactid='.$cid.'&amp;socid='.$socid.'">'.img_object($langs->trans("AddAction"),"calendar").'</a>';
$newemail='<table class="nobordernopadding"><tr><td>'.$newemail.' </td><td>&nbsp;'.$link.'</td></tr></table>';
if ($link) $newemail='<div>'.$newemail.' '.$link.'</div>';
}
}
else
@@ -1334,7 +1335,7 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=
$newemail.=img_warning($langs->trans("ErrorBadEMail",$email));
}
}
return $newemail;
return '<div class="nospan float" style="margin-right: 10px">'.($withpicto?img_picto($langs->trans("EMail"), 'object_email.png').' ':'').$newemail.'</div>';
}
/**
@@ -1360,18 +1361,18 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64)
$newskype='<a href="skype:';
$newskype.=dol_trunc($skype,$max);
$newskype.='?call" alt="'.$langs->trans("Call").'&nbsp;'.$skype.'" title="'.$langs->trans("Call").'&nbsp;'.$skype.'">';
$newskype.='<img src="../theme/common/skype_callbutton.png" border="0">&nbsp;';
$newskype.='</a>&nbsp;<a href="skype:';
$newskype.='<img src="../theme/common/skype_callbutton.png" border="0">';
$newskype.='</a>&nbsp; &nbsp;<a href="skype:';
$newskype.=dol_trunc($skype,$max);
$newskype.='?chat" alt="'.$langs->trans("Chat").'&nbsp;'.$skype.'" title="'.$langs->trans("Chat").'&nbsp;'.$skype.'">';
$newskype.='<img src="../theme/common/skype_chatbutton.png" border="0">&nbsp;';
$newskype.='</a>';
$newskype.='<img src="../theme/common/skype_chatbutton.png" border="0">';
$newskype.='</a>&nbsp;';
if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{
$type='AC_SKYPE'; $link='';
if (! empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$type.'&amp;contactid='.$cid.'&amp;socid='.$socid.'">'.img_object($langs->trans("AddAction"),"calendar").'</a>';
$newskype='<table class="nobordernopadding"><tr><td>'.$newskype.' </td><td>&nbsp;'.$link.'</td></tr></table>';
$newskype='<div class="divskype nowrap">'.$newskype.($link?' '.$link:'').'</div>';
}
}
else
@@ -1391,9 +1392,10 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64)
* @param int $socid Id of third party if known
* @param int $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set)
* @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx
* @param string $withpicto Show picto
* @return string Formated phone number
*/
function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ="&nbsp;")
function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ="&nbsp;",$withpicto='')
{
global $conf,$user,$langs,$mysoc;
@@ -1469,11 +1471,11 @@ function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ="
$type='AC_TEL'; $link='';
if ($addlink == 'AC_FAX') $type='AC_FAX';
if (! empty($conf->global->AGENDA_ADDACTIONFORPHONE)) $link='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$type.($cid?'&amp;contactid='.$cid:'').($socid?'&amp;socid='.$socid:'').'">'.img_object($langs->trans("AddAction"),"calendar").'</a>';
if ($link) $newphone='<table class="nobordernopadding"><tr><td>'.$newphone.' </td><td>&nbsp;'.$link.'</td></tr></table>';
if ($link) $newphone='<div>'.$newphone.' '.$link.'</div>';
}
}
return $newphone;
return '<div class="nospan float" style="margin-right: 10px">'.($withpicto?img_picto(($withpicto=='fax'?$langs->trans("Fax"):$langs->trans("Phone")), 'object_'.($withpicto=='fax'?'phoning_fax':'phoning').'.png').' ':'').$newphone.'</div>';
}
/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B