Merge pull request #36343 from noec764/18_FIX_socid_undefined
FIX: TakePos sometimes thirdpartyid = undefined
This commit is contained in:
commit
c981b7ccb6
1 changed files with 26 additions and 3 deletions
|
|
@ -93,6 +93,8 @@ if ($conf->browser->layout == 'phone') {
|
|||
$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG) ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG);
|
||||
$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT) ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT);
|
||||
|
||||
$term = empty($_SESSION['takeposterminal']) ? 1 : $_SESSION['takeposterminal'];
|
||||
$socid = getDolGlobalInt('CASHDESK_ID_THIRDPARTY' . $term);
|
||||
/*
|
||||
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
|
||||
$soc = new Societe($db);
|
||||
|
|
@ -329,8 +331,15 @@ function LoadProducts(position, issubcat) {
|
|||
if (maxproduct >= 1) {
|
||||
limit = maxproduct-1;
|
||||
}
|
||||
|
||||
// Get socid
|
||||
let socid = jQuery('#thirdpartyid').val();
|
||||
if ((socid === undefined || socid === "") && parseInt("<?php echo dol_escape_js($socid) ?>") > 0) {
|
||||
socid = parseInt("<?php echo dol_escape_js($socid); ?>");
|
||||
}
|
||||
|
||||
// Only show products for sale (tosell=1)
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) {
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + socid + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) {
|
||||
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs");
|
||||
console.log(data);
|
||||
while (ishow < maxproduct) {
|
||||
|
|
@ -437,8 +446,15 @@ function MoreProducts(moreorless) {
|
|||
limit = maxproduct-1;
|
||||
}
|
||||
var offset = <?php echo ($MAXPRODUCT - 2); ?> * pageproducts;
|
||||
|
||||
// Get socid
|
||||
let socid = jQuery('#thirdpartyid').val();
|
||||
if ((socid === undefined || socid === "") && parseInt("<?php echo dol_escape_js($socid) ?>") > 0) {
|
||||
socid = parseInt("<?php echo dol_escape_js($socid); ?>");
|
||||
}
|
||||
|
||||
// Only show products for sale (tosell=1)
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + socid + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
|
||||
console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
|
||||
|
||||
if (typeof (data[0]) == "undefined" && moreorless=="more"){ // Return if no more pages
|
||||
|
|
@ -662,7 +678,14 @@ function Search2(keyCodeForEnter, moreorless) {
|
|||
pageproducts = 0;
|
||||
jQuery(".wrapper2 .catwatermark").hide();
|
||||
var nbsearchresults = 0;
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
|
||||
|
||||
// Only show products for sale (tosell=1)
|
||||
let socid = jQuery('#thirdpartyid').val();
|
||||
if ((socid === undefined || socid === "") && parseInt("<?php echo dol_escape_js($socid) ?>") > 0) {
|
||||
socid = parseInt("<?php echo dol_escape_js($socid); ?>");
|
||||
}
|
||||
|
||||
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term + '&thirdpartyid=' + socid + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
|
||||
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
|
||||
if (typeof (data[i]) == "undefined") {
|
||||
$("#prowatermark" + i).html("");
|
||||
|
|
|
|||
Loading…
Reference in a new issue