Merge pull request #16034 from Hystepik/develop#2
Close #16027 New Feature copy Code Client
This commit is contained in:
commit
4fbf2fff6f
@ -210,3 +210,25 @@ print '
|
||||
}
|
||||
});
|
||||
});'."\n";
|
||||
|
||||
print "\n/* JS CODE TO ENABLE ClipBoard copy paste*/\n";
|
||||
print 'jQuery(\'.clipboardCopyPaste\').click(function() {
|
||||
console.log(this.firstChild.innerText);
|
||||
if ( window.getSelection ) {
|
||||
|
||||
selection = window.getSelection();
|
||||
|
||||
range = document.createRange();
|
||||
range.selectNodeContents( this.firstChild );
|
||||
|
||||
selection.removeAllRanges();
|
||||
selection.addRange( range );
|
||||
|
||||
}
|
||||
document.execCommand( \'copy\' );
|
||||
window.getSelection().removeAllRanges();
|
||||
var lastchild = this.lastChild
|
||||
var tmp =lastchild.innerHTML
|
||||
lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\';
|
||||
setTimeout(() => { lastchild.innerHTML = tmp; }, 1000);
|
||||
})'."\n";
|
||||
|
||||
@ -9239,3 +9239,14 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
|
||||
fclose($handle2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a button to copy $valuetoprint in the clipboard
|
||||
* @param string $valuetoprint the value to print
|
||||
* @return string the string to print for the button
|
||||
*/
|
||||
function showValueWithCopyAndPasteButton($valuetoprint)
|
||||
{
|
||||
$result = '<span class="clipboardCopyPaste"><span>'.$valuetoprint.'</span> <span class="far fa-clipboard opacitymedium"></span></span>';
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -467,3 +467,4 @@ RestOfEurope=Rest of Europe (EEC)
|
||||
OutOfEurope=Out of Europe (EEC)
|
||||
CurrentOutstandingBillLate=Current outstanding bill late
|
||||
BecarefullChangeThirdpartyBeforeAddProductToInvoice=Be carefull, depending on your product price settings, you should change thirdparty before adding product to POS.
|
||||
CopiedToClipboard = Copied to clipboard
|
||||
@ -2423,8 +2423,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
if ($object->client)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CustomerCode').'</td><td>';
|
||||
print $object->code_client;
|
||||
print $langs->trans('CustomerCode');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print showValueWithCopyAndPasteButton($object->code_client);
|
||||
print '</td>';
|
||||
$tmpcheck = $object->check_codeclient();
|
||||
if ($tmpcheck != 0 && $tmpcheck != -5) {
|
||||
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
@ -2935,7 +2938,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user