Move ajax file

This commit is contained in:
Laurent Destailleur 2019-09-27 10:19:27 +02:00
parent 5d0d3b3908
commit 64a7bbe0fd
2 changed files with 10 additions and 8 deletions

View File

@ -16,7 +16,7 @@
*/
/**
* \file htdocs/takepos/ajax.php
* \file htdocs/takepos/ajax/ajax.php
* \brief Ajax search component for TakePos. It search products of a category.
*/
@ -30,7 +30,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../main.inc.php'; // Load $user and permissions
require '../../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$category = GETPOST('category', 'alpha');

View File

@ -226,7 +226,8 @@ function MoreCategories(moreorless) {
ClearSearch();
}
function LoadProducts(position, issubcat=false) {
// LoadProducts
function LoadProducts(position, issubcat) {
console.log("LoadProducts");
var maxproduct = <?php echo ($MAXPRODUCT - 2); ?>;
@ -251,7 +252,7 @@ function LoadProducts(position, issubcat=false) {
});
idata=0; //product data counter
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) {
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat);
while (ishow < maxproduct) {
@ -297,7 +298,7 @@ function MoreProducts(moreorless) {
if (pageproducts==0) return; //Return if no less pages
pageproducts=pageproducts-1;
}
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) {
console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
if (typeof (data[(maxproduct * pageproducts)]) == "undefined" && moreorless=="more"){ // Return if no more pages
@ -413,10 +414,11 @@ function New() {
}
function Search2() {
console.log("Search2");
console.log("Search2 Call ajax search to replace products");
pageproducts=0;
$.getJSON('./ajax.php?action=search&term='+$('#search').val(), function(data) {
for (i = 0; i < 30; i++) {
jQuery(".catwatermark").hide();
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) {
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
if (typeof (data[i]) == "undefined"){
$("#prodesc"+i).text("");
$("#proimg"+i).attr("src","genimg/empty.png");