2
0
forked from Wavyzz/dolibarr

NEW Add function showValueWithClipboardCPButton() to add a copy/paste

button on a text.
This commit is contained in:
Laurent Destailleur
2021-01-28 12:44:45 +01:00
parent ce3279c462
commit 3eebbc6426
2 changed files with 6 additions and 6 deletions

View File

@@ -9248,7 +9248,7 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
* @param int $showonlyonhover Show the copypaste button only on hover
* @return string The string to print for the button
*/
function showValueWithCopyAndPasteButton($valuetoprint, $showonlyonhover = 1)
function showValueWithClipboardCPButton($valuetoprint, $showonlyonhover = 1)
{
$result = '<span class="clipboardCP'.($showonlyonhover ? ' clipboardCPShowOnHover' : '').'"><span class="clipboardCPValue">'.$valuetoprint.'</span><span class="clipboardCPButton far fa-clipboard opacitymedium paddingleft paddingright"></span><span class="clipboardCPText opacitymedium"></span></span>';
return $result;

View File

@@ -2415,7 +2415,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// Prefix
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<tr><td>'.$langs->trans('Prefix').'</td><td>'.$object->prefix_comm.'</td>';
print '<tr><td>'.$langs->trans('Prefix').'</td><td>'.dol_escape_htmltag($object->prefix_comm).'</td>';
print '</tr>';
}
@@ -2426,7 +2426,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print $langs->trans('CustomerCode');
print '</td>';
print '<td>';
print showValueWithCopyAndPasteButton($object->code_client);
print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
print '</td>';
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
@@ -2441,7 +2441,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
{
print '<tr><td>';
print $langs->trans('SupplierCode').'</td><td>';
print $object->code_fournisseur;
print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
$tmpcheck = $object->check_codefournisseur();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
@@ -2454,7 +2454,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
if (!empty($conf->barcode->enabled))
{
print '<tr><td>';
print $langs->trans('Gencod').'</td><td>'.dol_escape_htmltag($object->barcode);
print $langs->trans('Gencod').'</td><td>'.showValueWithClipboardCPButton(dol_escape_htmltag($object->barcode));
print '</td>';
print '</tr>';
}
@@ -2470,7 +2470,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<tr>';
print '<td>'.$idprof.'</td><td>';
$key = 'idprof'.$i;
print $object->$key;
print showValueWithClipboardCPButton(dol_escape_htmltag($object->$key));
if ($object->$key)
{
if ($object->id_prof_check($i, $object) > 0) print ' &nbsp; '.$object->id_prof_url($i, $object);