Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
This commit is contained in:
commit
85687d5d88
5 changed files with 85 additions and 29 deletions
|
|
@ -487,7 +487,7 @@ if ($mode == 'template') {
|
|||
print '<input type="hidden" name="templateid" value="'.($printer->listprinterstemplates[$line]['rowid'] ?? '').'">';
|
||||
print '<td><input type="text" class="minwidth200" name="templatename" value="'.($printer->listprinterstemplates[$line]['name'] ?? '').'"></td>';
|
||||
print '<td class="wordbreak">';
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.($printer->listprinterstemplates[$line]['template'] ?? '').'</textarea>';
|
||||
print '<textarea name="template" wrap="soft" cols="90" rows="12">'.($printer->listprinterstemplates[$line]['template'] ?? '').'</textarea>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
|
|
@ -516,7 +516,7 @@ if ($mode == 'template') {
|
|||
print '<tr>';
|
||||
print '<td><input type="text" class="minwidth200" name="templatename" value="'.($printer->listprinterstemplates[$line]['name'] ?? '').'"></td>';
|
||||
print '<td class="wordbreak">';
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">';
|
||||
print '<textarea name="template" wrap="soft" cols="90" rows="12">';
|
||||
print '</textarea>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2022 Charlène Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2022-2026 Charlène Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
|
||||
|
|
@ -314,9 +314,6 @@ $parameters = array();
|
|||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
$sql .= " AND f.fk_soc = s.rowid";
|
||||
|
|
@ -361,9 +358,9 @@ if ($socid > 0) {
|
|||
}
|
||||
// Restriction on sale representative
|
||||
if (empty($user->socid) && !$permissiontoreadallthirdparty) {
|
||||
$sql .= " AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $user->id).")";
|
||||
$sql .= " AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $user->id).")";
|
||||
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES') && $userschilds) {
|
||||
$sql .= " OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user IN (".$db->sanitize(implode(',', $userschilds))."))";
|
||||
$sql .= " OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user IN (".$db->sanitize(implode(',', $userschilds))."))";
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -579,19 +579,31 @@ function ClickProduct(position, qty = 1) {
|
|||
LoadProducts(position, true);
|
||||
}
|
||||
else{
|
||||
console.log($('#prodiv4').data('rowid'));
|
||||
invoiceid = $("#invoiceid").val();
|
||||
idproduct=$('#prodiv'+position).data('rowid');
|
||||
console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty+" invoiceid="+invoiceid);
|
||||
if (idproduct == "") {
|
||||
return;
|
||||
}
|
||||
// Call page invoice.php to generate the section with product lines
|
||||
$("#poslines").load("invoice.php?action=addline&token=<?php echo newToken(); ?>&place="+place+"&idproduct="+idproduct+"&qty="+qty+"&invoiceid="+invoiceid, function() {
|
||||
<?php if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) {
|
||||
echo "CustomerDisplay();";
|
||||
}?>
|
||||
});
|
||||
addInvoiceLine = function(qty) {
|
||||
// Call page invoice.php to generate the section with product lines
|
||||
$("#poslines").load("invoice.php?action=addline&token=<?php echo newToken(); ?>&place="+place+"&idproduct="+idproduct+"&qty="+qty+"&invoiceid="+invoiceid, function() {
|
||||
idproduct = "";
|
||||
<?php if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) {
|
||||
echo "CustomerDisplay();";
|
||||
}?>
|
||||
});
|
||||
};
|
||||
// call WeighingScale() if product is a product that need to measure weight
|
||||
<?php if (getDolGlobalString('TAKEPOS_WEIGHING_SCALE')) { ?>
|
||||
if ($('#prodiv'+position).data('unit') == 2) {
|
||||
WeighingScale(addInvoiceLine);
|
||||
} else {
|
||||
addInvoiceLine(qty);
|
||||
}
|
||||
<?php } else { ?>
|
||||
addInvoiceLine(qty);
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
ClearSearch(false);
|
||||
|
|
@ -1076,18 +1088,53 @@ function FullScreen() {
|
|||
document.documentElement.requestFullscreen();
|
||||
}
|
||||
|
||||
function WeighingScale(){
|
||||
console.log("Weighing Scale");
|
||||
function WeighingScale(callback) {
|
||||
console.log("Weighing Scale: invoiceid = " + placeid + ", lineid = " + selectedline);
|
||||
<?php if (getDolGlobalString('TAKEPOS_CONNECTOR_TO_WHB_SCALE')) {?>
|
||||
<?php if (getDolGlobalString('WEIGHINGSCALE_PROTOCOL') == "diag06") { ?>
|
||||
// Protocole Dialog-06, il a besoin du prix unitaire, le demander s'il manque
|
||||
var urlProduct;
|
||||
if (idproduct == "" && selectedline > 0) {
|
||||
urlProduct = "<?php echo DOL_URL_ROOT; ?>/api/index.php/takeposconnector/invoices/" + placeid + "/lines/" + selectedline + "/product";
|
||||
} else {
|
||||
urlProduct = "<?php echo DOL_URL_ROOT; ?>/api/index.php/products/" + idproduct;
|
||||
}
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
headers: { "DOLAPIKEY": '<?php echo $user->api_key; ?>' },
|
||||
url: urlProduct,
|
||||
})
|
||||
.done(function(product) {
|
||||
if (callback === undefined) {
|
||||
callback = function(qty) {
|
||||
$("#poslines").load("invoice.php?token=<?php echo newToken(); ?>&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty);
|
||||
};
|
||||
}
|
||||
if (product.fk_unit == "2") {
|
||||
askForWeight(product.multiprices_ttc[1], callback, function (errorMessage) {
|
||||
console.log("Erreur: " + errorMessage);
|
||||
});
|
||||
}
|
||||
});
|
||||
<?php } else { ?>
|
||||
// Protocole par défaut de takeposconnector: réception continue du poids/stabilité
|
||||
editnumber = globalWeight;
|
||||
$("#poslines").load("invoice.php?token=<?php echo newToken(); ?>&action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
|
||||
editnumber="";
|
||||
});
|
||||
<?php } ?>
|
||||
<?php } else { ?> // utilisation du new TakePOS-Connector PHP: envoie "$" à la balance pour avoir le poids
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: { token: 'notrequired' },
|
||||
url: '<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>/scale/index.php',
|
||||
})
|
||||
.done(function( editnumber ) {
|
||||
$("#poslines").load("invoice.php?token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
|
||||
$("#poslines").load("invoice.php?token=<?php echo newToken(); ?>&action=updateqty&place="+place+"&idline="+selectedline+"&number="+editnumber, function() {
|
||||
editnumber="";
|
||||
});
|
||||
});
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
|
@ -1474,7 +1521,7 @@ if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) {
|
|||
|
||||
// Button to print receipt
|
||||
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { // deprecated method
|
||||
if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL')) == true) {
|
||||
if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) {
|
||||
// If TAKEPOS_PRINT_SERVER is an URL
|
||||
$menus[$r++] = array('title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("PrintTicket").'</div>', 'action' => 'PrintByESCPOSOld(placeid);');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1779,11 +1779,16 @@ if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) {
|
|||
echo "line1=line1.padEnd(20);";
|
||||
echo "var line2='".$CUSTOMER_DISPLAY_line2."'.substring(0,20);";
|
||||
echo "line2=line2.padEnd(20);";
|
||||
echo "$.ajax({
|
||||
type: 'GET',
|
||||
data: { text: line1+line2 },
|
||||
url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER')."/display/index.php',
|
||||
});";
|
||||
if (getDolGlobalString('TAKEPOS_CONNECTOR_TO_WHB_CUSTOMER_DISPLAY')) {
|
||||
echo 'webSocketCustomerDisplay.send(line1);';
|
||||
echo 'webSocketCustomerDisplay.send(line2);';
|
||||
} else {
|
||||
echo "$.ajax({
|
||||
type: 'GET',
|
||||
data: { text: line1+line2 },
|
||||
url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER')."/display/index.php',
|
||||
});";
|
||||
}
|
||||
echo "}";
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -534,11 +534,18 @@ if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) {
|
|||
echo "line1=line1.padEnd(20);";
|
||||
echo "var line2='".price($invoice->total_ttc, 1, '', 1, -1, -1)."'.substring(0,20);";
|
||||
echo "line2=line2.padEnd(20);";
|
||||
echo "$.ajax({
|
||||
type: 'GET',
|
||||
data: { text: line1+line2 },
|
||||
url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER')."/display/index.php',
|
||||
});";
|
||||
if (getDolGlobalString('TAKEPOS_CONNECTOR_TO_WHB_CUSTOMER_DISPLAY')) {
|
||||
echo 'webSocketCustomerDisplay.onOpen(function() {';
|
||||
echo ' webSocketCustomerDisplay.send(line1);';
|
||||
echo ' webSocketCustomerDisplay.send(line2);';
|
||||
echo '});';
|
||||
} else {
|
||||
echo "$.ajax({
|
||||
type: 'GET',
|
||||
data: { text: line1+line2 },
|
||||
url: '".getDolGlobalString('TAKEPOS_PRINT_SERVER')."/display/index.php',
|
||||
});";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue