--- /tmp/dsg/dolibarr/htdocs/product/ajax/github_products.php +++ /tmp/dsg/dolibarr/htdocs/product/ajax/client_products.php @@ -2,7 +2,6 @@ /* Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2007-2011 Laurent Destailleur - * Copyright (C) 2020 Josep LluĂ­s Amador * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,7 +39,7 @@ $status = ((GETPOST('status', 'int') >= 0) ? GETPOST('status', 'int') : - 1); $outjson = (GETPOST('outjson', 'int') ? GETPOST('outjson', 'int') : 0); $price_level = GETPOST('price_level', 'int'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $id = GETPOST('id', 'int'); $price_by_qty_rowid = GETPOST('pbq', 'int'); $finished = GETPOST('finished', 'int'); @@ -80,14 +79,14 @@ $found = false; $price_level = 1; - if ($socid > 0 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) { + if ($socid > 0 && !empty($conf->global->PRODUIT_MULTIPRICES)) { $thirdpartytemp = new Societe($db); $thirdpartytemp->fetch($socid); $price_level = $thirdpartytemp->price_level; } // Price by qty - if (!empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) // If we need a particular price related to qty + if (!empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))) // If we need a particular price related to qty { $sql = "SELECT price, unitprice, quantity, remise_percent"; $sql .= " FROM ".MAIN_DB_PREFIX."product_price_by_qty "; @@ -109,7 +108,7 @@ } // Multiprice - if (!$found && isset($price_level) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) // If we need a particular price level (from 1 to 6) + if (!$found && isset($price_level) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES))) // If we need a particular price level (from 1 to 6) { $sql = "SELECT price, price_ttc, price_base_type, tva_tx"; $sql .= " FROM ".MAIN_DB_PREFIX."product_price "; @@ -163,7 +162,9 @@ } echo json_encode($outjson); -} else { +} +else +{ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $langs->loadLangs(array("main", "products")); @@ -173,7 +174,7 @@ if (empty($htmlname)) { print json_encode(array()); - return; + return; } $match = preg_grep('/('.$htmlname.'[0-9]+)/', array_keys($_GET)); @@ -184,7 +185,7 @@ if (GETPOST($htmlname, 'alpha') == '' && (!$idprod || !GETPOST($idprod, 'alpha'))) { print json_encode(array()); - return; + return; } // When used from jQuery, the search term is added as GET param "term".