Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2021-09-05 02:03:31 +02:00
commit 4f744fb2c0
3 changed files with 1530 additions and 18 deletions

View File

@ -253,7 +253,7 @@ $arrayfields = array(
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
if (getDolGlobalString("INVOICE_USE_SITUATION") && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86);
}
// Overwrite $arrayfields from columns into ->fields (transition before removal of $arrayoffields)

File diff suppressed because it is too large Load Diff

View File

@ -152,19 +152,19 @@ $invoice = new Facture($db);
if ($invoiceid > 0) {
$ret = $invoice->fetch($invoiceid);
} else {
$ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')');
$ret = $invoice->fetch('', '(PROV-POS'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '') .'-'.$place.')');
}
if ($ret > 0) {
$placeid = $invoice->id;
}
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'. isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;
$soc = new Societe($db);
if ($invoice->socid > 0) {
$soc->fetch($invoice->socid);
} else {
$soc->fetch($conf->global->$constforcompanyid);
$soc->fetch(getDolGlobalString("$constforcompanyid"));
}
@ -477,10 +477,10 @@ if ($action == 'history' || $action == 'creditnote') {
}
if (($action == "addline" || $action == "freezone") && $placeid == 0) {
$invoice->socid = $conf->global->$constforcompanyid;
$invoice->socid = getDolGlobalString("$constforcompanyid");
$invoice->date = dol_now();
$invoice->module_source = 'takepos';
$invoice->pos_source = $_SESSION["takeposterminal"];
$invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;
$invoice->entity = !empty($_SESSION["takeposinvoiceentity"]) ? $_SESSION["takeposinvoiceentity"] : $conf->entity;
if ($invoice->socid <= 0) {
@ -549,7 +549,7 @@ if ($action == "addline") {
}
if ($idoflineadded <= 0) {
$invoice->fetch_thirdparty();
$idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, '', '', 0, 100, '', null, 0);
$idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', 0, 100, '', null, 0);
if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
$CUSTOMER_DISPLAY_line1 = $prod->label;
$CUSTOMER_DISPLAY_line2 = price($price_ttc);
@ -930,7 +930,7 @@ $(document).ready(function() {
}
<?php
if ($action == "order" and $order_receipt_printer1 != "") {
if ($action == "order" && !empty($order_receipt_printer1)) {
if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
?>
$.ajax({
@ -951,7 +951,7 @@ if ($action == "order" and $order_receipt_printer1 != "") {
}
}
if ($action == "order" and $order_receipt_printer2 != "") {
if ($action == "order" && !empty($order_receipt_printer2)) {
if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
?>
$.ajax({
@ -972,7 +972,7 @@ if ($action == "order" and $order_receipt_printer2 != "") {
}
}
if ($action == "order" and $order_receipt_printer3 != "") {
if ($action == "order" && !empty($order_receipt_printer3)) {
if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
?>
$.ajax({
@ -992,7 +992,7 @@ if ($action == "search" || $action == "valid") {
}
if ($action == "temp" and $ticket_printer1 != "") {
if ($action == "temp" && !empty($ticket_printer1)) {
?>
$.ajax({
type: "POST",
@ -1039,7 +1039,7 @@ function TakeposPrinting(id){
function TakeposConnector(id){
console.log("TakeposConnector" + id);
$.get("<?php echo DOL_URL_ROOT; ?>/takepos/ajax/ajax.php?action=printinvoiceticket&term=<?php echo urlencode($_SESSION["takeposterminal"]); ?>&id="+id+"&token=<?php echo currentToken(); ?>", function(data, status) {
$.get("<?php echo DOL_URL_ROOT; ?>/takepos/ajax/ajax.php?action=printinvoiceticket&term=<?php echo urlencode(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); ?>&id="+id+"&token=<?php echo currentToken(); ?>", function(data, status) {
$.ajax({
type: "POST",
url: '<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>/printer/index.php',
@ -1053,7 +1053,7 @@ function DolibarrTakeposPrinting(id) {
$.ajax({
type: "GET",
data: { token: '<?php echo currentToken(); ?>' },
url: "<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=printinvoiceticket&term='.urlencode($_SESSION["takeposterminal"]).'&id='; ?>" + id,
url: "<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=printinvoiceticket&term='.urlencode(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '').'&id='; ?>" + id,
});
}
@ -1086,7 +1086,7 @@ $( document ).ready(function() {
$sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture";
if (empty($conf->global->TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED)) {
// By default, only invoices with a ref not already defined can in list of open invoice we can edit.
$sql .= " WHERE ref LIKE '(PROV-POS".$db->escape($_SESSION["takeposterminal"])."-0%' AND entity IN (".getEntity('invoice').")";
$sql .= " WHERE ref LIKE '(PROV-POS".$db->escape(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '')."-0%' AND entity IN (".getEntity('invoice').")";
} else {
// If TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED set, we show also draft invoice that already has a reference defined
$sql .= " WHERE pos_source = '".$db->escape($_SESSION["takeposterminal"])."'";
@ -1127,12 +1127,12 @@ $( document ).ready(function() {
$s = '';
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") {
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
if (!empty($conf->stock->enabled) && getDolGlobalString("$constantforkey") != "1") {
$s = '<span class="small">';
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
$constantforkey = 'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
$warehouse = new Entrepot($db);
$warehouse->fetch($conf->global->$constantforkey);
$warehouse->fetch(getDolGlobalString($constantforkey));
$s .= $langs->trans("Warehouse").'<br>'.$warehouse->ref;
$s .= '</span>';
}