ability to copy contact address to clipboard

This commit is contained in:
Christophe Battarel 2013-09-15 19:09:22 +02:00
parent a100faa4b1
commit 33fbee51bd
3 changed files with 15 additions and 7 deletions

View File

@ -537,7 +537,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "\n".'<table class="noborder" width="100%">'."\n"; print "\n".'<table class="noborder" width="100%">'."\n";
$colspan=6; $colspan=8;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>'; print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Poste").'</td>'; print '<td>'.$langs->trans("Poste").'</td>';
@ -552,11 +552,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$colspan++; $colspan++;
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
if ($user->rights->societe->contact->creer)
{
$colspan++;
print '<td>&nbsp;</td>';
}
print "</tr>"; print "</tr>";
$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 = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.statut ";
$sql .= ", p.address, p.zip, p.town"; $sql .= ", p.civilite, p.address, p.zip, p.town";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " WHERE p.fk_soc = ".$object->id;
$sql .= " ORDER by p.datec"; $sql .= " ORDER by p.datec";
@ -611,8 +616,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$coords .= addslashes($obj->civilite).' '; $coords .= addslashes($obj->civilite).' ';
if (!empty($obj->firstname)) if (!empty($obj->firstname))
$coords .= addslashes($obj->firstname).' '; $coords .= addslashes($obj->firstname).' ';
if (!empty($obj->name)) if (!empty($obj->lastname))
$coords .= addslashes($obj->name); $coords .= addslashes($obj->lastname);
$coords .= "<br />"; $coords .= "<br />";
if (!empty($obj->address)) if (!empty($obj->address))
{ {
@ -634,7 +639,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
if (!empty($object->country)) if (!empty($object->country))
$coords .= "<br />".addslashes($object->country); $coords .= "<br />".addslashes($object->country);
} }
print '<td align="center"><a href="#" onclick="copyToClipboard(\''.$coords.'\');">'; print '<td align="center"><a href="#" onclick="return copyToClipboard(\''.$coords.'\');">';
print img_picto($langs->trans("Address"), 'object_address.png'); print img_picto($langs->trans("Address"), 'object_address.png');
print '</a></td>'; print '</a></td>';
@ -677,16 +682,17 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "<br>\n"; print "<br>\n";
?> ?>
<div id="dialog" title="Coordonnées" style="display: none;"> <div id="dialog" title="<?php echo $langs->trans('Address'); ?>" style="display: none;">
</div> </div>
<?php <?php
print '<script type="text/javascript"> print '<script type="text/javascript">
function copyToClipboard (text) { function copyToClipboard (text) {
text = text.replace(/<br \/>/g,"\n"); text = text.replace(/<br \/>/g,"\n");
var newElem = "<textarea id=\"coords\" style=\"border: none; width: 100%; height: 90px;\">"+text+"</textarea><br/><br/>Ctrl+C pour copier dans le presse-papier"; var newElem = "<textarea id=\"coords\" style=\"border: none; width: 90%; height: 120px;\">"+text+"</textarea><br/><br/>'.$langs->trans('HelpCopyToClipboard').'";
$("#dialog").html(newElem); $("#dialog").html(newElem);
$( "#dialog" ).dialog(); $( "#dialog" ).dialog();
$("#coords").select(); $("#coords").select();
return false;
} }
</script>'; </script>';

View File

@ -658,6 +658,7 @@ Deductible=Deductible
from=from from=from
toward=toward toward=toward
Access=Access Access=Access
HelpCopyToClipboard=Use Ctrl+C to copy to clipboard
# Week day # Week day
Monday=Monday Monday=Monday

View File

@ -658,6 +658,7 @@ Deductible=Déductible
from=de from=de
toward=vers toward=vers
Access=Accès Access=Accès
HelpCopyToClipboard=Ctrl+C pour copier dans le presse-papier
# Week day # Week day
Monday=Lundi Monday=Lundi